/* ===========================================================================
   Multimode Mind — site styles. Tokens live in tokens.css.
   ========================================================================= */

/* --- Self-hosted fonts. No runtime CDN calls. --------------------------- */
@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 500;
  font-display: swap; src: url('/assets/fonts/space-grotesk-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 700;
  font-display: swap; src: url('/assets/fonts/space-grotesk-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('/assets/fonts/inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 500;
  font-display: swap; src: url('/assets/fonts/inter-500.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('/assets/fonts/ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500;
  font-display: swap; src: url('/assets/fonts/ibm-plex-mono-500.woff2') format('woff2');
}

/* --- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html:focus-within { scroll-padding-top: 6rem; }

body {
  background: var(--void);
  color: var(--phosphor-dim);
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* A single, very quiet scanline field. Not a gimmick layer — it sits at 1.5%
     and only exists so pure black never reads as flat dead space. */
  background-image: repeating-linear-gradient(
    180deg, rgba(143, 232, 107, 0.014) 0 1px, transparent 1px 3px
  );
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }

/* --- Focus: visible, phosphor, never removed --------------------------- */
:focus-visible {
  outline: 2px solid var(--store-structured);
  outline-offset: 3px;
  border-radius: var(--radius);
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute; left: var(--s-4); top: var(--s-4);
  z-index: 100;
  padding: var(--s-3) var(--s-4);
  background: var(--surface-raised);
  color: var(--phosphor-live);
  font-family: var(--font-mono); font-size: var(--t-small);
  border: 1px solid var(--rule-bright);
  transform: translateY(-200%);
}
.skip-link:focus { transform: translateY(0); }

/* Available to assistive tech, removed from the visual layout. */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Layout primitives -------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); position: relative; }
.section + .section { border-top: 1px solid var(--rule); }

/* --- Type ---------------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--store-structured);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
/* The eyebrow rule encodes a real thing: a terminal prompt, the subject's
   own vernacular. Not decoration. */
.eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  background: currentColor;
  flex: none;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--phosphor-live);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: 1.08;
  text-wrap: balance;
}

h2 { font-size: var(--t-h2); max-width: 20ch; }
h3 { font-size: var(--t-h3); line-height: 1.3; }

.lead {
  font-size: var(--t-lead);
  color: var(--phosphor-mid);
  max-width: var(--measure);
  line-height: 1.6;
}

.body-copy {
  max-width: var(--measure);
  margin-top: var(--s-5);
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0.875rem 1.375rem;
  font-family: var(--font-mono);
  font-size: var(--t-small);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}

.btn-primary {
  background: var(--store-structured);
  color: var(--void);
  font-weight: 500;
}
.btn-primary:hover { background: var(--bundle); }

.btn-secondary {
  border-color: var(--rule-bright);
  color: var(--phosphor-mid);
}
.btn-secondary:hover {
  border-color: var(--store-structured);
  color: var(--phosphor-live);
}

.btn svg { flex: none; }

/* =========================================================================
   Nav
   ========================================================================= */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--void) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  display: flex; align-items: center; gap: var(--s-6);
  height: 60px;
}

.brand {
  display: flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--phosphor-live);
  text-decoration: none;
  margin-right: auto;
}
.brand .mark { flex: none; }

.nav-links {
  display: flex; align-items: center; gap: var(--s-5);
  list-style: none; padding: 0;
}
.nav-links a {
  font-family: var(--font-mono);
  font-size: var(--t-small);
  color: var(--phosphor-dim);
  text-decoration: none;
  transition: color 140ms var(--ease);
}
.nav-links a:hover { color: var(--phosphor-live); }

.nav-github {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-mono); font-size: var(--t-small);
  color: var(--phosphor-live);
  text-decoration: none;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--rule-bright);
  border-radius: var(--radius);
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease);
}
.nav-github:hover {
  border-color: var(--store-structured);
  background: var(--surface);
}

@media (max-width: 720px) {
  .nav-links { display: none; }
}

/* =========================================================================
   Hero
   ========================================================================= */
.hero {
  padding-block: clamp(4rem, 11vw, 8.5rem) var(--section-y);
  position: relative;
  overflow: hidden;
}

.hero h1 {
  font-size: var(--t-display);
  max-width: 15ch;
  margin-bottom: var(--s-6);
}

