/* ==========================================================================
   NSR prototype - persistent chrome
   loader, WebGL layer, logo, menu button, menu sheet, floating CTA, top bar, section sweep
   ========================================================================== */

/* ---------- loader --------------------------------------------------------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--carbon);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--e-out);
}
body.loading #loader { opacity: 1; pointer-events: auto; }

/* ---------- section hand-off sweep (desktop) --------------------------------- */
#texsweep {
  position: fixed;
  z-index: 8;
  top: var(--frame);
  left: var(--frame);
  width: calc(100% - var(--frame) * 2);
  height: calc(100% - var(--frame) * 2);
  border-radius: var(--radius);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}
#texsweep canvas { position: absolute; left: 0; top: 0; will-change: transform; } /* the still of the dots, slid across by a transform */

/* ---------- page-transition veil: a wave of the destination colour ------------------- */
#veil {
  position: fixed;
  z-index: 90;
  top: var(--frame);
  left: var(--frame);
  width: calc(100% - var(--frame) * 2);
  height: calc(100% - var(--frame) * 2);
  overflow: visible;
  pointer-events: none;
}
#veil path { fill: var(--carbon); }
#veil[data-theme="light"] path { fill: var(--salt); }
#veil[data-theme="signal"] path { fill: var(--infrared); }

/* ---------- WebGL layer ---------------------------------------------------- */
#gl { position: fixed; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
html.no-webgl #gl { display: none; }

/* a soft pool of light behind the hero object: cool graphite, with a low Infrared kicker. It follows the object (blob.js) and is clipped to the panel. */
#halo-clip { position: fixed; inset: var(--frame); z-index: 1; overflow: hidden; border-radius: var(--radius); pointer-events: none; }
#halo {
  position: absolute; left: -500px; top: -500px; width: 1000px; height: 1000px; opacity: 0; pointer-events: none; will-change: transform, opacity;
  background: radial-gradient(closest-side, rgba(184, 188, 186, 0.19), rgba(184, 188, 186, 0.09) 34%, rgba(184, 188, 186, 0.03) 66%, rgba(184, 188, 186, 0) 100%);
}
#halo::after {
  content: ""; position: absolute; inset: 0; transform: translate(10%, 12%) scale(0.52);
  background: radial-gradient(closest-side, rgba(255, 59, 104, 0.16), rgba(255, 59, 104, 0.05) 48%, rgba(255, 59, 104, 0) 100%);
}
html.no-webgl #halo-clip, html.no-js #halo-clip { display: none; }

/* fine film grain over everything below the header: it breaks up the banding of dark gradients and takes the flat digital edge off the panel */
#grain {
  position: fixed; inset: 0; z-index: 30; pointer-events: none;
  background-image: var(--grain); background-size: 220px 220px; /* the strength (about 7.5%) is in the picture's own alpha, see --grain in base.css */
}
html.no-js #grain { display: none; }

/* ---------- header scrim: once the page moves, type that scrolls under the logo and menu button fades out before it reaches them ---------- */
#topscrim {
  position: fixed;
  z-index: 40;
  top: var(--frame);
  left: var(--frame);
  right: var(--frame);
  height: 104px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(to bottom, var(--panel) 0%, var(--panel) 46%, transparent 100%); /* no mask: a masked fixed layer is composited again on every frame */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--e-ui);
}
body.scrolled #topscrim { opacity: 1; }
body.edge #topscrim, body.menu-open #topscrim { opacity: 0; } /* while a sheet's soft corner passes under the header there is nothing to hide, and a scrim of either colour would paint a band over it */

/* ---------- logo: the outlined NSR Media lockup, Salt or Carbon only, never animated ------------------------ */
/* the header is two soft pills floating over whatever is beneath (Apple: chrome is a translucent material, so it stays legible over a photograph, a sheet's edge or the Infrared poster alike) */
:root { --pill-bg: rgba(9, 10, 11, 0.5); --pill-line: rgba(243, 241, 236, 0.1); }
body[data-theme="light"] { --pill-bg: rgba(243, 241, 236, 0.8); --pill-line: rgba(9, 10, 11, 0.1); }
body[data-theme="signal"] { --pill-bg: rgba(255, 59, 104, 0.78); --pill-line: rgba(9, 10, 11, 0.16); }
#logo, #menu-btn {
  background-color: var(--pill-bg); box-shadow: inset 0 0 0 1px var(--pill-line);
  transition: color 0.2s var(--e-soft), background-color 0.2s var(--e-soft), box-shadow 0.2s var(--e-soft);
}
/* frosted glass where there is a mouse. A blur is a render pass over the pill's backdrop on every frame: it cost about 70 ms of load time on the phone profile
   (measured with qa/chrome-bisect.cjs), so touch devices get a more solid pill with no blur instead */
