/* ============================================================
   OFFLANDS v2 — Cinematic Design System & Theme Layout
   Aesthetic: Warm, hand-drawn outdoor sketchbook journal
   Colors: Pine · Moss · Rust · Sand · Cream · Midnight
   ============================================================ */

:root {
    /* Palette */
    --pine:       #2E4A35;
    --moss:       #4A6741;
    --rust:       #B5522A;
    --sand:       #D4BFA0;
    --fog:        #C8D5C0;
    --cream:      #F5EFE0; /* Cozy, warm light paper background */
    --editorial-bg: #FAF9F6; /* Neutral off-white — editorial chapter & story slides */
    --midnight:   #1A2530;
    --sky:        #7BA7BC;
    --stone:      #8C7B6B;
    --white:      #FFFFFF;
    --bark:       #4a3b32; /* Universal dark-brown outline */

    /* Semantic aliases */
    --bg-light:       var(--cream);
    --text-primary:   var(--midnight);
    --text-secondary: var(--stone);
    --accent:         var(--pine);
    --accent-warm:    var(--rust);
    --accent-cool:    var(--sky);

    /* Glass Panels */
    --glass-bg:     rgba(245, 239, 224, 0.88);
    --glass-border: rgba(255, 255, 255, 0.7);

    /* Typography — Fredoka (brand) + Fraunces (editorial titles) + Source Sans 3 (UI/body) */
    --font-brand: 'Fredoka One', cursive;
    --font-fraunces: 'Fraunces', serif;
    --font-source-sans: 'Source Sans 3', sans-serif;
    --font-display: var(--font-brand);
    --font-serif: var(--font-fraunces);
    --font-ui: var(--font-source-sans);
    --font-body: var(--font-source-sans);
    --ed-title-font: var(--font-fraunces);
    --ed-rest-font: var(--font-source-sans);

    /* Type scale — tracked caps floor 11px mobile / 12px desktop */
    --type-cap-sm: 0.6875rem;
    --type-cap-md: 0.75rem;
    --type-cap-lg: 0.8125rem;
    --type-body-sm: 0.9375rem;
    --type-body:    1rem;
    --type-body-lg: 1.125rem;

    /* Timeline cards — Apple-style continuous corner feel */
    --timeline-card-radius: 20px;
    --timeline-card-w: 250px;
    --timeline-card-h: calc(var(--timeline-card-w) * 340 / 280);
    --timeline-card-mobile-ratio: 1.48;
    --ed-film-band: 22px;
    --ed-film-card-h: calc(var(--timeline-card-h) * 1.06);
    --ed-film-card-w: calc((var(--ed-film-card-h) - 2 * var(--ed-film-band)) * 4 / 3);
}

@media (min-width: 1025px) {
    :root {
        --type-cap-sm: var(--type-cap-md);
        --type-cap-lg: 0.875rem;
        --timeline-card-radius: 22px;
    }
}

/* ── BASE RESET ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

body, html {
    width: 100%;
    height: 100%;
    height: 100dvh; /* Dynamic viewport height to prevent iOS address bar cutoffs */
    background-color: var(--bg-light);
    color: var(--text-primary);
    overflow: hidden;
}

/* ── MAP CONTAINER ── */
#map {
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: auto !important;
}

/* ── UTILITIES ── */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 24px rgba(46, 74, 53, 0.08);
    pointer-events: auto;
}

/* ── BRAND WORDMARK (Desktop) ── */
#offlands-logo {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--pine);
    opacity: 0.72;
    white-space: nowrap;
    pointer-events: none;
    z-index: 20;
    text-shadow: 0 1px 4px rgba(245,239,224,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#offlands-logo .logo-icon {
    height: 48px;
    width: auto;
    object-fit: contain;
}

/* Mobile logo inside card — hidden on desktop */
#offlands-logo-mobile {
    display: none;
    font-family: var(--font-display);
    font-size: var(--type-cap-md);
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--stone);
    opacity: 0.75;
    text-align: center;
    margin-bottom: 6px;
    pointer-events: none;
}

/* ── UI LAYER & VERTICAL PROFILE CARD ── */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 35%;
    max-width: 420px;
    min-width: 320px;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 20px;
    padding: 24px;
}

.travel-profile {
    width: 100%;
    flex-shrink: 0;
    border-radius: 24px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 2px solid var(--glass-border);
    box-shadow: 0 15px 40px rgba(46, 74, 53, 0.15);
    background: var(--glass-bg);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.profile-cover {
    height: 110px;
    width: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
    transition: transform 0.5s ease;
}

.profile-cover-gradient {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(245, 239, 224, 0) 0%, rgba(245, 239, 224, 0.96) 95%);
}

.profile-content {
    padding: 12px 20px 20px 20px;
    position: relative;
    z-index: 2;
    margin-top: -24px;
}

.profile-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.pill-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pill-subtitle {
    display: none; /* Mobile only */
}

.vehicle-mini-icon {
    display: flex;
    align-items: center;
    gap: 4px;
}
.vehicle-mini-icon svg {
    width: 32px;
    height: 32px;
}

.last-seen-ui {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.65rem;
    font-family: var(--font-ui);
    color: var(--stone);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-top: 4px;
    margin-bottom: 8px;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background-color: var(--rust);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* ── STATS GRID (2×2 layout) ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
    margin-top: 8px;
}

.stat-box {
    background: rgba(74, 103, 65, 0.08);
    border: 1px solid rgba(200, 213, 192, 0.6);
    padding: 8px 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-box:hover {
    transform: translateY(-2px);
    background: rgba(74, 103, 65, 0.14);
}

.stat-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon svg {
    width: 30px;
    height: 30px;
    display: block;
}

.stat-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.stat-val {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--pine);
    white-space: nowrap;
    line-height: 1;
}

.stat-lbl {
    font-family: var(--font-ui);
    font-size: var(--type-cap-sm);
    font-weight: 700;
    color: var(--stone);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1;
}

/* Quick Actions / Satellite panel placement */
#map-style-toggle-panel {
    padding: 4px;
    height: 48px;
    display: flex;
    align-items: center;
    border-radius: 16px;
}

.quick-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    font-family: var(--font-ui);
    font-size: var(--type-cap-md);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bark);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 10px;
    transition: background-color 0.2s;
}

.quick-btn:hover {
    background-color: rgba(74, 59, 50, 0.06);
}

.quick-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
}
.quick-icon svg {
    width: 100%;
    height: 100%;
}

.trip-selector-container {
    display: flex;
    align-items: center;
}

.trip-select {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 400; /* Fredoka One is inherently bold */
    letter-spacing: 0.02em;
    color: var(--pine);
    background: transparent;
    border: none;
    padding: 2px 30px 2px 0px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232E4A35' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 20px;
}

.trip-select:focus {
    outline: none;
}

.quick-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bark);
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 12px;
    transition: background-color 0.2s;
}

.quick-btn:hover {
    background-color: rgba(74, 59, 50, 0.06);
}

.quick-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
}
.quick-icon svg {
    width: 100%;
    height: 100%;
}

/* ── BOTTOM HORIZONTAL TIMELINE ── */
.timeline-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 406px;
    max-height: none;
    z-index: 10;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 22px 0 12px;
    pointer-events: auto;
    display: flex;
    align-items: flex-end;
}

.timeline-scroll-wrapper {
    display: flex;
    flex-direction: row;
    gap: 20px;
    height: 100%;
    padding: 0;
    align-items: flex-end;
}

/* trailing spacer so last card can scroll fully into view */
.timeline-scroll-wrapper::after {
    content: '';
    flex: 0 0 12px;
}

/* Loading state */
.timeline-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    justify-content: center;
    color: var(--pine);
    font-family: var(--font-ui);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: auto;
}

/* ── STEP CARDS SYSTEM ── */
.step-card {
    width: var(--timeline-card-w);
    height: var(--timeline-card-h);
    flex-shrink: 0;
    background: #fdfbf7;
    border: none;
    border-radius: var(--timeline-card-radius);
    box-shadow: 0 10px 0 rgba(74, 59, 50, 0.06), 0 18px 32px rgba(74, 59, 50, 0.12);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1),
                box-shadow 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.step-card:hover:not(.active) {
    transform: translateY(-6px);
    box-shadow: 0 14px 0 rgba(74, 59, 50, 0.08), 0 22px 36px rgba(74, 59, 50, 0.14);
}

.step-card.active {
    transform: translateY(-10px) rotate(-1deg);
    box-shadow: 0 14px 0 rgba(181, 82, 42, 0.14), 0 24px 38px rgba(74, 59, 50, 0.18);
}

/* Photo thumbnail area — fills card; caption sits in compact footer */
.step-card.photo-card .card-photo-thumb {
    flex: 1 1 0;
    height: auto;
    min-height: 220px;
}

.step-card.photo-card .card-info {
    flex: 0 0 auto;
    padding: 9px 12px 11px;
    gap: 3px;
    justify-content: flex-start;
    max-height: 92px;
}

.step-card.photo-card .card-title {
    font-size: 0.98rem;
    line-height: 1.1;
    -webkit-line-clamp: 1;
}

.step-card.photo-card .card-snippet {
    font-size: 0.74rem;
    line-height: 1.32;
    -webkit-line-clamp: 2;
}

.step-card.photo-card .card-snippet--lead {
    font-size: 0.8rem;
    line-height: 1.34;
    -webkit-line-clamp: 2;
}

.step-card.photo-card .card-mini-stamp {
    left: 9px;
    right: auto;
}

.step-card.photo-card {
    cursor: grab;
}

.timeline-bar.dragging .step-card {
    cursor: grabbing;
}

