/* Stephen Brouhard portfolio: shared foundation for every page, plus the inner-page
   components (work, method, about). Homepage sections live in home.css.
   System fonts only: no web fonts, analytics or third-party requests. */

:root {
  color-scheme: dark;
  --bg: #151719;
  --surface: #1f2225;
  --stage: #2a2e32;
  --ink: #ecebe6;
  --ink-2: #c9c9c2;
  --muted: #a9a9a1;
  --line: rgb(236 235 230 / 0.12);
  --line-strong: rgb(236 235 230 / 0.28);
  --accent: #b9d88c;
  --accent-ink: #151719;
  --term-bg: #0b0c0d;
  --term-ink: #d8dcd2;

  --s-ok: #b9d88c;
  --s-private: #aeb8dc;
  --s-experiment: #e2c47e;
  --s-early: #eba582;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --code: ui-monospace /* taste-skill-ignore: terminal output in <pre> only */, "SF Mono", Menlo, Consolas, monospace;

  --step-small: 0.875rem;
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.2rem + 2.6vw, 3.5rem);
  --step-display: clamp(2.5rem, 1rem + 3.6vw, 4.25rem);

  --m: clamp(16px, 2.5vw, 32px);
  --gap: clamp(96px, 10vw, 160px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-body)/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
h1, h2, h3 { margin: 0; font-weight: 400; letter-spacing: -0.02em; line-height: 1.02; text-wrap: balance; }
p, ul, ol, dl, figure { margin: 0; }
code { font: 0.92em var(--code); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.skip-link {
  position: absolute; left: var(--m); top: -100px; z-index: 10;
  padding: 10px 16px; background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* Bar */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 20px var(--m);
  font-size: var(--step-small);
}
.wordmark { font-weight: 600; text-decoration: none; font-size: var(--step-body); }
.bar ul { display: flex; gap: clamp(16px, 2.4vw, 32px); margin: 0; padding: 0; list-style: none; }
.bar nav a, .foot nav a { text-decoration: none; }
.bar nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 0.5em; }
.bar nav a:hover, .foot nav a:hover { text-decoration: underline; }

/* Buttons and links */
.button {
  display: inline-block; padding: 14px 22px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; text-decoration: none;
  transition: background-color .2s var(--ease), transform .15s var(--ease);
}
.button:hover { background: #cbe6a2; }
.button:active { transform: translateY(1px); }
.quiet-link { font-weight: 600; transition: color .2s var(--ease); }
.quiet-link:hover { color: var(--accent); }
.meta { font-size: var(--step-small); color: var(--muted); }
.meta a { color: var(--ink); font-weight: 600; }

/* Footer: a single quiet line */
.foot {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 24px;
  padding: clamp(96px, 12vw, 176px) var(--m) 30px;
  font-size: var(--step-small); color: var(--muted);
}
.foot nav { display: flex; gap: 24px; }
.foot nav a { color: var(--ink); }
.foot-end { text-align: right; }

/* Scroll entrances, driven by site.js, which only tags content when motion is allowed. */
.js .reveal { opacity: 0; transform: translateY(24px); }
.js .reveal.in {
  opacity: 1; transform: none;
  transition: opacity .55s var(--ease), transform .55s var(--ease);
  transition-delay: var(--d, 0ms);
}
.js .wipe { clip-path: inset(0 0 100% 0); }
.js .wipe.in { clip-path: inset(0); transition: clip-path .6s var(--ease) var(--d, 0ms); }
.js .terminal .ln { opacity: 0; }
.js .terminal.in .ln { animation: print .3s var(--ease) both; animation-delay: calc(var(--d, 0ms) + 150ms + var(--i) * 45ms); }
@keyframes print { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.ln { display: inline-block; }

/* Inner pages: a surface card opens each page, like the homepage hero */
.page-hero { padding: 0 var(--m); }
.page-hero-card {
  container-type: inline-size;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 28px clamp(28px, 5vw, 88px); align-content: end; align-items: end;
  min-height: min(48svh, 440px);
  padding: clamp(28px, 4.4vw, 72px);
  background: var(--surface);
}
.page-hero h1 { font-size: min(var(--step-display), 9.5cqi); max-width: 18ch; } /* holds two lines on the narrowest phone, like the homepage hero */
.page-hero h1 em { display: block; font-style: normal; color: var(--muted); }
.page-hero p { font-size: var(--step-lead); line-height: 1.4; max-width: 40ch; }
.page-hero-card:has(.hero-portrait) > :not(.hero-portrait) { grid-column: 1; }
.page-hero-card:has(.hero-portrait) > h1 { align-self: end; }
.page-hero-card:has(.hero-portrait) > p { align-self: start; }
.hero-portrait { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; width: 100%; max-width: 360px; justify-self: end; aspect-ratio: 3 / 4; object-fit: cover; }

.wrap { padding: 0 var(--m); }

/* Work entries: spec sheet beside the story */
.entry {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 88px);
  padding: var(--gap) 0 0; scroll-margin-top: 16px;
}
.entry > div:first-child { display: grid; gap: 20px; align-content: start; }
.entry h2 { font-size: var(--step-head); }
.entry .body { display: grid; gap: 1.1em; align-content: start; }
.entry .body > p, .chapter-body > p, .chapter-body > h3 { max-width: 44rem; }
.entry .body > p:first-child { font-size: var(--step-lead); line-height: 1.4; color: var(--ink); }
.body p, .body li { color: var(--ink-2); }
.body a { text-decoration: underline; }
.body a:hover { color: var(--accent); }

.spec { background: var(--surface); }
.spec dl { padding: 8px 0; }
.spec dl > div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 12px; padding: 8px 18px; }
.spec dt { font-size: var(--step-small); color: var(--muted); padding-top: 2px; }
.spec dd { margin: 0; font-size: var(--step-small); line-height: 1.5; overflow-wrap: anywhere; }

