/* Ink & Pixels — home / hero  (governed by DESIGN.md) */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
section[id], #top { scroll-margin-top: var(--space-8); }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--text);
  background: var(--background);
  min-height: 100vh;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--pixels); color: var(--accent-on-solid); }
a { color: inherit; }

/* the generative dither canvas — behind everything */
#dither {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: 0; pointer-events: none;
}
.shell { position: relative; z-index: 1; }

/* a faint engineering grid on the cream, so the dither reads as "developing" on paper */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(var(--surface-active) 1px, transparent 1px),
    linear-gradient(90deg, var(--surface-active) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(circle at 50% 38%, #000 0%, transparent 78%);
          mask-image: radial-gradient(circle at 50% 38%, #000 0%, transparent 78%);
}

/* ---------- NAV ---------- */
.nav {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) clamp(var(--space-4), 5vw, var(--space-24));
  gap: var(--space-4);
  background: var(--background);
  border-bottom: var(--border-w) solid var(--stroke);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--space-3);
  font-family: var(--font-display); font-weight: 800; font-size: var(--text-lg);
  letter-spacing: -.02em; text-decoration: none;
}
.brand .chip {
  width: 18px; height: 18px; background: var(--pixels);
  border: 2px solid var(--stroke); box-shadow: 3px 3px 0 var(--stroke);
}
.nav-links { display: flex; align-items: center; gap: var(--space-2); }
.nav-links a {
  font-family: var(--font-mono); font-size: var(--text-sm); text-decoration: none;
  padding: var(--space-2) var(--space-3); color: var(--text-secondary);
  border: 2px solid transparent; transition: color var(--t-micro) var(--ease-out),
    border-color var(--t-micro) var(--ease-out), background var(--t-micro) var(--ease-out);
}
.nav-links a:hover { color: var(--text); border-color: var(--stroke); background: var(--surface); }
.nav-links a.active { color: var(--text); box-shadow: inset 0 -3px 0 var(--pixels); }
.theme-toggle {
  font-family: var(--font-mono); font-size: var(--text-sm); cursor: pointer;
  background: var(--surface); color: var(--text);
  border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow-press);
  padding: var(--space-2) var(--space-3);
  transition: transform var(--t-micro) var(--ease-out), box-shadow var(--t-micro) var(--ease-out);
}
.theme-toggle:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--stroke); }
.theme-toggle:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--stroke); }

/* mobile menu button (created by theme.js) — hidden on desktop */
.nav-burger {
  display: none; width: 44px; height: 40px; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1; cursor: pointer; margin-right: var(--space-2);
  background: var(--surface); color: var(--text);
  border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow-press);
}
.theme-toggle, .nav-burger { white-space: nowrap; }

/* ---------- HERO ---------- */
.hero {
  min-height: calc(100vh - 92px);
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--space-8) clamp(var(--space-4), 5vw, var(--space-24)) var(--space-16);
  max-width: 1180px; margin: 0 auto;
}
.eyebrow {
  font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .08em;
  color: var(--accent-text); margin-bottom: var(--space-6);
  display: inline-flex; align-items: center; gap: var(--space-2);
}
.eyebrow .blink { color: var(--expression-text); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.headline {
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--text-display); line-height: var(--leading-tight);
  letter-spacing: -.03em; max-width: 16ch; text-wrap: balance;
}
/* highlighter marks — the duality, readable ink on bold color */
.mark { color: var(--ink); padding: 0 .12em; box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  background-repeat: no-repeat; background-position: left center; background-size: 100% 100%; }
.mark-pixels { background-image: linear-gradient(var(--pixels), var(--pixels)); }
.mark-ink    { background-image: linear-gradient(var(--expression), var(--expression)); }

/* intro "develop": once per session, motion-safe (set via .boot on <html>) */
html.boot .headline .mark { background-size: 0% 100%; animation: markwipe .55s var(--ease-out) forwards; }
html.boot .headline .mark-pixels { animation-delay: .25s; }
html.boot .headline .mark-ink { animation-delay: .55s; }
@keyframes markwipe { to { background-size: 100% 100%; } }
html.boot .eyebrow  { animation: rise .5s var(--ease-out) both; }
html.boot .headline { animation: rise .55s var(--ease-out) .05s both; }
html.boot .hero-left{ animation: rise .6s var(--ease-out) .15s both; }
html.boot .portrait { animation: fadein .6s var(--ease-out) .25s both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.sub {
  font-size: var(--text-lg); max-width: 52ch; margin-top: var(--space-8);
  color: var(--text);
}
.sub b { font-weight: 700; }

.cta-row { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-12); }

