/* ============================================================================
   Boarding Pass runway — a daily "season" of stamps rendered as a cream ticket
   with a plane on "today". Free track (left) + Boarding Pass Plus track (right).
   Content rules are scoped under .bp-host — a class carried by BOTH the v1
   full-screen overlay and the Departures sheet's Pass pane, so the boarding
   pass renders identically wherever it's mounted (2026-07-28, when the sheet
   swallowed the overlay). Only rules whose subject is the overlay ELEMENT
   itself still use #boarding-pass-overlay. Classes are bp- prefixed to avoid
   collisions with the rest of the app. See project_boarding_pass_runway memory.
   ============================================================================ */

/* The v1 overlay shell. Only the overlay is positioned like this — the
   Departures sheet hosts the same CONTENT (see .bp-host below) without
   becoming a full-screen layer. */
#boarding-pass-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: #ded8c8;
    color: var(--ink, #1a1a1a);
    font-family: var(--font-ui, 'Figtree', sans-serif);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    padding: 0 12px 48px;
}
#boarding-pass-overlay.open { opacity: 1; visibility: visible; }

/* ── top bar: close + month nav ─────────────────────────────── */
.bp-host .bp-topbar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 2px 8px;
    background: linear-gradient(180deg, #ded8c8 70%, rgba(222,216,200,0));
}
.bp-host .bp-close {
    width: 38px; height: 38px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    background: var(--paper, #F4F1EA);
    color: var(--ink, #1a1a1a);
    font-size: 18px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.bp-host .bp-monthnav {
    display: flex; align-items: center; gap: 10px;
}
.bp-host .bp-monthnav button {
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    background: var(--paper, #F4F1EA); color: var(--ink);
    font-size: 15px; cursor: pointer;
}
.bp-host .bp-monthnav .bp-month-label {
    font-family: var(--font-display, 'Archivo Black', sans-serif);
    font-size: 13px; letter-spacing: 0.04em; min-width: 96px; text-align: center;
}

/* ── ticket shell ───────────────────────────────────────────── */
.bp-host .bp-ticket {
    max-width: 440px; margin: 4px auto 0;
    background: var(--paper, #F4F1EA);
    border-radius: 18px; overflow: hidden; position: relative;
    box-shadow: 0 14px 40px rgba(0,0,0,0.22);
}
.bp-host .bp-band {
    background: linear-gradient(135deg,#bf953f 0%,#fcf6ba 42%,#b38728 60%,#fbf5b7 100%);
    padding: 14px 18px 12px; color: var(--ink);
}
.bp-host .bp-band h1 {
    font-family: var(--font-display, 'Archivo Black', sans-serif);
    font-size: 23px; letter-spacing: 0.04em; margin: 0;
}
.bp-host .bp-band .bp-band-row {
    display: flex; justify-content: space-between; align-items: baseline; margin-top: 3px;
}
.bp-host .bp-season {
    font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; opacity: 0.85;
}
.bp-host .bp-code {
    font-family: var(--font-mono, 'JetBrains Mono', monospace); font-size: 11px; opacity: 0.7;
}
.bp-host .bp-prog { padding: 10px 18px 4px; }
.bp-host .bp-bar {
    height: 6px; border-radius: 100px; background: rgba(0,0,0,0.09); overflow: hidden;
}
.bp-host .bp-bar > span {
    display: block; height: 100%; border-radius: 100px;
    background: linear-gradient(90deg,#b38728,#e8c667); transition: width 0.5s ease;
}
.bp-host .bp-prog-txt { font-size: 11px; opacity: 0.6; margin-top: 5px; text-align: center; }

.bp-host .bp-tear {
    height: 0; border-top: 2px dashed rgba(0,0,0,0.18); margin: 10px 14px 2px; position: relative;
}
.bp-host .bp-tear::before,
.bp-host .bp-tear::after {
    content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: #ded8c8;
}
.bp-host .bp-tear::before { left: -24px; }
.bp-host .bp-tear::after { right: -24px; }

/* ── column headers ─────────────────────────────────────────── */
.bp-host .bp-col-heads {
    display: grid; grid-template-columns: 1fr 62px 1fr; gap: 6px; padding: 8px 14px 2px;
}
.bp-host .bp-col-head {
    text-align: center; font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
}
.bp-host .bp-col-head.free { color: rgba(0,0,0,0.5); }
.bp-host .bp-col-head.plus { color: var(--gold-deep, #b38728); }

/* ── runway ─────────────────────────────────────────────────── */
.bp-host .bp-runway { position: relative; padding: 2px 14px 12px; }
.bp-host .bp-runway::before {
    content: ""; position: absolute; top: 6px; bottom: 6px; left: 50%; width: 0;
    transform: translateX(-50%); border-left: 2px dashed rgba(179,135,40,0.5); z-index: 0;
}
.bp-host .bp-row {
    position: relative; z-index: 1;
    display: grid; grid-template-columns: 1fr 62px 1fr; align-items: center; gap: 6px; padding: 8px 0;
}
.bp-host .bp-spine { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.bp-host .bp-date-pill {
    background: var(--paper, #F4F1EA); border: 1.5px solid rgba(179,135,40,0.5); border-radius: 100px;
    padding: 4px 0; width: 50px; text-align: center; font-size: 12px; font-weight: 800;
    color: var(--gold-deep, #b38728); line-height: 1.1;
}
.bp-host .bp-date-pill small { display: block; font-size: 8px; font-weight: 700; letter-spacing: 0.08em; opacity: 0.7; }
.bp-host .bp-plane { width: 42px; height: auto; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.28)); }
.bp-host .bp-today-tag {
    font-size: 8.5px; font-weight: 800; letter-spacing: 0.1em; color: var(--ink);
    background: var(--gold, #FFD93D); border-radius: 100px; padding: 2px 8px; box-shadow: 0 2px 8px rgba(179,135,40,0.4);
}

/* ── stamp cards ────────────────────────────────────────────── */
.bp-host .bp-stamp {
    border-radius: 12px; padding: 8px; min-height: 96px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    text-align: center; position: relative; background: #fff; color: var(--ink);
    box-shadow: 0 5px 14px rgba(0,0,0,0.14); overflow: hidden;
}
.bp-host .bp-stamp .bp-frame {
    position: absolute; inset: 4px; border: 1.5px dashed rgba(0,0,0,0.2); border-radius: 9px; pointer-events: none;
}
.bp-host .bp-stamp .bp-art {
    width: 52px; height: 52px; object-fit: contain; display: block;
}
.bp-host .bp-stamp .bp-art-fallback { font-size: 28px; line-height: 1; }
.bp-host .bp-stamp .bp-nm { font-size: 10.5px; font-weight: 700; line-height: 1.15; padding: 0 2px; }
.bp-host .bp-stamp .bp-st { font-size: 9px; font-weight: 800; letter-spacing: 0.04em; }

/* empty slot placeholder */
.bp-host .bp-empty-slot {
    min-height: 96px; border-radius: 12px; border: 1.5px dashed rgba(0,0,0,0.1);
}

/* states */
.bp-host .bp-stamp.earned { background: linear-gradient(180deg,#ffffff,#f3fbf4); }
.bp-host .bp-stamp.earned .bp-st { color: var(--green, #27ae60); }
.bp-host .bp-stamp.earned::after {
    content: "✓"; position: absolute; top: 5px; right: 7px; color: #fff; background: var(--green, #27ae60);
    width: 17px; height: 17px; border-radius: 50%; font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.bp-host .bp-stamp.today {
    background: linear-gradient(180deg,#fffdf2,#fff2c9);
    box-shadow: 0 0 0 2px var(--gold, #FFD93D), 0 8px 22px rgba(255,217,61,0.4);
}
.bp-host .bp-stamp.today .bp-st { color: var(--gold-deep, #b38728); }
.bp-host .bp-stamp.future,
.bp-host .bp-stamp.available,
.bp-host .bp-stamp.missed { background: #efece2; color: #948e7d; }
.bp-host .bp-stamp.future .bp-art,
.bp-host .bp-stamp.missed .bp-art { filter: grayscale(1); opacity: 0.5; }
.bp-host .bp-stamp.available .bp-art { filter: grayscale(0.5); opacity: 0.75; }
.bp-host .bp-stamp.available .bp-st { color: #c58b2e; }

/* PLUS = premium parchment; locked = silhouette */
.bp-host .bp-stamp.plus {
    background: linear-gradient(180deg,#f6ebca,#ecd9a4); border: 1px solid rgba(179,135,40,0.55);
    color: var(--gold-deep, #b38728); box-shadow: 0 5px 14px rgba(120,90,20,0.2);
}
.bp-host .bp-stamp.plus .bp-frame { border-color: rgba(179,135,40,0.4); }
.bp-host .bp-stamp.plus .bp-nm { color: rgba(90,70,20,0.75); }
.bp-host .bp-stamp.plus .bp-st { color: var(--gold-deep, #b38728); }
.bp-host .bp-stamp.plus.locked .bp-art { filter: grayscale(1) brightness(1.15); opacity: 0.32; }
.bp-host .bp-stamp.plus .bp-lock { position: absolute; top: 6px; right: 7px; font-size: 12px; opacity: 0.85; }

/* ── loading / empty ────────────────────────────────────────── */
.bp-host .bp-loading,
.bp-host .bp-empty {
    max-width: 440px; margin: 40px auto; text-align: center; opacity: 0.6; font-size: 14px; padding: 24px;
}
.bp-host .bp-empty .bp-empty-emoji { font-size: 34px; display: block; margin-bottom: 10px; }

/* ============================================================================
   Reusable stamp flip card + task back. Deliberately UNSCOPED (global classes)
   so other surfaces (series scoped view, passport) can reuse the same flip +
   `window.renderStampTaskBack` / `window.attachStampFlips`. Tap a stamp → it
   flips to reveal "what do I need to do?".
   ============================================================================ */
.stamp-flip { perspective: 900px; cursor: pointer; }
.stamp-flip-inner {
    position: relative; display: grid;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.stamp-flip-inner > .stamp-face {
    grid-area: 1 / 1;
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
    min-height: 96px;
}
.stamp-face.back { transform: rotateY(180deg); }
.stamp-flip.flipped .stamp-flip-inner { transform: rotateY(180deg); }

.stamp-back {
    border-radius: 12px; padding: 9px 9px 6px; min-height: 96px; max-height: 150px; overflow-y: auto;
    background: var(--ink, #1a1a1a); color: var(--paper, #F4F1EA);
    display: flex; flex-direction: column; gap: 5px;
    box-shadow: 0 5px 14px rgba(0,0,0,0.2);
}
.stamp-back .sb-title { font-size: 9.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold, #FFD93D); }
.stamp-back .sb-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.stamp-back .sb-tasks li { display: flex; align-items: flex-start; gap: 5px; font-size: 10.5px; line-height: 1.22; text-align: left; }
.stamp-back .sb-tasks li.done { opacity: 0.6; }
.stamp-back .sb-tasks li.done .sb-tt { text-decoration: line-through; }
.stamp-back .sb-check { color: var(--gold, #FFD93D); font-weight: 700; flex-shrink: 0; }
.stamp-back .sb-tasks li.done .sb-check { color: var(--green, #27ae60); }
.stamp-back .sb-prog { margin-left: auto; opacity: 0.7; font-variant-numeric: tabular-nums; padding-left: 4px; }
.stamp-back .sb-auto { font-size: 10.5px; opacity: 0.85; line-height: 1.3; text-align: left; }
.stamp-back .sb-plusnote { font-size: 9.5px; color: var(--gold, #FFD93D); opacity: 0.9; }
.stamp-back .sb-tasks li.sb-more { font-size: 9.5px; opacity: 0.6; padding-left: 15px; }
.stamp-back .sb-detail {
    align-self: flex-start; margin-top: 3px; padding: 4px 9px; border-radius: 100px;
    border: 1px solid rgba(255,217,61,0.5); background: transparent; color: var(--gold, #FFD93D);
    font-size: 9.5px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.stamp-back .sb-hint { margin-top: auto; font-size: 8.5px; opacity: 0.45; text-align: center; padding-top: 3px; }

/* Series scoped-view cards keep their OWN 3/4 aspect-ratio + greyscale/video
   behaviour; the grid-stacked flip sizes to the card (don't force a strict
   height — that clipped the title). The back stretches to fill the same cell. */
.dt-series-lane-scroll .stamp-flip .stamp-face { border-radius: 12px; overflow: hidden; }
.dt-series-lane-scroll .stamp-flip .dt-series-card:hover { transform: none; }
.dt-series-lane-scroll .stamp-back { max-height: none; }

/* ============================================================================
   Single-ticket runway (Phase 3) — a flight-board ticket's detail in the
   boarding-pass chrome. Stamp = destination gate; tasks = the runway climbing
   toward it, plane on the current task. Reuses .bp-ticket / .bp-band / .bp-prog.
   ========================================================================== */
/* Ticket mode has no month to page through — hide the prev/next nav. */
#boarding-pass-overlay.bp-ticket-mode .bp-monthnav { display: none; }

/* Destination stamp — a larger version of the .bp-stamp card, centred. */
.bp-host .bp-thero-wrap { display: flex; justify-content: center; padding: 16px 18px 6px; }
.bp-host .bp-thero { width: 168px; min-height: 158px; padding: 12px; }
.bp-host .bp-thero .bp-art { width: 88px; height: 88px; }
.bp-host .bp-thero .bp-art-fallback { font-size: 46px; }
.bp-host .bp-thero .bp-nm { font-size: 13px; line-height: 1.2; }
.bp-host .bp-thero .bp-st { font-size: 10px; }

.bp-host .bp-treward {
    text-align: center; font-size: 11.5px; font-weight: 700;
    letter-spacing: 0.02em; color: var(--gold-deep, #b38728); padding: 4px 18px 0;
}

/* Task runway — spine on the LEFT (a single ticket is one lane, not free/Plus). */
.bp-host .bp-truway { position: relative; padding: 8px 16px 18px; }
.bp-host .bp-truway::before {
    content: ""; position: absolute; top: 16px; bottom: 16px; left: 44px; width: 0;
    border-left: 2px dashed rgba(179, 135, 40, 0.5); z-index: 0;
}
.bp-host .bp-trow {
    position: relative; z-index: 1;
    display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 12px; padding: 7px 0;
}
.bp-host .bp-trow .bp-spine { width: 56px; }
.bp-host .bp-node {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--paper, #F4F1EA); border: 2px solid rgba(179, 135, 40, 0.5);
    color: var(--gold-deep, #b38728); font-weight: 800; font-size: 14px;
}
.bp-host .bp-node.done { background: var(--green, #27ae60); border-color: var(--green, #27ae60); color: #fff; }

.bp-host .bp-tcard {
    background: #fff; border: 1px solid rgba(0, 0, 0, 0.06); border-radius: 12px;
    padding: 12px 14px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.bp-host .bp-tcard.done {
    background: linear-gradient(180deg, #ffffff, #f3fbf4); border-color: rgba(39, 174, 96, 0.35);
}
.bp-host .bp-tcard.current {
    box-shadow: 0 0 0 2px var(--gold, #FFD93D), 0 8px 20px rgba(255, 217, 61, 0.32);
}
.bp-host .bp-tcard.todo { opacity: 0.92; }
.bp-host .bp-tcard-title { font-size: 13.5px; font-weight: 700; line-height: 1.25; color: var(--ink, #1a1a1a); }
.bp-host .bp-tcard.done .bp-tcard-title { text-decoration: line-through; opacity: 0.7; }

.bp-host .bp-tprog { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.bp-host .bp-tbar { flex: 1; height: 6px; border-radius: 100px; background: rgba(0, 0, 0, 0.08); overflow: hidden; }
.bp-host .bp-tbar > span { display: block; height: 100%; border-radius: 100px; background: linear-gradient(90deg, #b38728, #e8c667); }
.bp-host .bp-tprog-txt { font-size: 11px; font-weight: 700; opacity: 0.6; font-variant-numeric: tabular-nums; }

/* ============================================================================
   Merged surface (2026-07-24) — the Boarding Pass overlay gains a toggle:
   🎫 Boarding Pass (season runway) ⇄ ✈ Board (flight board). Behind a flag;
   .bp-merged is only set when the flag is on, so the plain overlay is unchanged.
   ========================================================================== */
.bp-host .bp-merge-toggle { display: none; }
#boarding-pass-overlay.bp-merged .bp-merge-toggle {
    display: flex; gap: 6px; width: max-content; margin: 2px auto 14px;
    background: rgba(0,0,0,0.28); padding: 5px; border-radius: 100px;
}
.bp-host .bp-merge-toggle button {
    border: none; background: transparent; color: #fff; opacity: 0.72; cursor: pointer;
    font-family: var(--font-ui, 'Figtree', sans-serif); font-weight: 700; font-size: 13px;
    letter-spacing: 0.01em; padding: 8px 16px; border-radius: 100px; white-space: nowrap;
}
.bp-host .bp-merge-toggle button.on {
    background: var(--gold, #FFD93D); color: var(--ink, #1a1a1a); opacity: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Board view: dark globe backdrop so the cream ticket cards pop (matches the
   over-globe board). The month nav doesn't apply here; the topbar goes clear. */
#boarding-pass-overlay.bp-board {
    background: radial-gradient(130% 90% at 50% -10%, #24304f 0%, #141a2c 55%, #0a0d18 100%);
}
#boarding-pass-overlay.bp-board .bp-topbar { background: transparent; }
#boarding-pass-overlay.bp-board .bp-monthnav { display: none; }
.bp-host .bp-board-wrap { max-width: 480px; margin: 0 auto; padding: 2px 14px 24px; }
.bp-host .bp-board-wrap .dep-flight-sec { margin: 6px 0 14px; }

/* Stamps view (2026-07-26): the third segment. #dt-side-stamps is reparented
   in here whole, so it keeps every one of its own styles — all this does is
   give it the dark backdrop it was designed against (same as the Board) and
   suppress the chrome that belongs to the sheet it came from. */
#boarding-pass-overlay.bp-stamps {
    background: radial-gradient(130% 90% at 50% -10%, #24304f 0%, #141a2c 55%, #0a0d18 100%);
}
#boarding-pass-overlay.bp-stamps .bp-topbar { background: transparent; }
#boarding-pass-overlay.bp-stamps .bp-monthnav { display: none; }
.bp-host .dt-side-hosted {
    display: block; max-width: 480px; margin: 0 auto; padding: 0 2px 24px;
}
/* The sheet's own ✕ — the overlay topbar already has one. */
.bp-host .dt-side-hosted .dt-close-x { display: none; }
