/* ============================================================================
   Memstead — shared brochure design system (memstead.com + memstead.io)
   SINGLE SOURCE: websites/shared/brochure/styles.css. Each site's npm
   predev/prebuild copies this sheet (plus fingerprint.js and fonts/) into
   its public/ via ../shared/brochure/sync.sh — those public/ copies are
   generated and gitignored; edit only this file. The registry embeds the
   .io build output, so it inherits the synced copy automatically.
   Homestead + blueprint: warm paper, structural indigo, one accent
   per surface. Default accent = forest-sage green (.com). The .io pages add
   class="io" on <html> to switch the accent to harvest gold (see html.io
   below). The .ai runtime has its own system — light cool-mist + royal blue.
   See SPEC §2 Palette.
   Type duality: humanist sans for prose, mono for structure, serif for brand.
   Hard rules (from SPEC §2): no particle constellation, no neon gradient.
   ============================================================================ */

/* Self-hosted webfonts (variable Fraunces / Inter / JetBrains Mono), synced
   to /fonts/ alongside this sheet. Same-origin — no Google Fonts request. */
@import url('/fonts/fonts.css');

:root {
  /* Warm parchment base — the homestead, not a cold AI dark-mode */
  --paper:      #F1E7D6;
  --paper-2:    #EADFCB;   /* recessed panels */
  --paper-edge: #DED0B6;

  /* Warm near-black — never pure #000 */
  --ink:        #211A12;
  --ink-soft:   #5A4E3F;
  --ink-faint:  #6B5E4C;   /* darkened from #8A7C68 → clears WCAG AA 4.5:1 on paper + paper-2 for the small mono labels/captions */

  /* Per-surface accent — DEFAULT = forest-sage green (.com, the homestead).
     Token name kept as --ember for now; it drives every accent across the
     shared system (fills, links via --ember-deep, the --fp-ember glyph). The
     .io surface overrides these three in the html.io block after :root. */
  --ember:      #4F7A52;   /* fills, glyph, focus — AA with off-white btn text */
  --ember-deep: #2F5A38;   /* links / text on paper — clears WCAG AA 4.5:1 */
  --ember-wash: rgba(79, 122, 82, 0.12);

  /* Structural ink — blueprint indigo/slate for lines and grids */
  --indigo:      #2C3A56;
  --indigo-soft: #56668A;
  --line:        rgba(44, 58, 86, 0.20);
  --line-strong: rgba(44, 58, 86, 0.42);

  /* Dark blueprint panel — for "what your agent reads" (warm charcoal) */
  --slate:      #1A1714;
  --slate-2:    #241F1A;
  --slate-line: rgba(241, 231, 214, 0.14);
  --on-slate:   #E8DEC9;
  --on-slate-soft: #A99E89;

  --maxw: 1080px;
  --gutter: clamp(20px, 5vw, 56px);
  /* Two-step radius scale: --radius for chips/pills/inputs, --radius-lg for
     framed containers (entity window, app panel, devnote). Nothing else. */
  --radius: 4px;
  --radius-lg: 8px;

  --font-prose: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  --font-display: 'Fraunces', Georgia, serif;
}

/* ---- memstead.io surface ---------------------------------------------- */
/* Same shared base, accent switched to harvest gold. Activated by class="io"
   on <html> (the registry landing + the mem-detail page). Gold is accent-only:
   bright for fills/glyph/focus, dark OLIVE-gold (--ember-deep) for text/links so
   it clears WCAG AA on paper without drifting back toward terracotta. */
html.io {
  --ember:      #CBA827;   /* fills, glyph, focus, borders — pairs with ink text */
  --ember-deep: #5F5210;   /* links / text on paper — olive-gold, AA 4.5:1, not brown */
  --ember-wash: rgba(203, 168, 39, 0.13);
}
/* Gold + off-white text fails AA, so the primary button takes ink text on .io;
   --ember-deep is reserved for links, so hover uses an explicit mid-gold that
   keeps the ink legible. */
html.io .btn-primary { background: var(--ember); color: var(--ink); }
html.io .btn-primary:hover { background: #B8901E; }

* { box-sizing: border-box; }

/* Anchor targets must clear the 64px sticky header, or #how/#faq jumps hide
   the section heading behind it. */
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-prose);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Paper tooth — one static fractal-noise film over the whole surface, the
   print-honest depth move (SPEC §2 allows texture, bans gradients/particles).
   Baked as a tiling data-URI: zero runtime filter cost. multiply keeps it a
   pure darkening grain; at .035 it is felt as fiber, never seen as noise. */
html::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  pointer-events: none;
  opacity: .035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Faint blueprint grid — the architectural ground. Never particles. */
.blueprint-ground {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
}

