/* ============================================================================
   Departures HUD — tracker. (2026-09-18)
   Everything is scoped under body.dep-hud, so with the flag off this file
   cannot match a single element. See js/dep-tracker.js for the shape.
   ============================================================================ */

body.dep-hud {
    --dt-ease: cubic-bezier(0.22, 0.9, 0.3, 1);
    --dt-glass: rgba(255, 255, 255, 0.88);
    --dt-muted: rgba(26, 26, 26, 0.55);
    --dt-gold-deep: #b38728;
    --dt-bottom: calc(var(--safe-bottom, 0px) + 56px);   /* the tab bar */
}

/* The sheet is what this replaces — the 224px peek is the whole reason the
   HUD exists, so with the flag on it does not ship at all. */
body.dep-hud #dep5-sheet { display: none !important; }
/* The partner chip anchored above the sheet's peek; with the sheet gone it
   belongs just above the tab bar, between the HUD button and locate. */
body.dep-hud #dep-partner-chip {
    bottom: calc(var(--dt-bottom) + 14px + 42px + 12px);
}
body.dep-hud.dep-hud-open #dep-partner-chip { opacity: 0; pointer-events: none; }
/* locate is bottom-anchored against the peek too (departures-v5.css). */
body.dep-hud #dep5-locate { bottom: calc(var(--dt-bottom) + 14px) !important; }

body.dep-hud .dt-glass {
    background: var(--dt-glass);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}

/* ── the button ─────────────────────────────────────────────────────── */
body.dep-hud #dep-hud-btn {
    position: fixed;
    left: 12px;
    bottom: calc(var(--dt-bottom) + 14px);
    z-index: 13;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 14px 0 5px;
    border: 0;
    border-radius: 100px;
    background: #fff;
    color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    transition: background 200ms;
    -webkit-tap-highlight-color: transparent;
}
body.dep-hud #dep-hud-btn .dt-ring-track { stroke: rgba(26, 26, 26, 0.1); }
body.dep-hud #dep-hud-btn .dt-lbl { font-weight: 800; font-size: 13.5px; }
body.dep-hud #dep-hud-btn .dt-cnt {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 12px;
    color: var(--dt-muted);
}
body.dep-hud.dep-hud-open #dep-hud-btn { background: #1a1a1a; color: #fff; }
body.dep-hud.dep-hud-open #dep-hud-btn .dt-cnt { color: rgba(255, 255, 255, 0.6); }
body.dep-hud.dep-hud-open #dep-hud-btn .dt-ring-track { stroke: rgba(255, 255, 255, 0.2); }
body.dep-hud #dep-hud-ring { transition: stroke-dashoffset 600ms var(--dt-ease); }

/* ── the tracker ────────────────────────────────────────────────────── */
body.dep-hud #dep-tracker {
    position: fixed;
    left: 12px;
    bottom: calc(var(--dt-bottom) + 14px + 42px + 10px);
    z-index: 12;
    width: min(300px, calc(100vw - 60px));
    max-height: calc(100vh - var(--header-height, 72px) - var(--dt-bottom) - 150px);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transform-origin: bottom left;
    transition: opacity 220ms, transform 320ms var(--dt-ease);
}
body.dep-hud:not(.dep-hud-open) #dep-tracker {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
    pointer-events: none;
}

body.dep-hud .dt-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    border-radius: 100px;
}
body.dep-hud .dt-head b {
    font-family: var(--font-display, 'Archivo Black', sans-serif);
    font-size: 12px;
    letter-spacing: 0.08em;
    flex: 1;
}
body.dep-hud .dt-cad { display: flex; flex: 1; gap: 2px; background: rgba(26,26,26,.06);
    border-radius: 100px; padding: 2px; }
body.dep-hud .dt-cad button { flex: 1; }
body.dep-hud .dt-cad button {
    border: 0; background: none; border-radius: 100px; padding: 4px 9px;
    font-size: 11.5px; font-weight: 700; color: var(--dt-muted); cursor: pointer;
}
body.dep-hud .dt-cad button[aria-pressed="true"] {
    background: #fff; color: #1a1a1a; box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
/* The tracker lives on the left, so it leaves to the left — the arrow points
   at the edge it goes out by, and the gesture agrees with the glyph. */
body.dep-hud .dt-off {
    flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%;
    background: rgba(26,26,26,.06); color: rgba(26,26,26,.45); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* Two levels in one window: the list slides out left as the detail comes in
   from the right. One column, one back arrow, no new surface. */
body.dep-hud .dt-window {
    position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 0;
}
body.dep-hud .dt-pane {
    display: flex; flex-direction: column; gap: 6px;
    overflow-y: auto; scrollbar-width: none;
    transition: transform 320ms var(--dt-ease), opacity 200ms;
}
body.dep-hud .dt-pane::-webkit-scrollbar { display: none; }
body.dep-hud #dep-tr-detail {
    position: absolute; inset: 0; transform: translateX(104%); opacity: 0; pointer-events: none;
}
/* Inside a task the whole header stands down: its pills act on a list you
   can't see, and the detail carries its own head with the task name and the way
   back. One header at a time, and the list gets the height. */
body.dep-hud.dep-hud-deep .dt-head { display: none; }
body.dep-hud.dep-hud-deep #dep-tr-list {
    transform: translateX(-30%); opacity: 0; pointer-events: none;
}
body.dep-hud.dep-hud-deep #dep-tr-detail { transform: none; opacity: 1; pointer-events: auto; }

