/* =========================================
   HERITAGE CLASSIC THEME CSS
   Dark sidebar, vintage aesthetic, uses org primary color
   ========================================= */

/* RESET & BASE */
.theme-heritage * {
    box-sizing: border-box;
}

.theme-heritage {
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-background);
    margin: 0;
    padding: 0;
}

/* PAGE WRAPPER */
.theme-heritage .page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* NEW GLOBAL HERO HEADER (Unified with Homepage) */
.theme-heritage .hero-region {
    position: relative;
    background-color: var(--color-primary); /* Org primary color fallback */
    background-size: cover;
    background-position: center;
    /* SCALED DOWN: Reduced padding from 80px to 45px for a tighter header */
    padding: 45px 20px; 
    text-align: center;
    color: white;
    border-bottom: 4px double #8B6914;
    overflow: hidden;
}

.theme-heritage .archive-title {
    /* SCALED DOWN: Reduced from 2.8rem to 2.2rem */
    font-size: 2.2rem; 
    font-family: var(--font-heading);
    margin: 5px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-weight: 700;
    letter-spacing: 2px;
    color: white;
}

.theme-heritage .archive-subtitle {
    /* SCALED DOWN: Reduced opacity and size slightly */
    font-size: 1rem;
    margin: 0;
    opacity: 0.9;
    font-style: italic;
    color: white;
}

.theme-heritage .quick-links {
    /* SCALED DOWN: Reduced bottom margin from 25px to 15px */
    margin-bottom: 15px;
    font-family: var(--font-body);
    font-size: 0.85rem; /* Slightly smaller text */
    text-transform: uppercase;
    letter-spacing: 1px;
}

.theme-heritage .quick-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
    opacity: 0.8;
}

.theme-heritage .quick-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

.theme-heritage .nav-divider {
    margin: 0 12px;
    opacity: 0.5;
}

/* HEADER - Uses organization primary color (Legacy site-header support) */
.theme-heritage .site-header {
    position: relative;
    background: var(--color-primary); /* Use org primary color */
    padding: 60px 40px;
    text-align: center;
    color: white;
    border-bottom: 4px double #8B6914;
    overflow: hidden;
}

.theme-heritage .header-watermark {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    filter: grayscale(100%);
    pointer-events: none;
}

.theme-heritage .header-inner {
    position: relative;
    z-index: 1;
}

.theme-heritage .site-title {
    font-size: 2.5rem;
    font-family: var(--font-heading);
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-weight: 700;
    letter-spacing: 1px;
}

.theme-heritage .site-tagline {
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.95;
    font-style: italic;
}

/* Hide hero section (Federal uses this, Heritage doesn't) */
.theme-heritage .hero-section {
    display: none;
}

/* Hide stats bar (Federal uses this, Heritage doesn't) */
.theme-heritage .stats-bar {
    display: none;
}

/* MAIN LAYOUT - Sidebar + Content */
.theme-heritage .main-layout {
    display: flex;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* SIDEBAR - Uses organization primary color */
.theme-heritage .sidebar {
    width: 280px;
    background: var(--color-primary); /* Use org primary color */
    color: white;
    padding: 30px 20px;
    border-right: 1px solid rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.theme-heritage .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.theme-heritage .nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 8px;
    margin-bottom: 12px;
    font-weight: 600;
}

.theme-heritage .sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.theme-heritage .sidebar-nav li {
    margin-bottom: 4px;
}

.theme-heritage .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.theme-heritage .sidebar-nav a:hover {
    background: rgba(139, 105, 20, 0.3);
    color: white;
    padding-left: 16px;
}

.theme-heritage .sidebar-nav a.active {
    background: rgba(139, 105, 20, 0.5);
    color: white;
    font-weight: 600;
}

.theme-heritage .sidebar-nav a.staff-link {
    background: rgba(184, 134, 11, 0.15);
    border: 1px dashed rgba(184, 134, 11, 0.4);
}

.theme-heritage .sidebar-nav i {
    font-size: 1.1rem;
}

/* SIDEBAR STATS */
.theme-heritage .sidebar-stats {
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
}

.theme-heritage .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.9rem;
}