a { color: var(--ember-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { font-weight: 500; line-height: 1.1; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
p { text-wrap: pretty; }

/* Display cut — each surface's single display H1 takes Fraunces' full
   opsz 144 (auto optical sizing tops out at the rendered px size; pinning
   144 buys the high-contrast letterforms the face was drawn for). */
.hero h1, .io-hero h1 { font-variation-settings: "opsz" 144; }

/* In-development callout — the same live-status voice on every surface.
   The accent edge, wash, and dot follow the surface's --ember automatically
   (.com forest green, .io harvest gold). Layout (margins, max-width) stays
   with each page. */
.hero-devnote, .io-devnote {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ember);
  border-radius: var(--radius);
  background: var(--ember-wash);
}
.hero-devnote b, .io-devnote b { color: var(--ink); font-weight: 600; }
.hero-devnote .dot, .io-devnote .dot { color: var(--ember-deep); font-weight: 700; }
/* The status dot breathes — a live indicator, literally "in active
   development". Still under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .hero-devnote .dot, .io-devnote .dot { animation: dev-breathe 2.6s ease-in-out infinite; }
}
@keyframes dev-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* Selected text carries the surface accent — small, felt, everywhere. */
::selection { background: color-mix(in srgb, var(--ember) 28%, var(--paper)); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--indigo-soft);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--ember);
}

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  font-family: var(--font-prose);
  font-size: 15px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  /* The lift rides a spring-like linear() curve — same 1px of restraint,
     engineered settle instead of a plain ease. */
  transition: transform .3s linear(0, .62 38%, 1.08 68%, .99 86%, 1), background .15s ease, border-color .15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--ember); color: #FFF7EE; }
