/* Writing: editorial article pages and the email signup block. Uses tim.css variables.
   Layout: a wide title area, then a two-column body (sticky contents rail + reading column).
   Text sits in a ~68ch column; landscape charts break out wider, tall images sit beside their caption. */

.article {
  --measure: 680px;          /* reading column */
  --main: 860px;             /* reading column + figure breakout */
  --rail: 220px;
  --gap: 64px;
  --mat: #f4f4f2;
  padding: 0 0 112px; border: 0;
}

/* ── Title area ───────────────────────────────────────────────── */
.article-head { padding: 88px 0 56px; border-bottom: 1px solid var(--rule); background: linear-gradient(180deg, var(--paper-2) 0%, var(--paper) 100%); }
.article-head-inner { max-width: calc(var(--rail) + var(--gap) + var(--main) + 48px); margin: 0 auto; padding: 0 24px; }
.article-head-inner > * { max-width: 900px; margin-left: calc(var(--rail) + var(--gap)); }
.article .kicker { font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); display: flex; gap: 10px; align-items: center; margin-bottom: 22px; }
.article .kicker a { text-decoration: none; color: inherit; }
.article .kicker a:hover { text-decoration: underline; text-underline-offset: 3px; }
.article .kicker span { color: var(--ink-faint); font-weight: 400; }
.article-head h1 { font-size: clamp(42px, 6.2vw, 76px); line-height: 1.02; letter-spacing: -0.028em; text-wrap: balance; }
.article-head .lede { margin-top: 24px; max-width: 640px; font-family: var(--serif); font-size: clamp(21px, 2.2vw, 25px); line-height: 1.45; color: var(--ink-soft); text-wrap: pretty; }
.article-head .meta { margin-top: 36px; display: flex; align-items: center; gap: 14px; font-family: var(--sans); }
.article-head .meta-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; }
.article-head .meta p { display: flex; flex-direction: column; line-height: 1.35; }
.article-head .meta-name { font-size: 15px; font-weight: 500; color: var(--ink); }
.article-head .meta-sub { font-size: 14px; color: var(--ink-faint); display: flex; gap: 8px; }

/* ── Body grid ────────────────────────────────────────────────── */
.article-body {
  max-width: calc(var(--rail) + var(--gap) + var(--main) + 48px); margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: var(--rail) minmax(0, var(--main)); column-gap: var(--gap); align-items: start;
}
.article-rail { position: sticky; top: 88px; padding-top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; scrollbar-width: none; }
.article-rail::-webkit-scrollbar { display: none; }
.article-main { min-width: 0; padding-top: 64px; }

/* Contents */
.article .toc { font-family: var(--sans); margin: 0; padding: 0; border: 0; }
.article .toc > p { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 14px; }
.article .toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.article .toc li { margin: 0; padding: 0; font-size: 14px; line-height: 1.4; }
.article .toc a { display: block; padding: 6px 0 6px 16px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-faint); text-decoration: none; transition: color .15s, border-color .15s; }
.article .toc a:hover { color: var(--ink); }
.article .toc a.is-active { color: var(--accent); border-left-color: var(--accent); }

/* Reading progress */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); z-index: 60; pointer-events: none; }

