/* === Historic Places Canada — Design System === */

:root {
    /* Heritage-inspired palette */
    --stone: #8B7355;
    --stone-light: #C4B49A;
    --stone-dark: #5C4D3C;
    --wood: #A0522D;
    --wood-light: #CD853F;
    --forest: #2D5A27;
    --forest-light: #4A8B3F;
    --sage: #87A878;
    --cream: #FAF7F2;
    --warm-white: #FFFDF8;
    --parchment: #F5F0E8;
    
    /* UI Colors */
    --primary: #2D5A27;
    --primary-hover: #1E3D1A;
    --accent: #A0522D;
    --accent-light: #CD853F;
    --text: #2C2418;
    --text-light: #6B5D4F;
    --text-muted: #9B8E7E;
    --border: #E8E0D4;
    --border-light: #F0EBE3;
    --card-bg: #FFFFFF;
    --shadow: 0 2px 12px rgba(44, 36, 24, 0.08);
    --shadow-lg: 0 8px 32px rgba(44, 36, 24, 0.12);
    --shadow-xl: 0 16px 64px rgba(44, 36, 24, 0.16);
    --radius: 12px;
    --radius-lg: 20px;
    --radius-sm: 8px;
    
    --nav-height: 70px;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--cream);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', Georgia, serif;
    line-height: 1.2;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.hidden { display: none !important; }

/* === Navigation === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--nav-height);
    transition: all 0.3s ease;
    background: transparent;
}

.navbar-solid,
.navbar.scrolled {
    background: rgba(255, 253, 248, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    transition: opacity 0.2s;
}

.navbar:not(.scrolled):not(.navbar-solid) .nav-logo { color: white; }

.nav-logo:hover { opacity: 0.8; color: inherit; }

.nav-icon { width: 28px; height: 28px; }

.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-main { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 16px; }
.logo-sub { font-size: 11px; font-weight: 500; letter-spacing: 2px; text-transform: uppercase; opacity: 0.7; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-links a {
    font-weight: 500;
    font-size: 15px;
    color: var(--text);
    transition: color 0.2s;
    position: relative;
}

.navbar:not(.scrolled):not(.navbar-solid) .nav-links a { color: rgba(255,255,255,0.9); }
.navbar:not(.scrolled):not(.navbar-solid) .nav-links a:hover { color: white; }

.nav-links a.active::after,
.nav-links a:hover::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

.navbar:not(.scrolled):not(.navbar-solid) .nav-links a.active::after,
.navbar:not(.scrolled):not(.navbar-solid) .nav-links a:hover::after {
    background: white;
}

.lang-toggle {
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
}

.navbar:not(.scrolled):not(.navbar-solid) .lang-toggle {
    border-color: rgba(255,255,255,0.4);
    color: white;
}

.lang-toggle:hover { border-color: var(--primary); }
.lang-active { opacity: 1; }
.lang-inactive { opacity: 0.4; }

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: 0.3s;
}

.navbar:not(.scrolled):not(.navbar-solid) .mobile-menu-btn span { background: white; }

/* === Hero === */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(135deg, #2D5A27 0%, #1a3a15 30%, #5C4D3C 70%, #3a2e22 100%);
    z-index: 0;
}

.hero-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.3) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    padding: 0 24px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    color: white;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 40px;
    font-weight: 300;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-search {
    display: flex;
    max-width: 560px;
    margin: 0 auto 48px;
    background: white;
    border-radius: 60px;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.hero-search-input {
    flex: 1;
    border: none;
    padding: 18px 28px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    background: transparent;
    color: var(--text);
}

.hero-search-btn {
    background: var(--primary);
    border: none;
    padding: 0 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.hero-search-btn:hover { background: var(--primary-hover); }
.hero-search-btn svg { width: 22px; height: 22px; color: white; }

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
}

.stat { text-align: center; }
.stat-number {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
}
.stat-label {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-scroll {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    animation: bounce 2s infinite;
}

.hero-scroll svg { width: 32px; height: 32px; color: rgba(255,255,255,0.5); }

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

/* === Sections === */
.section {
    padding: 80px 0;
}

.section-title {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 12px;
    color: var(--text);
}

.section-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 48px;
}

.section-cta {
    text-align: center;
    margin-top: 48px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 60px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-hover); color: white; transform: translateY(-1px); box-shadow: var(--shadow-lg); }

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 8px 18px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* === Cards === */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    color: inherit;
}

.card-image {
    position: relative;
    padding-top: 60%;
    background: var(--parchment);
    overflow: hidden;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.card:hover .card-image img { transform: scale(1.05); }

.card-image .card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.card-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--parchment) 0%, var(--stone-light) 100%);
}

.card-placeholder svg {
    width: 48px;
    height: 48px;
    color: var(--stone);
    opacity: 0.4;
}