.hero .lead { max-width: 58ch; }

.hero-actions {
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  margin-top: var(--s-7);
}

/* Four hairlines in store colors, converging toward the hero's right edge.
   A quiet foreshadow of the signature section — the thesis, stated in the
   margin before it is stated in full. */
.hero-rails {
  position: absolute;
  inset-block: 0;
  right: 0;
  width: min(38vw, 420px);
  pointer-events: none;
  opacity: 0.5;
}
@media (max-width: 900px) { .hero-rails { display: none; } }

/* =========================================================================
   Problem
   ========================================================================= */
.problem-body {
  max-width: var(--measure);
  margin-top: var(--s-6);
  font-size: var(--t-lead);
  line-height: 1.7;
}
/* The four nouns the paragraph turns on, marked in their store colors.
   The color coding *is* the argument: each kind of memory has a home. */
.k { font-weight: 500; }
.k-notes      { color: var(--store-notes); }
.k-structured { color: var(--store-structured); }
.k-files      { color: var(--store-files); }
.k-semantic   { color: var(--store-semantic); }

.problem-kicker {
  margin-top: var(--s-6);
  font-family: var(--font-display);
  font-size: var(--t-h3);
  color: var(--phosphor-live);
  max-width: var(--measure);
  font-weight: 500;
}

/* =========================================================================
   SIGNATURE — the four stores converging
   ========================================================================= */
.stores { position: relative; }

.stores-head { margin-bottom: var(--s-8); }

.converge {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-6);
}

/* The four channel cards */
.channels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
}

.channel {
  --c: var(--store-structured);
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--c);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: var(--s-5) var(--s-4) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
}
.channel[data-store='notes']      { --c: var(--store-notes); }
.channel[data-store='structured'] { --c: var(--store-structured); }
.channel[data-store='files']      { --c: var(--store-files); }
.channel[data-store='semantic']   { --c: var(--store-semantic); }

.channel-glyph {
  height: 44px;
  color: var(--c);
}
.channel-glyph svg { height: 100%; width: auto; }

.channel h3 {
  color: var(--c);
  font-family: var(--font-mono);
  font-size: var(--t-small);
  font-weight: 500;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
}

.channel p {
  font-size: var(--t-small);
  line-height: 1.55;
  color: var(--phosphor-dim);
}

.channel-backing {
  margin-top: auto;
  padding-top: var(--s-3);
  border-top: 1px dashed var(--rule-bright);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.04em;
  color: var(--c);
  opacity: 0.75;
}

/* The braid: real SVG geometry, four paths resolving into one bundle. */
.braid { width: 100%; height: clamp(140px, 20vw, 220px); display: block; }
.braid path { fill: none; stroke-linecap: round; }

.braid-stream { stroke-width: 1.75; }
.braid-stream.s-notes      { stroke: var(--store-notes); }
.braid-stream.s-structured { stroke: var(--store-structured); }
.braid-stream.s-files      { stroke: var(--store-files); }
.braid-stream.s-semantic   { stroke: var(--store-semantic); }

.braid-bundle { stroke: var(--bundle); stroke-width: 3; }

/* The one orchestrated motion moment: the streams draw and resolve on scroll. */
.braid path {
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
}
.stores.is-visible .braid path {
  animation: draw 1100ms var(--ease) forwards;
  animation-delay: var(--delay, 0ms);
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.bundle-out {
  margin-top: var(--s-2);
  display: flex;
  justify-content: center;
}
.bundle-chip {
  display: inline-flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  background: var(--surface-raised);
  border: 1px solid var(--rule-bright);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--t-small);
  color: var(--bundle);
}
.bundle-chip .dot {
  width: 7px; height: 7px; flex: none;
  background: var(--bundle);
  border-radius: 50%;
}

@media (max-width: 860px) {
  .channels { grid-template-columns: repeat(2, 1fr); }
  .braid { height: 120px; }
}
@media (max-width: 460px) {
  .channels { grid-template-columns: 1fr; }
  .channel { border-radius: var(--radius); }
  .braid { display: none; }
  .bundle-out { margin-top: var(--s-5); }
}

/* =========================================================================
   How it works
   ========================================================================= */