@media (hover: hover) and (pointer: fine) {
  #logo, #menu-btn { -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); }
}
@media (hover: none), (pointer: coarse) {
  :root { --pill-bg: rgba(9, 10, 11, 0.86); }
  body[data-theme="light"] { --pill-bg: rgba(243, 241, 236, 0.92); }
  body[data-theme="signal"] { --pill-bg: rgba(255, 59, 104, 0.92); }
}
body.menu-open #logo, body.menu-open #menu-btn { background-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; } /* over the menu sheet they sit on one flat colour */
#logo {
  border-radius: var(--r-pill);
  position: fixed;
  z-index: 105;
  top: calc(var(--frame) + 16px);
  left: calc(var(--frame) + 32px);
  display: block;
  width: 178px;
  padding: 12px 18px;
  color: var(--salt);
}
#logo svg { display: block; width: 100%; height: auto; }
body[data-theme="light"] #logo, body[data-theme="signal"] #logo { color: var(--carbon); }
body.menu-open #logo { color: var(--sheet-ink); }

/* ---------- menu button ---------------------------------------------------- */
#menu-btn {
  border-radius: var(--r-pill);
  position: fixed;
  z-index: 100;
  top: calc(var(--frame) + 16px);
  right: calc(var(--frame) + 28px);
  height: 56px;
  padding: 0 14px 0 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--salt);
}
#menu-btn .lbl { font-family: var(--f-body); font-weight: 600; font-size: 16px; line-height: 1; }
#menu-btn svg { width: 38px; height: 38px; overflow: visible; }
#menu-btn .track { stroke: currentColor; stroke-width: 2; fill: none; }
#menu-btn .knob { stroke: currentColor; stroke-width: 2; fill: var(--panel); transition: fill 0.35s var(--e-soft); }
body[data-theme="light"] #menu-btn, body[data-theme="signal"] #menu-btn { color: var(--carbon); }
body.menu-open #menu-btn { color: var(--sheet-ink); }
body.menu-open #menu-btn .knob { fill: var(--page-bg); }
body.menu-open #menu-btn:focus-visible, body.menu-open #logo:focus-visible, #menu :focus-visible { outline-color: var(--sheet-focus); }

/* ---------- top bar: the eyebrow sits where the foundation keeps its rotating line --------------------------- */
#topline {
  position: absolute;
  z-index: 10;
  top: calc(var(--frame) + 24px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 44vw;
  margin: 0;
  text-align: center;
  color: var(--meta);
}

/* ---------- menu sheet ----------------------------------------------------- */
#menu {
  position: fixed;
  z-index: 50;
  top: 0;
  left: var(--frame);
  right: var(--frame);
  height: 63vh;
  overflow: hidden;
  color: var(--sheet-ink);
  pointer-events: none;
  visibility: hidden;
}
body.menu-open #menu { pointer-events: auto; visibility: visible; }
#menu .menu-inner { position: relative; display: flex; flex-direction: column; height: 100%; padding: 120px calc(var(--col) * 2) 0; }
#menu nav.big { display: flex; flex-wrap: wrap; gap: 0 3.2vw; align-items: baseline; }
#menu nav.big a {
  display: inline-block;
  font-family: var(--f-display);
  font-weight: var(--disp-wght);
  font-stretch: var(--disp-wdth);

  letter-spacing: var(--ls-display);
  font-size: clamp(30px, 4.2vw, 70px);
  line-height: 1;
  color: var(--sheet-ink);
  opacity: 0;
  transition: color 0.3s var(--e-ui);
}
#menu nav.big a:hover, #menu nav.big a:focus-visible { color: var(--sheet-accent); }
#menu .menu-cta { margin-top: 4vh; opacity: 0; }
#menu .menu-cta .btn-primary { background: var(--sheet-btn-bg); color: var(--sheet-btn-ink); }
#menu .menu-cta .btn-primary:hover { background: var(--sheet-btn-hover); }
#menu .svc-groups {
  margin-top: auto;
  margin-bottom: 5vh;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* six offerings: three across, two rows */
  gap: 14px 28px;
  opacity: 0;
}
#menu .svc-group { border-top: 1px solid var(--sheet-hair); padding-top: 12px; }
#menu .svc-also { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 26px; margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--sheet-hair); font-size: 15px; color: var(--sheet-soft); }
#menu .svc-also span { font-family: var(--f-index); font-weight: var(--w-label); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
#menu .svc-also a { display: inline-block; padding: 8px 0; color: var(--sheet-ink); }
#menu .svc-also a:hover, #menu .svc-also a:focus-visible { color: var(--sheet-accent); }
#menu .svc-h { margin: 0 0 8px; font-family: var(--f-index); font-weight: var(--w-label); font-size: 11.5px; line-height: 1.3; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sheet-soft); }
#menu .svc-group a { display: block; padding: 5px 0; color: var(--sheet-ink); }
#menu .svc-group a b { display: block; font-weight: 600; font-size: 16px; line-height: 1.2; }
#menu .svc-group a span { display: block; font-size: 13.5px; line-height: 1.35; color: var(--sheet-soft); }
#menu .svc-group a:hover b, #menu .svc-group a:focus-visible b { color: var(--sheet-accent); }

