/* Field Notes: the hub and article pages. Builds on styles.css tokens. */

/* ---------- shared bits ---------- */
.eyebrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  font-size: 0.9375rem; line-height: 1.2;
  color: var(--ink-soft);
}
/* Set like a numbered entry in a notebook: the number in the display face, a short rule, then the topic. */
.eyebrow .no { font-family: var(--display); font-size: 1.0625rem; color: var(--ink); }
.eyebrow .dot { width: 22px; height: 1px; background: var(--ink); opacity: 0.35; flex: none; }
.eyebrow a { color: var(--ink); text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- hub ---------- */
.notes-head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(24px, 5vw, 80px);
  align-items: end;
  padding: clamp(24px, 3.5vw, 56px) var(--gutter) clamp(32px, 3.5vw, 52px);
}
.notes-head h1 {
  font-size: clamp(3rem, 7.4vw, 7.6rem);
  line-height: 0.95;
  letter-spacing: -0.025em;
}
.notes-head .blurb { font-size: clamp(1.15rem, 1.4vw, 1.35rem); line-height: 1.5; max-width: 40ch; }
.notes-head .blurb + .filters { margin-top: 22px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: var(--radius-pill); border: 1.5px solid var(--ink-line);
  background: transparent; color: var(--ink);
  font: 500 0.9375rem/1 var(--text); cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}
