/* ─────────────────────────────────────────────────────────────
   CometFare Sky Header — edge-to-edge TRANSPARENT top nav.

   Design language (rebuild, 2026-07-28):
   - The bar itself is not a surface. No background, no border, no
     radius, no margins: it spans the full viewport width and sits
     flush against the top edge. The only thing painting behind it
     is a black scrim that fades out downward, so the controls stay
     readable over whatever the page puts up there.
   - Every *control* is the surface: solid black with a sky-blue
     border. The brand icon is a black circle, the "Open app" CTA is
     a black pill, and the Explore/App/Policy triggers are invisible
     until hover, when they take the same black + blue treatment.
   - Menus follow the controls: black panels, blue border.

   Markup (unchanged):
   <nav class="sky-nav">
     <a class="sky-brand" href="./index.html"><img …>CometFare</a>
     <span class="sky-brand-version" id="sky-brand-version" hidden></span>
     <div class="sky-nav-links">
       <div class="sky-nav-group">
         <span class="sky-nav-trigger">Explore</span>
         <div class="sky-nav-menu"><div class="sky-nav-menu-inner">…links…</div></div>
       </div>
       …
     </div>
     <a class="sky-nav-cta" href="./home.html">Open app</a>
   </nav>
   <div class="sky-nav-dim"></div>
   ───────────────────────────────────────────────────────────── */

:root {
    --skyui-blue: #3fa4f6;
    --skyui-blue-deep: #1f7fd6;
    /* soft darker-blue wash layered over flat blue surfaces (shared with
       the footer and the page-level --sky-shade so all blue matches) */
    --skyui-shade: linear-gradient(160deg, rgba(8, 48, 100, 0) 0%, rgba(8, 48, 100, 0.14) 40%, rgba(8, 48, 100, 0.42) 100%);
    --skyui-ink: #000000;
    --skyui-soft-ink: rgba(0, 0, 0, 0.6);
    --skyui-white: #ffffff;
    --skyui-radius: 26px;

    /* ── new core tokens ── */
    --skyui-black: #000000;          /* every control's surface */
    --skyui-bar-h: 66px;             /* nav content height, flush to the top edge */

    /* ── RESTING vs SELECTED (2026-07-28) ──
       One rule across the whole header, matching the hero's download CTA:
       type and edges are BEIGE at rest, and turn BLUE the moment a control is
       engaged — hovered, focused, or holding an open menu. Blue is now the
       selection signal only; it is no longer the resting colour of anything.
       --skyui-white is kept because other rules still reference it, but it is
       no longer what nav labels are painted with. */
    --skyui-beige: #c9b3ff;
    --skyui-edge: 2px solid rgba(201, 179, 255, 0.5);       /* resting border */
    --skyui-edge-active: 2px solid var(--skyui-blue);       /* engaged border */
}

.sky-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    width: 100%;
    min-height: var(--skyui-bar-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 9px clamp(14px, 2.4vw, 28px);
    /* no surface: the bar is a layout container only */
    background: none;
    border-radius: 0;
    box-shadow: none;
    transition: padding 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── the top black shadow ──
   The bar's only paint. A scrim that starts black-ish at the very top
   edge and dissolves before it reaches page content, so the nav reads
   as "floating over" rather than "sitting on" anything. It's a
   pseudo-element rather than a background so it can overhang the bar's
   own height and fade past it. */
.sky-nav::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 190%;
    pointer-events: none;
    z-index: -1;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.34) 34%,
        rgba(0, 0, 0, 0.12) 66%,
        rgba(0, 0, 0, 0) 100%);
    opacity: 0.85;
    transition: opacity 0.35s ease;
}

/* The bar no longer collapses in width on scroll — there is no bar to
   collapse. It tightens its padding instead, and the scrim deepens. */
.sky-nav.scrolled {
    padding-top: 5px;
    padding-bottom: 5px;
}

.sky-nav.scrolled::before { opacity: 1; }

