/* jacobw.dev
   One typeface (IBM Plex Sans, variable), one accent, layout carried by a
   two-column résumé grid. Contrast ratios are noted next to each colour. */

@font-face {
  font-family: "Plex";
  src: url("/assets/fonts/plex-sans-var.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f5f1;
  --ink: #1b1b19;      /* 15.8:1 on --bg */
  --muted: #5d5c56;    /* 6.2:1 on --bg, meta text only */
  --accent: #a8291f;   /* 6.4:1 on --bg */
  --code-bg: #ebe9e2;

  --font: "Plex", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  --fs-small: 0.9375rem; /* 15px */
  --fs-body: 1.0625rem;  /* 17px */
  --fs-h3: 1.1875rem;    /* 19px */
  --fs-lead: clamp(1.1875rem, 1rem + 0.9vw, 1.4375rem);
  --fs-display: clamp(2.5rem, 1.6rem + 4.5vw, 4.25rem);

  --space-block: clamp(3.5rem, 2.5rem + 4vw, 6rem);
  --dur-fast: 120ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --ink: #ecebe5;    /* 15.4:1 */
    --muted: #a3a198;  /* 7.1:1 */
    --accent: #ff8f80; /* 8.3:1 */
    --code-bg: #22221f;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
}

h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
p { margin: 0; }

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

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color var(--dur-fast) ease-out, text-decoration-thickness var(--dur-fast) ease-out;
}
a:hover { color: var(--accent); text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 1;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}
.skip:focus { top: 1rem; }

.wrap {
  max-width: 62rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 0.5rem + 4vw, 3rem);
}

/* ---------- intro ---------- */
.intro {
  padding-top: clamp(3rem, 1.5rem + 8vw, 7.5rem);
  max-width: 44rem;
}
.intro h1 {
  font-size: var(--fs-display);
  line-height: 1.02;
  letter-spacing: -0.025em;
}
.intro .tagline {
  margin-top: 1.25rem;
  font-size: var(--fs-lead);
  line-height: 1.35;
  max-width: 34ch;
}
.intro .tagline + p,
.intro p + p { margin-top: 1rem; }
.intro p:not(.tagline) { max-width: 60ch; }

/* Row of primary links: each one is a 44px tap target. */
.actions {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.75rem;
}
.actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  min-height: 44px;
  font-weight: 500;
}
.actions.small { margin-top: 0.25rem; }
.actions.small a { font-weight: 400; }
.note { color: var(--muted); font-weight: 400; }

/* ---------- sections: heading column + content column ---------- */
.block {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  column-gap: 2.5rem;
  margin-top: var(--space-block);
}
.block > h2 {
  font-size: var(--fs-body);
  line-height: 1.6;
  align-self: start;
  position: sticky;
  top: 1.5rem;
}
.block-body { max-width: 44rem; }
.prose p + p { margin-top: 1rem; }

.entry + .entry { margin-top: 2.75rem; }
.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  column-gap: 1.5rem;
}
.entry h3 { font-size: var(--fs-h3); line-height: 1.35; }
.entry h3.minor { font-size: var(--fs-body); margin-bottom: 0.5rem; }
.entry > p { margin-top: 0.375rem; }
.entry .sub { margin-top: 0.125rem; }
.meta { color: var(--muted); font-size: var(--fs-small); }

.points { margin: 0.625rem 0 0; padding-left: 1.15em; }
.points li + li { margin-top: 0.375rem; }
.points li::marker { color: var(--muted); }

.plain { list-style: none; margin: 0; padding: 0; }
.plain li + li { margin-top: 0.875rem; }
.plain a { font-weight: 500; }

/* Standalone links in headings and lists: pad the hit area to 44px
   without moving the text. */
.entry h3 a, .plain a {
  display: inline-block;
  padding-block: 0.625rem;
  margin-block: -0.625rem;
}

.skills, .facts { margin: 0; }
.skills > div, .facts > div {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  column-gap: 1.5rem;
}
.skills > div + div { margin-top: 0.625rem; }
.skills dt, .facts dt { font-weight: 600; }
.skills dd, .facts dd { margin: 0; }