.card-photo-thumb {
    height: 180px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.card-photo-thumb .card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

.step-card img {
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

.card-photo-thumb {
    cursor: grab;
}

.timeline-bar.dragging .card-photo-thumb {
    cursor: grabbing;
}

.step-card:hover .card-photo-thumb .card-img {
    transform: scale(1.04);
}

/* Card info area (title + snippet) — desktop */
.card-info {
    padding: 14px 16px 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    justify-content: center;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.28rem;
    font-weight: 400;
    color: var(--pine);
    line-height: 1.08;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-snippet {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--stone);
    line-height: 1.38;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-snippet--lead {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1.02rem;
    color: var(--bark);
    line-height: 1.42;
    -webkit-line-clamp: 4;
}

/* Mini postage stamp — absolute top-right */
.card-mini-stamp {
    position: absolute;
    top: 9px;
    right: 9px;
    padding: 5px 7px;
    color: var(--rust);
    background: rgba(253, 251, 247, 0.82);
    border: 1.2px solid currentColor;
    border-radius: 6px;
    font-family: var(--font-ui);
    font-size: var(--type-cap-sm);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transform: rotate(5deg);
    pointer-events: none;
    z-index: 5;
}

/* Text-only field-note card */
.step-card.text-only-card {
    background:
        radial-gradient(circle at 88% 12%, rgba(212, 191, 160, 0.35), transparent 42%),
        linear-gradient(90deg, rgba(181, 82, 42, 0.16) 0 3px, transparent 3px 100%),
        #fdfbf7;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
}

.step-card.text-only-card .card-info--note {
    position: relative;
    padding: 38px 18px 18px;
    justify-content: center;
    gap: 10px;
    min-height: 0;
    flex: 1;
}

.card-note-ornament {
    position: absolute;
    top: 6px;
    left: 10px;
    font-family: var(--font-serif);
    font-size: 4.2rem;
    line-height: 1;
    color: rgba(181, 82, 42, 0.14);
    pointer-events: none;
    user-select: none;
}

.card-note-quote {
    position: relative;
    z-index: 1;
    font-family: var(--ed-title-font);
    font-size: 1.9rem;
    font-style: normal;
    font-weight: 500;
    font-variation-settings: 'opsz' 72;
    line-height: 1.2;
    color: var(--pine);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left;
}

.card-note-place {
    position: relative;
    z-index: 1;
    font-family: var(--font-ui);
    font-size: var(--type-cap-sm);
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rust);
}

.card-note-rule {
    display: block;
    width: 42px;
    height: 2px;
    margin-top: 2px;
    background: linear-gradient(90deg, rgba(181, 82, 42, 0.55), transparent);
    border-radius: 2px;
}

/* Date block (ticket-style) */
.card-date-block {
    display: grid;
    place-items: center;
    align-self: flex-start;
    min-width: 54px;
    min-height: 54px;
    margin: 12px 12px 0;
    color: var(--rust);
    border: 1.4px dashed rgba(181, 82, 42, 0.55);
    border-radius: 16px;
    text-align: center;
}

.card-date-day {
    display: block;
    font-family: var(--font-display);
    font-size: 1.55rem;
    line-height: 0.9;
    color: var(--rust);
}

.card-date-mon {
    display: block;
    font-family: var(--font-ui);
    font-size: var(--type-cap-sm);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rust);
}

.step-card.text-only-card .card-snippet {
    font-family: var(--font-body);
    font-style: italic;
    font-style: italic;
    color: var(--bark);
}

/* Drag to scroll timeline support on desktop */
.timeline-bar {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.timeline-bar.dragging {
    cursor: grabbing;
}

.card-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
}

.card-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(74, 103, 65, 0.08);
    border: 1px solid var(--fog);
    border-radius: 8px;
    padding: 4px 8px;
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--pine);
}

.badge-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
}
.badge-icon svg {
    width: 100%;
    height: 100%;
}

/* Photo count badge (shown on multi-photo cards) */
.photo-count-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    bottom: auto;
    z-index: 4;
    background: rgba(9, 13, 11, 0.62);
    color: var(--white);
    font-family: var(--font-ui);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    letter-spacing: 0.04em;
}

/* ── VEHICLE & MAP markers ── */
.car-marker {
    filter: drop-shadow(0 4px 8px rgba(74, 59, 50, 0.25));
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-map-marker,
.mapbox-custom-pin-wrapper {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
}

.stop-bubble {
    border-radius: 50% !important;
    box-sizing: border-box !important;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    padding: 0 !important;
}

.stop-bubble:hover {
    transform: scale(1.15) !important;
    z-index: 1000 !important;
}

/* Photo Pin: minimalistic circle with thinner white border, outer crisp brown outline using box-shadow, and soft shadow */
.stop-bubble.photo-pin {
    width: 36px !important;
    height: 36px !important;
    margin: 4px !important;
    border: 1.5px solid #fdfbf7 !important;
    box-shadow: 0 0 0 1px #4a3b32, 0 2px 6px rgba(0, 0, 0, 0.12) !important;
    background: #fdfbf7 !important;
}

.stop-bubble.photo-pin img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}

/* Field-note pin: circle with naive journal icon */
.stop-bubble.note-pin {
    width: 32px !important;
    height: 32px !important;
    margin: 6px !important;
    border: 1.5px solid #fdfbf7 !important;
    box-shadow: 0 0 0 1px #4a3b32, 0 2px 6px rgba(0, 0, 0, 0.12) !important;
    background: #fdfbf7 !important;
}

.note-pin-icon {
    width: 22px !important;
    height: 22px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.note-pin-icon svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* Vehicle pin — no circle; toy sprite with projected shadow on the map */
.custom-map-marker.map-vehicle-marker,
.map-vehicle-marker-wrapper {
    width: 56px !important;
    height: 56px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.map-vehicle-pin {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: auto;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.map-vehicle-pin .toy-sprite-container {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
}

.map-vehicle-pin .toy-shadow {
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 40px;
    height: 10px;
    margin-left: -20px;
    background: rgba(46, 74, 53, 0.28);
    border-radius: 50%;
    filter: blur(2px);
    transform: rotateX(72deg);
    transform-origin: center bottom;
}

.map-vehicle-pin .toy-sprite {
    position: relative;
    width: 44px;
    height: 44px;
    z-index: 2;
    transform-origin: bottom center;
    filter: drop-shadow(0 5px 4px rgba(74, 59, 50, 0.2));
}

.map-vehicle-pin .toy-sprite svg {
    width: 100%;
    height: 100%;
    display: block;
}

.map-vehicle-pin.active-pin {
    transform: scale(1.12) translateY(-4px);
    z-index: 9999;
}

.map-vehicle-pin.active-pin .toy-shadow {
    width: 46px;
    margin-left: -23px;
    background: rgba(181, 82, 42, 0.32);
}

/* Satellite imagery: high-contrast overlays for routes (JS) + marker halos */
html[data-map-satellite] .map-vehicle-pin::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 46px;
    height: 46px;
    margin-left: -23px;
    border-radius: 50%;
    background: rgba(255, 248, 240, 0.94);
    box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.55), 0 4px 14px rgba(0, 0, 0, 0.45);
    z-index: 0;
}

html[data-map-satellite] .map-vehicle-pin .toy-sprite-container {
    z-index: 1;
}

html[data-map-satellite] .map-vehicle-pin .toy-sprite {
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.95))
        drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55));
}

html[data-map-satellite] .map-vehicle-pin .toy-shadow {
    background: rgba(0, 0, 0, 0.42);
    filter: blur(3px);
}

html[data-map-satellite] .map-vehicle-pin.active-pin::before {
    box-shadow: 0 0 0 2px var(--rust), 0 0 12px rgba(181, 82, 42, 0.55), 0 4px 14px rgba(0, 0, 0, 0.5);
}

html[data-map-satellite] .stop-bubble.photo-pin,
html[data-map-satellite] .stop-bubble.note-pin {
    border-width: 2px !important;
    box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.65), 0 2px 10px rgba(0, 0, 0, 0.35) !important;
}

html[data-map-satellite] .vehicle-3d-pin.map-vehicle-pin::before {
    bottom: 4px;
}

/* Active Pin States: smooth scale and transition to accent color border/shadow */
.stop-bubble.active-pin {
    transform: scale(1.25) !important;
    z-index: 9999 !important;
    border-color: #fdfbf7 !important;
    box-shadow: 0 0 0 1.5px var(--rust), 0 4px 12px rgba(181, 82, 42, 0.35) !important;
}

/* ── LIGHTBOX GALLERY / POSTCARD STORY VIEWER ── */
#stories-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(26, 37, 48, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    color: var(--cream);
    user-select: none;
    -webkit-user-select: none;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
}

#stories-viewer.text-story-soft {
    background: rgba(245, 239, 224, 0.94);
    color: var(--pine);
}

/* Editorial chapter slides — flat cream chrome, unified film fit */
#stories-viewer.editorial-story-mode {
    background: var(--cream) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    /* Timeline film card geometry — scales with step card tokens */
    --ed-story-film-w: var(--ed-film-card-w);
    --ed-story-film-h: var(--ed-film-card-h);
    --ed-story-film-ratio: calc(var(--ed-story-film-h) / var(--ed-story-film-w));
    --ed-story-body-h: 148px;
    --ed-story-chrome: 96px;
    --ed-story-pad-x: 10px;
    --ed-story-max-w: min(calc(912px * var(--timeline-card-w) / 280px), calc(var(--ed-film-card-w) * 2.162));
    --ed-story-fit-w: min(
        var(--ed-story-max-w),
        calc(100vw - 2 * var(--ed-story-pad-x)),
        calc((100dvh - var(--ed-story-chrome) - var(--ed-story-body-h) - 12px) / var(--ed-story-film-ratio))
    );
}

#stories-viewer.editorial-story-mode #story-chrome,
#stories-viewer.editorial-story-mode #story-content-area {
    background: var(--cream) !important;
}

#stories-viewer.editorial-story-mode #story-indicators-container,
#stories-viewer.editorial-story-mode #story-header {
    background: transparent !important;
}

#stories-viewer.editorial-story-mode #story-content-area {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 8px var(--ed-story-pad-x) !important;
    box-sizing: border-box !important;
    min-height: 0 !important;
}

#stories-viewer.active {
    opacity: 1;
    pointer-events: auto;
    overscroll-behavior: none;
}

#stories-viewer.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden;
}

html.modal-scroll-lock,
html.modal-scroll-lock body {
    overflow: hidden;
    overscroll-behavior: none;
}

html.modal-scroll-lock .timeline-bar {
    overflow-x: auto !important;
    pointer-events: auto !important;
    touch-action: pan-x;
}

html.modal-scroll-lock #map,
html.modal-scroll-lock #map-3d {
    pointer-events: none !important;
}

#story-chrome {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    z-index: 100002;
}

#story-indicators-container {
    display: flex;
    gap: 5px;
    padding: 16px 24px 8px 24px;
    width: 100%;
    z-index: 100002;
    box-sizing: border-box;
}

#stories-viewer.text-story-soft .story-indicator-bar {
    background: rgba(74, 59, 50, 0.16);
}

#stories-viewer.text-story-soft .story-indicator-bar.completed .story-indicator-progress,
#stories-viewer.text-story-soft .story-indicator-bar.active .story-indicator-progress {
    background: rgba(181, 82, 42, 0.72);
}

.story-indicator-bar {
    height: 4px;
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.story-indicator-progress {
    height: 100%;
    width: 0;
    background: var(--white);
    border-radius: 2px;
}

.story-indicator-bar.completed .story-indicator-progress {
    width: 100%;
}

.story-indicator-bar.active .story-indicator-progress {
    width: 100%;
}

#story-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 24px 10px 24px;
    z-index: 100002;
}

.story-profile-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.story-location-badge {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--cream);
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    letter-spacing: 0.02em;
}

#stories-viewer.text-story-soft .story-location-badge {
    color: var(--pine);
    text-shadow: none;
}

