/* Shared nav (every page): a strip of cream paper with a scissor-cut bottom edge, sticky at the top.
   It lifts off the page (its soft paper shadow fades in) once the page scrolls. Links sit on the strip like folder
   tabs; a strip of sun-yellow paper tape rests under the page you are on (aria-current="page", set by build.py) and
   slides to the link under a fine pointer or keyboard focus (nav.js). "Log in" and "Book a school demo" sit at the
   right. Below 1200 px the links become a paper sheet that drops from the strip, each with its one line. */

.nv { --nv-h: 72px; position: sticky; top: 0; z-index: 60; }
.nv__bar { position: relative; z-index: 2; height: var(--nv-h); background: var(--paper) url(/assets/art/textures/paper-tile.webp) 0 0 / 512px 512px; }
/* the cut edge hangs below the strip; its shadow and a soft ambient shadow fade in when the page has scrolled */
.nv__bar::before, .nv__bar::after { content: ""; position: absolute; left: 0; right: 0; top: calc(100% - 1px); pointer-events: none; }
.nv__bar::after { height: 12px;
  background: var(--paper) url(/assets/art/textures/paper-tile.webp) 0 0 / 512px 512px;
  -webkit-mask: url(/assets/art/textures/edge-cut.svg) 0 0 / auto 100% repeat-x; mask: url(/assets/art/textures/edge-cut.svg) 0 0 / auto 100% repeat-x; }
.nv__bar::before { height: 34px;
  background: url(/assets/art/textures/edge-cut-shadow.webp) 0 0 / auto 12px repeat-x,
    linear-gradient(rgba(90, 42, 0, .16), rgba(90, 42, 0, .05) 45%, rgba(90, 42, 0, 0));
  opacity: 0; transition: opacity var(--m-small, 400ms) var(--m-settle, ease); }
.nv.is-stuck .nv__bar::before { opacity: 1; }

.nv__inner { width: var(--wrap); height: 100%; margin-inline: auto; display: flex; align-items: center; gap: 16px; }
.nv__logo { flex: none; display: block; margin-left: -4px; padding: 4px; border-radius: 12px; }
.nv__logo img { width: 150px; height: 44px; }
.nv__nav { flex: 1; min-width: 0; display: flex; justify-content: center; }

/* ---------- Desktop: links on the strip */
.nv__menu { position: relative; display: flex; align-items: center; }
.nv__links { display: flex; align-items: center; gap: 2px; }
.nv__link { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: center; min-height: 46px; padding: 0 12px;
  color: var(--ink); text-decoration: none; border-radius: 12px 14px 11px 13px / 13px 11px 14px 12px; }
.nv__name { display: inline-flex; align-items: center; gap: 7px; font: 800 16.5px/1 var(--font-body); letter-spacing: .005em; white-space: nowrap; }
.nv__line { display: none; }
/* hover: a sky paper tab rises behind the word */
.nv__link::before { content: ""; position: absolute; inset: 4px 0; z-index: -1; border-radius: inherit; background: var(--sky);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 1px rgba(90, 42, 0, .14);
  opacity: 0; transform: translateY(5px) scale(.94); transition: opacity var(--m-quick, 200ms) var(--m-settle, ease), transform var(--m-small, 400ms) var(--m-settle, ease); }
@media (hover: hover) and (pointer: fine) {
  .nv__link:hover::before { opacity: 1; transform: none; }
}
.nv__link:active::before { transform: scale(.97); transition-duration: var(--m-press, 100ms); }
/* the sun tape: rests under the current page's link, slides to the link being pointed at (transform only, nav.js) */
.nv__mark { position: absolute; left: 0; bottom: 3px; width: 100px; height: 7px; pointer-events: none; transform-origin: 0 50%;
  border-radius: 3px 5px 4px 2px / 4px 2px 5px 3px; background: var(--sun);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 1px 1px rgba(90, 42, 0, .28); opacity: 0; transition: opacity var(--m-quick, 200ms) var(--m-settle, ease); }
