/* Adventure Journal - Main Stylesheet */

:root {
    --color-primary-dark: #1a2825;
    --color-primary: #3d5248;
    --color-primary-mid: #526356;
    --color-accent: #f0961e;
    --color-accent-light: #f5b042;
    --color-accent-hover: #d8840f;
    --color-sage: #61655b;
    --color-sky: #7a8f82;
    --color-dark: #121e16;
    --color-text: #2a362f;
    --color-muted: #81847d;
    --color-bg: #f3f4f1;
    --color-surface: rgba(255, 255, 255, 0.1);
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --radius: 1rem;
    --shadow: 0 8px 32px rgba(18, 30, 22, 0.12);
    --nav-height: 70px;
    --section-nav-height: 58px;
    --anchor-offset: var(--nav-height);
    --trip-anchor-offset: calc(var(--nav-height) + var(--section-nav-height) + 1rem);

    /* Bootstrap 5 theme sync */
    --bs-primary: #3d5248;
    --bs-primary-rgb: 61, 82, 72;
    --bs-link-color: #3d5248;
    --bs-link-hover-color: #2f4038;
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--anchor-offset);
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    padding-top: 70px;
}

h1, h2, h3, h4, h5, .display-font {
    font-family: var(--font-display);
}

/* Glass Navigation */
.glass-nav {
    background: rgba(26, 40, 37, 0.88) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 20px rgba(18, 30, 22, 0.2);
    transition: background 0.3s;
}

.glass-nav.scrolled {
    background: rgba(26, 40, 37, 0.96) !important;
}

.navbar-brand { font-family: var(--font-display); }

.site-logo {
    display: block;
    object-fit: contain;
}

.site-logo-nav {
    height: 48px;
    width: auto;
    max-width: 48px;
    object-fit: contain;
}

.site-logo-footer {
    display: block;
    width: 56px !important;
    height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
    object-fit: contain;
}

.site-logo-hero {
    height: var(--hero-logo-size, 200px);
    width: auto;
    max-width: min(var(--hero-logo-size, 200px), 90vw);
    object-fit: contain;
    margin: 0 auto 1rem;
}

.nav-link.active { color: var(--color-accent-light) !important; font-weight: 600; }

/* Buttons */
.btn-accent {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
}
.btn-accent:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: white;
}

.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}

/* Hero */
.hero-section {
    min-height: 90vh;
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 45%, var(--color-sage) 100%);
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    margin-top: -70px;
    padding-top: 70px;
}

.hero-section-has-image {
    background-color: var(--color-primary-dark);
}

.hero-section-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        135deg,
        rgba(26, 40, 37, 0.72) 0%,
        rgba(61, 82, 72, 0.55) 45%,
        rgba(97, 101, 91, 0.5) 100%
    );
}

.hero-section-has-image .world-map-bg {
    display: none;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 400'%3E%3Cpath fill='rgba(255,255,255,0.05)' d='M0 200 Q200 100 400 200 T800 200 V400 H0Z'/%3E%3C/svg%3E") center/cover no-repeat;
    opacity: 0.5;
}

.hero-content { position: relative; z-index: 2; }

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    color: white;
    text-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255,255,255,0.9);
}

/* World map decoration */
.world-map-bg {
    position: absolute;
    right: -5%;
    top: 50%;
    transform: translateY(-50%);
    width: 50%;
    opacity: 0.15;
    pointer-events: none;
}

/* Stats bar */
.stats-bar {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-top: -60px;
    position: relative;
    z-index: 10;
}

.stat-item {
    text-align: center;
    padding: 1.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    font-family: var(--font-display);
}

.stat-label {
    color: var(--color-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Cards */
.trip-card {
    border: none;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    background: white;
}

.trip-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(0,0,0,0.15);
}

.trip-card .card-img-top {
    height: 220px;
    object-fit: cover;
}

.trip-card .status-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.status-active .pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
    margin-right: 4px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Glass card */
.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: var(--shadow);
}

/* Section headings */
.section-heading {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    color: var(--color-primary-dark);
    margin-bottom: 0.5rem;
}

.section-subheading {
    color: var(--color-muted);
    margin-bottom: 2rem;
}