.story-date-badge {
    font-family: var(--font-ui);
    font-size: var(--type-cap-md);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sand);
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

#stories-viewer.text-story-soft .story-date-badge {
    color: var(--stone);
    text-shadow: none;
}

.story-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

#story-close-btn {
    background: transparent;
    border: none;
    color: var(--cream);
    font-size: 26px;
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#stories-viewer.text-story-soft #story-close-btn {
    color: var(--pine);
    text-shadow: none;
}

#story-close-btn:hover {
    transform: scale(1.15) rotate(90deg);
}

#story-content-area {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
    z-index: 100001;
}

.story-slide-container {
    width: 100%;
    height: 100%;
    max-width: 520px;
    max-height: 76vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    border-radius: 34px;
    overflow: hidden;
    box-shadow: 0 22px 54px rgba(26, 37, 48, 0.22);
    border: none;
    background: #0d1210;
    position: relative;
    box-sizing: border-box;
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.35s;
}

.story-slide-container.text-story-soft {
    background: #fdfbf7;
    border: none;
    box-shadow: 0 18px 40px rgba(74, 59, 50, 0.16), 0 10px 0 rgba(74, 59, 50, 0.05);
}

/* Text-only field note page */
.story-slide-text.story-text-page {
    width: 100%;
    flex: 1;
    min-height: 0;
    padding: 52px 32px 108px;
    background:
        radial-gradient(circle at 24% 18%, rgba(212, 191, 160, 0.32), transparent 14rem),
        linear-gradient(90deg, rgba(181, 82, 42, 0.18) 0 3px, transparent 3px 100%),
        #fdfbf7;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    box-sizing: border-box;
    overflow-y: auto;
}

.story-slide-text .story-quote-text {
    font-family: var(--ed-title-font);
    font-size: clamp(2rem, 5.5vw, 2.75rem);
    font-style: normal;
    font-weight: 500;
    font-variation-settings: 'opsz' 72;
    line-height: 1.22;
    color: var(--pine);
    text-shadow: none;
    margin: 0;
    max-width: 22ch;
    width: 100%;
}

/* Day stamp — top-left inside story card */
.story-day-stamp {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 14;
    padding: 7px 11px;
    color: var(--rust);
    background: rgba(253, 251, 247, 0.94);
    border: 1.2px solid rgba(181, 82, 42, 0.45);
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: var(--type-cap-md);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    line-height: 1;
    pointer-events: none;
}

.story-slide-container.text-story-soft .story-day-stamp {
    background: rgba(253, 251, 247, 0.92);
    box-shadow: 0 1px 0 rgba(74, 59, 50, 0.06);
}

.story-slide-container.photo-story-card .story-day-stamp {
    box-shadow: 0 2px 8px rgba(26, 37, 48, 0.14);
}

/* Trip meta — bottom row (vehicle, weather, altitude) */
.story-meta-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: center;
    gap: 20px 28px;
    width: min(calc(100% - 32px), 400px);
    margin-inline: auto;
    pointer-events: none;
}

.story-meta-row--bottom {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 56px;
    z-index: 13;
}

/* Photo story: meta sits in bottom stack — no overlap with caption */
.story-slide-photo .story-meta-row--bottom {
    position: relative;
    left: auto;
    transform: none;
    bottom: auto;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px 18px 8px;
    box-sizing: border-box;
    background: transparent;
    flex-wrap: wrap;
    gap: 10px 22px;
}

.story-meta-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 0;
    text-align: center;
    flex-shrink: 0;
}

.story-meta-chip-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: var(--rust);
}

.story-meta-chip-icon svg {
    width: 40px;
    height: 40px;
    fill: currentColor;
    flex-shrink: 0;
    filter: drop-shadow(0 3px 4px rgba(74, 59, 50, 0.12));
}

.story-meta-chip-label {
    font-family: var(--font-ui);
    font-size: var(--type-cap-sm);
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.1;
    color: var(--stone);
}

.story-meta-row--on-photo .story-meta-chip-icon {
    color: var(--rust);
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.story-meta-row--on-photo .story-meta-chip-icon svg {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.story-slide-photo .story-meta-row--on-photo .story-meta-chip-label {
    color: rgba(253, 251, 247, 0.88);
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    text-shadow: none;
}

.story-slide-photo .story-meta-row--on-photo .story-meta-chip-icon {
    background: transparent;
    box-shadow: none;
}

.story-slide-photo .story-meta-row--on-photo .story-meta-chip-icon svg {
    fill: rgba(253, 251, 247, 0.95);
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}

.story-meta-row--on-note .story-meta-chip-icon {
    color: var(--rust);
}

.story-meta-row--on-note .story-meta-chip-label {
    color: var(--stone);
}

/* Photo story scene */
.story-slide-photo {
    width: 100%;
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.story-photo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-photo-count {
    top: 14px;
    right: 14px;
    z-index: 6;
    font-size: var(--type-cap-md);
    font-weight: 800;
    padding: 5px 10px;
    border-radius: 999px;
    letter-spacing: 0.06em;
}

.story-photo-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    padding-bottom: 68px;
    box-sizing: border-box;
    background: linear-gradient(
        to top,
        rgba(9, 13, 11, 0.96) 0%,
        rgba(9, 13, 11, 0.92) 28%,
        rgba(9, 13, 11, 0.72) 55%,
        rgba(9, 13, 11, 0.28) 82%,
        transparent 100%
    );
}

.story-photo-overlay {
    position: relative;
    width: 100%;
    padding: 32px 22px 10px;
    background: transparent;
    color: var(--cream);
    box-sizing: border-box;
}

.story-photo-caption--lead {
    margin: 0 0 10px;
    font-family: var(--font-body);
    font-size: clamp(1.05rem, 2.2vw, 1.2rem);
    line-height: 1.5;
    font-style: italic;
    font-weight: 400;
    color: rgba(253, 251, 247, 0.92);
}

.story-overlay-title {
    margin: 0;
    color: rgba(253, 251, 247, 0.75);
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2.4vw, 1.35rem);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.story-photo-caption {
    font-family: var(--font-body);
    font-size: 1.04rem;
    line-height: 1.45;
    font-style: italic;
    font-weight: 400;
    color: rgba(253, 251, 247, 0.86);
    text-shadow: none;
    margin: 0;
}

/* Heart reaction — inside the slide card */
#story-feedback-container {
    display: none;
}

.story-feedback-in-card {
    position: absolute;
    right: 18px;
    bottom: 22px;
    z-index: 20;
    display: flex;
    align-items: center;
    pointer-events: auto;
}

.story-nav-tap-zone {
    display: none;
    pointer-events: none;
}

.left-zone {
    left: 0;
}

.right-zone {
    right: 0;
    width: 70%;
}

/* Swipe hints */
.story-swipe-hint {
    display: none !important;
}

@keyframes story-bounce-hint {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
}

/* ── PULSE ANIMATION ── */
.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--rust);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(181, 82, 42, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(181, 82, 42, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(181, 82, 42, 0); }
}

