/* marklaurin.net: Mark Laurin's personal site. Tokens live in design-system.md; change them there first. */

:root {
  --bg: #FBF8F2;
  --surface: #FFFFFF;
  --alt: #F3EEE4;
  --ink: #1B2321;
  --muted: #57605C;
  --link: #103E3D;
  --link-hover: #0B2E2D;
  --btn-bg: #103E3D;
  --btn-bg-hover: #0B2E2D;
  --btn-ink: #FFFFFF;
  --accent-text: #7D5F28;
  --gold: #C09A5B;
  --rule: #E4DDCF;
  --rule-strong: #CFC6B4;
  --focus: #103E3D;
  --shadow: 0 1px 2px rgba(16, 62, 61, .05), 0 10px 28px rgba(16, 62, 61, .08);

  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;

  --fs-12: .75rem; --fs-14: .875rem; --fs-16: 1rem; --fs-19: 1.1875rem;
  --fs-24: 1.5rem; --fs-30: 1.875rem; --fs-40: 2.5rem; --fs-52: 3.25rem;

  --s-4: 4px; --s-8: 8px; --s-12: 12px; --s-16: 16px; --s-24: 24px;
  --s-32: 32px; --s-48: 48px; --s-64: 64px; --s-96: 96px;

  --r-6: 6px; --r-12: 12px; --r-pill: 999px;
  --t-fast: 150ms; --t-med: 250ms; --ease: cubic-bezier(.2, .7, .2, 1);
  --measure: 42rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121816;
    --surface: #19211F;
    --alt: #171F1D;
    --ink: #ECE7DD;
    --muted: #A7B1AC;
    --link: #8FCBC2;
    --link-hover: #B4DED7;
    --btn-bg: #D4B57E;
    --btn-bg-hover: #E2C796;
    --btn-ink: #12201E;
    --accent-text: #D4B57E;
    --rule: #2A3431;
    --rule-strong: #3A4643;
    --focus: #D4B57E;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--fs-19);
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
p, li { text-wrap: pretty; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:not(.btn):hover { color: var(--link-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--btn-bg); color: var(--btn-ink); padding: var(--s-12) var(--s-16); z-index: 10; font-family: var(--sans); }
.skip:focus { left: var(--s-16); top: var(--s-16); }

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 var(--s-16); }
@media (min-width: 768px) { .wrap { padding: 0 var(--s-32); } }
.measure { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.wrap.measure { max-width: calc(var(--measure) + 2 * var(--s-16)); }
@media (min-width: 768px) { .wrap.measure { max-width: calc(var(--measure) + 2 * var(--s-32)); } }

/* Headings */
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 var(--s-16); text-wrap: balance; color: var(--ink); }
h1 { font-size: 2.125rem; line-height: 1.1; letter-spacing: -.02em; }
h2 { font-size: var(--fs-30); margin-top: var(--s-48); }
h3 { font-size: var(--fs-24); }
@media (max-width: 359px) { h1 { font-size: 1.875rem; } }
@media (min-width: 768px) { h1 { font-size: var(--fs-52); } }
.section h2:first-child, .measure > h2:first-child { margin-top: 0; }
p { margin: 0 0 var(--s-16); }

.br-m { display: inline; }
.br-d { display: none; }
@media (min-width: 768px) { .br-m { display: none; } .br-d { display: inline; } }

.eyebrow { font-family: var(--sans); font-size: var(--fs-12); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 var(--s-12); }
.eyebrow::before { content: ""; display: inline-block; width: 24px; height: 2px; background: var(--gold); vertical-align: middle; margin-right: var(--s-12); position: relative; top: -2px; }
.intro { font-size: var(--fs-24); line-height: 1.45; color: var(--ink); max-width: 36rem; }
.dek { font-size: var(--fs-24); line-height: 1.45; font-style: italic; color: var(--muted); }
.answer { font-size: var(--fs-19); }
.byline, .meta { font-family: var(--sans); font-size: var(--fs-14); color: var(--muted); margin: var(--s-16) 0 0; }
.meta { margin: 0 0 var(--s-8); }
.source { font-family: var(--sans); font-size: var(--fs-14); color: var(--muted); border-left: 2px solid var(--gold); padding-left: var(--s-12); }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); background: var(--bg); }
.hdr { display: flex; align-items: center; justify-content: space-between; gap: var(--s-16); min-height: 64px; }
.wordmark { white-space: nowrap; font-family: var(--serif); font-size: var(--fs-24); font-weight: 600; letter-spacing: -.01em; color: var(--ink); text-decoration: none; padding: var(--s-8) 0; display: inline-flex; align-items: center; min-height: 44px; }
.wordmark:hover { color: var(--link); }
.nav { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--s-4); font-family: var(--sans); font-size: var(--fs-14); font-weight: 500; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-8); white-space: nowrap; color: var(--ink); text-decoration: none; border-radius: var(--r-6); }
@media (min-width: 768px) { .nav { gap: var(--s-12); font-size: var(--fs-16); } .nav a { padding: 0 var(--s-12); } }
.nav a:hover { color: var(--link); text-decoration: underline; }
.nav a[aria-current="page"] { color: var(--link); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 0; }
.ext { font-size: .85em; }