/* Trip Updates — parallax topographic background */
.updates-parallax-section {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.updates-parallax-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.updates-parallax-bg-inner {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    height: 140%;
    top: -20%;
    background-color: #d4dcc8;
    background-image: url('../images/topo-map.png?v=10');
    background-size: 740px 740px;
    background-position: 0 0;
    background-repeat: repeat;
    will-change: background-position;
}

.updates-parallax-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        165deg,
        rgba(26, 40, 37, 0.42) 0%,
        rgba(61, 82, 72, 0.38) 40%,
        rgba(26, 40, 37, 0.48) 100%
    );
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    pointer-events: none;
}

.updates-parallax-content {
    position: relative;
    z-index: 2;
}

.updates-parallax-section .section-heading {
    color: #f3f4f1;
    text-shadow: 0 2px 12px rgba(18, 30, 22, 0.35);
}

.updates-parallax-section .section-subheading {
    color: rgba(243, 244, 241, 0.75);
}

.timeline-on-topo::before {
    background: linear-gradient(
        to bottom,
        rgba(240, 150, 30, 0.85),
        rgba(122, 143, 130, 0.9)
    );
    box-shadow: 0 0 12px rgba(240, 150, 30, 0.25);
}

.timeline-on-topo .timeline-item::before {
    border-color: #f3f4f1;
    box-shadow: 0 0 0 3px rgba(240, 150, 30, 0.55);
}

.timeline-on-topo .timeline-card {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

@media (prefers-reduced-motion: reduce) {
    .updates-parallax-bg-inner {
        background-position: 0 0 !important;
    }

    .updates-parallax-overlay {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* Timeline */
.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--color-primary), var(--color-sky));
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    width: 50%;
    padding: 0 2rem;
}

.timeline-item.left { left: 0; text-align: right; }
.timeline-item.right { left: 50%; }

.timeline-item::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--color-accent);
    border: 3px solid white;
    border-radius: 50%;
    top: 1.5rem;
    box-shadow: 0 0 0 3px var(--color-primary);
}

.timeline-item.left::before { right: -8px; }
.timeline-item.right::before { left: -8px; }

.timeline-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: inline-block;
    text-align: left;
    max-width: 100%;
}

.timeline-date {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .timeline::before { left: 20px; }
    .timeline-item, .timeline-item.left, .timeline-item.right {
        width: 100%;
        left: 0;
        padding-left: 3rem;
        text-align: left;
    }
    .timeline-item::before, .timeline-item.left::before, .timeline-item.right::before {
        left: 12px;
        right: auto;
    }
}

/* Gallery masonry */
.gallery-masonry {
    columns: 3 280px;
    column-gap: 1rem;
}

.gallery-masonry .gallery-item {
    break-inside: avoid;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    display: block;
    cursor: zoom-in;
}

.gallery-masonry img {
    width: 100%;
    display: block;
    transition: transform 0.3s;
}

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

/* Video cards */
.video-card {
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.video-card > img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.video-card:hover { transform: scale(1.03); }

.video-card .play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    transition: background 0.3s;
}

.video-card:hover .play-overlay { background: rgba(0,0,0,0.5); }

.play-overlay i {
    font-size: 3rem;
    color: white;
    opacity: 0.9;
}

/* Affiliate / gear product cards */
.affiliate-card {
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.affiliate-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(18, 30, 22, 0.15);
}

.affiliate-card-media {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 220px;
    padding: 1rem;
    overflow: hidden;
    background: #fff;
    border-bottom: 1px solid rgba(26, 40, 37, 0.08);
}

.affiliate-card-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.affiliate-promo-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-muted);
    margin-bottom: 0.35rem;
}

/* Poll */
.poll-option {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.poll-option:hover, .poll-option.selected {
    border-color: var(--color-primary);
    background: rgba(61, 82, 72, 0.06);
}

.poll-result-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.poll-result-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: 4px;
    transition: width 1s ease;
}

/* Trip hero */
.trip-hero {
    min-height: 70vh;
    background-size: cover;
    background-position: center;
    position: relative;
    margin-top: -70px;
    padding-top: 70px;
    display: flex;
    align-items: flex-end;
}

