/* ============================================================
   notch.css — "notch" navbar: a screen cut-out that hangs from the
   top centre. Self-contained and token-independent (fallbacks), so it
   renders on any ground. Pages link this and use the .notch markup.
   ============================================================ */
.notch {
  --notch-flare: 20px;                /* size of the concave corner flares */
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 30px;
  background: var(--cube-black, #000); color: #fff;
  border-radius: 0 0 24px 24px;
  transition: transform .28s ease;
  /* iOS Safari composites position:fixed layers separately during a scroll
     and can render them offset from their layout position (the element's
     rect still reports top:0). Promoting the notch to its own layer keeps
     the compositor honest. */
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Concave flares: the black is widest at the very top edge and curves in as it
   descends, so it reads as a screen cut-out. The transparent quarter-disc is
   centred on each flare box's BOTTOM-OUTER corner; black fills the rest.
   Each flare is 1px WIDER than the gap and overlaps the body: the notch is
   centred with translateX(-50%) on a fractional width, so without that overlap
   the sub-pixel seam lets the page bleed through as a faint light hairline. */
.notch::before, .notch::after {
  content: ''; position: absolute; top: 0;
  height: var(--notch-flare); width: calc(var(--notch-flare) + 1px);
}
.notch::before {
  left: calc(var(--notch-flare) * -1);
  background: radial-gradient(circle at 0% 100%, transparent var(--notch-flare), var(--cube-black, #000) calc(var(--notch-flare) + 1px));
}
.notch::after {
  right: calc(var(--notch-flare) * -1);
  background: radial-gradient(circle at 100% 100%, transparent var(--notch-flare), var(--cube-black, #000) calc(var(--notch-flare) + 1px));
}

/* auto-hide (notch.js): tucks up out of view, flares travel with it */
/* -160% (rather than just over 100%) so it always clears completely — no
   part-tucked state can linger if a measurement is off by a few pixels. */
.notch.is-hidden { transform: translateX(-50%) translateY(-160%); }

/* ---- entrance: drops in last, after the hero text has landed ----
   Delay is tuned to the hero sequence in hero.css (.d-act 1.05s + ~.95s,
   .d-hint 1.95s), so the notch arrives once the copy has settled.
   notch.js removes .is-intro on animationend so the animation stops
   overriding the .is-hidden transform afterwards.
   The easing must NOT overshoot: a springy curve carries the notch past
   its resting position, which drops it below the top edge and exposes the
   page behind it. This is a pure decelerate, so it only ever slides down
   into place. */
@keyframes notch-drop {
  from { transform: translateX(-50%) translateY(-130%); }
  to   { transform: translateX(-50%) translateY(0); }
}
.notch.is-intro { animation: notch-drop .6s cubic-bezier(0.22, 1, 0.36, 1) 2.15s both; }

/* Already revealed earlier this visit (flag set in the page head before first
   paint, so there's no flash): the nav should feel persistent across the site
   rather than re-announcing itself on every navigation. Scoped to html so it
   also beats the mobile animation-name override below. */
html.kos-notch-seen .notch.is-intro { animation: none; }

/* mobile variant: the bar is full width, so it isn't centred with translateX */
@keyframes notch-drop-full {
  from { transform: translateY(-130%); }
  to   { transform: translateY(0); }
}

.notch .brand { display: flex; align-items: center; margin-right: 20px; }
.notch .brand img { height: 22px; width: auto; display: block; filter: brightness(0) invert(1); }

.notch nav { display: flex; align-items: center; gap: 6px; }
.notch nav a {
  font-family: var(--cube-font-primary, var(--font, 'Poppins', system-ui, sans-serif));
  font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.80);
  text-decoration: none; padding: 8px 15px; border-radius: 9px; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.notch nav a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.notch nav a.active { color: #fff; }

/* ---- "For Schools" submenu ----
   NOT the old nav.css dropdown: that one is a white 3SC card with a hard
   black shadow, built for the light `.bar/.menu` navbar. Against the notch
   it read as a foreign object. This hangs off the notch in the SAME black,
   with the same bottom-corner radius and the same white-alpha hover as the
   nav links, so it reads as the menubar opening rather than a card landing
   on top of it. Desktop only — mobile (below) lays the same two items out
   statically inside the burger panel. */
.notch .has-sub { position: relative; display: flex; align-items: center; }
.notch .sub-parent { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.notch .sub-parent .chev { width: 10px; height: 10px; opacity: .65; transition: transform .2s ease, opacity .15s ease; }
.notch .has-sub:hover .sub-parent .chev,
.notch .has-sub.open .sub-parent .chev { opacity: 1; }
.notch .has-sub.open .sub-parent { background: rgba(255,255,255,0.12); color: #fff; }
.notch .has-sub.open .sub-parent .chev { transform: rotate(180deg); }

.notch .submenu {
  position: absolute; top: calc(100% + 9px); left: 0; z-index: 50;
  min-width: 306px; padding: 7px;
  background: var(--cube-black, #000); color: #fff;
  /* All four corners round here: the panel is detached from the bar, so the
     notch's "hangs from the top edge" 0 0 24px 24px profile doesn't apply. */
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.13);
  box-shadow: 0 16px 38px rgba(0,0,0,0.45);
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity .16s ease, transform .18s cubic-bezier(0.22, 1, 0.36, 1);
}
/* invisible bridge across the 9px gap, so hover doesn't drop on the way down */
.notch .submenu::before { content: ''; position: absolute; top: -11px; left: 0; right: 0; height: 11px; }
.notch .has-sub.open .submenu,
.notch .has-sub:hover .submenu,
.notch .has-sub:focus-within .submenu { opacity: 1; transform: none; pointer-events: auto; }

/* Two classes, so these out-specify `.notch nav a` (one class) and the items
   don't inherit the bar link's padding and size. */
.notch .submenu a {
  display: block; padding: 10px 12px; border-radius: 10px;
  color: rgba(255,255,255,0.82); white-space: normal;
}
.notch .submenu a:hover,
.notch .submenu a:focus-visible { background: rgba(255,255,255,0.12); color: #fff; }
.notch .submenu .sn { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.notch .submenu .sd {
  display: block; margin-top: 2px; max-width: 38ch;
  font-size: 11.5px; font-weight: 500; line-height: 1.4; color: rgba(255,255,255,0.52);
}
.notch .submenu a:hover .sd,
.notch .submenu a:focus-visible .sd { color: rgba(255,255,255,0.72); }
/* Current page: a green tick of a dot, the only colour in the panel. */
.notch .submenu a[aria-current="page"] { color: #fff; }
.notch .submenu a[aria-current="page"] .sn::after {
  content: ''; display: inline-block; vertical-align: middle;
  width: 6px; height: 6px; margin-left: 8px; border-radius: 50%;
  background: var(--cube-green, var(--green, #00ed71));
}

/* ---- hamburger (mobile only) ---- */
.notch .burger {
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 34px; height: 34px; margin-left: auto;
  padding: 0; border: 0; background: transparent; cursor: pointer;
}
.notch .burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: #fff; transition: transform .2s ease, opacity .2s ease; }
.notch.is-open .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.notch.is-open .burger span:nth-child(2) { opacity: 0; }
.notch.is-open .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---- mobile: FULL-WIDTH top bar ----
   The floating 80%-wide notch left a strip above and beside it that iOS
   painted page content into, and no amount of shading/repainting fixed it
   reliably. Anchoring the bar to the top edge at full width removes the
   strip entirely — there is nowhere for content to show through. Desktop
   keeps the floating notch. */
@media (max-width: 820px) {
  .notch {
    flex-wrap: wrap; align-items: center; align-content: flex-start;
    /* Body is inset by exactly the flare width, and the flares below reach the
       screen edges — so the black is still FULL WIDTH at y=0 (nothing can show
       above it, which is what fixed iOS) while each side gets the notch's
       S-profile: concave flare at the top, convex radius at the bottom. */
    left: var(--notch-flare); right: var(--notch-flare); width: auto; transform: none;
    height: auto; min-height: 52px; padding: 0 18px;
    /* Full width at the very top edge (so nothing can show above it), then the
       black curves inward as it descends — the page fills the corner outside
       the curve. Generous radius so the curve actually reads; 20px was too
       tight to notice. */
    border-radius: 0 0 34px 34px;
    /* The nav is always laid out (so it can animate), so the notch is a
       2-line flex container. The base `gap` also applies BETWEEN lines,
       which added 8px of dead space under row 1 (52 + 8 = 60px tall).
       Kill the row gap; the open nav supplies its own padding. */
    row-gap: 0;
    /* The notch tucks up into the black status band, and being black too it
       merges with it — pure movement is invisible there, so the exit read as
       a blink. Slower, decelerating, and fading as it leaves, which reads
       against any background. */
    transition: transform .42s cubic-bezier(0.22, 1, 0.36, 1), opacity .34s ease;
  }
  /* Flares stay on: they fill the outer strips at the top (reaching the screen
     edges) and give the upper curve of each side's S. */
  .notch::before, .notch::after { display: block; }
  /* no translateX to preserve now the bar is full width */
  .notch.is-hidden { transform: translateY(-160%); opacity: 0; }
  .notch.is-intro { animation-name: notch-drop-full; }
  /* Row 1 is pinned to exactly 52px. Without this the line box collapses to
     its tallest item (the 34px burger) as soon as the nav adds a second
     line, so opening the menu nudged the logo and burger upward. */
  .notch .brand, .notch .burger { height: 52px; }
  .notch .brand { margin-right: 0; order: 0; }
  /* burger sits beside the logo on row 1; the nav wraps onto row 2 */
  .notch .burger { display: flex; order: 1; }

  /* The options grow open rather than pop in — display:none can't be
     transitioned, so the panel is always laid out and its height animates. */
  .notch nav {
    order: 2; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 2px;
    max-height: 0; opacity: 0; overflow: hidden; padding: 0;
    transition: max-height .34s cubic-bezier(0.22, 1, 0.36, 1),
                opacity .24s ease,
                padding .34s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .notch.is-open nav { max-height: 460px; opacity: 1; padding: 2px 0 12px; }
  .notch nav a { padding: 12px 12px; font-size: 15px; }

  /* The dropdown can't be a dropdown here: the open nav is an animating
     max-height box with overflow:hidden, so an absolutely-positioned panel
     would be clipped. Both destinations are laid out statically instead —
     one tap from opening the burger, nothing hidden behind a second toggle.
     (Hence no chevron: there's nothing left to expand.) */
  .notch .has-sub { display: block; }
  .notch .sub-parent { display: flex; }
  .notch .sub-parent .chev { display: none; }
  .notch .submenu {
    position: static; opacity: 1; transform: none; pointer-events: auto;
    min-width: 0; padding: 0 0 0 12px; margin: 2px 0 4px;
    background: none; border: 0; border-left: 2px solid rgba(255,255,255,0.16);
    border-radius: 0; box-shadow: none; transition: none;
  }
  .notch .submenu::before { display: none; }
  .notch .submenu a { padding: 9px 12px; }
  .notch .submenu .sn { font-size: 14px; }
  .notch .submenu .sd { font-size: 11.5px; }
}