/* ── Prose ────────────────────────────────────────────────────── */
.prose { font-family: var(--serif); font-size: 21px; line-height: 1.68; color: var(--ink); font-optical-sizing: auto; }
.prose > section > *, .prose section section > * { max-width: var(--measure); }
.prose section { padding: 0; border: 0; }
.prose > section { margin-top: 88px; padding-top: 0; scroll-margin-top: 96px; }
.prose > section:first-child { margin-top: 0; }
.prose section section { margin-top: 64px; scroll-margin-top: 96px; }
.prose > section + section { border-top: 0; }
.prose > section > h2 { padding-top: 40px; border-top: 1px solid var(--ink); }
.prose > section:first-child > h2 { padding-top: 0; border-top: 0; }
.prose h2 { font-size: clamp(30px, 3.4vw, 40px); line-height: 1.12; letter-spacing: -0.02em; margin-bottom: 24px; text-wrap: balance; }
.prose h3 { font-size: clamp(24px, 2.4vw, 28px); line-height: 1.2; letter-spacing: -0.012em; margin-bottom: 16px; text-wrap: balance; }
.prose h4 { font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 10px; }
.prose p { margin: 0 0 22px; text-wrap: pretty; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(14, 95, 104, .35); text-underline-offset: 3px; text-decoration-thickness: 1px; overflow-wrap: anywhere; transition: text-decoration-color .15s; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose #opening > p:first-child { font-size: clamp(24px, 2.4vw, 28px); line-height: 1.42; letter-spacing: -0.008em; }

.prose ul, .prose ol { margin: 0 0 28px; padding-left: 0; }
.prose ul { list-style: none; }
.prose ul > li { position: relative; padding-left: 26px; }
.prose ul > li::before { content: ""; position: absolute; left: 4px; top: .78em; width: 8px; height: 1.5px; background: var(--accent); }
.prose ol { padding-left: 1.4em; }
.prose li { margin: 0 0 12px; }
.prose ol > li { padding-left: .3em; }
.prose ol > li::marker { color: var(--accent); font-family: var(--sans); font-size: .82em; font-weight: 600; }

.prose code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .78em; background: var(--paper-2); padding: 2px 6px; border-radius: 5px; }
.prose pre { margin: 4px 0 30px; background: var(--night); color: #ededed; border-radius: 12px; padding: 20px 24px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; font-size: 14px; line-height: 1.65; color: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── Figures ──────────────────────────────────────────────────── */
.prose figure { margin: 44px 0 52px; display: flex; flex-direction: column; max-width: var(--measure); }
.prose figure img { order: 1; width: 100%; height: auto; border-radius: 6px; background: #fff; box-shadow: 0 0 0 1px rgba(17,17,17,.07), 0 10px 30px -18px rgba(17,17,17,.35); }
.prose figure figcaption { order: 2; }
.prose figure .fig-credit { order: 3; }
.prose figure.fig-wide { max-width: var(--main); padding: 28px; background: var(--mat); border-radius: 14px; }
.prose figure.fig-square { max-width: var(--main); padding: 28px; background: var(--mat); border-radius: 14px; }
.prose figure.fig-wide figcaption, .prose figure.fig-square figcaption { max-width: var(--measure); }
.prose figure.fig-square img { max-width: 520px; margin: 0 auto; }
.prose figcaption { margin-top: 16px; font-family: var(--sans); font-size: 14px; line-height: 1.55; color: var(--ink-soft); }
.prose figcaption a { color: var(--ink-faint); text-decoration-color: var(--rule); }
.prose .fig-credit { margin: 8px 0 0; font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; line-height: 1.4; color: var(--ink-faint); }
.prose .fig-credit a { color: inherit; text-decoration-color: var(--rule); }

/* Tall images (portrait screenshots, infographics): image + caption side by side on wide screens */
.prose figure.fig-tall { max-width: var(--main); display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); column-gap: 36px; align-items: end; padding: 28px; background: var(--mat); border-radius: 14px; }
.prose figure.fig-tall img { grid-column: 1; grid-row: 1 / span 2; }
.prose figure.fig-tall figcaption { grid-column: 2; grid-row: 1; align-self: end; margin: 0; padding-bottom: 4px; border-top: 1px solid rgba(17,17,17,.12); padding-top: 16px; font-size: 15px; }
.prose figure.fig-tall .fig-credit { grid-column: 2; grid-row: 2; align-self: end; }
.prose figure.fig-tall:not(:has(.fig-credit)) figcaption { grid-row: 1 / span 2; }

/* ── Example boxes and add/cut lists ──────────────────────────
   Deliberately colour-neutral (no colour carries meaning): every box gets the same
   light grey panel with a dark left rule; Add and Cut are told apart by their headings. */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 8px 0 32px; }
