/* ------------------------------------------------------------------
   tomasdiez.github.io — "set in ink"
   Fraunces (display) + Newsreader (text). Paper, ink, one brick red.
   Hairlines for structure. No boxes, no shadows, no gradients.
   ------------------------------------------------------------------ */

:root {
  --paper: #fdfbf7;
  --ink: #1a1714;
  --ink-soft: #5c554b;   /* 7.1:1 on paper — AA for small text */
  --accent: #8f2d16;     /* deep brick — 8:1 on paper */
  --hairline: #ddd5c7;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --text: "Newsreader", Georgia, "Times New Roman", serif;
  --measure: 65ch;
  --rhythm: 1.7rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
}

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-optical-sizing: auto;
  font-size: 1.125rem;
  line-height: 1.65;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- links & focus ---------- */

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) 45%, transparent);
  transition: text-decoration-color 120ms ease, color 120ms ease;
}

a:hover { text-decoration-color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 1rem;
  z-index: 10;
}

.skip-link:focus {
  left: var(--gutter);
  top: 0.5rem;
}

/* ---------- headings ---------- */

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 560;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(2.1rem, 5.4vw, 3.4rem); line-height: 1.06; }
h2 { font-size: clamp(1.5rem, 3.2vw, 1.9rem); }
h3 { font-size: 1.22rem; font-weight: 600; }

p { margin: 0 0 var(--rhythm); max-width: var(--measure); }
ul, ol { max-width: var(--measure); }

em { font-style: italic; }

hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: calc(var(--rhythm) * 2) 0;
}

/* ---------- shell ---------- */

.masthead-inner,
main,
.foot-inner {
  max-width: 46rem;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- masthead ---------- */

.masthead { border-bottom: 1px solid var(--hairline); }

.masthead-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.4rem;
  padding-bottom: 1.1rem;
}

.masthead-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.18rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.masthead-name:hover { color: var(--accent); }

.masthead nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.35rem;
}

.masthead nav a {
  font-family: var(--text);
  font-size: 0.98rem;
  color: var(--ink);
  text-decoration: none;
}

.masthead nav a:hover { color: var(--accent); }

.masthead nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
}

/* ---------- page scaffold ---------- */

main { padding-top: clamp(2.5rem, 7vw, 4.5rem); padding-bottom: 4rem; }

.kicker {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.1rem;
  font-variant-numeric: lining-nums;
}

.page-head { margin-bottom: calc(var(--rhythm) * 1.6); }

.lede {
  font-size: 1.28rem;
  line-height: 1.55;
  max-width: 34em;
}

/* ---------- sections with margin numbers ---------- */

.section {
  position: relative;
  border-top: 1px solid var(--hairline);
  padding-top: calc(var(--rhythm) * 1.1);
  margin-top: calc(var(--rhythm) * 1.8);
}

.section-num {
  display: block;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--accent);
  font-variant-numeric: oldstyle-nums;
  margin-bottom: 0.35rem;
}

@media (min-width: 66rem) {
  .section-num {
    position: absolute;
    left: -3.6rem;
    top: calc(var(--rhythm) * 1.1 + 0.35em);
    margin: 0;
    width: 2.6rem;
    text-align: right;
  }
}

.section h3 { margin-top: calc(var(--rhythm) * 1.15); }

.section h3 a {
  color: var(--ink);
  text-decoration-color: color-mix(in srgb, var(--ink) 30%, transparent);
}

.section h3 a:hover { color: var(--accent); }

/* ---------- hero (home) ---------- */

.hero { margin-bottom: calc(var(--rhythm) * 1.4); }

.hero h1 {
  font-size: clamp(2.4rem, 7vw, 4.1rem);
  max-width: 14em;
  margin-bottom: 0.55em;
}

.hero .lede { margin-bottom: var(--rhythm); }

.standfirst {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.22rem;
  color: var(--ink);
  max-width: 30em;
}

/* ---------- index lists (writing, publications, selected) ---------- */

.index {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: none;
}

.index > li {
  border-top: 1px solid var(--hairline);
  padding: 0.9rem 0;
}

.index > li:last-child { border-bottom: 1px solid var(--hairline); }

.index .entry-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.08rem;
  letter-spacing: -0.005em;
}

.index .entry-title a {
  color: var(--ink);
  text-decoration-color: color-mix(in srgb, var(--ink) 30%, transparent);
}

.index .entry-title a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.index .entry-meta {
  display: block;
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}

.index .entry-note { font-style: italic; }

/* selected work on home */

.selected .entry-desc {
  display: block;
  max-width: var(--measure);
  margin-top: 0.2rem;
  font-size: 1rem;
  color: var(--ink);
}

/* ---------- projects (work page) ---------- */

.project {
  border-top: 1px solid var(--hairline);
  padding-top: calc(var(--rhythm) * 0.9);
  margin-top: calc(var(--rhythm) * 1.2);
}

.project h2 { margin-bottom: 0.15em; }

.project h2 a {
  color: var(--ink);
  text-decoration: none;
}

.project h2 a:hover { color: var(--accent); }

.project .project-meta {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-bottom: 0.9rem;
}

.project .project-meta a { color: var(--accent); }

/* ---------- asides / footnote-style notes ---------- */

.aside {
  border-left: 2px solid var(--hairline);
  padding-left: 1.1rem;
  font-size: 0.98rem;
  font-style: italic;
  color: var(--ink-soft);
  max-width: 34em;
}

.aside a { font-style: normal; }

.aside-end { margin-top: 2.4rem; }

.section-foot {
  font-size: 0.95rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--hairline);
  padding-top: 0.8rem;
  margin-top: calc(var(--rhythm) * 1.2);
}

/* ---------- also list (work page one-liners) ---------- */

.also {
  list-style: none;
  margin: 0;
  padding: 0;
}

.also li {
  padding: 0.55rem 0;
  border-top: 1px solid var(--hairline);
  font-size: 1rem;
  max-width: var(--measure);
}

.also li:last-child { border-bottom: 1px solid var(--hairline); }

.also .also-name { font-family: var(--display); font-weight: 500; }

/* ---------- contact ---------- */

.contact-email {
  font-family: var(--display);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 500;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--rhythm);
}

.contact-list li {
  padding: 0.5rem 0;
  border-top: 1px solid var(--hairline);
}

.contact-list li:last-child { border-bottom: 1px solid var(--hairline); }

/* ---------- footer ---------- */

.site-foot {
  border-top: 1px solid var(--hairline);
  margin-top: 2rem;
}

.foot-inner { padding-top: 2.2rem; padding-bottom: 2.4rem; }

.foot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.6rem;
}

@media (min-width: 44rem) {
  .foot-grid { grid-template-columns: 1fr 1fr 1.2fr; gap: 2rem; }
}

.foot-col p { margin: 0 0 0.3rem; }

.foot-name { font-family: var(--display); font-weight: 600; }

.foot-place, .foot-label { font-size: 0.92rem; color: var(--ink-soft); }

.foot-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  margin-bottom: 0.5rem;
}

.elsewhere {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
}

.elsewhere li { display: inline; }

.elsewhere li + li::before { content: " · "; color: var(--ink-soft); }

.foot-rxtx { font-style: italic; font-size: 0.98rem; }

.colophon {
  margin-top: 2.2rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.82rem;
  color: var(--ink-soft);
  max-width: none;
}

/* ---------- 404 ---------- */

.lost h1 { font-size: clamp(2.6rem, 9vw, 5rem); }

/* ---------- print: it is called "set in ink" ---------- */

@media print {
  .masthead nav, .skip-link { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
}