/* Hero */
.hero { padding: var(--s-48) 0 var(--s-48); }
@media (min-width: 768px) { .hero { padding: var(--s-96) 0 var(--s-64); } }
.hero-plain { padding-bottom: var(--s-24); }
.hero-grid, .about-grid { display: grid; gap: var(--s-32); align-items: center; }
@media (min-width: 1024px) {
  .hero-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s-48); }
  .about-grid { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: var(--s-48); }
}
.hero-photo, .about-photo { justify-self: start; }
@media (min-width: 1024px) { .hero-photo, .about-photo { justify-self: end; } }
.portrait { width: 200px; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-12); box-shadow: var(--shadow); }
@media (min-width: 768px) { .portrait { width: 280px; } }
.hero-photo picture, .about-photo picture { position: relative; display: block; }
.hero-photo picture::after, .about-photo picture::after { content: ""; position: absolute; inset: var(--s-12) calc(-1 * var(--s-12)) calc(-1 * var(--s-12)) var(--s-12); border: 1px solid var(--gold); border-radius: var(--r-12); z-index: -1; }
.hero-photo, .about-photo { position: relative; z-index: 0; }
.portrait-sm { width: 96px; border-radius: var(--r-6); box-shadow: none; }

/* Buttons and links */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-16) var(--s-24); margin-top: var(--s-24); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 var(--s-24); border-radius: var(--r-pill); font-family: var(--sans); font-size: var(--fs-16); font-weight: 600; text-decoration: none; transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.btn-primary { background: var(--btn-bg); color: var(--btn-ink); }
.btn-primary:hover { background: var(--btn-bg-hover); color: var(--btn-ink); }
.btn-primary:active { transform: translateY(1px); }
.link-arrow { font-family: var(--sans); font-size: var(--fs-16); font-weight: 600; display: inline-flex; align-items: center; min-height: 44px; }

/* Sections */
.section { padding: var(--s-48) 0; }
@media (min-width: 768px) { .section { padding: var(--s-64) 0; } }
.section-tight { padding-top: var(--s-16); }
.alt { background: var(--alt); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }

.build-list, .ticks, .slices { padding-left: 0; list-style: none; margin: 0 0 var(--s-24); }
.build-list li, .ticks li { position: relative; padding-left: var(--s-24); margin-bottom: var(--s-12); }
.build-list li::before, .ticks li::before { content: ""; position: absolute; left: 0; top: .7em; width: 10px; height: 2px; background: var(--gold); }
.slices { display: flex; flex-wrap: wrap; gap: var(--s-8); }
.slices li { font-family: var(--sans); font-size: var(--fs-14); border: 1px solid var(--rule-strong); border-radius: var(--r-pill); padding: var(--s-4) var(--s-12); background: var(--surface); }

/* Writing */
.post-grid { list-style: none; margin: var(--s-32) 0 0; padding: 0; display: grid; gap: var(--s-24); }
@media (min-width: 1024px) { .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.post-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-12); padding: var(--s-24); position: relative; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-med) var(--ease); }
.post-card:hover { border-color: var(--rule-strong); box-shadow: var(--shadow); }
.post-card h3 { font-size: var(--fs-24); margin-bottom: var(--s-12); }
.post-card h3 a { color: var(--ink); text-decoration: none; }
.post-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-12); }
.post-card h3 a:hover { color: var(--link); }
.post-card p:last-child { margin: 0; font-size: var(--fs-16); color: var(--muted); }
.more { margin-top: var(--s-24); }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { padding: var(--s-32) 0; border-top: 1px solid var(--rule); }
.post-list li:last-child { border-bottom: 1px solid var(--rule); }
.post-list h2 { margin: 0 0 var(--s-12); font-size: var(--fs-30); }
.post-list h2 a { color: var(--ink); text-decoration: none; }
.post-list h2 a:hover { color: var(--link); text-decoration: underline; }
.post-list p:last-child { margin: 0; color: var(--muted); }