.card-body {
    padding: 20px;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.card-meta svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-desc {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Map Section === */
.map-section {
    background: var(--warm-white);
}

.map-container {
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
}

/* === Province Grid === */
.province-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.province-card {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
}

.province-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    color: inherit;
}

.province-name {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.province-count {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Playfair Display', serif;
}

.province-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* === Explore Page === */
.explore-header {
    background: var(--warm-white);
    border-bottom: 1px solid var(--border-light);
    padding: 100px 0 24px;
}

.explore-title {
    font-size: 2rem;
    margin-bottom: 20px;
}

.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.search-bar input {
    width: 100%;
    padding: 14px 14px 14px 48px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    background: white;
    transition: border-color 0.2s;
}

.search-bar input:focus { border-color: var(--primary); }

.search-count {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-muted);
}

.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: var(--text);
    cursor: pointer;
    outline: none;
    min-width: 150px;
}

.filter-select:focus { border-color: var(--primary); }

.view-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 0;
}

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

.view-btn svg { width: 16px; height: 16px; }
.view-btn.active { border-color: var(--primary); color: var(--primary); background: rgba(45,90,39,0.04); }

.results-info {
    margin-left: auto;
    font-size: 14px;
    color: var(--text-muted);
}

.explore-grid { padding-bottom: 40px; }

.load-more { text-align: center; padding: 20px 0 60px; }

.map-view { padding: 0 24px 40px; }

/* === Place Detail Page === */
.place-hero {
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.place-hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--stone-dark) 0%, var(--forest) 100%);
    background-size: cover;
    background-position: center;
}

.place-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
}

.place-hero-content {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 24px 40px;
    width: 100%;
}

.back-link {
    display: inline-block;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    margin-bottom: 16px;
    transition: color 0.2s;
}
.back-link:hover { color: white; }

.place-title {
    font-size: clamp(2rem, 4vw, 3rem);
    color: white;
    margin-bottom: 8px;
}

.place-location {
    color: rgba(255,255,255,0.7);
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.place-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    color: white;
    font-size: 12px;
    font-weight: 500;
}

/* Place Layout */
.place-content { padding: 48px 0; }

.place-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
    align-items: start;
}

.place-section {
    margin-bottom: 40px;
}

.place-section h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-light);
}

.place-section p {
    color: var(--text-light);
    line-height: 1.8;
    white-space: pre-line;
}

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.gallery-item {
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
    position: relative;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.gallery-item:hover img { transform: scale(1.05); }

.gallery-item .gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 12px;
}

/* Sidebar */
.sidebar-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.sidebar-card h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text);
}

.detail-list {
    display: grid;
    gap: 12px;
}

.detail-list dt {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.detail-list dd {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
}

.other-names-list {
    list-style: none;
    padding: 0;
}

.other-names-list li {
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border-light);
}

.other-names-list li:last-child { border: none; }

/* Nearby */
.nearby-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid var(--border-light);
}

.nearby-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* === Lightbox === */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(20px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lightbox.active { display: flex; }

.lightbox img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 0 60px rgba(0,0,0,0.5);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 24px;
}

.lightbox-close { top: 20px; right: 20px; width: 44px; height: 44px; font-size: 28px; }
.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; }
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; }

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,0.2); }

.lightbox-caption {
    color: rgba(255,255,255,0.7);
    margin-top: 16px;
    font-size: 14px;
    text-align: center;
}

/* === Footer === */
.footer {
    background: var(--text);
    color: rgba(255,255,255,0.6);
    padding: 48px 0;
}

.footer-content { text-align: center; }

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

.footer-icon { width: 24px; height: 24px; color: rgba(255,255,255,0.5); }
.footer-name { font-family: 'Playfair Display', serif; font-size: 1.1rem; color: rgba(255,255,255,0.8); }

.footer-disclaimer { font-size: 14px; margin-bottom: 8px; }
.footer-credit { font-size: 13px; }
.footer-credit a { color: rgba(255,255,255,0.5); text-decoration: underline; }

/* === Leaflet Customization === */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-lg) !important;
}

.map-popup {
    font-family: 'Inter', sans-serif;
    min-width: 200px;
}

.map-popup-title {
    font-family: 'Playfair Display', serif;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.map-popup-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.map-popup-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

/* Custom marker */
.custom-marker {
    background: var(--primary);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* === Loading === */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === Responsive === */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .mobile-menu-btn { display: flex; }
    
    .nav-links.mobile-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--warm-white);
        padding: 20px 24px;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
    }
    
    .nav-links.mobile-open a,
    .nav-links.mobile-open .lang-toggle { color: var(--text) !important; }
    
    .hero-stats { gap: 24px; }
    .stat-number { font-size: 1.8rem; }
    
    .cards-grid { grid-template-columns: 1fr; }
    
    .place-layout {
        grid-template-columns: 1fr;
    }
    
    .place-sidebar { order: -1; }
    
    .filters { flex-direction: column; }
    .filter-select { min-width: auto; }
    
    .province-grid { grid-template-columns: repeat(2, 1fr); }
    
    .gallery { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .hero-search { flex-direction: column; border-radius: var(--radius); }
    .hero-search-btn { padding: 14px; justify-content: center; }
    .province-grid { grid-template-columns: 1fr; }
}