.trip-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(18, 30, 22, 0.88) 0%, rgba(26, 40, 37, 0.45) 50%, rgba(38, 51, 48, 0.25) 100%);
}

.trip-hero-content {
    position: relative;
    z-index: 2;
    padding: 3rem 0;
    color: white;
}

.trip-stats-overlay {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.trip-stat {
    text-align: center;
}

.trip-stat .number {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-display);
}

.trip-stat .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.8;
}

/* Sticky section nav */
.section-nav {
    position: sticky;
    top: 70px;
    z-index: 100;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 0.75rem 0;
}

.section-nav .nav-link {
    color: var(--color-muted);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    transition: all 0.2s;
}

.section-nav .nav-link.active,
.section-nav .nav-link:hover {
    color: white;
    background: var(--color-primary);
}

/* Anchor targets — offset for fixed main nav + sticky section nav on trip pages */
section[id][data-section],
.timeline-item[id] {
    scroll-margin-top: var(--trip-anchor-offset);
}

/* Homepage / single-nav anchor sections */
#trips,
#newsletter {
    scroll-margin-top: var(--anchor-offset);
}

/* Map */
.trip-map-wrap {
    position: relative;
}

#tripMap,
#tripMap3d,
.trip-map-3d {
    height: 500px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 1;
    width: 100%;
}

#tripMap[hidden],
#tripMap3d[hidden] {
    display: none !important;
}

.trip-map-toolbar .btn-group .btn.active {
    pointer-events: none;
}

/* Leaflet layer control on trip maps */
#tripMap .leaflet-control-layers {
    border: none;
    border-radius: 8px;
    box-shadow: var(--shadow);
    font-family: var(--font-body);
}
#tripMap .leaflet-control-layers-toggle {
    width: 36px;
    height: 36px;
}
#tripMap .leaflet-control-layers label {
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}

/* MapLibre basemap control (3D) */
.trip-map3d-layers {
    font-family: var(--font-body);
}
.trip-map3d-layers-toggle {
    width: 29px;
    height: 29px;
    display: block;
    border: 0;
    background: #fff;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    line-height: 29px;
    text-align: center;
    color: #333;
}
.trip-map3d-layers-toggle:hover {
    background: #f4f4f4;
}
.trip-map3d-layers-panel {
    background: #fff;
    padding: 8px 10px;
    min-width: 110px;
    border-top: 1px solid #ddd;
}
.trip-map3d-layers-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    margin: 0 0 4px;
    cursor: pointer;
    white-space: nowrap;
}
.trip-map3d-layers-option:last-child {
    margin-bottom: 0;
}

/* Route color control (2D Leaflet + 3D MapLibre) */
.trip-route-color-control {
    font-family: var(--font-body);
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}
.trip-route-color-toggle {
    display: block;
    width: 34px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #333;
    text-decoration: none !important;
}
.trip-route-color-panel {
    padding: 8px 10px;
    border-top: 1px solid #ddd;
    min-width: 110px;
}
.trip-route-color-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    margin: 0 0 4px;
    cursor: pointer;
    white-space: nowrap;
}
.trip-route-color-option:last-child {
    margin-bottom: 0;
}
.trip-route-color-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

@media (min-width: 992px) {
    #tripMap,
    #tripMap3d,
    .trip-map-3d { height: 600px; }
}

/* Footer */
.site-footer {
    background: var(--color-primary-dark);
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: white;
    margin-right: 0.5rem;
    transition: background 0.2s;
}

.social-links a:hover {
    background: var(--color-accent);
    color: white;
}

.footer-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}
.footer-links a:hover { color: white; }

/* Animations — visible by default; hidden only when JS enables scroll animations */
.fade-in {
    opacity: 1;
    transform: translateY(0);
}

html.js .fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s, transform 0.6s;
}

html.js .fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Admin overrides imported separately */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* GLightbox — ensure images display (extensionless URLs need data-type="image") */
.glightbox-container .gslide-image img {
    max-width: 90vw;
    max-height: 85vh;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    opacity: 1 !important;
    visibility: visible !important;
}

.glightbox-container .gslide-media {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Map pin popups */
.map-popup {
    max-width: 100%;
}

.map-popup-img {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 8px;
    border-radius: 8px;
}