.theme-heritage .stat-label {
    color: rgba(255, 255, 255, 0.7);
}

.theme-heritage .stat-value {
    color: #ecf0f1;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* MAIN CONTENT */
.theme-heritage .main-content {
    flex: 1;
    padding: 40px;
    background: #ecf0f1;
}

.theme-heritage .content-section {
    margin-bottom: 50px;
}

.theme-heritage .content-divider {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, #bdc3c7, transparent);
    margin: 40px 0;
}

.theme-heritage .section-heading {
    font-size: 1.6rem;
    font-family: var(--font-heading);
    color: var(--color-primary);
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 3px double #8B6914;
    font-weight: 700;
}

.theme-heritage .section-subtext {
    color: #7f8c8d;
    font-style: italic;
    margin: -10px 0 20px 0;
    font-size: 0.95rem;
}

/* SEARCH BOX */
.theme-heritage .search-box {
    background: white;
    padding: 30px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #dcdcdc;
    margin-bottom: 30px;
}

.theme-heritage .search-box h3 {
    font-size: 1.3rem;
    margin: 0 0 20px 0;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-heritage .search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.theme-heritage .search-form input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    font-size: 1rem;
    font-family: var(--font-body);
    transition: border-color 0.2s ease;
}

.theme-heritage .search-form input[type="text"]:focus {
    outline: none;
    border-color: #8B6914;
}

.theme-heritage .search-form button {
    padding: 12px 30px;
    background: #8B6914;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-body);
}

.theme-heritage .search-form button:hover {
    background: #6B4F0F;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(139, 105, 20, 0.3);
}

.theme-heritage .search-links {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.theme-heritage .search-links span {
    margin-right: 8px;
    font-weight: 600;
}

.theme-heritage .search-links a {
    color: #8B6914;
    text-decoration: none;
    margin-right: 15px;
    transition: color 0.2s ease;
}

.theme-heritage .search-links a:hover {
    color: #6B4F0F;
    text-decoration: underline;
}

/* WELCOME TEXT */
.theme-heritage .welcome-text {
    background: white;
    padding: 30px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #8B6914;
}

.theme-heritage .welcome-text h2 {
    font-size: 1.8rem;
    font-family: var(--font-heading);
    color: var(--color-primary);
    margin: 0 0 15px 0;
}

.theme-heritage .welcome-text p {
    line-height: 1.7;
    color: #555;
    margin: 0;
    font-size: 1.05rem;
}

/* COLLECTIONS GRID */
.theme-heritage .collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.theme-heritage .collection-card {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.theme-heritage .collection-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    border-color: #8B6914;
}

.theme-heritage .card-frame {
    position: relative;
    padding-top: 75%;
    background: #f8f9fa;
    overflow: hidden;
}

.theme-heritage .card-frame a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-heritage .card-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    filter: sepia(10%);
}

.theme-heritage .collection-card:hover .card-frame img {
    transform: scale(1.1);
}

.theme-heritage .placeholder-icon {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
}

.theme-heritage .card-info {
    padding: 16px;
    text-align: center;
}

.theme-heritage .card-info h4 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-family: var(--font-heading);
}

.theme-heritage .card-info a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.theme-heritage .card-info a:hover {
    color: #8B6914;
}

.theme-heritage .meta-text {
    font-size: 0.85rem;
    color: #7f8c8d;
    font-style: italic;
}

/* MAP SECTION */
.theme-heritage .map-wrapper {
    background: white;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #dcdcdc;
}

.theme-heritage .map-toolbar {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e8e8e8;
}

.theme-heritage .category-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.theme-heritage .btn-text {
    background: none;
    border: 1px solid #bdc3c7;
    padding: 6px 12px;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.theme-heritage .btn-text:hover {
    background: #ecf0f1;
    border-color: #95a5a6;
}

.theme-heritage .map-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s ease;
}