.status {
  display: inline-block; white-space: nowrap;
  font-size: 0.8125rem; font-weight: 600; line-height: 1.4; letter-spacing: 0;
  padding: 2px 9px; border: 1px solid currentColor; border-radius: 999px;
}
.s-ok { color: var(--s-ok); }
.s-private { color: var(--s-private); }
.s-experiment { color: var(--s-experiment); }
.s-early { color: var(--s-early); }

.aside { background: var(--surface); padding: 18px 22px; color: var(--ink-2); font-size: var(--step-small); line-height: 1.6; }
.aside strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }

.terminal { width: 100%; max-width: 700px; background: var(--term-bg); color: var(--term-ink); }
.terminal-narrow { max-width: 560px; }
.terminal pre {
  margin: 0; padding: 24px 28px 32px;
  font: 400 var(--step-small)/1.6 var(--code);
  white-space: pre; overflow-x: auto;
}
.terminal-narrow pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.prompt { color: var(--accent); }
.evidence { display: grid; gap: 12px; margin: 0 0 0.6em; min-width: 0; }
.evidence > *, .body > * { min-width: 0; }
.evidence img { width: 100%; }
.evidence figcaption { font-size: var(--step-small); color: var(--muted); }
.evidence figcaption a { color: var(--ink); }
.shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0.6em 0; }
.shots img { width: 100%; border-radius: 16px; }
.shots figcaption { grid-column: 1 / -1; font-size: var(--step-small); color: var(--muted); }