/* ── RESPONSIVE MOBILE ADJUSTMENTS ── */
@media (max-width: 1024px) {
    :root {
        --mobile-timeline-card-w: calc((100vw - 32px) / 2.8);
        --mobile-timeline-card-h: calc(var(--mobile-timeline-card-w) * var(--timeline-card-mobile-ratio));
    }

    #offlands-logo { display: none; }

    #ui-layer {
        display: contents;
    }

    /* --- Collapsible Top Profile Pill --- */
    .travel-profile {
        position: absolute;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 32px);
        max-width: 400px;
        background: rgba(245, 239, 224, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-radius: 30px;
        border: 2px solid var(--glass-border);
        box-shadow: 0 8px 24px rgba(46, 74, 53, 0.15);
        padding: 12px 20px;
        z-index: 100000 !important;
        -webkit-transform: translate3d(-50%, 0, 150px) !important;
        transform: translate3d(-50%, 0, 150px) !important;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
        overflow: hidden;
        pointer-events: auto;
    }

    .profile-cover { display: none; }
    .profile-content { padding: 0; margin-top: 0; }
    .stats-grid { display: none; } 
    #offlands-logo-mobile { display: none; }
    
    /* Collapsed pill: horizontal layout, center-aligned */
    .profile-header-row {
        margin-bottom: 0;
        align-items: center;
        gap: 10px;
    }
    
    .pill-content {
        gap: 1px;
        justify-content: center;
    }

    .trip-select {
        font-size: 1.1rem;
        background-size: 14px;
        padding-right: 20px;
        line-height: 1.2;
    }
    
    /* Last-seen: always visible in collapsed pill, tight margins */
    .last-seen-ui {
        margin-top: 1px;
        margin-bottom: 0;
        font-size: 0.6rem;
    }
    
    /* --- EXPANDED TOP CARD STATE --- */
    .travel-profile.expanded {
        padding: 0;
        border-radius: 24px;
    }
    
    .travel-profile.expanded .profile-cover {
        display: block;
        height: 100px;
        border-radius: 24px 24px 0 0;
    }
    
    .travel-profile.expanded .profile-content {
        padding: 16px 20px 20px 20px;
        margin-top: 0;
    }
    
    .travel-profile.expanded .trip-select {
        font-size: 1.25rem;
        background-size: 16px;
        padding-right: 22px;
    }
    
    .travel-profile.expanded .last-seen-ui {
        margin-bottom: 14px;
        margin-top: 6px;
        font-size: 0.65rem;
    }
    
    .travel-profile.expanded .stats-grid {
        display: grid;
        margin-top: 0;
    }

    /* ── MAP TOGGLE FABs — Mobile floating bottom-left ── */
    #map-style-toggle-panel {
        position: fixed;
        bottom: calc(var(--mobile-timeline-card-h) + 72px + env(safe-area-inset-bottom)); /* sits just above the timeline strip */
        left: 16px;
        top: auto;
        right: auto;
        z-index: 99999 !important;
        -webkit-transform: translate3d(0, 0, 150px) !important;
        transform: translate3d(0, 0, 150px) !important;
        pointer-events: auto;
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 0;
        height: auto;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    /* Each FAB: glass circle */
    #map-style-toggle-panel .quick-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        border-radius: 50%;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        background: rgba(245, 239, 224, 0.92);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border: 1.5px solid rgba(200, 190, 170, 0.5);
        box-shadow: 0 4px 16px rgba(46, 74, 53, 0.18);
        transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
                    background-color 0.2s;
    }

    #map-style-toggle-panel .quick-btn:active {
        transform: scale(0.88);
    }

    /* Hide text labels — icon only on mobile */
    #map-style-toggle-panel .quick-btn-text {
        display: none;
    }

    /* Larger icon on mobile FAB */
    #map-style-toggle-panel .quick-icon {
        width: 24px;
        height: 24px;
    }

    /* Active 3D state ring */
    #map-3d-toggle.active {
        background: var(--rust) !important;
        border-color: var(--rust) !important;
        box-shadow: 0 4px 16px rgba(181, 82, 42, 0.45) !important;
    }

    /* ── Timeline strip: edge-to-edge, room for lifted cards ── */
    .timeline-bar {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: calc(var(--mobile-timeline-card-h) + 56px + env(safe-area-inset-bottom)) !important;
        max-height: none !important;
        padding: 22px 0 calc(4px + env(safe-area-inset-bottom)) 0 !important;
        align-items: flex-end !important;
    }

    .timeline-scroll-wrapper {
        gap: 10px !important;
        padding: 0 !important;
        align-items: flex-end !important;
    }

    .step-card.active {
        transform: translateY(-8px) scale(1.03) rotate(-1deg) !important;
        box-shadow: 0 16px 30px rgba(74, 59, 50, 0.22) !important;
    }

    /* Postcard-style mobile cards (~2.5 visible on screen) */
    .step-card {
        width: var(--mobile-timeline-card-w) !important;
        min-width: var(--mobile-timeline-card-w) !important;
        max-width: var(--mobile-timeline-card-w) !important;
        height: var(--mobile-timeline-card-h) !important;
        border-radius: var(--timeline-card-radius) !important;
        background: #fdfbf7 !important;
        border: none !important;
        box-shadow: 0 10px 22px rgba(74, 59, 50, 0.18) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .step-card:hover:not(.active) {
        transform: none !important;
        box-shadow: 0 10px 22px rgba(74, 59, 50, 0.18) !important;
    }

    /* Photo thumbnail on mobile — fill card, compact text footer */
    .step-card.photo-card .card-photo-thumb {
        flex: 1 1 auto !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .step-card.photo-card .card-info {
        flex: 0 0 auto !important;
        max-height: 34px !important;
        padding: 5px 42px 6px 8px !important;
        gap: 0 !important;
        position: relative !important;
        overflow: hidden !important;
    }

    .step-card.photo-card .card-info::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 52px;
        height: 100%;
        background: linear-gradient(to right, rgba(253, 251, 247, 0), #fdfbf7 72%);
        pointer-events: none;
        z-index: 2;
    }

    /* One line of copy; fades under the heart (title only when no note) */
    .step-card.photo-card .card-info:has(.card-snippet) .card-title {
        display: none !important;
    }

    .step-card.photo-card .card-title,
    .step-card.photo-card .card-snippet,
    .step-card.photo-card .card-snippet--lead {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        -webkit-line-clamp: unset !important;
        line-clamp: unset !important;
        -webkit-box-orient: unset !important;
    }

    .step-card.photo-card .card-title {
        font-size: var(--type-cap-sm) !important;
        line-height: 1.25 !important;
    }

    .step-card.photo-card .card-snippet,
    .step-card.photo-card .card-snippet--lead {
        font-size: var(--type-cap-sm) !important;
        line-height: 1.25 !important;
        font-style: italic !important;
        color: var(--bark) !important;
    }

    .card-photo-thumb {
        height: 86px !important;
        flex-shrink: 0 !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .card-photo-thumb .card-img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        transform: none !important;
    }

    /* Card info area on mobile */
    .card-info {
        padding: 5px 7px 4px !important;
        flex-grow: 1 !important;
        overflow: hidden !important;
        gap: 2px !important;
    }

    .card-title {
        font-size: 0.8125rem !important;
        color: var(--pine) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-shadow: none !important;
        font-weight: 400 !important;
        line-height: 1.1 !important;
    }

    .card-snippet {
        font-size: 0.6875rem !important;
        -webkit-line-clamp: 2 !important;
        font-style: normal !important;
        color: var(--stone) !important;
    }

    .card-snippet--lead {
        font-size: var(--type-cap-md) !important;
        -webkit-line-clamp: 3 !important;
        font-style: italic !important;
        color: var(--bark) !important;
    }

    /* Mini stamp smaller on mobile */
    .card-mini-stamp {
        font-size: 0.625rem !important;
        padding: 3px 5px !important;
        top: 6px !important;
        right: 6px !important;
        left: auto !important;
        width: auto !important;
        max-width: max-content !important;
    }

    /* Photo cards inherit desktop left:9px — with mobile right:6px that stretches the pill full width */
    .step-card.photo-card .card-mini-stamp {
        left: auto !important;
        right: 6px !important;
    }

    /* Text-only card on mobile — quote-first */
    .step-card.text-only-card {
        justify-content: center !important;
        padding: 0 !important;
    }

    .step-card.text-only-card .card-info--note {
        padding: 26px 10px 12px !important;
        gap: 6px !important;
    }

    .card-note-ornament {
        font-size: 2.6rem !important;
        top: 2px !important;
        left: 6px !important;
    }

    .card-note-quote {
        font-family: var(--ed-title-font) !important;
        font-size: 1.5rem !important;
        font-style: normal !important;
        font-weight: 500 !important;
        font-variation-settings: 'opsz' 72 !important;
        line-height: 1.16 !important;
        color: var(--pine) !important;
        -webkit-line-clamp: 4 !important;
    }

    .card-note-place {
        font-size: 0.625rem !important;
    }

    .card-note-rule {
        width: 28px !important;
    }

    /* Card heart — compact on mobile, count stays beside icon */
    .card-feedback-btn {
        min-height: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        bottom: 6px !important;
        right: 6px !important;
        box-shadow: none !important;
        background: transparent !important;
        gap: 1px !important;
    }

    .card-feedback-btn .chaos-fire-heart-svg {
        width: 34px !important;
        height: 34px !important;
    }

    .card-feedback-btn .hype-counter-bubble {
        font-size: 0.95rem !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        transform: rotate(2deg) translateY(1px) !important;
    }

    #stories-viewer.hidden {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* ── Fullscreen Stories Overlay on Mobile ── */
    #stories-viewer {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: rgba(13, 18, 16, 0.96) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        z-index: 100000 !important;
        overscroll-behavior: none !important;
    }

    #stories-viewer.text-story-soft {
        background: #fdfbf7 !important;
    }

    /* Unified story chrome — indicators + header, no gap */
    #story-chrome {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 100005 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        box-sizing: border-box !important;
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0) 100%) !important;
    }

    #story-indicators-container {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: auto !important;
        padding: 12px 16px 0 16px !important;
        box-sizing: border-box !important;
        background: transparent !important;
    }

    .story-indicator-bar {
        height: 3px !important;
        background: rgba(255, 255, 255, 0.3) !important;
    }

    .story-indicator-progress {
        background: #ffffff !important;
    }

    /* Story header sits flush under indicators inside #story-chrome */
    #story-header {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: auto !important;
        padding: 4px 16px 12px 16px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        box-sizing: border-box !important;
        background: transparent !important;
    }

    .story-profile-info {
        gap: 0 !important;
    }

    .story-location-badge {
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        color: #ffffff !important;
        text-shadow: 0 1px 3px rgba(0,0,0,0.6) !important;
    }

    .story-date-badge {
        font-size: 0.65rem !important;
        font-weight: 600 !important;
        color: rgba(255, 255, 255, 0.75) !important;
        text-shadow: 0 1px 2px rgba(0,0,0,0.5) !important;
        margin-top: 1px !important;
    }

    #story-close-btn {
        font-size: 22px !important;
        color: #ffffff !important;
        text-shadow: 0 1px 3px rgba(0,0,0,0.6) !important;
        padding: 4px !important;
    }

    /* Main Content Area goes edge-to-edge covering the entire viewport */
    #story-content-area {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 100001 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .story-slide-container {
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: #0d1210 !important;
        margin: 0 !important;
    }

    .story-slide-container.text-story-soft,
    .story-slide-container.editorial-story-slide {
        background: var(--cream) !important;
    }

    .story-slide-container.editorial-story-slide {
        display: flex !important;
        flex-direction: column !important;
    }

    /* Text story — single paper gradient on chrome */
    #stories-viewer.text-story-soft:not(.editorial-story-mode) #story-chrome {
        background: linear-gradient(to bottom, rgba(245, 239, 224, 0.92) 0%, rgba(245, 239, 224, 0) 100%) !important;
    }

    #stories-viewer.text-story-soft .story-location-badge {
        color: var(--pine) !important;
        text-shadow: none !important;
    }

    #stories-viewer.text-story-soft .story-date-badge {
        color: var(--stone) !important;
        text-shadow: none !important;
    }

    #stories-viewer.text-story-soft #story-close-btn {
        color: var(--pine) !important;
        text-shadow: none !important;
    }

    #stories-viewer.text-story-soft .story-indicator-bar {
        background: rgba(74, 59, 50, 0.16) !important;
    }

    #stories-viewer.text-story-soft .story-indicator-progress {
        background: rgba(181, 82, 42, 0.72) !important;
    }

    /* Editorial slides: flex column — chrome flows, no fixed top gap */
    #stories-viewer.editorial-story-mode {
        display: flex !important;
        flex-direction: column !important;
        --ed-story-chrome: calc(76px + env(safe-area-inset-top) + env(safe-area-inset-bottom));
    }

    #stories-viewer.editorial-story-mode #story-chrome {
        position: relative !important;
        top: auto !important;
        flex-shrink: 0 !important;
        padding-top: env(safe-area-inset-top) !important;
        background: var(--cream) !important;
    }

    #stories-viewer.editorial-story-mode #story-indicators-container {
        padding: 10px 16px 0 16px !important;
        background: transparent !important;
    }

    #stories-viewer.editorial-story-mode #story-header {
        min-height: 0 !important;
        background: transparent !important;
    }

    #stories-viewer.editorial-story-mode #story-content-area {
        position: relative !important;
        top: auto !important;
        left: 0 !important;
        width: 100% !important;
        flex: 1 !important;
        height: auto !important;
        min-height: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 8px 0 !important;
        box-sizing: border-box !important;
        -webkit-overflow-scrolling: touch;
    }

    .story-slide-container.editorial-story-slide {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        padding: 0 10px !important;
        box-sizing: border-box !important;
        border-radius: 0 !important;
        overflow: visible !important;
        flex-shrink: 0 !important;
    }

    .story-slide-text.story-text-page {
        width: 100% !important;
        height: 100% !important;
        flex: 1 !important;
        padding: 72px 24px calc(108px + env(safe-area-inset-bottom)) !important;
        background: #fdfbf7 !important;
        box-sizing: border-box !important;
        align-items: center !important;
        text-align: center !important;
    }

    .story-day-stamp {
        top: calc(72px + env(safe-area-inset-top, 0px)) !important;
        left: 16px !important;
        font-size: 0.66rem !important;
        padding: 6px 9px !important;
    }

    .story-meta-row--bottom {
        bottom: calc(56px + env(safe-area-inset-bottom)) !important;
        width: min(calc(100% - 28px), 340px) !important;
        gap: 12px 18px !important;
        flex-wrap: wrap !important;
    }

    .story-slide-photo .story-meta-row--bottom {
        bottom: auto !important;
        width: 100% !important;
        padding: 8px 14px 6px !important;
        background: transparent !important;
    }

    .story-photo-count {
        top: calc(72px + env(safe-area-inset-top, 0px)) !important;
        right: 14px !important;
    }

    .story-meta-chip-icon {
        width: 40px !important;
        height: 40px !important;
    }

    .story-meta-chip-icon svg {
        width: 32px !important;
        height: 32px !important;
    }

    .story-meta-chip-label {
        font-size: 0.6rem !important;
    }

    .story-slide-text .story-quote-text {
        font-family: var(--ed-title-font) !important;
        font-size: clamp(1.85rem, 7vw, 2.35rem) !important;
        font-style: normal !important;
        font-weight: 500 !important;
        font-variation-settings: 'opsz' 72 !important;
        line-height: 1.2 !important;
        color: var(--pine) !important;
        max-width: 20ch !important;
        max-height: 48vh !important;
        overflow-y: auto !important;
    }

    .story-slide-photo {
        width: 100% !important;
        height: 100% !important;
        position: relative !important;
    }

    .story-photo-img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important; /* Crucial: cover the entire screen like Instagram! */
    }

    /* Beautiful transparent dark overlay for text info directly over the photo */
    .story-photo-bottom {
        z-index: 100003 !important;
        padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
        background: linear-gradient(
            to top,
            rgba(9, 13, 11, 0.96) 0%,
            rgba(9, 13, 11, 0.92) 30%,
            rgba(9, 13, 11, 0.7) 58%,
            rgba(9, 13, 11, 0.25) 85%,
            transparent 100%
        ) !important;
    }

    .story-photo-overlay {
        position: relative !important;
        padding: 28px 16px 8px !important;
        background: transparent !important;
        box-sizing: border-box !important;
    }

    .story-overlay-title {
        font-size: 1.75rem !important;
    }

    .story-photo-caption {
        font-family: var(--font-body) !important;
        font-size: 0.95rem !important;
        line-height: 1.45 !important;
        color: rgba(253, 251, 247, 0.86) !important;
        font-style: italic !important;
    }

    /* Navigation handled via story-content-area click delegation */
    .story-nav-tap-zone {
        display: none !important;
        pointer-events: none !important;
    }

    /* Heart on editorial story slide — keep clear of swipe-up hint */
    .editorial-story-slide .story-feedback-in-card {
        bottom: calc(24px + env(safe-area-inset-bottom)) !important;
        right: 18px !important;
    }

    /* Heart stays inside the fullscreen slide on mobile */
    .story-feedback-in-card {
        bottom: calc(24px + env(safe-area-inset-bottom)) !important;
        right: 20px !important;
        z-index: 100006 !important;
    }

    .story-feedback-btn {
        min-height: 0 !important;
        background: transparent !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        gap: 2px !important;
    }

    .story-feedback-btn .chaos-fire-heart-svg {
        width: 48px !important;
        height: 48px !important;
    }

    .story-feedback-btn .hype-counter-bubble {
        font-size: 1.05rem !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        transform: rotate(2deg) translateY(1px) !important;
    }
}

