/* moglight.com — the page's design system: tokens, type, layout, the nav, buttons, keycaps,
   section headings and the reveal motion every section shares. Section styles live in
   css/sections/<id>.css; moglight's own UI in css/ui.css. */

:root {
  color-scheme: dark;
  --ink: #050608;
  --night: #07090d;
  --deep: #0b0f16;
  --raised: #0f141c;
  --cyan: #61e9fb;
  --ice: #b8ffff;
  --cyan-deep: #00bded;
  --blue: #0075ff;
  --electric: #28d9ff;
  --cobalt: #003cff;
  --paper: #f4f6fa;

  --text: rgba(238, 243, 250, 0.95);
  --text-2: rgba(206, 216, 230, 0.66);
  --text-3: rgba(190, 202, 220, 0.6); /* ≥ 4.5:1 on the night: fine print, footer, labels */
  --text-4: rgba(190, 202, 220, 0.42); /* decorative only (separator dots), never text to read */
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --glass: rgba(14, 19, 27, 0.62);

  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Geist", "Segoe UI", system-ui, sans-serif;
  --font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Geist", "Segoe UI", system-ui, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Geist", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 1180px;
  --gutter: clamp(16px, 4.5vw, 48px);
  --section-pad: clamp(72px, 11vh, 132px);
  --nav-h: 64px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* ───────── reset */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 12px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--night);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
kbd { font: inherit; }
::selection { background: rgba(97, 233, 251, 0.28); color: #fff; }
:focus-visible { outline: 2px solid var(--electric); outline-offset: 3px; border-radius: 6px; }
/* Forced colors drop box-shadows, so focus drawn with one (outline: none) would vanish. */
@media (forced-colors: active) {
  :focus-visible { outline: 2px solid CanvasText !important; outline-offset: 3px; }
}

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 10px;
  background: var(--paper); color: var(--ink); font-weight: 600; transition: top 0.2s;
}
.skip:focus { top: 12px; }

/* Film grain over everything: a quiet texture so the darks never band. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ───────── layout */

.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.scene {
  position: relative;
  padding: var(--section-pad) 0;
  isolation: isolate;
  /* Glows and tilted stages may spill sideways; never let them widen the page on a phone. */
  overflow-x: clip;
}
main { overflow-x: clip; }
/* Every section but the hero styles itself from css/sections.css, which loads without blocking the
   first paint; until it arrives (the page's <link onload> adds .css-ready) they stay invisible
   rather than unstyled. */
.js:not(.css-ready) main > section:not(#top) { visibility: hidden; }
/* A soft pool of the brand's light behind a section's stage: light behind an object, never a wash.
   It sits on the stage's center (main.js measures the element marked data-glow, else the one after
   the section's head, into --glow-auto-x/y); a section may place it with --glow-x/--glow-y and size
   it with --glow-size. It isn't clipped at the section's box, so it fades out across the seam. */
.scene.has-glow::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: var(--glow-x, var(--glow-auto-x, 50%));
  top: var(--glow-y, var(--glow-auto-y, 55%));
  width: var(--glow-size, min(1100px, 120vw));
  aspect-ratio: 1.6;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(0, 117, 255, 0.16), rgba(0, 60, 255, 0.05) 55%, transparent 75%);
  pointer-events: none;
}

.scene-head { max-width: 760px; margin: 0 auto clamp(36px, 4vw, 56px); text-align: center; }
.scene-head.is-left { margin-left: 0; text-align: left; }
.scene-head .lede { margin-left: auto; margin-right: auto; }
.scene-head.is-left .lede { margin-left: 0; }

/* ───────── type */

.display, .h2, .h3 { font-family: var(--font-display); font-weight: 700; color: var(--text); text-wrap: balance; }
.display {
  font-size: clamp(46px, 7.6vw, 108px);
  line-height: 0.98;
  letter-spacing: -0.038em;
}
.h2 {
  font-size: clamp(32px, 4.3vw, 60px);
  line-height: 1.04;
  letter-spacing: -0.034em;
}
.h3 { font-size: clamp(21px, 2vw, 26px); line-height: 1.15; letter-spacing: -0.018em; font-weight: 650; }
/* The key words: one solid brand color, as in the launch film. No gradient text. */
.accent { color: var(--cyan); }
.lede {
  max-width: 30em;
  margin-top: clamp(18px, 2vw, 26px);
  font-size: clamp(17px, 1.45vw, 21px);
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--text-2);
  text-wrap: balance;
}
.lede strong { color: var(--text); font-weight: 600; }
.fine { font-size: 13px; color: var(--text-3); letter-spacing: 0.01em; }
.mono { font-family: var(--font-mono); }