.nv__mark.is-on { opacity: 1; }
/* without the script, the current page still gets its tape (drawn on the link itself) */
html:not(.nv-live) .nv__link[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 3px; height: 7px;
  border-radius: 3px 5px 4px 2px / 4px 2px 5px 3px; background: var(--sun); box-shadow: 0 1px 1px rgba(90, 42, 0, .28); }

.nv__ctas { flex: none; display: flex; align-items: center; gap: 10px; }
.nv__cta { flex: none; min-height: 46px; padding: 0 20px; font-size: 16px; }
.nv__cta--bar { position: relative; } /* its magnetic light stays inside the button (R2 motion fix) */
.nv__menu-ctas { display: none; }
/* Log in: a small cream paper pill with a little paper key */
.nv__login { display: inline-flex; align-items: center; gap: 9px; min-height: 46px; padding: 0 18px 0 15px; border-radius: 999px;
  background: var(--card); color: var(--ink); font: 800 16px/1 var(--font-body); text-decoration: none; white-space: nowrap;
  box-shadow: inset 0 0 0 2px rgba(30, 42, 90, .14), 0 1px 1px rgba(90, 42, 0, .12);
  transition: transform var(--m-press, 100ms) var(--m-settle, ease), box-shadow var(--m-quick, 200ms) var(--m-settle, ease); }
@media (hover: hover) and (pointer: fine) { .nv__login:hover { box-shadow: inset 0 0 0 2px rgba(30, 42, 90, .3), var(--sh-paper-lift); } }
.nv__login:active { transform: translateY(1px) scale(.97); }
.nv__key { position: relative; flex: none; width: 21px; height: 12px; }
.nv__key::before { content: ""; position: absolute; left: 0; top: 0; width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 3.4px var(--sun-deep), 0 1px 0 rgba(90, 42, 0, .25); }
.nv__key::after { content: ""; position: absolute; left: 10px; top: 4.5px; width: 11px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--sun-deep) 0 58%, transparent 58% 70%, var(--sun-deep) 70%); box-shadow: 0 1px 0 rgba(90, 42, 0, .2); }
.nv__login[aria-current="page"] { box-shadow: inset 0 0 0 2px var(--sun-deep); }

.nv__toggle { display: none; flex: none; align-items: center; gap: 10px; min-height: 46px; padding: 0 16px 0 14px; border: 0;
  border-radius: 14px 16px 13px 15px / 15px 13px 16px 14px; background: var(--card); color: var(--ink); font: 800 16px/1 var(--font-body);
  box-shadow: inset 0 0 0 2px rgba(30, 42, 90, .12), 0 1px 1px rgba(90, 42, 0, .18); transition: transform var(--m-press, 100ms) var(--m-settle, ease); }
.nv__toggle:active { transform: scale(.96); }
.nv__burger { position: relative; width: 18px; height: 12px; }
.nv__burger i { position: absolute; left: 0; width: 18px; height: 2.5px; border-radius: 2px; background: currentColor;
  transition: transform var(--m-small, 400ms) var(--m-spring, ease); }
.nv__burger i:first-child { top: 1px; }
.nv__burger i:last-child { bottom: 1px; }
.nv.is-open .nv__burger i:first-child { transform: translateY(3.75px) rotate(45deg); }
.nv.is-open .nv__burger i:last-child { transform: translateY(-3.75px) rotate(-45deg); }

.nv__scrim { display: none; }