.how-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(var(--s-6), 5vw, var(--s-8));
  align-items: start;
}
@media (max-width: 900px) {
  .how-grid { grid-template-columns: 1fr; }
}

.code-block {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.code-head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--rule);
  background: var(--void);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--phosphor-dim);
}
.code-block pre {
  margin: 0;
  padding: var(--s-5);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.75;
  color: var(--phosphor-mid);
  tab-size: 2;
}
.code-block code { font-family: inherit; }

/* Token colors, tied to the store palette so the code reads as the same system. */
.c-key  { color: var(--store-structured); }
.c-type { color: var(--store-files); }
.c-str  { color: var(--store-notes); }
.c-com  { color: #5a6b60; font-style: normal; }
.c-punc { color: #55665c; }

/* =========================================================================
   Quick start
   ========================================================================= */
.start-inner { max-width: 720px; }

.command {
  display: flex; align-items: stretch;
  margin-top: var(--s-6);
  background: var(--surface);
  border: 1px solid var(--rule-bright);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.command-text {
  flex: 1 1 auto;
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  font-family: var(--font-mono);
  font-size: clamp(0.8125rem, 0.72rem + 0.4vw, 1rem);
  color: var(--phosphor-live);
  overflow-x: auto;
  white-space: nowrap;
}
.command-text .prompt {
  color: var(--store-structured);
  user-select: none;
  flex: none;
}

.copy-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding-inline: var(--s-4);
  background: var(--surface-raised);
  border: none;
  border-left: 1px solid var(--rule-bright);
  color: var(--phosphor-mid);
  font-family: var(--font-mono);
  font-size: var(--t-small);
  cursor: pointer;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.copy-btn:hover { background: var(--rule); color: var(--phosphor-live); }
.copy-btn[data-copied='true'] { color: var(--store-structured); }
.copy-btn .label { min-width: 4.25rem; text-align: left; }

.start-note {
  margin-top: var(--s-4);
  font-size: var(--t-small);
  color: var(--phosphor-dim);
  max-width: 58ch;
}

/* =========================================================================
   Scope
   ========================================================================= */
.scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-5);
  margin-top: var(--s-7);
}
@media (max-width: 640px) { .scope-grid { grid-template-columns: 1fr; } }

.scope-col {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s-5);
}
.scope-col h3 {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  margin-bottom: var(--s-4);
}
.scope-col[data-kind='is'] h3     { color: var(--store-structured); }
.scope-col[data-kind='is-not'] h3 { color: var(--danger); }

.scope-col ul { list-style: none; padding: 0; display: grid; gap: var(--s-3); }
.scope-col li {
  display: flex; align-items: baseline; gap: var(--s-3);
  font-size: 0.9375rem;
  color: var(--phosphor-mid);
}
.scope-col li::before {
  font-family: var(--font-mono);
  font-size: var(--t-small);
  flex: none;
}
.scope-col[data-kind='is'] li::before     { content: '+'; color: var(--store-structured); }
.scope-col[data-kind='is-not'] li::before { content: '\2212'; color: var(--danger); }

/* =========================================================================
   Footer
   ========================================================================= */
.footer {
  border-top: 1px solid var(--rule);
  padding-block: var(--s-7) var(--s-6);
  background: var(--surface);
}
.footer-top {
  display: flex; flex-wrap: wrap; gap: var(--s-5);
  align-items: baseline; justify-content: space-between;
}
.footer p { font-size: var(--t-small); }

.footer-links {
  display: flex; flex-wrap: wrap; gap: var(--s-5);
  list-style: none; padding: 0;
  font-family: var(--font-mono);
  font-size: var(--t-small);
}
.footer-links a {
  color: var(--phosphor-mid);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 140ms var(--ease), border-color 140ms var(--ease);
}
.footer-links a:hover {
  color: var(--phosphor-live);
  border-bottom-color: var(--store-structured);
}

.footer-bottom {
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: var(--s-4);
  justify-content: space-between;
  font-size: var(--t-micro);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  color: #55665c;
}
.footer-bottom a { color: inherit; text-decoration: none; }
.footer-bottom a:hover { color: var(--phosphor-mid); }

/* =========================================================================
   Reduced motion — honored throughout.
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  /* The braid must still be fully drawn, just not animated into place. */
  .braid path { stroke-dashoffset: 0 !important; }
}
