/* ==========================================================================
   LockedIn Flow — site shell
   Design tokens, the one font stack, base element styles, and the shared
   header and footer. Every page loads this first; assets/site.css adds the
   component library and a page stylesheet adds page-specific layout.
   Header and footer are styled only through .site-nav* and .site-footer*.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* ---- type ------------------------------------------------------------ */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  --fs-display: clamp(56px, 8vw, 128px);   /* home hero only */
  --fs-h1: clamp(40px, 5.4vw, 76px);        /* page heroes */
  --fs-h2: clamp(30px, 3.6vw, 52px);
  --fs-h3: clamp(19px, 1.45vw, 22px);
  --fs-lede: clamp(17px, 1.35vw, 20px);
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-micro: 13px;
  --fs-mono: 11px;

  --tracking-display: -0.045em;
  --tracking-heading: -0.03em;
  --tracking-text: -0.011em;
  --tracking-mono: 0.14em;

  /* ---- FlowBrand: the dark instrument palette (BrandTheme.swift) --------- */
  --bg: #08090C;
  --bg-deep: #050709;
  --raised: #0E1014;
  --surface: #14171D;
  --surface-strong: #1B1F26;
  --control: #252C35;
  --steel: #879EB8;
  --line: rgba(135, 158, 184, .22);
  --line-strong: rgba(135, 158, 184, .38);
  --line-faint: rgba(135, 158, 184, .10);
  --line-ghost: rgba(135, 158, 184, .055);
  --t1: rgba(255, 255, 255, .96);
  --t2: #B2BAC4;
  --t3: #7D8794;
  --success: #4FE8B0;
  --warning: #FFAD4A;
  --danger: #FF5C7A;

  /* spectrum: belongs to the live signal, the mark and the active node only */
  --violet: #9C3BFF;
  --indigo: #526BFF;
  --cyan: #00D1FF;
  --spectrum: linear-gradient(90deg, #9C3BFF 0%, #526BFF 50%, #00D1FF 100%);
  --spectrum-v: linear-gradient(180deg, #9C3BFF 0%, #526BFF 50%, #00D1FF 100%);
  --spill: radial-gradient(ellipse 50% 60% at 50% 60%, rgba(82, 107, 255, .34), rgba(156, 59, 255, .12) 45%, rgba(0, 209, 255, .06) 60%, transparent 72%);

  /* ---- FlowWorkspace: the light document palette (Home, History) -------- */
  --w-canvas: #F1F2F4;
  --w-surface: #FDFDFE;
  --w-raised: #EAEDF0;
  --w-line: rgba(0, 0, 0, .11);
  --w-line-strong: rgba(51, 79, 110, .34);
  --w-t1: #121417;
  --w-t2: #444952;
  --w-t3: #676E78;
  --w-action: #1B4977;
  --w-success: #095D41;
  --w-danger: #9E1B2D;

  /* ---- layout ------------------------------------------------------------ */
  --max: 1200px;
  --gutter: clamp(16px, 4vw, 48px);
  --measure: 68ch;
  --sec: clamp(88px, 10vw, 160px);
  --sec-sm: clamp(56px, 7vw, 96px);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  /* ---- radii --------------------------------------------------------------- */
  --r-xs: 4px; --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;

  /* ---- elevation ---------------------------------------------------------- */
  --sh-card: inset 0 1px 0 rgba(255, 255, 255, .05), 0 24px 48px -32px rgba(0, 0, 0, .9);
  --sh-win: 0 0 0 1px rgba(255, 255, 255, .08), 0 40px 90px -30px rgba(0, 0, 0, .9), 0 12px 28px -12px rgba(0, 0, 0, .6), 0 0 0 .5px rgba(0, 0, 0, .6);
  --sh-bar: inset 0 0 0 1px var(--line-strong), inset 0 1px 0 rgba(255, 255, 255, .09), 0 4px 16px rgba(0, 0, 0, .48), 0 24px 40px -16px rgba(0, 0, 0, .9);
  --sh-menu: 0 24px 50px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(135, 158, 184, .2);
  --glow-signal: 0 0 24px rgba(82, 107, 255, .45);

  /* ---- motion ------------------------------------------------------------ */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --dur-1: .15s;
  --dur-2: .25s;

  /* ---- legacy aliases (kept for stylesheets that have not migrated) ------ */
  --shell-max: var(--max);
  --shell-gutter: var(--gutter);
  --shell-ground: var(--bg);
  --shell-raised: var(--surface);
  --shell-ink: var(--t1);
  --shell-soft: var(--t2);
  --shell-faint: var(--t3);
  --shell-line: var(--line-faint);
  --shell-focus: #ffffff;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--t2);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  letter-spacing: var(--tracking-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
b, strong { font-weight: 600; }
em, i { font-style: italic; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }

h1, h2, h3, h4 { color: var(--t1); font-weight: 600; text-wrap: balance; }
h1 { font-size: var(--fs-h1); line-height: 1.0; letter-spacing: var(--tracking-display); }
h2 { font-size: var(--fs-h2); line-height: 1.06; letter-spacing: var(--tracking-heading); }
h3 { font-size: var(--fs-h3); line-height: 1.3; letter-spacing: -0.018em; }
h4 { font-size: 17px; line-height: 1.3; letter-spacing: -0.014em; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--t1); }

:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 4px; }
::selection { background: rgba(82, 107, 255, .45); color: #fff; }
:target { scroll-margin-top: 88px; }

code, kbd, samp, pre { font-family: var(--font-mono); }

/* skip link (both class names are in use across pages) */
.skip, .skip-link {
  position: absolute; left: var(--gutter); top: -60px; z-index: 100;
  padding: 10px 14px; border-radius: var(--r-sm);
  background: #fff; color: #08090C; font-weight: 600; text-decoration: none;
}
.skip:focus, .skip-link:focus { top: 12px; }

/* --------------------------------------------------------------------------
   Header (markup is frozen; style only through .site-nav*)
   -------------------------------------------------------------------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 64px;
  background: rgba(8, 9, 12, .72);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--line-faint);
}

.site-nav__inner {
  max-width: var(--max);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-nav__brand,
.site-footer__brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
}

.site-nav__brand img {
  display: block;
  width: auto;
  height: 30px;
  max-width: none;
}

.site-nav__nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav__links a,
.site-nav__panel a {
  color: var(--t2);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.005em;
  transition: color var(--dur-1) ease;
}

.site-nav__links a:hover,
.site-nav__panel a:hover { color: var(--t1); }

.site-nav .site-nav__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: #F5F6F8;
  color: #08090C;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
  transition: background var(--dur-1) ease, transform var(--dur-1) var(--ease);
}

.site-nav .site-nav__action:hover { background: #fff; color: #08090C; }

/* Small screens: the links move into a native disclosure, no script needed. */
.site-nav__menu { position: relative; display: none; }

.site-nav__menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  color: var(--t1);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  list-style: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background var(--dur-1) ease, border-color var(--dur-1) ease;
}

