/* MOE. shared base: tokens, type, browser surfaces and shared components.
   Every page variant loads this first, then its own stylesheet. */

@font-face {
  font-family: "Anton";
  src: url("../fonts/anton-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-var.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --paper: #F6F4EE;
  --paper-2: #ECEAE3;
  --paper-3: #E2DFD6;
  --ink: #15171C;
  --ink-2: #22252D;
  --ink-3: #2C2F38;
  --blue: #2F5BEA;
  --blue-soft: #8FA8F5;
  --blue-text: #2449C9; /* blue for small text on paper: 6.6:1 */
  --yellow: #F4D35E;
  --yellow-soft: #FBF3CF;
  --muted: #454955;
  --muted-on-ink: #B7BAC4;
  --text-on-ink: #D8DAE0;

  --display: "Anton", "Archivo", sans-serif;
  --body: "Archivo", system-ui, sans-serif;

  --gutter: clamp(20px, 4vw, 64px);
  --max: 1360px;
  --radius: 10px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-marker: cubic-bezier(0.65, 0, 0.35, 1);
  --shadow-lift: 0 18px 40px -18px rgba(21, 23, 28, 0.35), 0 4px 10px -4px rgba(21, 23, 28, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 2px; }

/* Browser surfaces carry the brand too */
::selection { background: var(--yellow); color: var(--ink); }
.on-ink ::selection, .on-ink::selection { background: var(--yellow); color: var(--ink); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
.on-ink :focus-visible { outline-color: var(--yellow); }
input { caret-color: var(--blue); }
html { scrollbar-color: var(--ink) var(--paper-2); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--paper-2); }
::-webkit-scrollbar-thumb { background: var(--ink); border: 3px solid var(--paper-2); border-radius: 10px; }

/* Type */
.display {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: 0.92;
  letter-spacing: 0.005em;
  text-wrap: balance;
}
.h-xl { font-size: clamp(3.4rem, 9.2vw, 9rem); }
.h-l { font-size: clamp(2.6rem, 6vw, 5.6rem); }
.h-m { font-size: clamp(2rem, 3.6vw, 3.4rem); }
.h-s { font-size: clamp(1.5rem, 2.2vw, 2rem); line-height: 1; }
.lede { font-size: clamp(1.15rem, 1.6vw, 1.4rem); line-height: 1.45; max-width: 38ch; color: var(--muted); }
.on-ink .lede { color: var(--text-on-ink); }
.label {
  font-family: var(--body);
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.dot { color: var(--blue); }
.on-ink .dot { color: var(--yellow); }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.on-ink { background: var(--ink); color: var(--paper); }

/* Highlighter: a yellow stroke that sweeps in behind a phrase */
.hl {
  background-image: linear-gradient(transparent 58%, var(--yellow) 58%, var(--yellow) 92%, transparent 92%);
  background-repeat: no-repeat;
  background-size: 0% 100%;
  transition: background-size 0.9s var(--ease-marker);
  padding-inline: 0.06em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hl.is-on, .no-motion .hl { background-size: 100% 100%; }
.lede .hl { color: var(--ink); }
.on-ink .lede .hl { color: inherit; }

/* Marker circle: an SVG loop drawn around a word (built by shared.js) */
.circled { position: relative; display: inline-block; white-space: nowrap; }
.circled > svg.marker-loop {
  position: absolute;
  left: -14%; top: -18%;
  width: 128%; height: 136%;
  max-width: none;
  overflow: visible;
  pointer-events: none;
}
.marker-loop path { fill: none; stroke: var(--blue); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.on-ink .marker-loop path { stroke: var(--yellow); }

/* Buttons */
.btn {
  --bg: var(--ink); --fg: var(--paper);
  position: relative;
  display: inline-flex; align-items: center; gap: 0.7em;
  padding: 1.05em 1.5em;
  border: 0; border-radius: var(--radius);
  background: var(--bg); color: var(--fg);
  font-family: var(--body); font-weight: 900; font-size: 0.95rem;
  letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  cursor: pointer;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), background-color 0.25s;
  will-change: transform;
}
.btn:hover { box-shadow: var(--shadow-lift); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn .sq { width: 0.62em; height: 0.62em; background: var(--yellow); flex: none; transition: transform 0.35s var(--ease-out); }
.btn:hover .sq { transform: rotate(90deg) scale(1.15); }
.btn--yellow { --bg: var(--yellow); --fg: var(--ink); }
.btn--yellow .sq { background: var(--blue); }
.btn--blue { --bg: var(--blue); --fg: var(--paper); }
.btn--ghost { --bg: transparent; --fg: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.on-ink .btn--ghost { --fg: var(--paper); box-shadow: inset 0 0 0 2px var(--paper); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

/* Shared nav */
.site-nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px var(--gutter);
  transition: background-color 0.3s, box-shadow 0.3s, transform 0.4s var(--ease-out);
}
.site-nav.is-scrolled { background: rgba(246, 244, 238, 0.92); backdrop-filter: blur(10px); box-shadow: 0 1px 0 var(--paper-3); }
.site-nav .brand img { height: 30px; width: auto; }
.site-nav ul { display: flex; gap: clamp(14px, 2vw, 32px); list-style: none; padding: 0; margin: 0; }
.site-nav ul a { font-weight: 700; font-size: 0.92rem; text-decoration: none; position: relative; }
.site-nav ul a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px;
  background: var(--blue); transform: scaleX(0); transform-origin: left; transition: transform 0.35s var(--ease-out);
}
.site-nav ul a:hover::after { transform: scaleX(1); }
.site-nav .btn { padding: 0.8em 1.1em; font-size: 0.8rem; }
@media (max-width: 860px) { .site-nav ul { display: none; } }

/* Draft badge: marks copy that still needs Moe's confirmation */
.draft {
  display: inline-block; vertical-align: middle;
  padding: 0.15em 0.55em; border-radius: 4px;
  background: var(--yellow-soft); color: var(--ink);
  font: 800 0.72rem/1.4 var(--body); letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px dashed var(--ink);
}
.on-ink .draft { background: transparent; color: var(--yellow); border-color: var(--yellow); }

/* Photo placeholder: a marker sketched frame where a real photo will go */
.ph {
  position: relative; display: grid; place-items: center; text-align: center;
  min-height: 260px; padding: 24px;
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, rgba(21, 23, 28, 0.05) 14px 15px),
    var(--paper-2);
  color: var(--muted);
}
.ph::before {
  content: ""; position: absolute; inset: 10px;
  border: 2px dashed rgba(21, 23, 28, 0.35); border-radius: 6px;
}
.ph span { position: relative; font-weight: 800; font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; }
.on-ink .ph { background: repeating-linear-gradient(-45deg, transparent 0 14px, rgba(246, 244, 238, 0.06) 14px 15px), var(--ink-2); color: var(--muted-on-ink); }
.on-ink .ph::before { border-color: rgba(246, 244, 238, 0.3); }

/* Reset sign up form (draft, not connected) */
.reset-form { display: flex; flex-wrap: wrap; gap: 10px; max-width: 560px; }
.reset-form input {
  flex: 1 1 240px; min-width: 0;
  padding: 1em 1.1em; border-radius: var(--radius);
  border: 2px solid var(--ink); background: var(--paper);
  font-weight: 600;
}
.reset-form input::placeholder { color: #6A6E79; }
.on-ink .reset-form input { background: var(--ink-2); border-color: var(--ink-3); color: var(--paper); }
.on-ink .reset-form input::placeholder { color: var(--muted-on-ink); }
.reset-form input[aria-invalid="true"] { border-color: #C2412D; }
.reset-form .msg { flex-basis: 100%; min-height: 1.5em; font-weight: 700; font-size: 0.95rem; }
.reset-form .msg.err { color: #B23A27; }
.on-ink .reset-form .msg.err { color: #FF9C88; }

/* Footer */
.site-foot { padding: 56px 0 40px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 24px 48px; align-items: end; justify-content: space-between; }
.site-foot img { height: 44px; width: auto; }
.site-foot p { color: var(--muted-on-ink); font-size: 0.92rem; }

/* Reduced motion: everything visible, nothing travels */
.no-motion [data-reveal] { opacity: 1 !important; transform: none !important; }

/* ---------- Dark mode ----------
   Moe asked for it: nobody gets blasted with light at night. The page ground
   turns ink, text turns paper, and the ink bands stay dark one step deeper.
   The theme is set on <html data-theme> before first paint (inline script in
   each page head) and switched by the toggle shared.js adds to the nav. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #14161B;
  --paper-2: #1C1F26;
  --paper-3: #2B2F38;
  --ink: #ECEAE3;
  --ink-2: #D2D4DA;
  --ink-3: #B7BAC4;
  --blue: #5B7FF0;
  --blue-text: #8FA8F5;
  --yellow-soft: #3A3420;
  --muted: #A9ADB8;
  --shadow-lift: 0 18px 40px -18px rgba(0, 0, 0, 0.75), 0 4px 10px -4px rgba(0, 0, 0, 0.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #14161B; --paper-2: #1C1F26; --paper-3: #2B2F38;
    --ink: #ECEAE3; --ink-2: #D2D4DA; --ink-3: #B7BAC4;
    --blue: #5B7FF0; --blue-text: #8FA8F5; --yellow-soft: #3A3420; --muted: #A9ADB8;
  }
}
/* Inside an ink band the original pairing returns, so bands stay dark. */
[data-theme="dark"] .on-ink {
  --paper: #ECEAE3;
  --ink: #0C0D10;
  --ink-2: #1A1C22;
  --ink-3: #2A2D35;
  --paper-2: #1C1F26;
  --paper-3: #2B2F38;
  --muted: #B7BAC4;
}
[data-theme="dark"] ::selection { background: var(--yellow); color: #15171C; }
[data-theme="dark"] .site-nav.is-scrolled { background: rgba(20, 22, 27, 0.9); box-shadow: 0 1px 0 #2B2F38; }
/* Highlighter on dark: a thick marker underline, so light letters never sit on yellow */
[data-theme="dark"] .hl { background-image: linear-gradient(transparent 76%, var(--yellow) 76%, var(--yellow) 94%, transparent 94%); }
[data-theme="dark"] .btn--yellow { --fg: #15171C; }
[data-theme="dark"] .btn--blue { --bg: #2F5BEA; --fg: #F6F4EE; }
[data-theme="dark"] .reset-form input::placeholder { color: #9599A4; }
[data-theme="dark"] .reset-form .msg.err { color: #FF9C88; }
[data-theme="dark"] .ph {
  background: repeating-linear-gradient(-45deg, transparent 0 14px, rgba(236, 234, 227, 0.05) 14px 15px), var(--paper-2);
}
[data-theme="dark"] .ph::before { border-color: rgba(236, 234, 227, 0.3); }
/* Smooth only when the visitor flips the switch, never on load */
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after {
  transition: background-color 0.45s var(--ease-out), color 0.45s var(--ease-out), border-color 0.45s var(--ease-out), fill 0.45s, stroke 0.45s !important;
}

/* The light / dark switch (added to every nav by shared.js) */
.theme-toggle {
  position: relative; flex: none;
  width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink);
  box-shadow: inset 0 0 0 2px currentColor;
  cursor: pointer;
  transition: transform 0.35s var(--ease-out), box-shadow 0.25s;
}
.theme-toggle:hover { transform: rotate(-12deg) scale(1.06); }
.theme-toggle svg { width: 22px; height: 22px; overflow: visible; }
.theme-toggle .tt-disc { fill: none; stroke: currentColor; stroke-width: 2.4; }
.theme-toggle .tt-half { fill: currentColor; transform-origin: 12px 12px; transition: transform 0.6s var(--ease-out); }
[data-theme="dark"] .theme-toggle .tt-half { transform: rotate(180deg); }
.theme-toggle .tt-ray { stroke: var(--yellow); stroke-width: 2.2; stroke-linecap: round; opacity: 0; transition: opacity 0.3s; }
.theme-toggle:hover .tt-ray { opacity: 1; }
.site-nav .nav-end { display: flex; align-items: center; gap: 12px; }
/* Over an ink band the toggle is always light, in both themes */
.on-ink .theme-toggle, .site-nav.over-ink .theme-toggle { color: #F6F4EE; }
@media (max-width: 860px) { .theme-toggle { width: 40px; height: 40px; } }