/* ============================================================
   THE CHAOS FIRE-HEART SUPER-REACTION SYSTEM
   ============================================================ */

/* Bored Offlands heart icon */
.chaos-fire-heart-svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 4px 5px rgba(74, 59, 50, 0.18));
    transform-origin: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chaos-fire-heart-svg .heart-body,
.chaos-fire-heart-svg .heart-lid {
    fill: #ef172b;
    stroke: none;
}

.chaos-fire-heart-svg .heart-eye {
    fill: var(--white);
    stroke: none;
}

.chaos-fire-heart-svg .heart-pupil {
    fill: var(--bark);
}

/* Card-Level Super Reaction Button */
.card-feedback-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: auto;
    height: auto;
    min-height: 44px;
    border-radius: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    z-index: 50;
    padding: 0;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}

.card-feedback-btn .chaos-fire-heart-svg {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.card-feedback-btn:hover {
    transform: scale(1.06) rotate(-3deg);
}

/* Plain red count beside the heart — ink, not a badge */
.hype-counter-bubble {
    position: static;
    background: transparent;
    color: #e23b3b;
    border: 0;
    border-radius: 0;
    padding: 0;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-shadow: none;
    pointer-events: none;
    display: inline-block;
    transform-origin: center;
    transform: rotate(3deg) translateY(1px);
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.5);
    z-index: 2;
}

.hype-counter-bubble[hidden] {
    display: none;
}

.hype-counter-bubble.pop {
    animation: popScale 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.6) forwards;
}

/* Stories-level reaction button (in-card) */
.story-feedback-btn {
    width: auto;
    height: auto;
    min-height: 60px;
    border-radius: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    padding: 0;
}

.story-feedback-btn .chaos-fire-heart-svg {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.story-feedback-btn:hover {
    transform: scale(1.06) rotate(-3deg);
}

.story-feedback-btn .hype-counter-bubble {
    font-size: 1.2rem;
    transform: rotate(2deg) translateY(2px);
}

/* ANIMATIONS KEYFRAMES */

/* Counter pop nudge */
@keyframes popScale {
    0% { transform: scale(1) rotate(3deg) translateY(1px); }
    50% { transform: scale(1.35) rotate(-6deg) translateY(-1px); }
    100% { transform: scale(1) rotate(3deg) translateY(1px); }
}

/* Timeline Card physical shake */
@keyframes cardShake {
    0%   { transform: translateY(-10px) rotate(-1deg); }
    15%  { transform: translateY(-10px) rotate(-3deg) translateX(-3px); }
    30%  { transform: translateY(-10px) rotate(1.5deg) translateX(3px); }
    45%  { transform: translateY(-10px) rotate(-2.5deg) translateX(-2px); }
    60%  { transform: translateY(-10px) rotate(1deg) translateX(2px); }
    75%  { transform: translateY(-10px) rotate(-1.5deg) translateX(-1px); }
    90%  { transform: translateY(-10px) rotate(0.5deg) translateX(1px); }
    100% { transform: translateY(-10px) rotate(-1deg); }
}

.step-card.shake {
    animation: cardShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Stories viewer modal viewport rattle */
@keyframes viewerShake {
    0% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-5px, -3px) rotate(-0.5deg); }
    20% { transform: translate(4px, 5px) rotate(0.6deg); }
    30% { transform: translate(-4px, -4px) rotate(-0.6deg); }
    40% { transform: translate(5px, 3px) rotate(0.5deg); }
    50% { transform: translate(-3px, 4px) rotate(-0.5deg); }
    60% { transform: translate(3px, -3px) rotate(0.5deg); }
    70% { transform: translate(-4px, 3px) rotate(-0.5deg); }
    80% { transform: translate(4px, -3px) rotate(0.5deg); }
    90% { transform: translate(-2px, 3px) rotate(-0.5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.story-slide-container.shake {
    animation: viewerShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes hypeBtnShake {
    0%   { transform: scale(1) rotate(0deg); }
    20%  { transform: scale(1.12) rotate(-8deg); }
    40%  { transform: scale(1.08) rotate(7deg); }
    60%  { transform: scale(1.1) rotate(-5deg); }
    80%  { transform: scale(1.06) rotate(4deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.story-feedback-btn.shake,
.card-feedback-btn.shake {
    animation: hypeBtnShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Particle Explosion Elements */
.hype-particle {
    position: fixed;
    pointer-events: none;
    z-index: 200010;
    width: 28px;
    height: 28px;
    opacity: 1;
    will-change: transform, opacity;
    animation: particleExplode 0.85s cubic-bezier(0.1, 0.8, 0.35, 1) forwards;
}

@keyframes particleExplode {
    0% {
        transform: translate(0, 0) scale(0.2) rotate(0deg);
        opacity: 1;
    }
    15% {
        transform: translate(var(--tx-mid), var(--ty-mid)) scale(1.15) rotate(var(--rot-mid));
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx-end), var(--ty-end)) scale(0.5) rotate(var(--rot-end));
        opacity: 0;
    }
}

/* Global Toast Notifications (Spam Hype Comments) */
#chaos-toast-container {
    position: fixed;
    top: 38px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200011;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    width: max-content;
    max-width: min(94vw, 680px);
}

.chaos-toast {
    background: var(--cream);
    color: var(--bark);
    border: none;
    border-radius: 999px;
    padding: 12px 22px;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 8px 24px rgba(74, 59, 50, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: max-content;
    max-width: min(94vw, 680px);
    white-space: nowrap;
    pointer-events: auto;
    transform-origin: center bottom;
    animation: toastSlideIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
               toastFadeOut 0.25s ease-in 1.6s forwards;
}

@media (max-width: 1024px) {
    /* Sit just below the collapsed journey title pill */
    #chaos-toast-container {
        top: calc(84px + env(safe-area-inset-top, 0px));
        max-width: min(calc(100vw - 32px), 400px);
    }

    .chaos-toast {
        font-size: 0.85rem;
        padding: 11px 20px;
        max-width: min(calc(100vw - 32px), 400px);
    }

    /* Stories overlay: tuck under indicator + location header */
    html.modal-scroll-lock #stories-viewer.active ~ #chaos-toast-container {
        top: calc(68px + env(safe-area-inset-top, 0px));
        max-width: min(94vw, 640px);
    }

    html.modal-scroll-lock #stories-viewer.active ~ #chaos-toast-container .chaos-toast {
        max-width: min(94vw, 640px);
    }

    /* Fullscreen editorial chapter: no journey pill */
    #editorial-viewer.active ~ #chaos-toast-container {
        top: calc(24px + env(safe-area-inset-top, 0px));
        max-width: min(94vw, 640px);
    }

    #editorial-viewer.active ~ #chaos-toast-container .chaos-toast {
        max-width: min(94vw, 640px);
    }
}

@keyframes toastSlideIn {
    0% { transform: translateY(-40px) scale(0.8) rotate(-4deg); opacity: 0; }
    100% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
}

@keyframes toastFadeOut {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(20px) scale(0.8); opacity: 0; }
}

/* Small adjustments to ensure standard timeline cards don't clip the reaction button */
.step-card {
    position: relative;
}
.card-badges-row {
    padding-right: 56px; /* Offset to ensure badge text never collides with reaction button */
}

/* ============================================================
   OFFLANDS v2 — Premium 3D Cinematic Map Styles
   ============================================================ */

#map-3d {
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    background-color: var(--cream); /* warm paper fallback */
    pointer-events: auto !important;
}

/* Smooth Cross-Fading Map Layers */
.map-fade {
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 1;
    visibility: visible;
}

.map-fade.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* 3D Map Active state on the toggle panel */
#map-3d-toggle.active {
    background-color: var(--rust) !important;
    color: var(--white) !important;
}

