/* Editorial layout: a sticky top bar, a wide hero with a thin fact row, then the work as cards.
   Type: Fraunces for display, Hanken Grotesk for reading, Plex Mono for numbers.
   Color: warm paper and ink with one accent (vermilion). The chart keeps its own two data colors. */
:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --sunk: #ece7dc;
  --ink: #161513;
  --ink-2: #3b3934;
  --muted: #67635a;
  --line: #ddd7ca;
  --line-2: #c4bdae;
  --accent: #b5370f;
  --accent-strong: #8f2a0a;
  --accent-soft: #f7e3d8;
  --mem: #d9822b;           /* chart: plain citation / plain notes */
  --doc: #1f6f68;           /* chart: labeled source chain */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 76rem;
  --pad: clamp(18px, 4vw, 56px);
  --radius: 18px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, dl, dd, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; display: block; }
.skip { position: absolute; left: 1rem; top: -3rem; z-index: 20; background: var(--ink); color: var(--bg); padding: 0.5rem 0.9rem; border-radius: 8px; }
.skip:focus { top: 0.75rem; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 2rem;
  padding: 0.85rem var(--pad);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.mark { font-family: var(--font-display); font-weight: 650; font-size: 1.15rem; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.mark:hover { color: var(--accent); }
.nav-links { margin-left: auto; display: flex; gap: 0.35rem; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  display: inline-flex; align-items: baseline; gap: 0.4rem; white-space: nowrap;
  padding: 0.4rem 0.8rem; border-radius: 999px;
  font-size: 0.88rem; font-weight: 550; color: var(--ink-2); text-decoration: none;
}
.nav-links a:hover { background: var(--sunk); color: var(--ink); }
.nav-links a[aria-current="true"] { background: var(--ink); color: var(--bg); }
.nav-links a[aria-current="true"] .n { color: inherit; opacity: 0.7; }
.nav .n { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }

/* Page */
.page { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--pad); }

/* Hero */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0;
  padding-block: clamp(2.5rem, 6vw, 4.5rem) 2.5rem;
}
.eyebrow, .label {
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent);
}
.hero h1 {
  margin-top: 1rem;
  font-family: var(--font-display); font-weight: 700; font-variation-settings: "SOFT" 50, "opsz" 144;
  font-size: clamp(3rem, 1.4rem + 6.6vw, 7.5rem); line-height: 0.9; letter-spacing: -0.035em;
}
.role {
  margin-top: 1.25rem; max-width: 34rem;
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: clamp(1.2rem, 1rem + 0.8vw, 1.6rem); line-height: 1.3; color: var(--ink-2);
}
.role { max-width: 52rem; }
.hero .about { margin-top: clamp(2.5rem, 5vw, 4rem); }
.intro { margin-top: 1.75rem; max-width: 50rem; font-size: clamp(1.08rem, 1rem + 0.35vw, 1.25rem); line-height: 1.65; color: var(--ink-2); }
.factrow { list-style: none; padding: 0; margin-top: clamp(2.25rem, 4vw, 3rem); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line-2); }
.factrow li { display: grid; gap: 0.35rem; align-content: start; padding: 1.1rem 1.5rem 0.2rem; border-left: 1px solid var(--line); }
.factrow li:first-child { padding-left: 0; border-left: 0; }
.factrow .label { color: var(--muted); font-size: 0.7rem; }
.factrow a, .factrow span:not(.label) { font-size: 1rem; font-weight: 600; color: var(--ink); }
.factrow a { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.factrow a:hover { color: var(--accent); text-decoration-color: currentColor; }
.contact { list-style: none; padding: 0; margin-top: 1.75rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.contact a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1rem; border-radius: 999px; border: 1px solid var(--ink);
  font-size: 0.9rem; font-weight: 600; color: var(--ink); text-decoration: none;
}
.contact li:first-child a { background: var(--ink); color: var(--bg); }
.contact a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.contact a::after { content: "\2197"; font-size: 0.8em; }
.contact a[href^="mailto:"]::after { content: none; }


.about {
  grid-column: 1 / -1; display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 1rem 4rem;
  padding-top: 2.5rem; border-top: 1px solid var(--ink);
}
.about p { max-width: 46rem; font-size: 1.02rem; color: var(--ink-2); }

/* Sections */
.main { padding-bottom: 2rem; }
.sec { padding-top: clamp(3.5rem, 7vw, 6rem); scroll-margin-top: 4rem; }
.sec-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--ink); }
.sec-num { font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent); }
.sec-head h2 {
  font-family: var(--font-display); font-weight: 650; font-variation-settings: "opsz" 144;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3.2rem); line-height: 1; letter-spacing: -0.03em;
}
.sec-head .n { margin-left: auto; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }

