/* thorwhalen.com: one stylesheet for the site's own pages. Tokens first (shared with the Atelier
   page: warm paper, field green, brick, serif headings); dark mode by preference. */
:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --ink: #1f1d1a;
  --muted: #5d5850;
  --line: #ddd5c8;
  --accent: #2f6b4f;      /* field green */
  --accent-ink: #ffffff;
  --warm: #b4643c;        /* brick */
  --sky: #dbe8e1;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --measure: 40rem;
  --tap-min: 44px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151614;
    --surface: #1d1f1c;
    --ink: #ece8e0;
    --muted: #a9a398;
    --line: #34362f;
    --accent: #7cc39c;
    --accent-ink: #10231a;
    --warm: #e0946a;
    --sky: #23302a;
  }
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--sans); }
a { color: var(--accent); text-underline-offset: 0.15em; }
img { max-width: 100%; height: auto; }
.wrap { max-width: 64rem; margin: 0 auto; padding: 0 16px; }
.prose { max-width: var(--measure); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; z-index: 10; }

/* header */
header.top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding: 14px 0; font-size: 15px; border-bottom: 1px solid var(--line); }
header.top a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; min-height: var(--tap-min); }
header.top a.home { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--ink); margin-right: auto; }
header.top nav.site { display: flex; flex-wrap: wrap; gap: 0 18px; }
header.top nav a[aria-current] { color: var(--ink); font-weight: 600; }
header.top nav.lang { display: flex; gap: 12px; padding-left: 14px; border-left: 1px solid var(--line); }
@media (hover: hover) and (pointer: fine) { header.top a:hover { color: var(--accent); } }

/* type */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); margin: 0.5em 0 0.3em; }
h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin: 0 0 0.5em; }
h3 { font-size: 1.2rem; margin: 0 0 0.3em; }
.lede { font-size: 1.2rem; color: var(--muted); }
.kicker { font-size: 13px; font-weight: 600; color: var(--warm); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 6px; }
.small { font-size: 14px; color: var(--muted); }
section { padding: 52px 0; border-top: 1px solid var(--line); }
section.hero { border-top: 0; padding-top: 12px; }

/* hero with portrait */
.hero-grid { display: grid; grid-template-columns: 1fr 260px; gap: 40px; align-items: center; }
.portrait { margin: 0; }
.portrait img { display: block; width: 100%; aspect-ratio: 592 / 900; object-fit: cover; border-radius: var(--radius); background: var(--line); }

/* buttons */
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 600; text-decoration: none; border: 2px solid var(--accent); touch-action: manipulation; transition: transform 80ms ease, opacity 80ms ease; cursor: pointer; font-size: 16px; font-family: var(--sans); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn[data-pressed], .link-card[data-pressed] { transform: scale(0.98); opacity: 0.85; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 20px; }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.cards.focus { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card p { margin: 0.4em 0 0; color: var(--muted); font-size: 16px; }
.card .tag { display: inline-block; font-size: 13px; font-weight: 600; color: var(--warm); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.card.featured { border: 2px solid var(--accent); padding: 28px; margin-top: 8px; }
.card.featured h2 { margin-top: 4px; }
.card.featured p { font-size: 17px; max-width: var(--measure); }
a.link-card { display: block; color: var(--ink); text-decoration: none; touch-action: manipulation; transition: transform 80ms ease, border-color 120ms ease; }
a.link-card .more { display: inline-block; margin-top: 12px; color: var(--accent); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { a.link-card:hover { border-color: var(--accent); } }

/* numbers */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0 0; padding: 0; list-style: none; }
.stats li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stats b { display: block; font-family: var(--serif); font-size: 1.7rem; line-height: 1.1; }
.stats span { color: var(--muted); font-size: 15px; }
.stats a { color: inherit; text-decoration: none; }

/* timeline (career) */
ol.timeline { list-style: none; margin: 20px 0 0; padding: 0; }
ol.timeline > li { display: grid; grid-template-columns: 9rem 1fr; gap: 16px; padding: 18px 0; border-top: 1px solid var(--line); }
ol.timeline > li:first-child { border-top: 0; }
ol.timeline .when { color: var(--muted); font-size: 15px; padding-top: 3px; }
ol.timeline h3 { margin: 0; }
ol.timeline .role { color: var(--warm); font-weight: 600; font-size: 15px; margin: 2px 0 6px; }
ol.timeline p { margin: 0; color: var(--muted); }

/* package lists */
ul.pkgs { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 20px; }
ul.pkgs li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 16px; color: var(--muted); }
ul.pkgs a { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; font-size: 15px; }

/* expandable detail */
details { border-top: 1px solid var(--line); padding: 6px 0; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 600; min-height: var(--tap-min); display: flex; align-items: center; touch-action: manipulation; color: var(--accent); }
details[open] > summary { margin-bottom: 4px; }

/* plain lists of links (patents, publications) */
ul.refs { list-style: none; margin: 12px 0 0; padding: 0; }
ul.refs li { padding: 4px 0 10px; border-top: 1px solid var(--line); }
ul.refs li > a { display: flex; align-items: center; min-height: var(--tap-min); }
ul.refs li:first-child { border-top: 0; }
ul.refs .meta { display: block; color: var(--muted); font-size: 14px; }

/* footer */
.site-footer { padding: 36px 0 56px; border-top: 1px solid var(--line); margin-top: 24px; }
ul.profiles { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-wrap: wrap; gap: 0 18px; }
ul.profiles a { display: inline-flex; align-items: center; min-height: var(--tap-min); }
.build-meta { color: transparent; font-size: 10px; margin: 0; user-select: none; }

@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; gap: 8px; }
  .portrait { max-width: 200px; order: -1; margin-top: 16px; }
  .cards, .cards.three { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  ol.timeline > li { grid-template-columns: 1fr; gap: 2px; }
  ul.pkgs { grid-template-columns: 1fr; }
  section { padding: 40px 0; }
  header.top nav.lang { border-left: 0; padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, a.link-card { transition: none; }
  .btn[data-pressed], .link-card[data-pressed] { transform: none; }
}
h2 a { color: inherit; text-decoration-thickness: 1px; text-decoration-color: var(--line); }