#map-3d-toggle.active svg path {
    stroke: var(--white) !important;
    fill: var(--white) !important;
    fill-opacity: 0.25 !important;
}

/* Mapbox specific custom marker adjustments */
.mapboxgl-marker {
    will-change: transform;
    cursor: pointer;
}

/* Snapped 3D vehicle marker style */
.vehicle-3d-pin {
    width: 60px;
    height: 60px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transform-origin: center center;
}

/* ── Premium 2.5D Naive Toy Sprites (Paper Mario Style) ── */
.toy-sprite-container {
    transform-style: preserve-3d;
    transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1);
}

.toy-sprite {
    will-change: transform;
}

/* Playful bobbing animation for cars, SUVs, and scooters */
.toy-sprite-container.car .toy-sprite,
.toy-sprite-container.suv .toy-sprite,
.toy-sprite-container.scooter .toy-sprite {
    animation: toy-bob 1.1s infinite ease-in-out alternate;
}

@keyframes toy-bob {
    0% {
        transform: translateY(0) scaleY(1) rotate(0deg);
    }
    100% {
        transform: translateY(-5px) scaleY(0.95) rotate(3deg);
    }
}

/* Playful wave rocking animation for the sailboat */
.toy-sprite-container.boat .toy-sprite {
    animation: boat-rock 1.5s infinite ease-in-out alternate;
}

@keyframes boat-rock {
    0% {
        transform: translateY(0) rotate(-4deg);
    }
    100% {
        transform: translateY(-2px) rotate(4deg);
    }
}

/* Rhythmic walking sway animation for pedestrian walk */
.toy-sprite-container.walk .toy-sprite {
    animation: walk-sway 0.85s infinite ease-in-out alternate;
}

@keyframes walk-sway {
    0% {
        transform: translateY(0) rotate(-3deg) scaleX(1);
    }
    100% {
        transform: translateY(-3.5px) rotate(3deg) scaleX(0.97);
    }
}

/* ============================================================
   OFFLANDS v2 — Apple Music Now Playing Telemetry Badge
   ============================================================ */

.music-log-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px dashed rgba(74, 59, 50, 0.15);
    border-radius: 14px;
    padding: 8px 14px;
    margin: 8px 0 12px 0;
    box-shadow: 0 4px 16px rgba(74, 59, 50, 0.04);
    overflow: hidden;
    max-width: 100%;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.sound-wave-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.sound-wave-bars .bar {
    width: 2.5px;
    height: 3px;
    background-color: var(--pine);
    border-radius: 1px;
    animation: bounce-wave 0.8s ease-in-out infinite alternate;
}

.sound-wave-bars .bar-1 {
    animation-delay: 0.1s;
    height: 40%;
}

.sound-wave-bars .bar-2 {
    animation-delay: 0.3s;
    height: 80%;
}

.sound-wave-bars .bar-3 {
    animation-delay: 0.2s;
    height: 60%;
}

@keyframes bounce-wave {
    0% {
        height: 3px;
    }
    100% {
        height: 14px;
    }
}

.music-title-marquee {
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--pine);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.music-log-badge:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--pine);
    cursor: pointer;
}

/* Timeline cards — compact now-playing strip */
.step-card .music-log-badge {
    margin: 8px 0 0;
    padding: 6px 10px;
    width: 100%;
    box-sizing: border-box;
}

.step-card.text-only-card .music-log-badge {
    position: relative;
    z-index: 1;
}

.step-card .music-title-marquee {
    font-size: 0.72rem;
}

.step-card.photo-card .card-info:empty {
    display: none;
}

.story-music-badge {
    margin-top: 8px;
}

/* ── Minimalistic Dot Map Marker for Background Telemetry Pings ── */
.dot-pin {
    width: 12px !important;
    height: 12px !important;
    background-color: var(--pine) !important;
    border: 2px solid var(--white) !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
    flex-shrink: 0 !important;
    display: block !important;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.25s ease;
}

.dot-pin.active-pin {
    background-color: var(--rust) !important;
    transform: scale(1.5);
    box-shadow: 0 4px 10px rgba(239, 71, 111, 0.4);
}


/* ================================================================
   EDITORIAL CHAPTER EXPERIENCE — Phase 3
   Design philosophy: Photography before interface. Story before stats.
   ================================================================ */

/* ── EDITORIAL TIMELINE CARD ── */

.editorial-card {
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    border: none;
    border-radius: var(--timeline-card-radius);
    background: #0c1210;
    box-shadow: 0 10px 0 rgba(74, 59, 50, 0.06), 0 18px 32px rgba(74, 59, 50, 0.14);
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1),
                box-shadow 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

/* Apple continuous corners on timeline cards (Safari 18.4+, Chrome 139+) */
@supports (corner-shape: superellipse(1.45)) {
    .step-card,
    .editorial-card:not(.editorial-card--film-story) {
        corner-shape: superellipse(1.45);
    }
}

/* Film negative — landscape 4:3 frame, THE EDIT · top/bottom only (timeline only) */
.editorial-card--film:not(.editorial-card--film-story) {
    --ed-film-band: 28px;
    --ed-film-h: var(--ed-film-card-h);
    display: grid;
    grid-template-rows: var(--ed-film-band) 1fr var(--ed-film-band);
    height: var(--ed-film-h);
    width: var(--ed-film-card-w);
    min-width: var(--ed-film-card-w);
}

.ed-film-band {
    overflow: hidden;
    display: flex;
    align-items: center;
    background: #0c1210;
    min-height: 0;
}

.ed-film-ticker {
    font-family: var(--font-ui);
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(245, 239, 224, 0.9);
    white-space: nowrap;
    line-height: 1;
    padding: 6px 0;
}

/* Timeline film cards — stable ticker size (not affected by story viewer cqi/vw) */
.editorial-card--film:not(.editorial-card--film-story) .ed-film-ticker {
    font-size: clamp(0.5rem, 1.15vw, 0.5625rem);
    padding: 0 12px;
}

.ed-film-frame {
    position: relative;
    overflow: hidden;
    min-height: 0;
    background: #0c1210;
}

.editorial-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 14px 0 rgba(74, 59, 50, 0.08), 0 22px 36px rgba(74, 59, 50, 0.18);
}

/* Stories viewer editorial slide — flat, no hover lift/zoom/shadow */
.editorial-story-slide .editorial-card,
.editorial-story-slide .editorial-card--film-story {
    box-shadow: none !important;
    transition: none !important;
}

.editorial-story-slide .editorial-card:hover,
.editorial-story-slide .editorial-card--film-story:hover {
    transform: none !important;
    box-shadow: none !important;
}

.editorial-story-slide .ed-card-cover-img {
    transition: none !important;
}

.editorial-story-slide .editorial-card:hover .ed-card-cover-img {
    transform: none !important;
}

.ed-card-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.editorial-card--film .ed-card-cover-img {
    width: 100%;
    height: 100%;
}

.editorial-card:hover .ed-card-cover-img {
    transform: scale(1.03);
}

.ed-card-teaser {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-style: italic;
    line-height: 1.45;
    color: rgba(245, 239, 224, 0.65);
    margin: 6px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ed-card-open-hint {
    font-family: var(--font-ui);
    font-size: var(--type-cap-sm);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(245, 239, 224, 0.3);
    margin-top: 10px;
    transition: color 0.2s ease;
}

.editorial-card:hover .ed-card-open-hint {
    color: rgba(245, 239, 224, 0.6);
}

/* Tablet / small desktop: cap timeline card scale so strips don't balloon */
@media (max-width: 1024px) and (min-width: 641px) {
    :root {
        --mobile-timeline-card-w: min(calc((100vw - 32px) / 3.14), calc(232px * var(--timeline-card-w) / 280px));
        --mobile-timeline-card-h: calc(var(--mobile-timeline-card-w) * var(--timeline-card-mobile-ratio));
    }
}

@media (max-width: 1024px) {
    .editorial-card--film:not(.editorial-card--film-story) {
        --ed-film-band: 21px;
        --ed-film-h: calc(var(--mobile-timeline-card-h) * 1.06);
        height: var(--ed-film-h) !important;
        width: calc((var(--ed-film-h) - (2 * var(--ed-film-band))) * 4 / 3) !important;
        min-width: calc((var(--ed-film-h) - (2 * var(--ed-film-band))) * 4 / 3) !important;
        grid-template-rows: var(--ed-film-band) 1fr var(--ed-film-band);
        border-radius: var(--timeline-card-radius) !important;
    }

    .editorial-story-slide .editorial-card--film-story {
        display: grid !important;
        grid-template-rows: 6.104% 1fr 6.104% !important;
        width: 100% !important;
        min-width: unset !important;
        max-width: 100% !important;
        height: auto !important;
        aspect-ratio: var(--ed-film-card-w) / var(--ed-film-card-h) !important;
        border-radius: 14px !important;
        overflow: hidden !important;
    }

    .editorial-card--film:not(.editorial-card--film-story) .ed-film-ticker {
        font-size: 0.5rem;
        letter-spacing: 0.09em;
        padding: 0 12px;
    }
}

@media (max-width: 767px) {
    .editorial-card--film:not(.editorial-card--film-story) {
        --ed-film-band: 17px;
    }

    .editorial-card--film:not(.editorial-card--film-story) .ed-film-ticker {
        font-size: 0.4375rem;
        letter-spacing: 0.07em;
        padding: 0 10px;
    }
}


/* ── Editorial cover fit — full frame, top-aligned ── */
.ed-cover-stage {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #0c1210;
    overflow: hidden;
}

.ed-cover-stage--hero {
    height: min(calc(100vw * 10 / 16), 75vh);
    flex-shrink: 0;
}

.ed-cover-fit {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: top center;
}

/* ── EDITORIAL STORY SLIDE (inside Stories Viewer) — film card + meta below ── */

.editorial-story-slide {
    background: var(--cream);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.editorial-story-layout {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    width: var(--ed-story-fit-w, min(912px, calc(100vw - 20px)));
    max-width: calc(100vw - 2 * var(--ed-story-pad-x, 10px));
    height: auto;
    cursor: pointer;
    margin: 0 auto;
}

.editorial-card--film-story {
    display: grid !important;
    grid-template-rows: 6.104% 1fr 6.104%;
    width: 100% !important;
    min-width: unset !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: var(--ed-film-card-w) / var(--ed-film-card-h);
    flex-shrink: 0;
    border-radius: 14px !important;
    overflow: hidden !important;
    box-shadow: none !important;
}

.editorial-story-film {
    cursor: pointer;
}

.editorial-story-slide .ed-film-ticker {
    font-size: clamp(0.38rem, 2.8cqi, 0.52rem);
    padding: 0.35em 0;
}

@media (min-width: 1025px) {
    .editorial-story-slide .ed-film-ticker {
        font-size: clamp(0.58rem, 1.25cqi, 0.78rem);
        letter-spacing: 0.22em;
    }
}

.editorial-story-slide .editorial-card--film-story {
    container-type: inline-size;
}

.editorial-story-slide .ed-card-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.editorial-story-slide .editorial-card--film-story .ed-film-band--top {
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
}

.editorial-story-slide .editorial-card--film-story .ed-film-band--bottom {
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
}

.editorial-story-slide .editorial-card--film-story .ed-film-frame {
    overflow: hidden;
}

.editorial-story-body {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    background: var(--cream);
    padding: 16px 24px calc(56px + env(safe-area-inset-bottom));
    gap: 6px;
}

.editorial-story-day {
    font-family: var(--font-ui);
    font-size: var(--type-cap-md);
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--rust);
}

.editorial-story-location {
    font-family: var(--font-ui);
    font-size: var(--type-cap-sm);
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--stone);
}