/* Cards */
.grid { display: grid; gap: 1.5rem; }
.grid-other { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; scroll-margin-top: 4.5rem; min-width: 0;
}
.entry { display: grid; gap: 1.75rem; padding: clamp(1.4rem, 3vw, 2.75rem); }
.entry > * { min-width: 0; }
.entry.featured { box-shadow: inset 4px 0 0 var(--accent); }
.entry-head { display: grid; gap: 0.9rem; max-width: 52rem; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.78rem; }
.entry-meta span { font-family: var(--font-mono); letter-spacing: 0.04em; }
.entry-meta .kind { color: var(--accent); font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; }
.entry-meta .date { color: var(--muted); }
.entry-meta .date::before { content: ""; display: inline-block; width: 1rem; height: 1px; background: var(--line-2); vertical-align: middle; margin-right: 0.5rem; }
.entry-meta .flag { margin-left: auto; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; }
.entry h3, .next h3 {
  font-family: var(--font-display); font-weight: 600; font-variation-settings: "opsz" 72;
  font-size: clamp(1.5rem, 1.15rem + 1.3vw, 2.25rem); line-height: 1.12; letter-spacing: -0.02em;
}
.payoff { font-size: 1.06rem; line-height: 1.65; color: var(--ink-2); }

/* Cover images run edge to edge at the top of the card */
.entry > .media.cover:first-child { margin: calc(-1 * clamp(1.4rem, 3vw, 2.75rem)); margin-bottom: 0; border-radius: 0; gap: 4px; }
.entry > .media.cover:first-child img { border-radius: 0; aspect-ratio: auto; max-height: 30rem; }
/* Media: cover images and charts sit on a tinted stage */
.media { border-radius: 12px; overflow: hidden; }
.media.cover { display: grid; grid-template-columns: 2fr 1fr; gap: 0.5rem; background: none; }
.media.cover img { width: 100%; height: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; }
.media.cover:not(.multi) { grid-template-columns: 1fr; }
.chart-wrap { background: var(--sunk); padding: clamp(0.6rem, 2vw, 1.5rem); }