/* ---------- Below 1100 px: the menu is a paper sheet that drops from the strip */
@media (max-width: 1199.98px) {
  .nv { --nv-h: 66px; }
  .nv__inner { gap: 10px; }
  .nv__nav { order: 3; flex: none; }
  .nv__ctas { margin-left: auto; }
  .nv__toggle { order: 2; display: inline-flex; }
  .nv__mark { display: none; }
  html:not(.nv-live) .nv__link[aria-current="page"]::after { display: none; }

  /* z-index -1 inside the strip's stacking context: the sheet tucks under the cut edge and slides out from it */
  .nv__menu { position: absolute; left: 0; right: 0; top: calc(100% - 2px); z-index: -1; display: block;
    max-height: calc(100dvh - var(--nv-h) - 8px); overflow-y: auto; overscroll-behavior: contain;
    padding: 18px max(var(--gutter), calc((100% - 760px) / 2)) 26px;
    background: var(--card) url(/assets/art/textures/paper-tile.webp) 0 0 / 512px 512px;
    border-radius: 0 0 26px 22px / 0 0 22px 26px;
    box-shadow: 0 1px 1.5px rgba(90, 42, 0, .25), 0 26px 44px -18px rgba(90, 42, 0, .45);
    visibility: hidden; opacity: 0; transform: translateY(-14px);
    transition: opacity var(--m-quick, 200ms) var(--m-settle, ease), transform var(--m-small, 400ms) var(--m-exit, ease), visibility 0s linear var(--m-small, 400ms); }
  .nv.is-open .nv__menu { visibility: visible; opacity: 1; transform: none;
    transition: opacity var(--m-quick, 200ms) var(--m-settle, ease), transform 600ms var(--m-spring, ease), visibility 0s; }
  .nv__links { display: block; }
  .nv__links li + li { border-top: 1.5px dashed rgba(30, 42, 90, .13); }
  .nv__link { min-height: 66px; padding: 12px 6px; gap: 5px; border-radius: 14px; }
  .nv__link::before { inset: 4px -6px; }
  .nv__name { font: 800 22px/1.1 var(--font-display); letter-spacing: -.005em; }
  .nv__line { display: block; font: 600 16px/1.35 var(--font-body); color: var(--ink-2); }
  .nv__link[aria-current="page"] .nv__name::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--sun-deep); box-shadow: 0 1px 1px rgba(90, 42, 0, .3); }
  /* the rows settle in one after another as the sheet opens */
  .nv__links li { opacity: 0; transform: translateY(8px); transition: opacity var(--m-quick, 200ms) var(--m-settle, ease), transform var(--m-small, 400ms) var(--m-settle, ease); }
  .nv.is-open .nv__links li { opacity: 1; transform: none; }
  .nv.is-open .nv__links li:nth-child(2) { transition-delay: 35ms; }
  .nv.is-open .nv__links li:nth-child(3) { transition-delay: 70ms; }
  .nv.is-open .nv__links li:nth-child(4) { transition-delay: 105ms; }
  .nv.is-open .nv__links li:nth-child(5) { transition-delay: 140ms; }
  .nv.is-open .nv__links li:nth-child(6) { transition-delay: 175ms; }

  .nv__scrim { display: block; position: fixed; inset: 0; z-index: 1; background: rgba(24, 34, 77, .34);
    opacity: 0; visibility: hidden; transition: opacity var(--m-small, 400ms) var(--m-settle, ease), visibility 0s linear var(--m-small, 400ms); }
  .nv.is-open .nv__scrim { opacity: 1; visibility: visible; transition: opacity var(--m-small, 400ms) var(--m-settle, ease), visibility 0s; }
}
/* phones: the strip keeps the logo, Log in and the menu; the demo button moves into the sheet */
@media (max-width: 639.98px) {
  .nv { --nv-h: 62px; }
  .nv__logo img { width: 122px; height: 36px; }
  .nv__cta--bar { display: none; }
  .nv__login { min-height: 44px; padding: 0 14px 0 12px; font-size: 15.5px; gap: 7px; }
  .nv__toggle { min-height: 44px; padding: 0 13px 0 12px; font-size: 15.5px; gap: 8px; }
  .nv__menu-ctas { display: grid; gap: 12px; margin-top: 20px; }
  .nv__menu-ctas .btn { width: 100%; min-height: 52px; font-size: 17px; }
}
@media (max-width: 359.98px) {
  .nv__key { display: none; }
  .nv__toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
html.nv-lock { overflow: hidden; }
/* the open phone menu is modal: it (and its scrim) sit above the fixed helpers, such as Suri (z-index 60) */
html.nv-lock .nv { z-index: 80; }

/* ---------- Preferences */
@media (prefers-reduced-motion: reduce) {
  .nv__bar::before, .nv__link::before, .nv__mark, .nv__burger i, .nv__menu, .nv__links li, .nv__scrim, .nv__login { transition: none !important; }
}
@media (prefers-contrast: more) {
  .nv__bar { box-shadow: inset 0 -2px 0 var(--ink); }
  .nv__toggle, .nv__login { box-shadow: inset 0 0 0 2px var(--ink); }
}
@media (forced-colors: active) {
  .nv__bar::after, .nv__bar::before { display: none; }
  .nv__bar { border-bottom: 2px solid CanvasText; }
  .nv__mark { background: Highlight; }
  .nv__link[aria-current="page"] { outline: 2px solid Highlight; }
  .nv__login { border: 1px solid ButtonText; }
}

/* R6 (9 Nov): a signed-in visitor sees "Open Naalai · name" instead of "Sign in"; the key turns into a green dot */
.nv__login.is-in .nv__key { background: #3FA96B; box-shadow: 0 0 0 3px rgba(63, 169, 107, .22); border-radius: 50%; width: 10px; height: 10px; }
.nv__login.is-in { font-weight: 800; }

.nv__login.is-in .nv__key { width: 12px; height: 12px; border-radius: 50%; background: #3FA96B; box-shadow: 0 0 0 3px rgba(63, 169, 107, .22); }
.nv__login.is-in .nv__key::before, .nv__login.is-in .nv__key::after { content: none; }

/* Kuru sign in: the children's door, one tap from every page. On the desktop bar it is Kuru's face only: its words
   ("Kuru sign in") stay in the markup for screen readers and show as the link's hover text (title). Below 1200 px the
   pill is gone and the phone menu carries "Kuru sign in (children)" as a button. */
.nv__kuru { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 7px; border-radius: 999px; background: #EAF3FF; color: var(--ink); font: 700 14px/1 var(--font-body); text-decoration: none; box-shadow: inset 0 0 0 1.5px #CFE1FF; white-space: nowrap; }
.nv__kuru img { width: 26px; height: 26px; border-radius: 50%; }
.nv__kuru span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.nv__kuru:hover { background: #DCEBFF; }
@media (max-width: 1199.98px) { .nv__kuru { display: none; } }

/* Signed in, the bar carries "Open Naalai · name" (nav.js writes <span class="nv__lab">Open Naalai<span class="nv__who"> · name</span></span>).
   A long name is cut with an ellipsis inside the pill and never pushes the bar sideways (Lane G saw /games/ and /pricing/ overflow at 390 px). */
.nv__login.is-in { max-width: min(46vw, 210px); overflow: hidden; white-space: nowrap; }
.nv__lab { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1199.98px) { .nv__ctas { min-width: 0; } .nv__login.is-in { max-width: 38vw; } }

/* R8 (10 Nov 2026): the desktop bar holds the logo, SIX links (Kuru Sings joined Kuru Maths and Kuru Games), Kuru's pill,
   Sign in (or the signed-in name) and the demo button, with clear air between them at every width from 1200 px up.
   The page wrap is 1200 px at most, so 1280, 1366, 1440 and 1920 px all give the bar the same room.
   Measured by tests/site/site_errors.py --bar: no wrap, no overlap, signed out and signed in. */
@media (min-width: 1200px) {
  .nv__inner { gap: 10px; }
  .nv__link { padding: 0 7px; }
  .nv__name { font-size: 15.5px; }
  .nv__login { padding: 0 14px 0 12px; font-size: 15px; }
  .nv__cta { padding: 0 16px; font-size: 15px; }
  .nv__ctas { gap: 8px; }
  .nv__login.is-in { max-width: 170px; }
}
/* 1200 to 1279 px: the wrap is narrower here (1120 px at 1200), so the links sit a little closer and the signed-in pill
   says "Open Naalai" without the name */
@media (min-width: 1200px) and (max-width: 1279.98px) {
  .nv__link { padding: 0 6px; }
  .nv__name { font-size: 14.5px; }
  .nv__who { display: none; }
}