.editorial-story-open-hint {
    margin-top: auto;
    padding-top: 16px;
    font-family: var(--font-ui);
    font-size: var(--type-cap-sm);
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--stone);
    opacity: 0.75;
}

@media (min-width: 1025px) {
    .editorial-story-body {
        padding: 20px 32px 28px;
        gap: 8px;
    }

    .editorial-story-day {
        font-size: var(--type-cap-md);
        letter-spacing: 0.26em;
    }

    .editorial-story-location {
        font-size: var(--type-body-sm);
        letter-spacing: 0.16em;
    }

    .editorial-story-open-hint {
        font-size: var(--type-cap-sm);
        padding-top: 20px;
        letter-spacing: 0.2em;
    }
}

/* Desktop: editorial story card in stories viewer */
.story-slide-container.editorial-story-slide {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    background: var(--cream);
    box-shadow: none;
    transition: none;
    border-radius: 0;
    overflow: visible;
    padding: 0 !important;
}

/* ── EDITORIAL CHAPTER VIEWER ── */

#editorial-viewer {
    --ed-photo-lead: min(1200px, 94vw);
    --ed-photo-gallery: min(1024px, 90vw);
    --ed-photo-pad: clamp(16px, 5vw, 48px);

    position: fixed;
    inset: 0;
    z-index: 200000;
    background: var(--editorial-bg);
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s cubic-bezier(0.25, 1, 0.5, 1);
}

#editorial-viewer::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

#editorial-viewer.active {
    opacity: 1;
    pointer-events: auto;
}

#editorial-viewer:not(.active) .ed-viewer-close,
#editorial-viewer:not(.active) .ed-viewer-share,
#editorial-viewer:not(.active) .ed-viewer-feedback {
    visibility: hidden;
    pointer-events: none !important;
}

.ed-viewer-close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(74, 59, 50, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--bark);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    line-height: 1;
}

.ed-viewer-close:hover {
    background: rgba(74, 59, 50, 0.22);
    transform: scale(1.08);
}

.ed-viewer-feedback {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: var(--ed-chrome-right, 20px);
    z-index: 11;
    pointer-events: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

#editorial-viewer.active .ed-viewer-feedback {
    pointer-events: auto;
}

/* Section 1: Hero — cover on top, typography below on cream */
.ed-viewer-hero--band {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    min-height: 0;
    background: var(--editorial-bg);
}

.ed-viewer-hero-band {
    flex-shrink: 0;
}

.ed-viewer-hero-content {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    background: var(--editorial-bg);
    padding: 36px 8vw 20px;
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    box-sizing: border-box;
}

.ed-viewer-day {
    font-family: var(--font-body);
    font-size: var(--type-cap-md);
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--rust);
}

.ed-viewer-title {
    font-family: var(--ed-title-font);
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 500;
    font-variation-settings: 'opsz' 72;
    font-style: normal;
    line-height: 1.08;
    color: var(--bark);
    margin: 4px 0;
    max-width: 100%;
    overflow-wrap: break-word;
    hyphens: auto;
}

.ed-viewer-subtitle {
    font-family: var(--font-body);
    font-size: var(--type-cap-md);
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--stone);
}

.ed-viewer-hero-meta {
    font-family: var(--font-body);
    font-size: var(--type-cap-sm);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--stone);
    margin-top: 10px;
}

/* Section 2: Editorial Text */
.ed-viewer-text {
    background: var(--editorial-bg);
    padding: 24px 8vw 28px;
}

.ed-viewer-text-inner {
    max-width: 640px;
    margin: 0 auto;
}

.ed-viewer-text-inner p {
    font-family: var(--font-body);
    font-size: var(--type-body-lg);
    line-height: 1.85;
    color: var(--bark);
    margin-bottom: 1.6em;
}

.ed-viewer-text-inner p:last-child {
    margin-bottom: 0;
}

.ed-viewer-text-inner p.ed-viewer-text-lead::first-letter {
    font-family: var(--ed-title-font);
    font-size: 3.4em;
    font-weight: 500;
    font-variation-settings: 'opsz' 72;
    line-height: 0.82;
    float: left;
    margin: 0.05em 0.14em 0 0;
    color: var(--rust);
}

.ed-viewer-section-label {
    font-family: var(--font-body);
    font-size: var(--type-cap-md);
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--stone);
    text-align: center;
    margin: 0 0 32px;
}

.ed-viewer-figure {
    margin: 48px auto 0;
    position: relative;
    width: 65%;
}

.ed-viewer-photo {
    width: 100%;
    height: auto;
    display: block;
}

.ed-viewer-caption {
    font-family: var(--font-body);
    font-size: var(--type-cap-md);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(74, 59, 50, 0.5);
    padding: 10px 0 20px;
    background: transparent;
}

.ed-viewer-caption--right {
    text-align: right;
}

.ed-viewer-quote {
    font-family: var(--font-body);
    font-size: 1.5rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.5;
    color: rgba(74, 59, 50, 0.6);
    text-align: center;
    padding: 64px 10vw;
    margin: 0;
    background: var(--editorial-bg);
    border: none;
}

/* Lead photo — larger hero image, fluid + centered */
.ed-viewer-figure.ed-viewer-figure--lead {
    width: var(--ed-photo-lead);
    max-width: 100%;
    margin: 0 auto;
}

/* Gallery — single column, fluid + centered */
.ed-viewer-figure.ed-viewer-figure--stack {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.ed-viewer-gallery {
    background: var(--editorial-bg);
    padding: 8px var(--ed-photo-pad) 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.ed-viewer-gallery__row {
    width: var(--ed-photo-gallery);
    max-width: 100%;
    margin-bottom: clamp(28px, 4vw, 48px);
}

.ed-viewer-gallery__row:last-child {
    margin-bottom: 0;
}

/* Extra (non-AI-selected) photos — two columns, same total width as main gallery */
.ed-viewer-gallery-extras {
    background: var(--editorial-bg);
    padding: 0 var(--ed-photo-pad) 80px;
    width: var(--ed-photo-gallery);
    max-width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(10px, 1.8vw, 18px);
    box-sizing: border-box;
}

.ed-viewer-section-label--extras {
    margin-top: clamp(12px, 2vw, 24px);
}

.ed-viewer-gallery-extras__cell {
    min-width: 0;
}

.ed-viewer-gallery-extras .ed-viewer-figure {
    width: 100%;
    margin: 0;
}

.ed-viewer-figure--expandable {
    cursor: zoom-in;
}

.ed-viewer-figure--expandable .ed-viewer-photo {
    transition: opacity 0.2s ease;
}

.ed-viewer-figure--expandable:hover .ed-viewer-photo,
.ed-viewer-figure--expandable:focus-visible .ed-viewer-photo {
    opacity: 0.92;
}

.ed-viewer-gallery-extras .ed-viewer-caption {
    font-size: var(--type-cap-sm, 0.65rem);
    padding: 6px 0 0;
}

/* Full-size photo lightbox for extra gallery taps */
.ed-photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 300000;
    background: rgba(28, 22, 18, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 48px);
    box-sizing: border-box;
}

.ed-photo-lightbox.hidden {
    display: none;
}

.ed-photo-lightbox__img {
    max-width: min(1200px, 96vw);
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.ed-photo-lightbox__close {
    position: absolute;
    top: clamp(12px, 3vw, 28px);
    right: clamp(12px, 3vw, 28px);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

html.ed-photo-lightbox-open {
    overflow: hidden;
}

/* Section 7: Chapter Map — field notes plate + 3D terrain */
.ed-viewer-map-section {
    background: var(--editorial-bg);
    padding: 64px 4vw;
    max-width: min(96vw, 1480px);
    margin: 0 auto;
}

.ed-viewer-map-label {
    font-family: var(--font-body);
    font-size: var(--type-cap-md);
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--stone);
    margin-bottom: 16px;
}

.ed-map-plate {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #f5f0e8;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.6) inset,
        0 12px 40px rgba(74, 59, 50, 0.1);
    border: 1px solid rgba(74, 59, 50, 0.08);
}

.ed-viewer-map {
    width: 100%;
    aspect-ratio: 21 / 9;
    min-height: 280px;
    max-height: min(52vh, 560px);
}

.ed-map-plate--field .ed-viewer-map .maplibregl-canvas,
.ed-map-plate--field .ed-viewer-map .mapboxgl-canvas {
    filter: sepia(0.1) saturate(0.58) contrast(0.98) brightness(1.06);
}

.ed-map-grain,
.ed-map-vignette {
    pointer-events: none;
    position: absolute;
    inset: 0;
}

.ed-map-grain {
    opacity: 0.15;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 180px 180px;
}

.ed-map-vignette {
    background: radial-gradient(ellipse at center, transparent 55%, rgba(107, 93, 82, 0.12) 100%);
}

.ed-map-leaders {
    pointer-events: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
}

.ed-map-labels {
    pointer-events: none;
    position: absolute;
    inset: 0;
    z-index: 5;
}

.ed-map-leaders line {
    stroke-width: 1;
    stroke-dasharray: 1 4;
}

.ed-map-annotation {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    font-family: var(--ed-rest-font);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    color: #6b5d52;
    text-shadow: 0 0 8px rgba(250, 249, 246, 0.8);
    white-space: nowrap;
    transform: translate(-50%, -50%);
}

.ed-map-annotation--right { transform: translate(-100%, -50%); }
.ed-map-annotation--left { transform: translate(0, -50%); }

.ed-chapter-photo-marker {
    width: 54px;
    height: 36px;
    border-radius: 1px;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(250, 249, 246, 0.9);
    box-shadow: 0 2px 10px rgba(26, 37, 48, 0.22);
    cursor: default;
    transform-origin: center bottom;
}

.ed-chapter-photo-marker--a { transform: rotate(-2deg); }
.ed-chapter-photo-marker--b { transform: rotate(1.5deg); }
.ed-chapter-photo-marker--c { transform: rotate(-1deg); }
.ed-chapter-photo-marker--d { transform: rotate(2deg); }

.ed-chapter-photo-marker--a:hover { transform: rotate(-2deg) scale(1.06); }
.ed-chapter-photo-marker--b:hover { transform: rotate(1.5deg) scale(1.06); }
.ed-chapter-photo-marker--c:hover { transform: rotate(-1deg) scale(1.06); }
.ed-chapter-photo-marker--d:hover { transform: rotate(2deg) scale(1.06); }

.ed-chapter-step-marker {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #b85a38;
    border: 2px solid rgba(250, 249, 246, 0.95);
    box-shadow: 0 1px 5px rgba(26, 37, 48, 0.28);
}

/* Section 2: Day in Numbers */
.ed-viewer-numbers {
    background: var(--editorial-bg);
    padding: 72px 8vw 64px;
    text-align: center;
}

.ed-viewer-numbers-heading {
    font-family: var(--font-body);
    font-size: var(--type-cap-md);
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--stone);
    margin-bottom: 48px;
}

.ed-viewer-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    max-width: 680px;
    margin: 0 auto;
}

