/* ============================================================================
   billylinn.com — design system
   ----------------------------------------------------------------------------
   One stylesheet for the whole site. Every page links this file and builds on
   the tokens below. Base styles (body, headings, links, .container, .btn,
   .muted, .site-footer) are generic and safe to reuse anywhere; page-specific
   rules live in clearly marked sections at the bottom.

   Visual direction: a quiet letterhead. Cool grey-blue paper, near-black ink,
   one blue accent. Newsreader (a low
   contrast text serif) carries voice; Archivo (a plain grotesque) carries
   labels, metadata, and anything that behaves like an interface control.
   ========================================================================= */

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;

  /* Type stacks.
     --font-serif is the reading voice: headings, prose, anything with a
     sentence in it. --font-sans is the labelling voice: eyebrow-free small
     metadata, table labels, buttons, tags. */
  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino,
                Georgia, "Times New Roman", serif;
  --font-sans: "Archivo", ui-sans-serif, system-ui, -apple-system,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Type scale — 17px base, ~1.25 ratio, plus two display steps that fluid-
     scale between mobile and desktop. */
  --text-xs:   0.75rem;    /* 12px — fine print, footer */
  --text-sm:   0.8125rem;  /* 13px — index destinations, labels */
  --text-base: 1.0625rem;  /* 17px — body */
  --text-md:   1.1875rem;  /* 19px — lead paragraphs */
  --text-lg:   clamp(1.375rem, 1.05rem + 1.35vw, 1.9rem);   /* section heads */
  --text-statement: clamp(1.5rem, 1.12rem + 1.6vw, 2.05rem); /* landing lede */
  --text-xl:   clamp(1.6rem, 1.1rem + 2.2vw, 2.6rem);       /* page titles */
  --text-display: clamp(3.1rem, 1.4rem + 8.6vw, 6.5rem);    /* the name */

  --leading-tight: 1.12;
  --leading-snug: 1.35;
  --leading-body: 1.62;

  /* Spacing — a 4px-derived ramp. Use these instead of ad-hoc rem values. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* Measure and layout widths. */
  --max-width: 68rem;      /* .container */
  --max-width-narrow: 46rem; /* .container.container--narrow */
  --measure: 34rem;        /* comfortable line length for serif prose */

  /* Corners — deliberately small. Nothing here is a card. */
  --radius: 4px;
  --radius-lg: 10px;

  /* Colour — light (default).
     --bg          page ground, cool paper
     --bg-raised   the one step up from the page, for inset blocks
     --ink         headings and primary text
     --ink-soft    body copy and long-form prose
     --muted       metadata, captions, anything deliberately secondary
     --rule        hairlines between rows and sections
     --rule-strong a hairline that needs to be seen from across the room
     --accent      links, focus, the single point of colour (blue)
     --accent-soft the same blue at hover-tint strength
     --on-accent   text sitting on a solid --accent fill */
  --bg: #eef1f5;
  --bg-raised: #f7f9fb;
  --ink: #171d26;
  --ink-soft: #3f4a58;
  --muted: #6b7684;
  --rule: #d4dbe3;
  --rule-strong: #b1bbc7;
  --accent: #1d5fa6;
  --accent-soft: rgba(29, 95, 166, 0.09);
  --on-accent: #f7faff;

  --focus-ring: 2px solid var(--accent);
}

/* Colour — dark. Same roles, re-pointed; nothing else changes. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13171c;
    --bg-raised: #1a2027;
    --ink: #e5e9ee;
    --ink-soft: #b9c2cc;
    --muted: #8993a0;
    --rule: #2a323b;
    --rule-strong: #404a56;
    --accent: #7db3f0;
    --accent-soft: rgba(125, 179, 240, 0.12);
    --on-accent: #0e1620;
  }
}

/* ── Base ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  margin: 0 0 var(--space-3);
  color: var(--ink);
  font-weight: 500;
  line-height: var(--leading-snug);
  letter-spacing: -0.012em;
  text-wrap: balance;
}

h1 { font-size: var(--text-xl); line-height: var(--leading-tight); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
h4 { font-size: var(--text-base); }

p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }

strong { color: var(--ink); font-weight: 600; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}
a:hover { text-decoration-color: currentColor; }

:where(a, button, [tabindex]):focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius);
}

hr {
  height: 0;
  margin: var(--space-6) 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

img, svg { max-width: 100%; height: auto; }

::selection { background: var(--accent-soft); color: var(--ink); }

/* ── Layout helpers ─────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.container--narrow { max-width: var(--max-width-narrow); }

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}
.page > main { flex: 1 0 auto; }

/* Prose: serif body copy held to a readable measure. */
.prose { max-width: var(--measure); }
.prose p { margin-bottom: var(--space-4); }