.sky-brand {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.08rem;
    color: var(--skyui-beige);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

/* ── brand icon: bare mark, no surface ──
   The logo sits directly on the scrim — no black plate, no radius, no
   border. Only the square hover outline (below) ever paints around it,
   which is what keeps it reading as the mark rather than as a third
   button. Applies on every page that loads this stylesheet. */
.sky-brand img {
    height: 46px;
    width: 46px;
    flex-shrink: 0;
    display: block;
    margin: 0;
    background: none;
    border: 0;
    border-radius: 0;
    object-fit: contain;
    transition: outline-color 0.18s ease;
    /* declared transparent up front so only the colour animates on hover —
       an outline is used rather than a border because it is drawn OUTSIDE
       the box, which keeps the 46px square (and the bar's height) fixed */
    outline: 2px solid transparent;
    outline-offset: 0;
}

/* the mark takes the same blue-on-engage treatment as every other control */
.sky-brand:hover img,
.sky-brand:focus-visible img {
    outline-color: var(--skyui-blue);
}

/* the wordmark centers against the icon */
.sky-brand span {
    align-self: center;
    line-height: 1;
}

/* version squircle beside the wordmark — same black + blue token as
   every other control. Filled by cometfare-sky-header.js from
   /api/releases/latest; stays hidden until a version actually loads. */
.sky-brand-version {
    align-self: center;
    margin-left: -4px;
    padding: 4px 9px;
    border-radius: 11px;
    background: var(--skyui-black);
    border: var(--skyui-edge);
    color: var(--skyui-beige);
    font-weight: 800;
    font-size: 0.72rem;
    line-height: 1;
    white-space: nowrap;
}

/* pinned to the bar's true midpoint — flex auto-margins would center
   in the leftover space, which drifts because brand ≠ CTA width.
   cometfare-sky-header.js overwrites `left` with a px value when the
   true midpoint would run the links into the brand or the CTA; this
   50% is the uncramped default. */
.sky-nav-links {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 4px;
}

.sky-nav-group { position: relative; }

/* ── middle triggers: no surface until hover ──
   Transparent by default (text only). The border is declared
   transparent rather than added on hover so the label never shifts by
   the 2px when the surface appears. */
.sky-nav-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid transparent;
    border-radius: 16px;
    background: none;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--skyui-beige);
    cursor: default;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.sky-nav-trigger::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2.2px solid currentColor;
    border-bottom: 2.2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
}

/* engaged: the group is holding its menu open */
.sky-nav-group:hover .sky-nav-trigger,
.sky-nav-group:focus-within .sky-nav-trigger {
    color: var(--skyui-blue);
    background: var(--skyui-black);
    border-color: var(--skyui-blue);
}

.sky-nav-group:hover .sky-nav-trigger::after {
    transform: rotate(225deg) translateY(-2px);
}

.sky-nav-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding-top: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 5;
}

.sky-nav-group:hover .sky-nav-menu {
    opacity: 1;
    pointer-events: auto;
}

/* a menu is only ever on screen while its group is engaged, so it wears the
   active edge rather than the resting one */
.sky-nav-menu-inner {
    min-width: 190px;
    background: var(--skyui-black);
    border: var(--skyui-edge-active);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    padding: 10px;
    display: grid;
    gap: 2px;
}

.sky-nav-menu-inner a {
    display: block;
    padding: 10px 14px;
    border-radius: 13px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--skyui-beige);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.sky-nav-menu-inner a:hover {
    background: rgba(63, 164, 246, 0.22);
    color: var(--skyui-blue);
}

.sky-nav-dim {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

body:has(.sky-nav-group:hover) .sky-nav-dim { opacity: 1; }

/* ── Open app: same token as the brand circle, stretched to a pill ── */
.sky-nav-cta {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.92rem;
    white-space: nowrap; /* stops "Open app" folding into two lines */
    color: var(--skyui-beige);
    background: var(--skyui-black);
    border: var(--skyui-edge);
    text-decoration: none;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.sky-nav-cta:hover,
.sky-nav-cta:focus-visible {
    color: var(--skyui-blue);
    border-color: var(--skyui-blue);
}

/* The links hide only when the bar genuinely can't fit them between the
   brand and the CTA — cometfare-sky-header.js measures that and toggles
   this class. Hidden via opacity, not display, so the width stays
   measurable and the script can bring them back. */
.sky-nav-links.is-cramped {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* below 420px, shrink brand + CTA instead of letting them wrap/overflow */
@media (max-width: 420px) {
    .sky-nav { gap: 8px; padding: 8px 12px; }
    .sky-brand { gap: 8px; font-size: clamp(1rem, 4.8vw, 1.08rem); }
    .sky-brand img { height: clamp(38px, 12vw, 46px); width: clamp(38px, 12vw, 46px); }
    .sky-nav-cta { padding: 9px clamp(12px, 3.4vw, 20px); font-size: clamp(0.85rem, 3.3vw, 0.92rem); }
}