/* ---------- floating call-to-action: a square Infrared button, shown once the hero buttons leave ------------------ */
#cta {
  position: fixed;
  z-index: 110;
  right: calc(var(--frame) + 20px);
  bottom: calc(var(--frame) + 20px);
  min-height: 48px;
  padding: 0 18px;
  gap: 10px;
  font-size: 15px;
  opacity: 0;
  visibility: hidden; /* not focusable while it is away */
  pointer-events: none;
  transform: translateY(8px) scale(0.92);
  transform-origin: 100% 100%;
  transition: opacity 0.22s var(--e-out), transform 0.26s var(--e-out), visibility 0s linear 0.26s, background-color 0.18s var(--e-ui), color 0.18s var(--e-ui);
}
#cta svg { width: 16px; height: 10px; flex: none; }
#cta.is-on { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition: opacity 0.4s var(--e-out), transform 0.5s var(--e-out), background-color 0.18s var(--e-ui), color 0.18s var(--e-ui); }
#cta.is-on:active { transform: scale(0.97); transition-duration: 0.4s, 0.08s, 0.18s, 0.18s; }
body.menu-open #cta { opacity: 0; pointer-events: none; }
body[data-theme="light"] #cta { background: var(--infrared); color: var(--carbon); }
body[data-theme="light"] #cta:hover { background: var(--infrared-300); }
body[data-theme="signal"] #cta { background: var(--carbon); color: var(--salt); }
body[data-theme="signal"] #cta:hover { background: #2b2f2e; }

/* ---------- responsive chrome ---------------------------------------------- */
@media (max-width: 1024px) {
  #menu nav.big a { font-size: clamp(28px, 5vw, 54px); }
  #menu .svc-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin-bottom: 4vh; }
  #topline { max-width: 36vw; }
}
@media (max-width: 768px) {
  #logo { top: 12px; left: 12px; width: 146px; padding: 11px 19px; }
  #menu-btn { top: 12px; right: 12px; height: 46px; padding: 0 10px 0 18px; }
  #menu-btn .lbl { font-size: 15px; }
  #topline { top: 74px; max-width: 86vw; text-align: center; }
  #menu { left: 0; right: 0; height: 100%; }
  #menu .menu-inner { padding: 92px calc(var(--col) * 1.5) 0; }
  #menu nav.big { flex-direction: column; align-items: flex-start; gap: 4px; }
  #menu nav.big a { font-size: clamp(24px, min(8.4vw, 5.2svh), 42px); }
  #menu .menu-cta { margin-top: 22px; }
  #menu .svc-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 28px; margin-bottom: 0; gap: 10px 18px; }
  #menu .svc-group a span { display: none; }
  #menu .svc-group a b { font-size: 15px; }
  #cta { right: 16px; bottom: 16px; }
}
/* a very narrow window (a side pane, a small split view): the two header pills no longer fit side by side, so the menu button keeps its icon and gives up its word (its accessible name is on the button) */
@media (max-width: 340px) {
  #logo { width: 124px; padding: 9px 15px; }
  #menu-btn { padding: 0 8px; }
  #menu-btn .lbl { display: none; }
  #topline { max-width: 94vw; }
}
@media (prefers-reduced-motion: reduce) {
  #logo, #menu-btn, #menu-btn .knob, #topline { transition: none; }
}

/* transparency turned off: the pills become solid */
@media (prefers-reduced-transparency: reduce) {
  :root { --pill-bg: rgb(23, 26, 27); }
  body[data-theme="light"] { --pill-bg: rgb(243, 241, 236); }
  body[data-theme="signal"] { --pill-bg: rgb(255, 59, 104); }
  #logo, #menu-btn { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