/* Eyebrow: a quiet line above a headline, plain text: a short sentence-case label in the secondary
   text color, so the headline's own cyan stays the only accent. No keycaps: the page shows those
   only in the hero's invitation and the keyboard section's list (the founder, 2026-10-17).
   <p class="eyebrow" data-reveal>Search</p> */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-family: var(--font-text);
  font-size: 15px;
  font-weight: 500;
  line-height: 22px;
  letter-spacing: -0.005em;
  color: var(--text-2);
}

/* ───────── keycaps (marketing size, a little physical): only in the hero's invitation and the
   keyboard section's list; moglight's own UI draws its keys itself (css/ui.css) */

.kc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9em;
  height: 1.9em;
  padding: 0 0.5em;
  border-radius: 0.42em;
  font-family: var(--font-text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  color: rgba(235, 242, 250, 0.92);
  background: linear-gradient(180deg, #23272e, #16191e);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    0 1.5px 0 #0a0c0f,
    0 3px 8px rgba(0, 0, 0, 0.45);
  vertical-align: middle;
  white-space: nowrap;
}
.kc + .kc { margin-left: 0.28em; }
.kc.is-lit {
  color: #fff;
  background: linear-gradient(180deg, #1d3a48, #12252f);
  box-shadow:
    inset 0 1px 0 rgba(184, 255, 255, 0.25),
    0 0 0 1px rgba(97, 233, 251, 0.35),
    0 1.5px 0 #0a0c0f,
    0 0 22px rgba(97, 233, 251, 0.35);
}
.keys-inline { display: inline-flex; align-items: center; gap: 0.28em; white-space: nowrap; }
.keys-inline .kc + .kc { margin-left: 0; }

/* ───────── buttons */

.btn {
  --h: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--h);
  padding: 0 24px;
  border-radius: 999px;
  font-family: var(--font-text);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 0.25s var(--ease-out), background-color 0.25s, box-shadow 0.25s, color 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary {
  background: var(--paper);
  color: #06080b;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset, 0 10px 30px -8px rgba(97, 233, 251, 0.35), 0 0 0 0 rgba(97, 233, 251, 0);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px #fff inset, 0 14px 38px -8px rgba(97, 233, 251, 0.55), 0 0 0 6px rgba(97, 233, 251, 0.08); }
.btn-primary:active { transform: translateY(0) scale(0.985); }
.btn-ghost { color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); background: rgba(255, 255, 255, 0.02); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
.btn-sm { --h: 36px; padding: 0 16px; font-size: 14px; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 18px; }
.cta-note { margin-top: 16px; }

/* ───────── nav */

.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 80;
  height: var(--nav-h);
  transition: background-color 0.35s, box-shadow 0.35s, -webkit-backdrop-filter 0.35s, backdrop-filter 0.35s;
}
.nav.is-scrolled {
  background: rgba(7, 9, 13, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 1px 0 var(--line);
}
.nav .wrap { height: 100%; display: flex; align-items: center; gap: 28px; }
/* The wordmark: the kit's monoline "moglight", its i dotted with the spark (src/index.html's
   #wm symbol, the finale's mark). The spark's own glow may spill past the box. */
.wordmark { display: block; flex: none; overflow: visible; }
.brand { display: inline-flex; align-items: center; padding: 5px 0; color: var(--text); }
.brand .wordmark { width: 88px; height: 24px; }
.nav-links { display: flex; gap: 26px; margin-left: auto; font-size: 14.5px; color: var(--text-2); }
.nav-links a { transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }
/* The section in view (main.js sets aria-current): quietly brighter, nothing more. */
.nav-links a[aria-current] { color: var(--text); }
.nav .btn { margin-left: 4px; }
/* The nav's Download is flat under the frosted bar; it lights only on hover. */
.nav .btn-primary:not(:hover) { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset; }
@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav .btn { margin-left: auto; }
}

/* ───────── footer: one quiet line */

.site-footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--text-3); font-size: 14px; }
.foot-brand { display: inline-flex; align-items: center; gap: 14px; }
.foot-brand .wordmark { width: 67px; height: 18px; color: var(--text-2); }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-left: auto; }
.site-footer a { transition: color 0.2s; }
/* The open-source projects moglight is built on, credited above the rest of the footer. */
.site-footer .foot-oss { flex: 1 0 100%; margin: 0 0 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); color: var(--text-2); line-height: 1.5; }
.site-footer .foot-oss a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.site-footer .foot-oss a:hover { text-decoration-color: currentColor; }
/* The four names stay on one line, so a finger's targets (below) never stack over each other. */
.foot-names { white-space: nowrap; }
.site-footer a:hover { color: var(--text); }
@media (max-width: 760px) { .site-footer nav { margin-left: 0; column-gap: clamp(12px, 4vw, 22px); } }
/* Fingers: 44px targets for the nav's buttons and the footer's links. */
@media (pointer: coarse) {
  .motion-toggle, .nav .btn { position: relative; }
  .motion-toggle::before, .nav .btn::before { content: ""; position: absolute; inset: -5px; }
  .site-footer nav a { padding: 12px 0; }
  /* The credits' names sit a comma apart in a sentence: each gets a finger's height, more of it
     above (the footer's empty top) than over the next line, and half the gap to its neighbours
     (the margin keeps the words in place; positioned, the padding covers the commas between). */
  .site-footer .foot-oss a { position: relative; padding: 16px 4px 11px; margin: 0 -4px; }
  .site-footer .wrap { row-gap: 0; }
  /* The X card (card.html): its brand link (already positioned) and its smaller pause button. */
  .hero-card .hero-card-brand::before { content: ""; position: absolute; inset: -13px -8px; }
  .hero-card .motion-toggle::before { inset: -7px; }
}