.filter span { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.filter:hover { border-color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.filter[aria-pressed="true"] span { color: var(--cream-soft); }

.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(36px, 4vw, 56px) clamp(20px, 2.6vw, 40px);
  padding: 0 var(--gutter) clamp(64px, 7vw, 104px);
  margin: 0; list-style: none;
}
.notes-grid[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
.card[hidden] { display: none; }

/* ---------- card ---------- */
.card { position: relative; display: grid; align-content: start; gap: 14px; }
.card-media { margin: 0; overflow: hidden; border-radius: 14px; background: var(--paper-deep); aspect-ratio: 3 / 2; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-media img { transform: scale(1.03); }
@media (prefers-reduced-motion: reduce) { .card-media img { transition: none; } .card:hover .card-media img { transform: none; } }
.card h2, .card h3 {
  font-size: clamp(1.5rem, 1.9vw, 1.95rem);
  line-height: 1.1;
  letter-spacing: -0.008em;
  text-wrap: balance;
}
.card h2 a, .card h3 a { text-decoration: none; }
.card h2 a::after, .card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 14px; }
.card h2 a:focus-visible, .card h3 a:focus-visible { outline: none; }
.card:has(a:focus-visible) { outline: 2px solid var(--leaf); outline-offset: 6px; border-radius: 14px; }
.card:hover h2 a, .card:hover h3 a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.card .dek { color: var(--ink-soft); line-height: 1.55; }
.card .time { font-size: 0.875rem; color: var(--ink-soft); }

/* ---------- article ---------- */
.note-head { padding: clamp(20px, 3vw, 44px) var(--gutter) clamp(28px, 3vw, 44px); }
.note-head .eyebrow { margin-bottom: clamp(16px, 1.6vw, 24px); }
.note-head .eyebrow .no { margin-left: auto; }
.note-head h1 {
  max-width: 18ch;
  font-size: clamp(2.5rem, 5.4vw, 5.25rem);
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.note-head .dek { margin-top: clamp(16px, 1.6vw, 24px); max-width: 52ch; font-size: clamp(1.2rem, 1.55vw, 1.45rem); line-height: 1.5; color: var(--ink-soft); }
.byline { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 20px; font-size: 0.9375rem; color: var(--ink-soft); }
/* Wide screens: title on the left, standfirst and byline beside it, so the header has no empty half. */
@media (min-width: 961px) {
  .note-head {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
    grid-template-rows: auto 1fr auto;
    column-gap: clamp(32px, 5vw, 80px);
  }
  .note-head .eyebrow { grid-column: 1 / -1; }
  .note-head h1 { grid-column: 1; grid-row: 2 / 4; align-self: end; max-width: none; }
  .note-head .dek { grid-column: 2; grid-row: 2; align-self: end; margin-top: 0; font-size: clamp(1.1rem, 1.3vw, 1.3rem); }
  .note-head .byline { grid-column: 2; grid-row: 3; margin-top: 16px; }
}

.note-cover { margin: 0 var(--gutter); overflow: hidden; border-radius: 18px; background: var(--paper-deep); aspect-ratio: 21 / 9; }
.note-cover img { width: 100%; height: 100%; object-fit: cover; }

.note-layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(20px, 3vw, 48px);
  padding: clamp(40px, 5vw, 72px) var(--gutter) clamp(64px, 7vw, 104px);
}
.toc { grid-column: 1 / span 3; }
.toc-inner { position: sticky; top: 24px; }
.toc h2 { font-size: 1.25rem; line-height: 1.2; }
.toc ol { margin: 14px 0 0; padding: 0; list-style: none; border-left: 1.5px solid var(--ink-line); }
.toc li a {
  display: block; margin-left: -1.5px; padding: 6px 0 6px 16px;
  border-left: 1.5px solid transparent;
  font-size: 0.9375rem; line-height: 1.4; color: var(--ink-soft); text-decoration: none;
}
.toc li a:hover { color: var(--ink); }
.toc li a[aria-current="true"] { color: var(--ink); border-left-color: var(--ink); }

/* min-width: 0 lets the column shrink to the screen; wide tables then scroll inside .table-wrap
   instead of pushing the whole page sideways on phones. */
.prose { grid-column: 4 / span 8; min-width: 0; max-width: 70ch; font-size: 1.125rem; }
.prose > * + * { margin-top: 1.1em; }
.prose p, .prose li { line-height: 1.72; }
.prose > p:first-of-type { font-size: 1.25rem; line-height: 1.62; }
.prose h2 {
  margin-top: 2.1em;
  font-size: clamp(1.75rem, 2.4vw, 2.25rem);
  line-height: 1.12;
  letter-spacing: -0.008em;
  scroll-margin-top: 24px;
}
.prose h3 { margin-top: 1.7em; font-family: var(--text); font-size: 1.1875rem; font-weight: 500; line-height: 1.35; scroll-margin-top: 24px; }
.prose h2 + *, .prose h3 + * { margin-top: 0.7em; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--ink-soft); }
.prose a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose strong { font-weight: 500; }
.prose code { font-size: 0.92em; padding: 0.1em 0.35em; border-radius: 5px; background: var(--paper-deep); }
/* A formula on its own line. */
.prose p > code:only-child { display: inline-block; max-width: 100%; padding: 10px 16px; border-radius: 10px; font-size: 1rem; line-height: 1.5; }
.prose hr { border: 0; border-top: 1px solid var(--ink-line); margin: 2.4em 0; }

/* The short answer: the first thing on the page, in the deeper tan. */
.prose blockquote {
  margin: 0 0 2em;
  padding: clamp(20px, 2.2vw, 28px) clamp(20px, 2.4vw, 32px);
  border-radius: 14px;
  background: var(--paper-deep);
  font-size: 1.125rem;
}
.prose blockquote p { line-height: 1.6; }
.prose blockquote strong { display: block; margin-bottom: 8px; font-family: var(--display); font-weight: 400; font-size: 1.375rem; line-height: 1.2; color: var(--ink); }

.table-wrap { overflow-x: auto; margin-top: 1.4em; border: 1px solid var(--ink-line); border-radius: 14px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.9688rem; font-variant-numeric: tabular-nums; }
.prose th, .prose td { padding: 12px 16px; text-align: left; vertical-align: top; line-height: 1.5; }
.prose thead th { font-weight: 500; background: var(--paper-deep); }
.prose tbody tr + tr td { border-top: 1px solid var(--ink-line); }

.sources { margin-top: 3em; padding-top: 1.6em; border-top: 1px solid var(--ink-line); }
.sources h2 { margin-top: 0; font-size: 1.5rem; }
.sources ol { margin-top: 0.9em; padding-left: 1.4em; font-size: 0.9375rem; color: var(--ink-soft); }
.sources li { line-height: 1.55; }
.sources li + li { margin-top: 0.5em; }
.sources a { color: var(--ink); }
.sources .pub { display: block; }
.note-foot { margin-top: 1.6em; font-size: 0.9375rem; color: var(--ink-soft); }

.more { padding: clamp(56px, 6.5vw, 96px) 0 clamp(56px, 6.5vw, 96px); background: var(--paper-deep); }
.more-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 0 var(--gutter); margin-bottom: clamp(28px, 3vw, 40px); }
.more-head h2 { font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.02; letter-spacing: -0.01em; }
.more-head a { font-weight: 500; text-underline-offset: 4px; text-decoration-thickness: 1px; white-space: nowrap; }
.more .notes-grid { padding-bottom: 0; }
.more .card-media { background: var(--paper); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .notes-head { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toc { display: none; }
  .prose { grid-column: 1 / -1; width: 100%; margin-inline: auto; }
  .note-cover { aspect-ratio: 16 / 9; }
}
@media (max-width: 640px) {
  .notes-grid { grid-template-columns: minmax(0, 1fr); }
  .note-cover { margin: 0; border-radius: 0; aspect-ratio: 4 / 3; }
  .prose { font-size: 1.0625rem; }
  .prose > p:first-of-type { font-size: 1.125rem; }
  .more-head { flex-direction: column; align-items: flex-start; }
}