.theme-heritage .map-legend-item:hover {
    background: #e9ecef;
}

.theme-heritage .map-legend-item input[type="checkbox"] {
    cursor: pointer;
}

.theme-heritage .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* MAP POPUP */
.theme-heritage .map-popup {
    font-family: var(--font-heading);
    min-width: 180px;
}

.theme-heritage .popup-image {
    width: 100%;
    height: 110px;
    overflow: hidden;
    border-bottom: 3px double #ccc;
    margin-bottom: 8px;
}

.theme-heritage .popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(15%);
}

.theme-heritage .popup-content {
    padding: 5px;
}

.theme-heritage .popup-title {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.theme-heritage .popup-category {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.theme-heritage .popup-link {
    color: #8B6914;
    font-weight: bold;
    font-size: 12px;
    text-decoration: none;
}

.theme-heritage .popup-link:hover {
    text-decoration: underline;
}

/* RECORDS TABLE */
.theme-heritage .records-table {
    width: 100%;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-collapse: collapse;
}

.theme-heritage .records-table thead {
    background: var(--color-primary); /* Use org primary color */
    color: white;
}

.theme-heritage .records-table th {
    padding: 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.theme-heritage .records-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: background 0.2s ease;
}

.theme-heritage .records-table tbody tr:hover {
    background: #f8f9fa;
}

.theme-heritage .records-table td {
    padding: 14px;
    font-size: 0.95rem;
}

/* Thumbnail column */
.theme-heritage .t-thumbnail {
    width: 60px;
    padding: 8px;
}

.theme-heritage .t-thumbnail img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    filter: sepia(10%);
}

.theme-heritage .t-title {
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-heritage .t-title i {
    color: #95a5a6;
}

.theme-heritage .t-col {
    color: #555;
    font-style: italic;
}

.theme-heritage .btn-small {
    display: inline-block;
    padding: 6px 16px;
    background: #8B6914;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.theme-heritage .btn-small:hover {
    background: #6B4F0F;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(139, 105, 20, 0.3);
}

/* EMPTY MESSAGE */
.theme-heritage .empty-message {
    text-align: center;
    padding: 40px;
    color: #95a5a6;
    font-style: italic;
}

/* FOOTER */
.theme-heritage .site-footer {
    background: #dcdcdc;
    text-align: center;
    padding: 20px;
    color: #555;
    font-size: 0.9rem;
    border-top: 1px solid #bbb;
    margin-top: auto;
}

.theme-heritage .site-footer p {
    margin: 5px 0;
}

.theme-heritage .powered-by {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.theme-heritage .powered-by a {
    color: #8B6914;
    text-decoration: none;
}

.theme-heritage .powered-by a:hover {
    text-decoration: underline;
}

.theme-heritage .footer-staff-access {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.theme-heritage .footer-staff-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.theme-heritage .footer-staff-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.theme-heritage .footer-staff-link i {
    font-size: 1rem;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .theme-heritage .main-layout {
        flex-direction: column;
    }
    
    .theme-heritage .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    }
    
    .theme-heritage .main-content {
        padding: 20px;
    }
    
    .theme-heritage .search-form {
        flex-direction: column;
    }
    
    .theme-heritage .search-form button {
        width: 100%;
    }
    
    .theme-heritage .collections-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
    
    .theme-heritage .site-title {
        font-size: 2rem;
    }

    /* Sub-page Header Responsive */
    .theme-heritage .hero-region {
        padding: 30px 20px;
    }

    .theme-heritage .archive-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 600px) {
    .theme-heritage .site-header {
        padding: 40px 20px;
    }
    
    .theme-heritage .site-title {
        font-size: 1.6rem;
    }
    
    .theme-heritage .section-heading {
        font-size: 1.3rem;
    }
    
    .theme-heritage .records-table {
        font-size: 0.85rem;
    }
    
    .theme-heritage .records-table th,
    .theme-heritage .records-table td {
        padding: 10px 8px;
    }
    
    .theme-heritage .t-thumbnail {
        width: 52px;
        padding: 6px;
    }
    
    .theme-heritage .t-thumbnail img {
        width: 40px;
        height: 40px;
    }
}

/* Heritage Extension for Record Cards and Public Pages */
.theme-heritage .record-card {
    background: white;
    border: 1px solid #dcdcdc;
    border-left: 5px solid var(--color-primary) !important;
    border-radius: 0; /* Web 1.0 sharp corners */
    box-shadow: 2px 2px 0px rgba(0,0,0,0.05); /* Flat "pressed" look */
}

.theme-heritage .record-card:hover {
    border-color: #8B6914;
    background: #fdfcf9;
}

.theme-heritage .badge {
    border-radius: 2px;
    font-family: 'Courier New', monospace;
    background: #f0f0f0;
    border: 1px solid #ccc;
    color: #333;
}

.theme-heritage .record-title {
    font-family: var(--font-heading);
    color: var(--color-primary);
}

.theme-heritage .record-card-image {
    background: #eee;
    filter: sepia(20%);
    border-right: 1px solid #dcdcdc;
}/* =============================================
   HERITAGE THEME HOTFIX
   Add these styles to fix map width and thumbnail sizing
   ============================================= */

/* FIX 1: Constrain map width to prevent overflow */
.theme-heritage #collection-map {
    width: 100%;
    max-width: 100%;
    height: 500px;
    border-radius: 4px;
    overflow: hidden; /* Prevent map from expanding beyond container */
}

.theme-heritage .map-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* Ensure wrapper constrains child elements */
}

/* FIX 2: Proper thumbnail sizing in records table */
.theme-heritage .t-col-thumb {
    width: 80px !important;
    min-width: 80px;
    max-width: 80px;
    padding: 8px !important;
}

.theme-heritage .thumb-img {
    width: 64px !important;
    height: 64px !important;
    max-width: 64px;
    max-height: 64px;
    object-fit: cover;
    border-radius: 4px;
    filter: sepia(10%);
    display: block;
}

.theme-heritage .thumb-placeholder {
    width: 64px !important;
    height: 64px !important;
    max-width: 64px;
    max-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 4px;
    color: #bdc3c7;
}

.theme-heritage .thumb-placeholder i {
    font-size: 24px;
}

/* FIX 3: Ensure table columns have proper widths */
.theme-heritage .t-col-action {
    width: 100px;
    text-align: center;
}

.theme-heritage .t-title a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.theme-heritage .t-title a:hover {
    text-decoration: underline;
    color: #8B6914;
}

/* FIX 4: Map toolbar button styling */
.theme-heritage .toggle-btn {
    background: #8B6914;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.theme-heritage .toggle-btn:hover {
    background: #6B4F0F;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(139, 105, 20, 0.3);
}

/* Mobile adjustments */
@media (max-width: 900px) {
    .theme-heritage #collection-map {
        height: 400px;
    }
    
    .theme-heritage .t-col-thumb {
        width: 60px !important;
        min-width: 60px;
        max-width: 60px;
    }
    
    .theme-heritage .thumb-img,
    .theme-heritage .thumb-placeholder {
        width: 48px !important;
        height: 48px !important;
        max-width: 48px;
        max-height: 48px;
    }
}

@media (max-width: 600px) {
    .theme-heritage .t-col-thumb {
        width: 52px !important;
        min-width: 52px;
        max-width: 52px;
    }
    
    .theme-heritage .thumb-img,
    .theme-heritage .thumb-placeholder {
        width: 40px !important;
        height: 40px !important;
        max-width: 40px;
        max-height: 40px;
    }
    
    .theme-heritage .thumb-placeholder i {
        font-size: 18px;
    }
}