.site-nav__menu > summary::-webkit-details-marker { display: none; }
.site-nav__menu > summary::marker { content: ""; }

/* a three-line glyph drawn in CSS, before the word "Menu" */
.site-nav__menu > summary::before {
  content: "";
  width: 14px;
  height: 10px;
  background: linear-gradient(currentColor, currentColor) 0 0 / 100% 1.5px no-repeat,
              linear-gradient(currentColor, currentColor) 0 50% / 100% 1.5px no-repeat,
              linear-gradient(currentColor, currentColor) 0 100% / 100% 1.5px no-repeat;
  opacity: .9;
}

.site-nav__menu[open] > summary { background: rgba(135, 158, 184, .14); border-color: rgba(135, 158, 184, .6); }

.site-nav__panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(260px, calc(100vw - (var(--gutter) * 2)));
  padding: 8px;
  display: grid;
  gap: 2px;
  background: rgba(14, 16, 20, .96);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--sh-menu);
  animation: site-nav-open var(--dur-2) var(--ease);
}

@keyframes site-nav-open {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.site-nav__panel a {
  display: block;
  padding: 12px 14px;
  border-radius: 9px;
  color: var(--t1);
  font-size: 15px;
  font-weight: 500;
}

.site-nav__panel a:hover { background: rgba(135, 158, 184, .12); }

/* The action is shown in the panel only when the header button is hidden. */
.site-nav__panel .site-nav__action {
  display: none;
  margin-top: 6px;
  height: 44px;
  font-size: 15px;
}

.site-nav a:focus-visible,
.site-nav summary:focus-visible,
.site-footer a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Footer (markup is frozen; style only through .site-footer*)
   -------------------------------------------------------------------------- */
.site-footer {
  position: relative;
  border-top: 1px solid var(--line);
  background: var(--bg-deep);
  color: var(--t2);
}

.site-footer__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 44px var(--gutter) 40px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 26px 48px;
  align-items: center;
}

.site-footer__brand img {
  display: block;
  width: auto;
  height: 24px;
  max-width: none;
  opacity: .92;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 24px;
}

.site-footer__links a {
  color: var(--t2);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  transition: color var(--dur-1) ease;
}

.site-footer__links a:hover { color: var(--t1); }

.site-footer .site-footer__legal {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 20px;
  border-top: 1px solid var(--line-faint);
  color: var(--t3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.6;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Breakpoints: 640 / 960 / 1280
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .site-nav__nav { gap: 10px; }
  .site-nav__links { display: none; }
  .site-nav__menu { display: block; }
  .site-footer__inner { grid-template-columns: 1fr; gap: 22px; }
  .site-footer__links { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .site-nav { height: 60px; }
  .site-nav__inner { gap: 12px; }
  .site-nav__brand img { height: 25px; }
  .site-nav__nav > .site-nav__action { height: 34px; padding: 0 13px; font-size: 13px; }
  .site-nav__menu > summary { height: 34px; padding: 0 12px; font-size: 13px; }
  .site-footer__inner { padding-block: 38px 34px; }
  .site-footer__links { gap: 10px 18px; }
}

@media (max-width: 440px) {
  /* The same action is the last item in the menu at this width. */
  .site-nav__nav > .site-nav__action { display: none; }
  .site-nav__panel .site-nav__action { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .site-nav a, .site-nav summary, .site-footer a, .site-nav__panel { transition: none; animation: none; }
}

@media (forced-colors: active) {
  .site-nav, .site-footer { border-color: CanvasText; }
  .site-nav .site-nav__action, .site-nav__menu > summary { border: 1px solid CanvasText; }
}