/* ───────── reveal: content rises softly into place the first time it scrolls into view */

@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out);
    transition-delay: calc(var(--d, 0) * 1ms);
  }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
  /* Focus never waits on the rise: a block holding the focused control shows without delay. */
  .js [data-reveal]:focus-within { opacity: 1; transform: none; transition-delay: 0s; }
}

/* The visitor paused motion (the nav's button): everything jumps to its end state. */
.motion-off *, .motion-off *::before, .motion-off *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
.js.motion-off [data-reveal] { opacity: 1; transform: none; }

.motion-toggle {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: color 0.2s, background-color 0.2s;
}
.motion-toggle:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.motion-toggle svg { width: 12px; height: 12px; }
/* A toggle: "Pause animations", pressed while paused (the play glyph then says how to resume). */
.motion-toggle[aria-pressed="true"] { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.motion-toggle .i-play { display: none; }
.motion-toggle[aria-pressed="true"] .i-play { display: block; }
.motion-toggle[aria-pressed="true"] .i-pause { display: none; }
/* The system's Reduce Motion already stills the page: shown pressed, and inert. */
.motion-toggle[aria-disabled="true"], .motion-toggle[aria-disabled="true"]:hover { opacity: 0.5; cursor: default; background: none; color: var(--text-2); }
.hero-card .motion-toggle[aria-disabled="true"][aria-pressed] { background: rgba(4, 5, 7, 0.5); }
@media (max-width: 760px) { .nav .wrap { gap: 12px; } .nav .motion-toggle { margin-left: auto; } .nav .motion-toggle + .btn { margin-left: 0; } }

/* Stage: where a section's live demo sits; demos scale moglight's UI with --s. */
.stage { position: relative; margin: 0 auto; }
.stage .mog { --s: 1; }
/* On phones the panel keeps legible text and narrows instead (rows truncate, like the app). */
@media (max-width: 860px) { .stage .mog { --s: 0.86; } }
@media (max-width: 520px) { .stage .mog { --s: 0.76; } }

/* ───────── forced colors (Windows High Contrast): fills and shadows are dropped, so the buttons and
   keycaps that are drawn with them get a border (moglight's own UI: css/ui.css) */
@media (forced-colors: active) {
  .btn, .motion-toggle { border: 1px solid ButtonText; }
  .kc, #top .hero-cap { border: 1px solid CanvasText; }
  /* The hero's Apple logo is a white glyph inverted for the paper button; the button is the canvas
     now, so the glyph follows the canvas: light on a dark one, dark on a light one. */
  .btn img { filter: none !important; }
}
@media (forced-colors: active) and (prefers-color-scheme: light) {
  .btn img { filter: invert(1) !important; }
}