.card { background: var(--paper-2); border: 0; border-left: 3px solid var(--ink); border-radius: 0 12px 12px 0; padding: 20px 22px; font-size: 18px; line-height: 1.5; color: var(--ink); }
.prose .card p { margin: 0 0 10px; }
.prose .card p:last-child { margin-bottom: 0; }
.prose .card .card-label { display: block; font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 10px; }
.prose .card .note-line { font-family: var(--sans); font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); padding-top: 10px; border-top: 1px solid rgba(17,17,17,.12); margin-top: 14px; }
/* Big-number stat boxes: same neutral panel, the stat set large */
.prose .card-number p:nth-child(2) { font-size: 24px; line-height: 1.28; letter-spacing: -0.01em; color: var(--ink); }

.addcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 8px 0 16px; }
.addcut { background: var(--paper-2); border: 0; border-radius: 12px; padding: 20px 22px 8px; font-size: 18px; line-height: 1.45; }
.prose .addcut h4 { font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid rgba(17,17,17,.14); }
.prose .addcut ul { margin-bottom: 10px; }
.prose .addcut li { margin-bottom: 10px; padding-left: 24px; color: var(--ink); }
.prose .addcut li::before { background: none; width: auto; height: auto; top: 0; left: 2px; color: var(--ink-soft); font-family: var(--sans); font-weight: 600; }
.prose .addcut-add li::before { content: "+"; }
.prose .addcut-cut li::before { content: "\2013"; }

/* Notes and quotes */
.note { margin: 12px 0 34px; padding: 22px 26px; background: var(--paper-2); border-left: 3px solid var(--accent); border-radius: 0 14px 14px 0; font-size: 18px; line-height: 1.6; }
.prose .note p { margin: 0 0 10px; }
.prose .note p:last-child { margin-bottom: 0; }
.prose .note .note-title { font-family: var(--sans); font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.prose blockquote { margin: 44px 0; padding: 0 0 0 28px; border-left: 3px solid var(--accent); }
.prose blockquote p:first-child { font-size: clamp(26px, 2.8vw, 32px); line-height: 1.28; letter-spacing: -0.012em; font-style: italic; }
.prose blockquote .cite { font-style: normal; font-family: var(--sans); font-size: 14px; color: var(--ink-faint); margin: 0; }

/* Tables */
.table-wrap { margin: 8px 0 32px; overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 15px; line-height: 1.5; }
.prose th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); padding: 10px 14px 10px 0; border-bottom: 1px solid var(--ink); }
.prose td { padding: 14px 14px 14px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose table.t2 td:first-child { font-family: var(--serif); font-size: 18px; width: 34%; }
.prose table.t4 td:first-child { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--accent); width: 32px; }
.prose table.t4 td:nth-child(2) { font-weight: 600; }
.prose table.t4 td:nth-child(4) { color: var(--ink-soft); }
.prose .table-wrap:has(table.t4) { max-width: var(--main); }

/* Steps */
.prose ol.steps { list-style: none; padding: 0; counter-reset: st; margin-bottom: 32px; }
.prose ol.steps li { counter-increment: st; position: relative; padding: 0 0 22px 56px; margin: 0; }
.prose ol.steps li:not(:last-child)::after { content: ""; position: absolute; left: 17px; top: 42px; bottom: 6px; width: 1px; background: var(--rule); }
.prose ol.steps li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(14, 95, 104, .3); background: rgba(14, 95, 104, 0.06); color: var(--accent); font-family: var(--serif); font-size: 18px; display: flex; align-items: center; justify-content: center; }
.prose ol.steps .step-title { font-family: var(--sans); font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.prose ol.steps p { margin-bottom: 0; }

/* ── Sources ──────────────────────────────────────────────────── */
.prose #sources { margin-top: 112px; }
.prose #sources > h2 { font-size: clamp(24px, 2.6vw, 30px); }
.prose #sources .src-sub { font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 10px; }
.prose #sources .caveats { font-family: var(--sans); font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); padding: 18px 20px; background: var(--paper-2); border-radius: 12px; margin-bottom: 36px; }
.prose ol.sources { font-family: var(--sans); font-size: 14.5px; line-height: 1.45; padding: 0; list-style: none; max-width: var(--main); columns: 2 340px; column-gap: 40px; }
.prose ol.sources li { position: relative; padding: 0 0 0 36px; margin: 0 0 14px; break-inside: avoid; }
.prose ol.sources li::before { content: attr(value); position: absolute; left: 0; top: 1px; width: 26px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-faint); }
.prose ol.sources a { color: var(--ink); text-decoration-color: var(--rule); }
.prose ol.sources a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.prose ol.sources .src-meta { display: block; margin-top: 2px; color: var(--ink-faint); font-size: 12.5px; }