.facts { margin-top: 1.75rem; }
.facts > div { padding-block: 0.375rem; }
.facts dt { color: var(--muted); font-weight: 400; }

/* ---------- chrome ---------- */
.site-nav {
  padding-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 1.75rem;
}
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; column-gap: 1.75rem; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 500;
}
.site-nav > a { font-weight: 600; }
.site-nav a[aria-current="page"] { text-decoration-thickness: 2px; }

/* ---------- notes: one column, a comfortable reading measure ---------- */
.note-head { padding-top: clamp(2.5rem, 1.5rem + 5vw, 5rem); max-width: 40rem; }
.note-head h1 {
  margin-top: 0.5rem;
  font-size: clamp(1.875rem, 1.3rem + 2.6vw, 2.75rem);
  line-height: 1.1;
}
.note-head .meta a { display: inline-block; padding-block: 0.75rem; margin-block: -0.75rem; }
.note-body { max-width: 40rem; margin-top: 2rem; }
.note-body > * + * { margin-top: 1rem; }
.note-body h2 { font-size: var(--fs-lead); line-height: 1.25; margin-top: 2.5rem; }
.note-body h3 { font-size: var(--fs-h3); line-height: 1.3; margin-top: 2rem; }
.note-body h2 + *, .note-body h3 + * { margin-top: 0.5rem; }
.note-body ul, .note-body ol { padding-left: 1.4em; }
.note-body li + li { margin-top: 0.5rem; }
.note-body li::marker { color: var(--muted); }
.note-body pre {
  background: var(--code-bg);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-size: var(--fs-small);
}
.note-body pre code { padding: 0; background: none; overflow-wrap: normal; }
.note-more { margin-top: 3rem; }
.note-more a { display: inline-block; padding-block: 0.75rem; }

.site-footer {
  margin-top: calc(var(--space-block) * 1.25);
  padding-bottom: 3rem;
  color: var(--muted);
  font-size: var(--fs-small);
}
.site-footer p + p { margin-top: 0.25rem; }
.site-footer a {
  display: inline-block;
  padding-block: 0.75rem;
}

/* ---------- narrow screens ---------- */
@media (max-width: 46rem) {
  .block { grid-template-columns: minmax(0, 1fr); }
  .block > h2 {
    position: static;
    margin-bottom: 1rem;
    font-size: var(--fs-h3);
  }
  .skills > div, .facts > div { grid-template-columns: minmax(0, 1fr); }
  .facts > div { padding-block: 0.25rem; }
}

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

/* ---------- architecture diagram (project pages) ----------
   Semantic HTML: an ordered list of tiers, joined by labelled connectors.
   Ruled boxes for components, a hairline for each connection. */
.diagram { margin: 0; }
.dia { list-style: none; margin: 0; padding: 0; }
.dia-place {
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.dia-nodes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
}
.dia-nodes > li {
  border: 1px solid var(--ink);
  padding: 0.625rem 0.75rem;
}
.dia-name { font-weight: 600; }
.dia-detail { color: var(--muted); font-size: var(--fs-small); margin-top: 0.125rem; }
.dia-via {
  position: relative;
  margin: 0.25rem 0 0.25rem 1.25rem;
  padding: 0.75rem 0 0.75rem 1.5rem;
  border-left: 1px solid var(--muted);
  color: var(--muted);
  font-size: var(--fs-small);
  max-width: 40rem;
}
/* Arrowheads drawn as text so they inherit colour and print cleanly. */
.dia-via::before, .dia-via::after {
  position: absolute;
  left: -0.36em;
  line-height: 1;
  color: var(--accent);
}
.dia-down::after, .dia-both::after { content: "\25BC"; bottom: -0.2em; font-size: 0.75em; }
.dia-both::before { content: "\25B2"; top: -0.2em; font-size: 0.75em; }
.diagram figcaption {
  margin-top: 1rem;
  color: var(--muted);
  font-size: var(--fs-small);
  max-width: 60ch;
}