.btn-primary:hover { background: var(--ember-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }

/* ---- Header ----------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
/* Once the page scrolls, the header gains a whisper of depth — scroll-driven,
   pure CSS, absent (and fine) where the timeline isn't supported. */
@supports (animation-timeline: scroll()) {
  .site-header {
    animation: header-depth linear both;
    animation-timeline: scroll();
    animation-range: 0 140px;
  }
  @keyframes header-depth {
    to { box-shadow: 0 10px 30px -18px rgba(33, 26, 18, 0.38); border-bottom-color: var(--line-strong); }
  }
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand .glyph { width: 30px; height: 30px; display: block; }
/* Every TLD token — the brand wordmark AND the sibling cross-links — renders in
   the current page's own accent, the same hue no matter where it appears
   (.com green · .io gold · .ai blue). */
.tld { color: var(--ember-deep); }
.nav { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.nav a { color: var(--ink-soft); font-size: 14.5px; font-weight: 500; }
.nav a:hover { color: var(--ink); text-decoration: none; }
/* .nav a's specificity beats .btn-primary's — restate the button text color
   so the header CTA keeps its off-white label. */
.nav .btn-primary, .nav .btn-primary:hover { color: #FFF7EE; }
.nav .sep { width: 1px; height: 20px; background: var(--line); }

/* Sibling-surface cross-links — the uniform "surface switcher" in every header.
   The domain shows in full; its .tld takes the current page's accent (above). */
.xnav { display: inline-flex; align-items: center; gap: 16px; }
.nav .xlink { font-family: var(--font-mono); font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.nav .xlink:hover { color: var(--ink); text-decoration: none; }
/* Header CTA (used by the .com brochure) — sized here, not inline, so the
   mobile block below can shrink it. */
.nav .btn { padding: 8px 16px; font-size: 14.5px; }

/* ---- Sections --------------------------------------------------------- */
section { padding: clamp(56px, 9vw, 104px) 0; }
.section-head { max-width: 640px; margin-bottom: 44px; }
.section-head h2 {
  font-size: clamp(28px, 4.2vw, 40px);
  margin: 16px 0 14px;
  letter-spacing: -0.02em;
}
.section-head p { color: var(--ink-soft); font-size: 18px; margin: 0; }

/* ---- Hero (shared shell) --------------------------------------------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero .wrap { position: relative; z-index: 2; }

/* ---- Mono / code chips ------------------------------------------------ */
.mono { font-family: var(--font-mono); }
code, .cmd {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
.install {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 14.5px;
  overflow: hidden;
}
.install .prompt { color: var(--ember-deep); padding: 11px 4px 11px 16px; user-select: none; }
.install code { padding: 11px 14px 11px 6px; color: var(--ink); white-space: nowrap; }
.install button {
  border: none;
  border-left: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 0 15px;
  cursor: pointer;
  letter-spacing: 0.06em;
}
.install button:hover { background: var(--ember-wash); color: var(--ember-deep); }

/* ---- Cards / panels --------------------------------------------------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  color: var(--indigo);
}
.tag.preview { color: var(--ember-deep); border-color: var(--ember); background: var(--ember-wash); }

/* ---- Footer ----------------------------------------------------------- */
.site-footer {
  background: var(--slate);
  color: var(--on-slate-soft);
  padding: 64px 0 40px;
  border-top: 3px solid var(--ember);
}
.site-footer .wrap { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 36px; }
.site-footer h4 { color: var(--on-slate); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; margin: 0 0 16px; font-weight: 500; }
.site-footer a { color: var(--on-slate-soft); display: block; padding: 4px 0; font-size: 14.5px; }
.site-footer a:hover { color: var(--on-slate); text-decoration: none; }
.site-footer .brand { color: var(--on-slate); }
/* On the dark slate footer the deep accent is too dark — use the bright accent
   so the TLD still reads as the page's colour. */
.site-footer .tld { color: var(--ember); }
.site-footer .xlink { color: var(--on-slate-soft); display: inline; padding: 0; }
.site-footer .xlink:hover { color: var(--on-slate); }
.site-footer .colophon { font-size: 13px; line-height: 1.5; margin-top: 14px; }
.footer-base { border-top: 1px solid var(--slate-line); margin-top: 44px; padding-top: 22px; font-family: var(--font-mono); font-size: 12px; color: var(--on-slate-soft); display:flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ---- Entity render (the anti-notes proof) ----------------------------- */
.entity {
  background: var(--slate);
  border: 1px solid var(--slate-line);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  color: var(--on-slate);
  overflow: hidden;
  box-shadow: 0 24px 60px -30px rgba(26,23,20,0.55);
}
.entity .bar {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--slate-line);
  background: var(--slate-2);
}
.entity .bar .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--slate-line); }
.entity .bar .file { margin-left: 8px; color: var(--on-slate-soft); font-size: 12.5px; letter-spacing: 0.02em; }
.entity .body { padding: 18px 20px; white-space: pre; overflow-x: auto; }
.entity .fm { color: var(--indigo-soft); }
.entity .key { color: var(--on-slate-soft); }
.entity .val { color: var(--on-slate); }
.entity .type { color: var(--ember); }
.entity .h { color: #C9A86A; }            /* section heading ## */
.entity .link { color: var(--ember); border-bottom: 1px dotted var(--ember); }
.entity .rel { color: var(--indigo-soft); }
.entity .cmt { color: var(--on-slate-soft); opacity: .7; }

/* ---- Fingerprint grid wall ------------------------------------------- */
.fp-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 14px; }
.fp-wall .glyph { width: 100%; aspect-ratio: 1; opacity: .9; transition: opacity .25s ease; }
/* Hovering one mem's mark lets the others recede — the wall reads as a
   catalogue of individuals, not wallpaper. Pure :has(), no JS. */
.fp-wall:has(.glyph:hover) .glyph:not(:hover) { opacity: .4; }

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 860px) {
  .site-footer .wrap { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  /* The longest eyebrow ("for developers…" + folio) must hold one line. */
  .eyebrow { font-size: 11px; }
  .nav .hide-sm { display: none; }
  .nav { gap: 13px; }
  /* Surface switcher collapses to the bare TLDs — brand + two full domains +
     CTA otherwise overflow a 375px viewport. font-size:0 keeps the full
     accessible name; the .tld span stays visible in the page accent. */
  .nav .xlink { font-size: 0; }
  .nav .xlink .tld { font-size: 13px; }
  .xnav { gap: 12px; }
  /* Comfortable tap heights on touch screens. */
  .nav .xlink { padding: 12px 0; }
  .nav a { padding: 10px 0; }
  .site-footer a { padding: 9px 0; }
  .nav .btn { padding: 7px 12px; font-size: 14px; }
  /* keep the header within the viewport on narrow screens */
  .site-header .wrap { gap: 10px; }
  .brand { font-size: 17px; gap: 8px; }
  .brand .glyph { width: 24px; height: 24px; }
  .site-footer .wrap { grid-template-columns: 1fr; gap: 26px; }
  section { padding: 52px 0; }
  /* Long install commands must never exceed the viewport: the pill becomes a
     full-width block flex that can shrink in its container (min-width:0), with
     the prompt and COPY pinned and the command scrolling within so the control
     stays reachable. Wrappers must also stop content-sizing. */
  .install { display: flex; width: 100%; max-width: 100%; min-width: 0; }
  .install .prompt, .install button { flex: none; }
  /* The command scrolls within its track; a right-edge fade replaces the bare
     mid-glyph clip — it reads as "scrollable / more here", not a defect, while
     COPY still carries the full command. */
  .install code {
    flex: 1; min-width: 0; overflow-x: auto;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
  }
  .io-install, .mh-install { display: block; max-width: 100%; min-width: 0; }
  /* Grid/flex children must be allowed to shrink below their content's
     min-size, or long unbreakable mono content (commands, the rendered entity
     body) forces the whole track — and the page — wider than the viewport. */
  .what-grid > *, .app-grid > *, .wi-grid > *, .rt-grid > *, .layout > * { min-width: 0; }
  .entity { min-width: 0; }
  /* The entity body scrolls within its window on phones — same right-edge
     fade the install pill uses, "more here" instead of a bare clip. */
  .entity .body {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
  }
}

/* Focus visibility (a11y) */
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; border-radius: 2px; }

/* Cross-document page moves crossfade natively where supported (Chromium,
   Safari); elsewhere navigation stays instant. No JS router. */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