.contrib, .shelf { list-style: none; padding: 0; display: grid; }
.contrib { gap: 6px; }
.contrib li { padding: 22px 24px; background: var(--surface); }
.shelf { gap: 40px; margin-top: 0.8em; }
.contrib li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 16px; }
.contrib .count { font-size: var(--step-head); line-height: 1; letter-spacing: -0.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
.contrib h3, .shelf h3 { font-size: var(--step-lead); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; margin-bottom: 8px; color: var(--ink); }
.shelf h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.contrib h3 small { font-size: var(--step-small); font-weight: 400; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.contrib p, .shelf p { font-size: var(--step-small); line-height: 1.6; }
.contrib p + p, .shelf p + p { margin-top: 8px; }
.contrib a { white-space: nowrap; }
.prs { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.pull { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem); line-height: 1.2; letter-spacing: -0.015em; color: var(--ink) !important; margin: 0.8em 0; max-width: 24ch; }

.loop { list-style: none; padding: 0; display: grid; gap: 6px; }
.loop li { display: grid; gap: 6px; padding: 20px 24px; background: var(--surface); }
.loop h3 { margin: 0; }
.loop p { font-size: var(--step-small); color: var(--muted); }

.timeline { list-style: none; padding: 0; display: grid; gap: 4px; }
.timeline li { display: grid; grid-template-columns: 7rem 1fr; gap: 16px; padding: 10px 0; color: var(--ink-2); }
.timeline time { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Contact: a surface card that bookends the hero */
.contact {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-content: space-between; align-items: end; gap: 72px 40px;
  margin: 0 var(--m);
  padding: clamp(56px, 7vw, 112px) clamp(28px, 4.4vw, 72px);
  background: var(--surface);
}
.contact-note { font-size: var(--step-lead); line-height: 1.4; max-width: 28ch; }
.contact-links { grid-column: 1 / -1; }
.contact h2 { font-size: var(--step-head); max-width: 14ch; }
.contact-links { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 0; padding: 0; list-style: none; font-size: var(--step-lead); }
.contact-note { color: var(--ink-2); }
.contact:has(div.contact-note) { align-items: start; }
div.contact-note { display: grid; gap: 1em; max-width: 40ch; }
div.contact-note p + p { font-size: var(--step-body); line-height: 1.55; }
.chapters + .contact { margin-top: clamp(80px, 8vw, 128px); }
.contact-links a { color: var(--accent); transition: color .2s var(--ease); }
.contact-links a:hover { color: #cbe6a2; }

/* Chapter pages: heading held on the left, reading column on the right, same split as Work */
.chapters { display: grid; padding-top: clamp(56px, 6vw, 96px); }
.chapter {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 28px clamp(28px, 5vw, 88px);
  padding: clamp(64px, 7vw, 112px) 0 0;
}
.chapter:first-child { padding-top: 0; }
.chapter-head { display: grid; gap: 20px; align-content: start; }
.chapter-head h2 { font-size: var(--step-head); scroll-margin-top: 16px; }
.chapter-head p { color: var(--ink-2); max-width: 30ch; }
.chapter-body { display: grid; gap: 1.1em; align-content: start; min-width: 0; }
.chapter-body > * { min-width: 0; }
.chapter-body p, .chapter-body li { color: var(--ink-2); }
.chapter-body a { text-decoration: underline; }
.chapter-body a:hover { color: var(--accent); }
.chapter-body .lede { font-size: var(--step-lead); line-height: 1.4; color: var(--ink); }
.chapter-body h3 { font-size: var(--step-lead); font-weight: 600; letter-spacing: -0.01em; scroll-margin-top: 16px; }
.chapter-body > * + h3 { margin-top: 0.8em; }
.chapter-lead .chapter-head { align-content: end; }
.chapter-lead .evidence { margin: 0; }
.chapter-lead .terminal { max-width: none; }

.page-end { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; padding-top: var(--gap); }
.page-end-chapters { padding-top: clamp(80px, 8vw, 128px); }

@media (max-width: 860px) {
  .entry { grid-template-columns: 1fr; padding-top: 96px; }
  .chapter { grid-template-columns: 1fr; padding-top: 72px; }
  .entry .body > p, .chapter-body > p, .chapter-body > h3 { max-width: none; }
  .chapter-head p { max-width: none; }
  .contact { grid-template-columns: 1fr; gap: 40px; }
  .contact h2 { max-width: none; }
  .page-hero-card { grid-template-columns: 1fr; min-height: 0; padding: 28px 24px 32px; }
  .hero-portrait { grid-column: 1; grid-row: auto; order: -1; max-width: 240px; justify-self: start; }
  .shots { gap: 10px; }
  .shots img { border-radius: 12px; }
  .foot { grid-template-columns: 1fr; gap: 8px; padding-top: 96px; }
  .foot nav { flex-wrap: wrap; }
  .foot-end { text-align: left; }
}
@media (max-width: 480px) {
  .bar { flex-wrap: wrap; row-gap: 8px; }
  .spec dl > div { grid-template-columns: 5.5rem minmax(0, 1fr); padding: 12px 16px; }
  .contrib li { grid-template-columns: 3rem 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal, .js .terminal .ln { opacity: 1; transform: none; }
  .js .wipe { clip-path: none; }
}