.print-only { display: none; }

/* ---------- print: a résumé on paper ----------
   Black on white, no chrome, link addresses printed after the links that
   carry them (data-url). The home page is sized to fit one Letter page. */
@page { size: Letter; margin: 0.45in 0.5in; }

@media print {
  :root {
    --bg: #fff;
    --ink: #000;
    --muted: #333;
    --accent: #000;
    --code-bg: transparent;
    --fs-small: 8pt;
    --fs-body: 9pt;
    --fs-h3: 9.5pt;
    --fs-lead: 9.5pt;
    --fs-display: 18pt;
    --space-block: 0.45rem;
  }
  html { font-size: 9pt; }
  body { background: var(--bg); color: var(--ink); line-height: 1.3; }
  ::selection { background: transparent; }

  .skip, .no-print { display: none !important; }
  .note-head { padding-top: 0; }
  .note-head h1 { font-size: 16pt; }
  .note-body { max-width: 6.5in; margin-top: 0.5rem; }
  .note-body > * + * { margin-top: 0.4rem; }
  .note-body h2 { font-size: var(--fs-h3); margin-top: 0.8rem; }
  .note-body li + li { margin-top: 0.15rem; }
  .note-body pre { padding: 0.2rem 0.4rem; border: 0.5pt solid var(--ink); }
  .note-body p, .note-body li, .note-body pre { break-inside: avoid; }
  .note-body h2 { break-after: avoid; }
  .print-only { display: list-item; }

  .wrap { max-width: none; padding-inline: 0; }

  a { color: var(--ink); text-decoration: none; }
  a[data-url]::after {
    content: " " attr(data-url);
    color: var(--muted);
    font-weight: 400;
    font-size: var(--fs-small);
  }
  code { padding: 0; }

  .intro { padding-top: 0; max-width: none; }
  .intro h1 { letter-spacing: -0.01em; }
  .intro .tagline { margin-top: 0.15rem; max-width: none; font-weight: 500; }
  .intro .tagline + p, .intro p + p { margin-top: 0.3rem; }
  .intro p:not(.tagline) { max-width: none; }

  .actions { margin-top: 0.3rem; column-gap: 1.1rem; }
  .actions a { min-height: 0; font-weight: 400; }
  .actions .print-only { color: var(--ink); }

  .block {
    grid-template-columns: 6.5rem minmax(0, 1fr);
    column-gap: 1rem;
    border-top: 0.5pt solid var(--ink);
    padding-top: 0.3rem;
  }
  .block > h2 { position: static; font-size: var(--fs-body); line-height: 1.35; }
  .block-body { max-width: none; }
  .entry h3.minor { font-size: var(--fs-h3); }
  .prose p + p { margin-top: 0.35rem; }

  .entry + .entry { margin-top: 0.4rem; }
  .entry > p { margin-top: 0.1rem; }
  .entry .sub { margin-top: 0; }
  .entry h3 a, .plain a { padding-block: 0; margin-block: 0; }
  .entry h3.minor { margin-bottom: 0.1rem; }
  .points { margin-top: 0.15rem; }
  .points li + li { margin-top: 0; }
  .plain li + li { margin-top: 0; }
  .plain li br { display: none; }

  .skills > div, .facts > div { grid-template-columns: 8.5rem minmax(0, 1fr); column-gap: 0.75rem; }
  .skills > div + div { margin-top: 0.1rem; }
  .facts { margin-top: 0.5rem; }
  .facts > div { padding-block: 0.05rem; }

  .entry, .dia-tier, .dia-via, .skills > div, .facts > div, .prose p { break-inside: avoid; }
  h2, h3, .entry-head { break-after: avoid; }
  .block { break-inside: auto; }

  .dia-nodes { gap: 0.4rem; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  .dia-nodes > li { padding: 0.3rem 0.45rem; }
  .dia-place { margin-bottom: 0.2rem; }
  .dia-via { padding-block: 0.4rem; margin-block: 0.1rem; border-left-color: var(--ink); }
  .diagram figcaption { margin-top: 0.4rem; }
}