/* Stat chips */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.6rem; }
.chip { padding: 0.9rem 1rem; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.chip dt { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.chip dd { margin-top: 0.35rem; font-size: 0.95rem; font-weight: 600; line-height: 1.35; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Toggles */
.toggles { border-top: 1px solid var(--line); }
.more { border-bottom: 1px solid var(--line); }
.more summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0.25rem;
  font-weight: 650; font-size: 1rem; color: var(--ink);
}
.more summary::-webkit-details-marker { display: none; }
.more summary i { position: relative; width: 1.8rem; height: 1.8rem; border-radius: 50%; border: 1px solid var(--line-2); flex: none; }
.more summary i::before, .more summary i::after { content: ""; position: absolute; left: 50%; top: 50%; width: 0.7rem; height: 1.5px; background: currentColor; transform: translate(-50%, -50%); }
.more summary i::after { transform: translate(-50%, -50%) rotate(90deg); }
.more[open] summary i::after { transform: translate(-50%, -50%) rotate(0deg); }
.more summary:hover { color: var(--accent); }
.more summary:hover i { border-color: var(--accent); }
.more-body { padding: 0 0.25rem 1.4rem; max-width: 52rem; color: var(--ink-2); }
.more-body ul { padding-left: 1.15rem; display: grid; gap: 0.7rem; }
.more-body li::marker { color: var(--accent); }

/* Footer of a card: links and tag pills */
.entry-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem 1.5rem; }
.links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.links a {
  display: inline-block; padding: 0.45rem 0.9rem; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: 0.85rem; font-weight: 600; text-decoration: none;
}
.links li + li a { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.links a:hover, .links li + li a:hover { background: var(--accent); color: #fff; box-shadow: none; }
.links a::after { content: " \2197"; font-size: 0.8em; }
.links .soon { color: var(--muted); font-size: 0.85rem; }
.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tags li { padding: 0.2rem 0.65rem; border-radius: 999px; background: var(--sunk); font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-2); }

/* Compact cards */
.entry.compact { padding: 0; gap: 0; align-content: start; }
.entry.compact.has-media { grid-column: 1 / -1; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
.compact-body { display: grid; gap: 0.8rem; align-content: start; padding: clamp(1.25rem, 2.5vw, 2rem); }
.entry.compact h3 { font-size: clamp(1.2rem, 1rem + 0.6vw, 1.5rem); line-height: 1.2; }
.entry.compact .payoff { font-size: 0.97rem; line-height: 1.6; }
.entry.compact .entry-foot { margin-top: 0.4rem; }
.media.thumb { border-radius: 0; }
.media.thumb img { width: 100%; height: 100%; min-height: 18rem; object-fit: cover; }

/* What's next: a dark band. Why: a large quiet paragraph. */
.band { margin-top: clamp(3.5rem, 7vw, 6rem); padding: clamp(1.75rem, 5vw, 4rem); border-radius: calc(var(--radius) + 6px); background: var(--ink); color: var(--bg); }
.band .sec-head { border-color: rgba(244, 241, 234, 0.25); }
.band .sec-num { color: #f0a17f; }
.band h3 { max-width: 48rem; color: var(--bg); }
.band p { margin-top: 1.25rem; max-width: 50rem; font-size: 1.04rem; line-height: 1.7; color: #d8d2c6; }
.why p { max-width: 50rem; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.2rem, 1rem + 0.7vw, 1.55rem); line-height: 1.5; color: var(--ink-2); }

.main footer { margin-top: 5rem; padding-block: 2rem 3rem; border-top: 1px solid var(--line); font-size: 0.82rem; color: var(--muted); }

/* Tailored page: "The posting, line by line" as requirement and evidence columns */
.fit { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 8fr); column-gap: 0; }
.fit .ask { padding-right: 2.5rem; }
.fit .ask + p { padding-left: 2.5rem; border-left: 1px solid var(--line); }
.fit > .sec-head, .fit > .lead, .fit > .note { grid-column: 1 / -1; }
.fit .lead { max-width: 46rem; margin-bottom: 1.5rem; font-size: 1.08rem; color: var(--ink-2); }
.fit .ask, .fit .ask + p { padding-block: 1.4rem; border-top: 1px solid var(--line); }
.fit .ask {
  font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; line-height: 1.3; letter-spacing: -0.01em; color: var(--ink);
  position: relative; padding-left: 1.1rem;
}
.fit .ask::before { content: ""; position: absolute; left: 0; top: 1.75rem; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--accent); }
.fit .ask + p { color: var(--ink-2); }
.fit a { color: var(--accent); }
.fit .gap { display: block; margin-top: 0.75rem; padding: 0.6rem 0.85rem; border-left: 3px solid var(--line-2); background: var(--sunk); border-radius: 0 8px 8px 0; color: var(--ink-2); font-size: 0.94rem; }
.fit .note { margin-top: 1.5rem; padding: 1.1rem 1.3rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 0.95rem; }

/* Chart: grouped horizontal bars with 95% intervals. Column geometry is shared by the rows, grid lines and axis. */
.chart {
  --lab: 8.5rem; --vgap: 0.85rem; --val: 4.2rem;
  background: var(--surface); border-radius: 12px;
  padding: 1.15rem 1.25rem 1.1rem; display: grid; gap: 1.1rem;
}
.chart-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.4rem 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); }
.legend i { display: inline-block; width: 0.65rem; height: 0.65rem; border-radius: 3px; margin-right: 0.45rem; }
.chart .unit { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.bars { position: relative; display: grid; gap: 0.9rem; }
.gridline { position: absolute; top: -0.3rem; bottom: -0.3rem; width: 0; border-left: 1px dashed var(--line); pointer-events: none; }
.gridline.zero { border-left-style: solid; border-color: var(--line-2); }
.bar-row { position: relative; display: grid; grid-template-columns: var(--lab) 1fr; gap: var(--vgap); align-items: center; }
.bar-row .name { font-size: 0.88rem; font-weight: 600; }
.pair { display: grid; gap: 0.3rem; }
.bar { display: grid; grid-template-columns: 1fr var(--val); gap: 0.5rem; align-items: center; }
.track { position: relative; height: 0.75rem; }
.track b { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 0 3px 3px 0; transform-origin: left center; }
.bar.s0 .track b { background: var(--mem); }
.bar.s1 .track b { background: var(--doc); }
.bar.zero .track b { width: 2px !important; background: var(--line-2); }
.ci { position: absolute; top: 50%; height: 0.55rem; transform: translateY(-50%); border-left: 1.5px solid var(--ink); border-right: 1.5px solid var(--ink); opacity: 0.55; pointer-events: none; }
.ci::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1.5px solid var(--ink); }
.val { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.axis { display: grid; grid-template-columns: var(--lab) 1fr; gap: var(--vgap); margin-top: -0.2rem; }
.axis > div { position: relative; height: 1.15rem; margin-right: calc(var(--val) + 0.5rem); border-top: 1px solid var(--line-2); }
.axis div span { position: absolute; top: 0.2rem; transform: translateX(-50%); font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }
.axis div span:first-child { transform: none; }
.axis div span:last-child { transform: translateX(-100%); }
.chart figcaption { font-size: 0.85rem; line-height: 1.5; color: var(--muted); }

/* Motion, only when allowed */
.bars.anim .track b { transform: scaleX(0); }
.bars.anim .ci { opacity: 0; }
.bars.anim.in .track b { transform: scaleX(1); transition: transform 0.8s var(--ease) calc(var(--i, 0) * 70ms); }
.bars.anim.in .ci { opacity: 0.55; transition: opacity 0.4s ease calc(0.5s + var(--i, 0) * 70ms); }
@media (prefers-reduced-motion: no-preference) {
  .reveal.pre { opacity: 0; transform: translateY(24px); }
  .reveal.pre.in { opacity: 1; transform: none; transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
  .card { transition: border-color 0.2s ease, box-shadow 0.3s ease, transform 0.3s var(--ease); }
  .card:hover { border-color: var(--line-2); box-shadow: 0 18px 40px -28px rgba(40, 30, 10, 0.35); }
  .entry.featured:hover { box-shadow: inset 4px 0 0 var(--accent), 0 18px 40px -28px rgba(40, 30, 10, 0.35); }
  .media img { transition: transform 0.6s var(--ease); }
  .card:hover .media img { transform: scale(1.025); }
  .more summary i::after { transition: transform 0.25s var(--ease); }
  .nav-links a, .contact a, .links a { transition: background-color 0.15s ease, color 0.15s ease; }
}

/* Tablet and phone */
@media (max-width: 900px) {
  .hero { padding-block: 2.5rem 2rem; }
  .factrow { grid-template-columns: 1fr; margin-top: 2.25rem; }
  .factrow li, .factrow li:first-child { padding: 0.85rem 0; border-left: 0; border-top: 1px solid var(--line); }
  .factrow li:first-child { border-top: 0; }
  .about { grid-template-columns: 1fr; gap: 0.6rem; padding-top: 1.75rem; }
  .grid-other { grid-template-columns: 1fr; }
  .entry.compact.has-media { grid-template-columns: 1fr; }
  .media.thumb img { min-height: 0; aspect-ratio: 16 / 9; }
  .fit { grid-template-columns: 1fr; }
  .fit .ask { padding-bottom: 0.3rem; }
  .fit .ask { padding-right: 0; }
  .fit .ask + p { border-top: 0; border-left: 0; padding-left: 1.1rem; padding-top: 0.3rem; }
}
@media (max-width: 600px) {
  .topbar { gap: 1rem; padding-block: 0.65rem; }
  .mark { display: none; }
  .nav-links { margin-left: 0; }
  .nav-links a { padding: 0.35rem 0.7rem; font-size: 0.84rem; }
  .entry { gap: 1.35rem; padding: 1.15rem; }
  .entry > .media.cover:first-child { margin: -1.15rem -1.15rem 0; }
  .compact-body { padding: 1.15rem; }
  .more-body ul { padding-left: 1rem; }
  .media.cover { grid-template-columns: 1fr; }
  .media.cover img + img { display: none; }
  .facts { grid-template-columns: 1fr 1fr; }
  .chip { padding: 0.7rem 0.8rem; }
  .chip dd { font-size: 0.88rem; }
  .chart { --lab: 6.6rem; --val: 4rem; padding: 0.9rem; }
  .bar-row .name { font-size: 0.8rem; }
  .entry-meta .flag { margin-left: 0; }
  .sec-head { margin-bottom: 1.4rem; }
}

/* What's next: three beats and cost chips on the dark band */
.band .beats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin-top: 2rem; }
.band .beat { padding-top: 1.1rem; border-top: 1px solid rgba(244, 241, 234, 0.22); }
.band .beat-num { font-family: var(--font-mono); font-size: 0.75rem; color: #f0a17f; }
.band .beat h4 { margin-top: 0.4rem; font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; line-height: 1.2; color: var(--bg); }
.band .beat p { margin-top: 0.6rem; font-size: 0.98rem; line-height: 1.65; color: #d8d2c6; }
.band .next-facts { margin-top: 2.25rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.band .chip { background: rgba(244, 241, 234, 0.06); border-color: rgba(244, 241, 234, 0.16); }
.band .chip dt { color: #b9b2a5; }
.band .chip dd { color: var(--bg); }
@media (max-width: 900px) { .band .beats { grid-template-columns: 1fr; gap: 0.5rem; } }
@media (max-width: 600px) { .band .next-facts { grid-template-columns: 1fr 1fr; } }