.ed-viewer-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 12px;
}

.ed-viewer-stat-value {
    font-family: var(--ed-title-font);
    font-size: 2rem;
    font-weight: 600;
    color: var(--midnight);
    line-height: 1;
}

.ed-viewer-stat-label {
    font-family: var(--font-body);
    font-size: var(--type-cap-sm);
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--stone);
}

/* Section 3: Lead photograph */
.ed-viewer-first-photo {
    background: var(--editorial-bg);
    padding: 16px var(--ed-photo-pad) 0;
    display: flex;
    justify-content: center;
}

/* Section 5: Journey Moments (legacy selector kept for compat) */
.ed-viewer-moments {
    background: var(--editorial-bg);
    padding: 0 8vw 64px;
    border-top: none;
}

.ed-viewer-section-heading {
    font-family: var(--font-body);
    font-size: var(--type-cap-md);
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--stone);
    padding: 44px 0 32px;
    margin: 0;
}

/* Section 7: Journey Moments */
.ed-viewer-moments-section {
    background: var(--editorial-bg);
    padding: 64px 8vw 80px;
}

.ed-viewer-moments-section .ed-viewer-section-heading {
    padding-top: 0;
    text-align: center;
    margin-bottom: 8px;
}

.ed-viewer-moment {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 560px;
    margin: 0 auto 40px;
    padding: 0;
}

.ed-viewer-moment-time {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: var(--stone);
    margin-bottom: 10px;
    text-align: center;
}

.ed-viewer-moment-text {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.72;
    color: var(--bark);
    font-style: italic;
    text-align: center;
}

.ed-viewer-moment-photo {
    margin-top: 24px;
    margin-bottom: 0;
}

/* Section 6: Next Chapter */
.ed-viewer-next-chapter {
    display: flex;
    align-items: center;
    height: 220px;
    overflow: hidden;
    cursor: pointer;
    background: var(--cream);
    transition: opacity 0.25s ease;
}

.ed-viewer-next-chapter:hover {
    opacity: 0.88;
}

.ed-viewer-next-cover {
    width: 240px;
    min-width: 240px;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: brightness(0.72);
    transition: transform 0.5s ease;
    flex-shrink: 0;
}

.ed-viewer-next-chapter:hover .ed-viewer-next-cover {
    transform: scale(1.04);
}

.ed-viewer-next-content {
    flex: 1;
    padding: 0 44px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ed-viewer-next-label {
    font-family: var(--font-ui);
    font-size: var(--type-cap-sm);
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--stone);
}

.ed-viewer-next-title {
    font-family: var(--ed-title-font);
    font-size: 1.55rem;
    font-weight: 700;
    font-variation-settings: 'opsz' 72;
    font-style: normal;
    color: var(--bark);
    line-height: 1.15;
}

.ed-viewer-next-meta {
    font-family: var(--font-ui);
    font-size: var(--type-cap-sm);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--stone);
}

@media (max-width: 767px) {
    #editorial-viewer {
        --ed-photo-lead: min(1200px, 96vw);
        --ed-photo-gallery: min(1024px, 94vw);
        --ed-photo-pad: clamp(12px, 4vw, 24px);
    }

    .ed-viewer-figure:not(.ed-viewer-figure--lead):not(.ed-viewer-figure--stack) {
        width: calc(100% - 20px);
    }

    .ed-viewer-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .ed-viewer-stat-value {
        font-size: 1.65rem;
    }

    .ed-viewer-moment-photo {
        width: calc(100% - 20px);
    }
}

@media (max-width: 1024px) {
    .ed-viewer-hero-content { padding: 28px 6vw 16px; }
    .ed-viewer-text { padding: 20px 6vw 24px; }
    .ed-viewer-text-inner p { font-size: var(--type-body); }
    .ed-viewer-numbers { padding: 50px 6vw 44px; }
    .ed-viewer-map-section,
    .ed-viewer-moments,
    .ed-viewer-moments-section { padding: 40px 4vw; }
    .ed-viewer-map {
        aspect-ratio: 16 / 10;
        min-height: 240px;
        max-height: 360px;
    }
    .ed-chapter-photo-marker {
        width: 44px;
        height: 29px;
    }
    .ed-viewer-gallery__row {
        margin-bottom: 32px;
    }
    .ed-viewer-next-cover { width: 140px; min-width: 140px; }
    .ed-viewer-next-content { padding: 0 24px; }
    .ed-viewer-next-title { font-size: 1.2rem; }
}

/* ============================================================
   INFO MODAL — Welcome / About Offlands (editorial)
   ============================================================ */

.info-modal-trigger {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid rgba(21, 21, 21, 0.22);
    background: rgba(255, 255, 255, 0.5);
    color: var(--midnight);
    font-family: var(--font-serif);
    font-size: 14px;
    font-weight: 600;
    font-style: italic;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.info-modal-trigger:hover {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(21, 21, 21, 0.45);
    transform: scale(1.04);
}

.info-modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    z-index: 250000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(26, 37, 48, 0.46);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.info-modal-overlay.hidden {
    display: none !important;
    pointer-events: none !important;
}

.info-modal-overlay:not(.hidden) {
    display: flex !important;
    pointer-events: auto;
}

.info-modal {
    position: relative;
    width: min(440px, 100%);
    max-height: min(85vh, 580px);
    overflow-y: auto;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1);
}

.info-modal-overlay:not(.hidden) .info-modal {
    transform: translateY(0) scale(1);
}

.info-modal--editorial {
    background: var(--editorial-bg);
    border: none;
    border-radius: 20px;
    padding: 32px 28px 28px;
    box-shadow: 0 24px 60px rgba(26, 37, 48, 0.14);
}

.info-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: 1.5px solid rgba(74, 59, 50, 0.12);
    border-radius: 50%;
    background: rgba(250, 249, 246, 0.92);
    color: var(--midnight);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
    z-index: 5;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.info-modal-close:hover {
    background: var(--white);
    border-color: rgba(74, 59, 50, 0.22);
}

.info-modal-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: 0.04em;
    color: var(--pine);
    margin: 0 0 14px;
    padding-right: 36px;
}

.info-modal-body p {
    font-family: var(--font-body);
    font-size: var(--type-body-sm);
    line-height: 1.65;
    color: var(--midnight);
    margin: 0 0 14px;
}

.info-modal-body p:last-child {
    margin-bottom: 0;
}

.info-modal-footnote {
    font-size: 0.875rem;
    color: var(--stone);
    font-style: italic;
}

.info-modal-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.info-modal-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.info-modal-wordmark {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--pine);
    opacity: 0.88;
    line-height: 1;
}

.info-modal-edit-mark {
    display: inline-block;
    font-family: var(--font-ui);
    font-style: normal;
    font-weight: 700;
    font-size: 0.72em;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(245, 239, 224, 0.92);
    background: #0c1210;
    padding: 0.28em 0.5em;
    border-radius: 2px;
    vertical-align: 0.06em;
    line-height: 1.3;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

@media (max-width: 1024px) {
    .info-modal-overlay {
        padding: 16px;
    }

    .info-modal--editorial {
        padding: 26px 22px 24px;
    }

    .info-modal-title {
        font-size: 1.5rem;
    }
}

/* ── EDITORIAL SHARE SHEET ── */

.ed-viewer-share {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    left: var(--ed-chrome-left, 20px);
    z-index: 11;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(74, 59, 50, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--bark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: background 0.2s ease, transform 0.2s ease;
    box-shadow: none;
}

.ed-viewer-share:hover {
    background: rgba(74, 59, 50, 0.22);
    transform: scale(1.08);
}

.ed-share-overlay {
    position: fixed;
    inset: 0;
    z-index: 210000;
    background: rgba(26, 37, 48, 0.45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.28s ease;
}

.ed-share-overlay.active {
    opacity: 1;
}

.ed-share-sheet {
    width: 100%;
    max-width: 480px;
    background: var(--cream);
    border-radius: 20px 20px 0 0;
    padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -8px 40px rgba(26, 37, 48, 0.18);
}

.ed-share-overlay.active .ed-share-sheet {
    transform: translateY(0);
}

.ed-share-sheet__handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(74, 59, 50, 0.18);
    margin: 0 auto 16px;
}

.ed-share-sheet__title {
    margin: 0 0 8px;
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--stone);
    text-align: center;
}

.ed-share-sheet__row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 4px;
    border: none;
    border-bottom: 1px solid rgba(74, 59, 50, 0.08);
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: opacity 0.2s ease;
}

.ed-share-sheet__row:last-of-type {
    border-bottom: none;
}

.ed-share-sheet__row:hover:not(:disabled) {
    opacity: 0.82;
}

.ed-share-sheet__row:disabled,
.ed-share-sheet__row.loading {
    opacity: 0.55;
    cursor: wait;
}

.ed-share-sheet__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 700;
}

.ed-share-sheet__icon--copy {
    background: rgba(46, 74, 53, 0.1);
    color: var(--pine);
}

.ed-share-sheet__icon--fb {
    background: #1877f2;
    color: #fff;
}

.ed-share-sheet__icon--ig {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: #fff;
}

.ed-share-sheet__copy strong {
    display: block;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
    color: var(--bark);
}

.ed-share-sheet__copy span {
    display: block;
    font-size: 12px;
    color: var(--stone);
    margin-top: 2px;
}

.ed-share-sheet__cancel {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: rgba(74, 59, 50, 0.06);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    color: var(--bark);
    cursor: pointer;
}

.ed-share-sheet__cancel:hover {
    background: rgba(74, 59, 50, 0.1);
}

html.ed-share-sheet-open {
    overflow: hidden;
}

.share-toast {
    background: var(--midnight);
    color: var(--cream);
}