.prose h2 { font-size: var(--fs-30); }
.prose > h2:first-child { margin-top: var(--s-16); }

.author-box { display: flex; gap: var(--s-24); align-items: flex-start; }
.author-box p { font-size: var(--fs-16); margin: 0; }
.author-name { font-size: var(--fs-19); font-family: var(--sans); font-weight: 600; margin: 0 0 var(--s-8); }
.more-h { font-size: var(--fs-24); margin-top: var(--s-48); }
.more-list { padding-left: 0; list-style: none; margin: 0; }
.more-list li { border-top: 1px solid var(--rule); }
.more-list a { display: block; padding: var(--s-12) 0; min-height: 44px; }

/* Elsewhere */
.elsewhere { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-12); }
@media (min-width: 600px) { .elsewhere { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.elsewhere a { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-12); padding: var(--s-16) var(--s-24); border: 1px solid var(--rule); border-radius: var(--r-12); background: var(--surface); text-decoration: none; color: var(--ink); min-height: 56px; transition: border-color var(--t-fast) var(--ease); }
.elsewhere a:hover { border-color: var(--link); color: var(--ink); }
.el-name { font-family: var(--serif); font-size: var(--fs-19); font-weight: 600; }
.el-handle { font-family: var(--sans); font-size: var(--fs-14); color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; margin: var(--s-24) 0; border: 1px solid var(--rule); border-radius: var(--r-12); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: var(--fs-14); }
caption { text-align: left; padding: var(--s-12) var(--s-16); font-weight: 600; color: var(--ink); }
th, td { text-align: left; padding: var(--s-12) var(--s-16); border-top: 1px solid var(--rule); vertical-align: top; }
thead th { border-top: 0; font-weight: 600; color: var(--muted); font-size: var(--fs-12); letter-spacing: .08em; text-transform: uppercase; }
tbody th { font-weight: 600; }
.timeline td:first-child { white-space: nowrap; font-weight: 600; color: var(--accent-text); }
.facts th { width: 32%; color: var(--muted); }

/* Crumbs */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-8); margin: 0 0 var(--s-24); padding: 0; font-family: var(--sans); font-size: var(--fs-14); color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: var(--s-8); color: var(--rule-strong); }
.crumbs a { color: var(--muted); display: inline-flex; min-height: 44px; align-items: center; }
.crumbs li { display: inline-flex; align-items: center; }

/* FAQ: native details, all closed on load */
.faq { border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: var(--s-16); padding: var(--s-16) 0; min-height: 56px; font-family: var(--serif); font-size: var(--fs-19); font-weight: 500; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover .q { color: var(--link); }
.pm { flex: none; width: 20px; height: 20px; position: relative; }
.pm::before, .pm::after { content: ""; position: absolute; left: 3px; right: 3px; top: 9px; height: 2px; background: var(--accent-text); transition: transform var(--t-med) var(--ease); }
.pm::after { transform: rotate(90deg); }
details[open] .pm::after { transform: rotate(0deg); }
.ans p { font-size: var(--fs-16); margin: 0 0 var(--s-16); }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding: var(--s-48) 0 var(--s-32); font-family: var(--sans); font-size: var(--fs-14); color: var(--muted); }
.ft { display: grid; gap: var(--s-24); }
@media (min-width: 768px) { .ft { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.ft-name { font-family: var(--serif); font-size: var(--fs-19); color: var(--ink); font-weight: 600; margin-bottom: var(--s-8); }
.ft-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 var(--s-16); }
.ft-links a { display: inline-flex; align-items: center; min-height: 44px; }
.ft-legal { grid-column: 1 / -1; border-top: 1px solid var(--rule); padding-top: var(--s-16); margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Lining figures everywhere: Newsreader defaults are fine, but a later font shorthand must never reset this. */
* { font-variant-numeric: lining-nums; }
.faq summary .q { text-wrap: balance; }