/* Anything deliberately secondary. Set in the labelling face. */
.muted {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.sans { font-family: var(--font-sans); }

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.62rem 1.15rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease,
              color 0.14s ease;
}
.btn:hover {
  background: color-mix(in srgb, var(--accent) 84%, var(--ink));
  border-color: color-mix(in srgb, var(--accent) 84%, var(--ink));
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--rule-strong);
}
.btn--ghost:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
  margin-top: var(--space-9);
  padding-block: var(--space-5) var(--space-6);
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--muted);
}
.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  align-items: baseline;
  justify-content: space-between;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); text-decoration-color: var(--rule-strong); }
.site-footer a:hover { color: var(--ink); }
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

/* ── Landing ────────────────────────────────────────────────────────────── */

.landing { padding-top: clamp(var(--space-7), 9vh, var(--space-9)); }

/* The name is the whole hero: set large, in the serif's display optical size,
   with a full-width hairline separating identity from everything after it. */
.masthead-name {
  margin: 0;
  font-size: var(--text-display);
  font-optical-sizing: auto;
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.028em;
  color: var(--ink);
}

.masthead {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--rule-strong);
}

.landing-grid {
  display: grid;
  gap: var(--space-6);
  padding-top: var(--space-6);
}

/* Identity block — role and place, the sans voice, tight and quiet. */
.identity {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--muted);
}
.identity-role {
  margin: 0 0 var(--space-2);
  color: var(--ink);
  font-weight: 500;
}
.identity p { margin: 0; }

.statement {
  max-width: 24ch;
  margin: 0 0 var(--space-5);
  font-size: var(--text-statement);
  line-height: 1.26;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}

.landing-prose {
  max-width: var(--measure);
  font-size: var(--text-md);
  line-height: 1.66;
}

.landing .btn-row { margin-top: var(--space-5); }

/* Current work — a definition list, because that is what it is. */
.now {
  margin: var(--space-7) 0 0;
  border-top: 1px solid var(--rule);
}
.now-row {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--rule);
}
.now dt {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.7;
  color: var(--muted);
}
.now dd {
  margin: 0;
  max-width: 40rem;
  color: var(--ink-soft);
}

/* Elsewhere — an index, not a button bar. Each row names the thing and the
   address it goes to, so you know where you land before you click. */
/* No border-top here: the definition list above already closes with a rule,
   and a second one across the gap reads as an empty row. */
.index {
  margin-top: var(--space-6);
}
.index-row {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-3);
  margin-inline: calc(var(--space-3) * -1);
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.index-row:hover { background: var(--accent-soft); color: var(--accent); }
.index-row:focus-visible { outline-offset: -2px; }
.index-name {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.7;
  color: inherit;
}
.index-dest {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.index-row:hover .index-dest { color: inherit; }

/* Once the row is wide enough for a label and a real measure side by side,
   the definition list and the index become two-column tables. */
@media (min-width: 34rem) {
  .now-row,
  .index-row {
    grid-template-columns: 8.5rem minmax(0, 1fr);
    gap: var(--space-4);
  }
}

/* Desktop: identity sits in a narrow left rail, everything else reads down
   the wide column, aligned to the same baseline grid. */
@media (min-width: 56rem) {
  .landing-grid {
    grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr);
    gap: var(--space-8);
    padding-top: var(--space-7);
  }
  .identity { position: sticky; top: var(--space-6); align-self: start; }
  .statement { max-width: 28ch; }
}

/* ── Job pages (/for/<slug>/) ───────────────────────────────────────────────
   Unlisted per-role landing pages. They reuse the landing page's letterhead
   wholesale — masthead, identity rail, .landing-prose, the .now list, the
   .index — and add only two pieces: a line above the name naming who the page
   is for, and a section label, because unlike / this page has a section that
   needs naming. See docs/job-pages.md. */

.masthead-eyebrow {
  margin: 0 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* The resume's .section-title voice, for pages that do not load resume.css. */
.section-label {
  margin: var(--space-7) 0 var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The label already closes with a rule; the list must not open with a second. */
.section-label + .now { margin-top: 0; border-top: 0; }

/* ── Error page ─────────────────────────────────────────────────────────── */

.error-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 68vh;
  padding-block: var(--space-8);
}
.error-code {
  margin: 0 0 var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
}
.error-page h1 {
  font-size: var(--text-xl);
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* ── Preferences ────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body { background: #fff; color: #000; }
  .btn-row, .site-footer nav { display: none; }
  a { text-decoration: none; color: #000; }
}