/* the signature pressable block */
.btn {
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-base);
  text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow);
  background: var(--surface); color: var(--text);
  transition: transform var(--t-micro) var(--ease-out), box-shadow var(--t-micro) var(--ease-out);
}
.btn:hover { transform: translate(-3px,-3px); box-shadow: var(--shadow-hover); }
.btn:active { transform: translate(4px,4px); box-shadow: var(--shadow-press); }
.btn-pixels { background: var(--pixels); color: var(--accent-on-solid); }

.hint {
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-secondary);
  margin-top: var(--space-16); letter-spacing: .04em;
}
.hint b { color: var(--accent-text); }

/* ---------- hero row: text + developing portrait ---------- */
.hero-row {
  display: grid; grid-template-columns: 1fr auto; gap: var(--space-12);
  align-items: end; margin-top: var(--space-8);
}
.hero-left { min-width: 0; }
.hero-left .sub, .hero-left .cta-row, .hero-left .hint { margin-top: var(--space-8); }
.hero-left .sub { margin-top: 0; }

.portrait { position: relative; margin: 0 var(--space-6) var(--space-6) 0; transform: rotate(-2deg); }
.portrait canvas {
  display: block; width: 300px; height: 360px; background: var(--surface);
  border: var(--border-w) solid var(--stroke); box-shadow: var(--shadow);
  cursor: crosshair;
}
.portrait figcaption {
  position: absolute; left: -6px; bottom: -13px; transform: rotate(2deg);
  font-family: var(--font-mono); font-size: var(--text-xs); padding: 3px var(--space-2);
  background: var(--pixels); color: var(--accent-on-solid);
  border: 2px solid var(--stroke); box-shadow: 3px 3px 0 var(--stroke);
}
.px-reset {
  position: absolute; top: -13px; right: -6px; transform: rotate(2deg);
  font-family: var(--font-mono); font-size: var(--text-xs); cursor: pointer;
  padding: 3px var(--space-2); background: var(--surface); color: var(--text);
  border: 2px solid var(--stroke); box-shadow: 3px 3px 0 var(--stroke);
  transition: transform var(--t-micro) var(--ease-out), box-shadow var(--t-micro) var(--ease-out);
}
.px-reset:hover { transform: rotate(2deg) translate(-2px,-2px); box-shadow: 5px 5px 0 var(--stroke); }
.px-reset:active { transform: rotate(2deg) translate(2px,2px); box-shadow: 1px 1px 0 var(--stroke); }

/* visible, never-removed focus ring (a11y) */
:focus-visible { outline: 3px solid var(--expression); outline-offset: 3px; }

/* ---------- MOBILE (vanilla, simplified) ---------- */
@media (max-width: 720px) {
  .nav-burger { display: inline-flex; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 6;
    flex-direction: column; align-items: stretch; gap: 0; padding: var(--space-2);
    background: var(--background); border-top: 2px solid var(--stroke); border-bottom: var(--border-w) solid var(--stroke);
  }
  .nav.nav-open .nav-links { display: flex; }
  .nav-links a { min-height: 44px; display: flex; align-items: center; padding: 0 var(--space-3); border: none; font-size: var(--text-base); }
  .nav-links a.active { box-shadow: inset 3px 0 0 var(--pixels); }
  #dither { display: none; }              /* no generative layer on mobile — perf + simplicity */
  body::before { background-size: 18px 18px; }
  .hero { min-height: auto; padding-top: var(--space-12); }
  .headline { max-width: 100%; }
  .hero-row { grid-template-columns: 1fr; gap: var(--space-12); }
  .portrait { margin: var(--space-4) 0 var(--space-6); justify-self: start; }
  .portrait canvas { width: 240px; height: 288px; }
  .px-reset { display: none; }            /* develop/reset is a desktop interaction */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .eyebrow .blink, .cursor { animation: none !important; }
  .px-reset { display: none; }            /* face is pre-developed; no live develop under reduced-motion */
}