/* Email signup: kept hidden (the hidden attribute) until the real form ID is in. Shared with the homepage. */
.signup[hidden] { display: none !important; }
.signup { margin: 48px 0 0; padding: 22px 22px 24px; border: 1px solid var(--rule); border-radius: 14px; background: var(--paper-2); font-family: var(--sans); }
.article .signup { max-width: var(--measure); margin-top: 72px; padding: 28px 28px 30px; }
.signup .signup-title { font-family: var(--serif); font-size: 22px; line-height: 1.3; margin: 0 0 12px; color: var(--ink); }
.signup .signup-row { display: flex; gap: 10px; flex-wrap: wrap; }
.signup input[type="email"] { flex: 1 1 220px; min-width: 0; font: inherit; font-size: 16px; padding: 12px 16px; border: 1px solid rgba(17,17,17,.2); border-radius: 999px; background: #fff; color: var(--ink); }
.signup input[type="email"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.signup .btn { border: 0; cursor: pointer; padding: 12px 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Medium: drop the rail, centre the column ─────────────────── */
@media (max-width: 1100px) {
  .article-head-inner > * { margin-left: 0; }
  .article-head-inner, .article-body { max-width: calc(var(--main) + 48px); }
  .article-body { display: block; }
  .article-rail { position: static; max-height: none; overflow: visible; padding-top: 48px; }
  .article .toc { max-width: var(--measure); padding: 22px 24px; background: var(--paper-2); border-radius: 14px; }
  .article .toc ol { border-left: 0; columns: 2 260px; column-gap: 28px; }
  .article .toc li { break-inside: avoid; }
  .article .toc a { padding: 5px 0; border-left: 0; margin: 0; color: var(--ink-soft); }
  .article .toc a.is-active { color: var(--ink-soft); }
  .article-main { padding-top: 56px; }
}

/* ── Phone ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .article { padding-bottom: 72px; }
  .article-head { padding: 48px 0 36px; }
  .article .kicker { font-size: 12px; margin-bottom: 16px; }
  .article-head h1 { font-size: clamp(36px, 10.5vw, 46px); line-height: 1.04; }
  .article-head .lede { font-size: 20px; margin-top: 18px; }
  .article-head .meta { margin-top: 26px; }
  .article-rail { padding-top: 32px; }
  .article .toc { padding: 18px 20px; }
  .article .toc ol { columns: 1; }
  .article .toc li { font-size: 14.5px; }
  .article-main { padding-top: 44px; }

  .prose { font-size: 18.5px; line-height: 1.64; }
  .prose > section { margin-top: 64px; }
  .prose > section > h2 { padding-top: 28px; }
  .prose section section { margin-top: 48px; }
  .prose h2 { font-size: 29px; margin-bottom: 18px; }
  .prose h3 { font-size: 23px; }
  .prose p { margin-bottom: 18px; }
  .prose #opening > p:first-child { font-size: 22px; }

  /* Figures go edge to edge on phone */
  .prose figure, .prose figure.fig-wide, .prose figure.fig-square, .prose figure.fig-tall { display: flex; flex-direction: column; margin: 32px -24px 40px; padding: 18px; border-radius: 0; background: var(--mat); max-width: none; }
  .prose figure:not([class]) { padding: 0; background: none; margin-left: 0; margin-right: 0; }
  .prose figure.fig-tall img { max-width: 300px; margin: 0 auto; }
  .prose figure.fig-tall figcaption { border-top: 0; padding-top: 0; margin-top: 14px; font-size: 14px; align-self: stretch; }
  .prose figure.fig-tall .fig-credit { align-self: stretch; }
  .prose figcaption { margin-top: 12px; font-size: 13.5px; }

  .cards, .addcuts { grid-template-columns: 1fr; gap: 12px; }
  .card, .addcut, .note { font-size: 17px; }
  .card { padding: 18px 18px; }
  .note { padding: 18px 20px; }
  .prose pre { margin-left: -24px; margin-right: -24px; border-radius: 0; padding: 18px 24px; }
  .prose pre code { font-size: 13px; }
  .prose blockquote { padding-left: 20px; }

  /* The four-column table becomes stacked rows; the two-column table stays a table */
  .table-wrap { overflow: visible; }
  .prose table { font-size: 14.5px; }
  .prose table.t2 td:first-child { width: 38%; font-size: 17px; line-height: 1.35; }
  .prose table.t4, .prose table.t4 tbody, .prose table.t4 td { display: block; width: auto; }
  .prose table.t4 thead { display: none; }
  .prose table.t4 tr { display: grid; grid-template-columns: 30px 1fr; column-gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
  .prose table.t4 tr:first-child { border-top: 1px solid var(--ink); }
  .prose table.t4 td { border: 0; padding: 2px 0; }
  .prose table.t4 td:first-child { width: auto; grid-row: 1 / span 3; line-height: 1.2; }
  .prose table.t4 td:nth-child(2) { font-size: 16px; }
  .prose table.t4 td:nth-child(4) { color: var(--ink-soft); }

  .prose #sources { margin-top: 80px; }
  .prose ol.sources { columns: 1; }
  .article .signup { margin-top: 56px; padding: 22px; }
}

/* ── Single-column variant (short pieces: no contents rail) ───── */
.article--single .article-head-inner { max-width: calc(var(--main) + 48px); }
.article--single .article-head-inner > * { margin-left: max(0px, calc((100% - var(--measure)) / 2)); max-width: calc(var(--measure) + 90px); }
.article--single .article-head .lede { max-width: var(--measure); }
.article--single .article-body { display: block; max-width: calc(var(--main) + 48px); }
.article--single .article-main { padding-top: 72px; }
.article--single .prose > section > *, .article--single .signup { margin-left: auto; margin-right: auto; }
.article--single .prose > section { margin-top: 96px; }
.article--single .prose > section:first-child { margin-top: 0; }
.article--single .prose figure.fig-wide, .article--single .prose figure.fig-tall { margin-top: 48px; margin-bottom: 56px; }

/* Job-by-job rows: role on the left, advice on the right */
.prose .job { display: grid; grid-template-columns: 170px minmax(0, 1fr); column-gap: 28px; padding: 22px 0; border-top: 1px solid var(--rule); }
.prose .job:last-child { border-bottom: 1px solid var(--rule); }
.prose .job h3 { font-family: var(--sans); font-size: 15px; font-weight: 600; letter-spacing: 0; line-height: 1.5; margin: 6px 0 0; color: var(--ink); }
.prose .job p { margin: 0; }

/* Nine skills: numbered, two columns, neutral */
.prose ol.skill-list { list-style: none; padding: 0; counter-reset: sk; columns: 2 260px; column-gap: 32px; margin-bottom: 30px; border-top: 1px solid var(--rule); }
.prose ol.skill-list li { counter-increment: sk; break-inside: avoid; position: relative; padding: 12px 0 12px 40px; margin: 0; border-bottom: 1px solid var(--rule); font-size: 19px; line-height: 1.4; }
.prose ol.skill-list li::before { content: counter(sk); position: absolute; left: 0; top: 12px; width: 26px; font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--ink-soft); }

@media (max-width: 640px) {
  .article--single .article-main { padding-top: 44px; }
  .article--single .prose > section { margin-top: 64px; }
  .prose .job { grid-template-columns: 1fr; padding: 18px 0; }
  .prose .job h3 { margin: 0 0 6px; }
  .prose ol.skill-list { columns: 1; }
  .prose ol.skill-list li { font-size: 17.5px; }
}
.article--single .prose ol.sources { max-width: var(--measure); columns: 2 290px; column-gap: 32px; }
