/* ============================================================
   markuslipp.org — shared stylesheet
   Palette:  ink #1A1D1C · paper #FBFAF7 · deep #14564F
             sand #C9BFA9 · muted #6B6F6D · rule #E3E0D8
   Type:     Newsreader (display + reading) · IBM Plex Sans (utility)
   ============================================================ */

:root {
  --ink:   #1A1D1C;
  --paper: #FBFAF7;
  --deep:  #14564F;
  --sand:  #C9BFA9;
  --muted: #6B6F6D;
  --rule:  #E3E0D8;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --measure: 68ch;
  --gutter: clamp(1.25rem, 5vw, 3.5rem);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.75;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.measure { max-width: var(--measure); }

/* ---------- Header ---------- */

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

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

.wordmark {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark:hover { color: var(--deep); }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.nav a:hover { color: var(--deep); border-bottom-color: var(--sand); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--deep); }

/* ---------- Hero ---------- */

.hero { padding-top: clamp(2.5rem, 6vw, 4.5rem); padding-bottom: 1rem; }

.hero-figure {
  width: 100%;
  max-width: 900px;
  margin-bottom: clamp(2rem, 5vw, 3.25rem);
}

.hero-figure svg { width: 100%; height: auto; display: block; }

.thesis {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4.4vw, 2.9rem);
  line-height: 1.22;
  font-weight: 400;
  letter-spacing: -0.012em;
  margin: 0 0 1.5rem;
  max-width: 22ch;
}

.thesis em { font-style: italic; color: var(--deep); }

.standfirst {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--ink);
  max-width: 58ch;
  margin: 0;
}

/* ---------- Page titles ---------- */

.page-head { padding-top: clamp(2.25rem, 5vw, 3.5rem); }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}

h1.title {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.015em;
  margin: 0 0 1.25rem;
}

.lede {
  font-size: 1.15rem;
  line-height: 1.7;
  max-width: 60ch;
  margin: 0;
}

/* ---------- Sections ---------- */

.band { padding-top: clamp(3rem, 7vw, 5rem); padding-bottom: clamp(0.5rem, 2vw, 1rem); }
.band-last { padding-bottom: clamp(3rem, 7vw, 5rem); }

.band-rule { border-top: 1px solid var(--rule); }

h2.section {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--deep);
  margin: 0 0 1.75rem;
}

h3.item {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.3;
  margin: 0 0 0.5rem;
}

p { margin: 0 0 1.15rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--deep); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }

/* ---------- Areas grid ---------- */

.areas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: clamp(1.75rem, 4vw, 3rem);
}

.area { border-top: 2px solid var(--deep); padding-top: 1rem; }
.area p { font-size: 1rem; color: var(--ink); margin: 0; }

/* ---------- Definition-style list ---------- */

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

.entry {
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0 2rem;
}

.entry:last-child { border-bottom: 1px solid var(--rule); }

.entry-meta {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding-top: 0.42rem;
}

.entry-body p { font-size: 1rem; margin: 0.35rem 0 0; color: var(--muted); }
.entry-body h3 { margin: 0; }
.entry-body h3 a { text-decoration: none; }
.entry-body h3 a:hover { text-decoration: underline; }

@media (max-width: 620px) {
  .entry { grid-template-columns: 1fr; gap: 0.35rem; }
  .entry-meta { padding-top: 0; }
}

/* ---------- Prose (essays) ---------- */

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.35rem; }

.prose h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.3;
  margin: 2.75rem 0 1rem;
}

.prose blockquote {
  margin: 2rem 0;
  padding-left: 1.5rem;
  border-left: 2px solid var(--sand);
  font-style: italic;
  color: var(--ink);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.75rem 0;
}

.byline {
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 2.5rem;
}

/* ---------- Publications ---------- */

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  margin: 0 0 2.5rem;
  padding: 0;
  list-style: none;
}

.metric-value {
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1;
  color: var(--deep);
  display: block;
}

.metric-label {
  font-family: var(--sans);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-top: 0.45rem;
}

.refs { margin: 0; padding: 0; list-style: none; max-width: var(--measure); }

.refs li {
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
  font-size: 0.98rem;
  line-height: 1.6;
}

.refs li:last-child { border-bottom: 1px solid var(--rule); }
.refs .j { font-style: italic; }
.refs .y { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); }

.refs .doi {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

.refs .doi:hover { color: var(--deep); border-bottom-color: var(--sand); }

/* ---------- Citation line ---------- */

.cite {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
}

.cite a { color: var(--deep); text-decoration: none; border-bottom: 1px solid var(--rule); }
.cite a:hover { border-bottom-color: var(--sand); }
.cite-note { font-size: 0.8rem; }

.entry-doi {
  font-family: var(--sans);
  font-size: 0.78rem;
  margin-top: 0.4rem;
}

.entry-doi a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--rule); }
.entry-doi a:hover { color: var(--deep); border-bottom-color: var(--sand); }

/* ---------- Contact rows ---------- */

.rows { margin: 0; padding: 0; list-style: none; max-width: var(--measure); }

.rows li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}

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

.rows dt, .row-key {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 620px) {
  .rows li { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* ---------- Contact ---------- */

.contact-address {
  font-size: clamp(1.35rem, 3.2vw, 1.75rem);
  line-height: 1.3;
  margin: 0 0 1.5rem;
}

.contact-address a {
  color: var(--deep);
  text-decoration: none;
  border-bottom: 1px solid var(--sand);
}

.contact-address a:hover {
  color: var(--ink);
  border-bottom-color: var(--deep);
}

/* ---------- Footer ---------- */

.foot {
  margin-top: clamp(3.5rem, 8vw, 6rem);
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
  padding-bottom: 3rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  justify-content: space-between;
  align-items: center;
}

.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--deep); text-decoration: underline; }

/* ---------- Accessibility ---------- */

a:focus-visible, .nav a:focus-visible {
  outline: 2px solid var(--deep);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--gutter);
  top: 0.75rem;
  z-index: 10;
  background: var(--deep);
  color: var(--paper);
  padding: 0.5rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  text-decoration: none;
}

/* ---------- Signature animation ---------- */

.sig-mark {
  stroke-dasharray: 170;
  stroke-dashoffset: 170;
  animation: draw 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.sig-ray { opacity: 0; animation: fade 0.9s ease-out forwards; }
.sig-dot { opacity: 0; animation: fade 0.9s ease-out forwards; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .sig-mark { stroke-dashoffset: 0; animation: none; }
  .sig-ray, .sig-dot { opacity: 1; animation: none; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