/* ── rows ───────────────────────────────────────────────────────────── */
body.dep-hud .dt-item,
body.dep-hud .dt-poi {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px;
    border: 0; border-radius: 13px; text-align: left; width: 100%; cursor: pointer;
    color: #1a1a1a; font-family: inherit;
}
body.dep-hud .dt-mid { flex: 1; min-width: 0; }
body.dep-hud .dt-t {
    display: block; font-weight: 700; font-size: 13.5px; line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body.dep-hud .dt-s {
    display: block; font-size: 11.5px; color: var(--dt-muted); margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body.dep-hud .dt-ic {
    width: 30px; height: 30px; flex: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--paper, #F4F1EA); color: #1a1a1a;
}
body.dep-hud .dt-ic.is-done { background: #1a1a1a; color: var(--accent-gold, #FFD93D); }
body.dep-hud .dt-bar {
    display: block; height: 4px; border-radius: 4px; background: rgba(26,26,26,.1);
    overflow: hidden; margin-top: 5px;
}
body.dep-hud .dt-bar i {
    display: block; height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, #b38728, #e8c860);
}
body.dep-hud .dt-chev { flex: none; color: rgba(26,26,26,.3); }
body.dep-hud .dt-claim {
    flex: none; font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 100px;
    background: linear-gradient(135deg,#bf953f 0%,#fcf6ba 40%,#b38728 60%,#fbf5b7 100%);
    color: #1a1a1a;
}
body.dep-hud .dt-item.is-done .dt-t {
    text-decoration: line-through;
    text-decoration-color: rgba(26,26,26,.35);
    color: var(--dt-muted);
}

/* ── detail ─────────────────────────────────────────────────────────── */
body.dep-hud .dt-dhead {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 5px; border-radius: 100px;
}
body.dep-hud .dt-back {
    width: 28px; height: 28px; flex: none; border: 0; border-radius: 50%;
    background: rgba(26,26,26,.06); color: #1a1a1a; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
body.dep-hud .dt-dhead .dt-t { font-size: 13px; white-space: normal; }
body.dep-hud .dt-poi.is-near { outline: 2px solid rgba(179,135,40,.5); outline-offset: -2px; }
/* The place's NAME is what the row is for, so it gets the width and a second
   line if it needs one — it used to truncate at "The Preci…" while the distance
   spent half the row saying "away from you" (2026-09-18). */
body.dep-hud .dt-poi .dt-t {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
}
body.dep-hud .dt-poi .dt-dist {
    flex: none; font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 11.5px; color: var(--dt-muted); padding-left: 2px;
}
body.dep-hud .dt-poi.is-on { background: #1a1a1a; }
body.dep-hud .dt-poi.is-on .dt-t { color: #fff; }
body.dep-hud .dt-poi.is-on .dt-s,
body.dep-hud .dt-poi.is-on .dt-dist { color: rgba(255,255,255,.6); }
body.dep-hud .dt-poi.is-on .dt-ic { background: rgba(255,255,255,.14); color: var(--accent-gold, #FFD93D); }
body.dep-hud .dt-note {
    padding: 10px 12px; border-radius: 13px; font-size: 12px;
    color: var(--dt-muted); line-height: 1.4;
}
body.dep-hud .dt-note b { color: #1a1a1a; }
body.dep-hud .dt-big {
    display: block; font-family: var(--font-display, 'Archivo Black', sans-serif);
    font-size: 26px; line-height: 1; color: #1a1a1a;
}
body.dep-hud .dt-src { display: block; margin-top: 6px; }
body.dep-hud .dt-go {
    display: block; width: 100%; margin-top: 9px; border: 0; border-radius: 100px;
    padding: 8px 0; font-weight: 800; font-size: 12px; cursor: pointer; color: #1a1a1a;
    background: linear-gradient(135deg,#bf953f 0%,#fcf6ba 40%,#b38728 60%,#fbf5b7 100%);
}

/* ── occasions ──────────────────────────────────────────────────────── */
body.dep-hud #dep-occs {
    position: fixed; right: 12px; top: calc(var(--header-height, 72px) + 5px + 42px + 10px);
    z-index: 11; width: 200px;
    max-height: calc(100vh - var(--header-height, 72px) - var(--dt-bottom) - 170px);
    overflow-y: auto; scrollbar-width: none;
    display: flex; flex-direction: column; gap: 7px; padding-bottom: 2px;
}
body.dep-hud #dep-occs::-webkit-scrollbar { display: none; }
body.dep-hud .dt-occ {
    border-radius: 14px; overflow: hidden; transform-origin: top right;
    animation: dtOccIn 420ms var(--dt-ease) both;
}
@keyframes dtOccIn { from { opacity: 0; transform: translateY(-6px) scale(.96); } }
/* Hiding is a move to the right edge, where the stub then appears — the card
   goes to a place, it doesn't evaporate. */
body.dep-hud .dt-occ.is-hiding {
    transition: transform 240ms var(--dt-ease), opacity 200ms, margin 240ms var(--dt-ease);
    transform: translateX(118%); opacity: 0; margin-top: -8px;
}
body.dep-hud .dt-occ-top { display: flex; align-items: stretch; }
body.dep-hud .dt-occ-head {
    display: flex; align-items: center; gap: 8px; padding: 8px 4px 8px 8px;
    width: 100%; border: 0; background: none; text-align: left; cursor: pointer;
    color: #1a1a1a; font-family: inherit;
}
body.dep-hud .dt-occ-art {
    width: 36px; height: 36px; flex: none; object-fit: contain; border-radius: 8px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.2));
}
body.dep-hud .dt-occ-t {
    display: block; font-family: var(--font-display, 'Archivo Black', sans-serif);
    font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
    color: var(--dt-gold-deep); line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.dep-hud .dt-occ-s {
    display: block; font-size: 12.5px; font-weight: 700; line-height: 1.25; margin-top: 1px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body.dep-hud .dt-occ-hide {
    flex: none; width: 28px; align-self: stretch; border: 0; background: none;
    color: rgba(26,26,26,.3); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
body.dep-hud .dt-occ-hide:active { color: #1a1a1a; }
body.dep-hud .dt-occ-more {
    display: grid; grid-template-rows: 0fr; transition: grid-template-rows 300ms var(--dt-ease);
}
body.dep-hud .dt-occ.is-open .dt-occ-more { grid-template-rows: 1fr; }
body.dep-hud .dt-occ-more > div { overflow: hidden; }
body.dep-hud .dt-occ-body {
    padding: 0 10px 10px; font-size: 12px; color: var(--dt-muted); line-height: 1.35;
}
body.dep-hud .dt-occ-body b { color: #1a1a1a; }

/* The stub rail — what makes hiding survivable. A hidden occasion is still on
   screen, at the edge it left by, one tap from coming back. */
body.dep-hud #dep-occ-stubs {
    position: fixed; right: 0; top: calc(var(--header-height, 72px) + 5px + 42px + 10px);
    z-index: 11; display: none; flex-direction: column; gap: 6px;
}
body.dep-hud #dep-occ-stubs.has-stubs { display: flex; }
body.dep-hud .dt-stub {
    width: 34px; height: 40px; border: 0; cursor: pointer; padding: 0;
    border-radius: 12px 0 0 12px;
    background: var(--dt-glass);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    box-shadow: -2px 2px 10px rgba(0,0,0,.14);
    display: flex; align-items: center; justify-content: center;
    animation: dtStubIn 300ms var(--dt-ease) both;
}
@keyframes dtStubIn { from { opacity: 0; transform: translateX(14px); } }
body.dep-hud .dt-stub img { width: 26px; height: 26px; object-fit: contain; }
body.dep-hud .dt-stub-i { color: rgba(26,26,26,.45); display: flex; }

/* The map takes the surface back when the terminal or a focused dive owns it. */
body.dep-hud.dep5-terminal-open #dep-hud-btn,
body.dep-hud.dep5-terminal-open #dep-tracker,
body.dep-hud.dep5-terminal-open #dep-occs,
body.dep-hud.dep5-terminal-open #dep-occ-stubs,
body.dep-hud.dep-challenge-focus #dep-hud-btn,
body.dep-hud.dep-challenge-focus #dep-tracker,
body.dep-hud.dep-challenge-focus #dep-occs,
body.dep-hud.dep-challenge-focus #dep-occ-stubs { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    body.dep-hud .dt-pane,
    body.dep-hud .dt-occ,
    body.dep-hud .dt-stub,
    body.dep-hud #dep-tracker { transition: none; animation: none; }
}
