/* ==========================================================================
   base.css — structure, layout and typography.

   This file contains NO hard-coded colors or fonts. Everything visual comes
   from the custom properties defined in themes.css, so a new style never
   requires editing this file.
   ========================================================================== */

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

html {
  font-size: var(--fs-root);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

::selection { background: var(--accent); color: var(--on-accent); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: .6em 1em;
  z-index: 200;
  font-family: var(--font-ui);
  font-size: .85rem;
}
.skip-link:focus { left: .5rem; top: .5rem; }

/* --------------------------------------------------------------- layout ---- */

.wrap {
  width: 100%;
  max-width: var(--measure-wide);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

/* The reading column. Direct children sit in the center track; add
   class="bleed" to a child to let it span the full wrapper width. */
.prose {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(0, var(--measure))
    minmax(0, 1fr);
}
.prose > * { grid-column: 2; min-width: 0; }
.prose > .bleed { grid-column: 1 / -1; }
.prose > div.bleed,
.prose > figure.bleed { margin-bottom: 2.2rem; }

/* ------------------------------------------------- sticky top navigation --- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  color: var(--nav-fg);
  border-bottom: var(--border-w) solid var(--nav-border, transparent);
}
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.4rem;
  min-height: 3.1rem;
  padding-block: .5rem;
}

.site-title {
  font-family: var(--font-head);
  font-weight: var(--site-title-weight);
  letter-spacing: var(--site-title-tracking);
  text-transform: var(--site-title-transform);
  font-size: 1.02rem;
  line-height: 1.15;
  margin: 0;
  margin-right: auto;
}
.site-title a { color: var(--nav-fg); text-decoration: none; }
.site-title a:hover { color: var(--nav-fg-strong, #fff); }
.site-title small {
  display: block;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: .6rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--nav-fg-dim);
  margin-top: .3em;
}

.site-nav {
  display: flex;
  gap: 1.05rem;
  flex-wrap: wrap;
  font-family: var(--font-ui);
  font-size: .82rem;
}
.site-nav a {
  color: var(--nav-fg-dim);
  text-decoration: none;
  padding-block: .2em;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--nav-fg-strong, #fff); }
.site-nav a[aria-current="page"] {
  color: var(--nav-fg-strong, #fff);
  border-bottom-color: var(--accent-on-nav, var(--accent));
}

/* --------------------------------------------------------- style switcher -- */

.switcher {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--font-ui);
}
.switcher__label {
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--nav-fg-dim);
}
.switcher select {
  font: inherit;
  font-size: .78rem;
  line-height: 1.2;
  padding: .3em 1.6em .3em .55em;
  color: var(--nav-fg);
  background-color: var(--nav-bg-soft);
  border: 1px solid var(--nav-border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right .72em top 55%, right .42em top 55%;
  background-size: .3em .3em, .3em .3em;
  background-repeat: no-repeat;
}
.switcher select:hover { border-color: var(--nav-fg-dim); }
.switcher option { color: #111; background: #fff; }

/* Keep the sticky bar to two short rows on a phone. */
@media (max-width: 34rem) {
  .site-title small { display: none; }
  .site-header__inner { gap: .35rem 1rem; min-height: 0; padding-block: .45rem; }
  .site-nav { gap: .9rem; font-size: .78rem; }
  .switcher select { font-size: .74rem; }
}

/* ------------------------------------------------------------ hero band ---- */

.banner {
  background: var(--hero-bg);
  color: var(--hero-fg);
  border-bottom: var(--border-w) solid var(--hero-border, transparent);
}
.banner__inner { padding-block: clamp(2rem, 5vw, 3.6rem); }
.banner--post .banner__inner { padding-block: clamp(1.8rem, 4vw, 2.8rem); }

.banner h1 {
  color: var(--hero-fg);
  font-size: var(--title-size);
  margin: 0 0 .5em;
  text-wrap: balance;
}
.banner--home { text-align: center; }
.banner--home h1 { margin-inline: auto; max-width: 22ch; }

.banner .lede {
  font-size: 1.05rem;
  color: var(--hero-fg-dim);
  margin: 0 auto 0;
  max-width: 52ch;
  text-wrap: pretty;
}
.banner--home .lede { text-wrap: balance; }
.banner--post .lede { margin-inline: 0; }
.banner .eyebrow { color: var(--hero-fg-dim); margin-bottom: 1em; }
.banner a { color: var(--hero-fg); text-decoration-color: var(--hero-fg-dim); }

/* the bordered box in the middle of the home banner */
.intro-card {
  display: grid;
  grid-template-columns: minmax(0, 13rem) minmax(0, 1fr);
  gap: 0;
  text-align: left;
  margin-top: 2.2rem;
  border: 1px solid var(--hero-rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--hero-bg-soft);
}
.intro-card__media { margin: 0; position: relative; min-height: 11rem; }
.intro-card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  border-radius: 0;
}
.intro-card__body { padding: 1.3rem 1.5rem; }
.intro-card__body > :first-child { margin-top: 0; }
.intro-card__body > :last-child { margin-bottom: 0; }
.intro-card__body p { margin: 0 0 1em; font-size: .94rem; color: var(--hero-fg-dim); }
.intro-card h2 {
  font-size: .72rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--hero-fg);
  border: 0;
  padding: 0;
  margin: 0 0 .7em;
}
.intro-card ul { margin: 0; padding-left: 1.15em; font-size: .9rem; color: var(--hero-fg-dim); }
.intro-card li { margin-bottom: .45em; }
.intro-card li b, .intro-card li strong { color: var(--hero-fg); }

@media (max-width: 40rem) {
  .intro-card { grid-template-columns: 1fr; }
  .intro-card__media { min-height: 0; aspect-ratio: 16 / 7; }
}

/* post meta sitting on the band */
.banner .card__meta { margin-bottom: .9em; }
.banner .dateline { color: var(--hero-fg-dim); }
.banner .tag {
  color: var(--hero-fg);
  background: var(--hero-tag-bg);
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: var(--h-weight);
  letter-spacing: var(--h-tracking);
  line-height: var(--h-lh);
  text-transform: var(--h-transform);
  color: var(--fg);
  margin: 0;
  scroll-margin-top: 4.5rem;
  text-wrap: balance;
}
h1 { font-size: var(--title-size); }
h2 { font-size: 1.62rem; margin-top: 2.4em; margin-bottom: .55em; }
h3 {
  font-size: 1.16rem;
  font-style: var(--h3-style, normal);
  margin-top: 1.9em;
  margin-bottom: .45em;
}
h4 {
  font-size: .95rem;
  margin-top: 1.7em;
  margin-bottom: .4em;
  text-transform: var(--eyebrow-transform);
  letter-spacing: var(--eyebrow-tracking);
}

.prose h2 {
  padding-bottom: .25em;
  border-bottom: var(--rule-weight) solid var(--rule);
}

p, ul, ol, dl, blockquote, figure, table, pre { margin: 0 0 1.2em; }

/* Justified body text is part of the look; it is switched off on narrow
   screens, where it would open rivers. */
.prose > p {
  text-align: var(--text-align, left);
  hyphens: var(--hyphens, manual);
}
@media (max-width: 48rem) {
  .prose > p { text-align: left; hyphens: manual; }
}

a {
  color: var(--accent);
  font-weight: var(--link-weight, inherit);
  text-decoration: underline;
  text-decoration-thickness: var(--link-thickness);
  text-underline-offset: var(--link-offset);
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}
a:hover { text-decoration-color: currentColor; }

strong, b { font-weight: 700; }
em { font-style: italic; }
small { font-size: .82em; }
abbr[title] { text-decoration: underline dotted; cursor: help; }

ul, ol { padding-left: 1.3em; }
li + li { margin-top: .3em; }
li > ul, li > ol { margin-top: .3em; margin-bottom: .3em; }

blockquote {
  padding-left: 1.1em;
  border-left: 3px solid var(--accent);
  color: var(--fg-soft);
  font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }

hr {
  border: 0;
  border-top: var(--rule-weight) var(--hr-style, solid) var(--rule);
  margin: 3em 0;
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: .86em;
}
code {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: .12em .38em;
  border-radius: calc(var(--radius) * .75);
  overflow-wrap: break-word;
}
pre {
  background: var(--code-bg);
  color: var(--code-fg);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: .9em 1em;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: none; padding: 0; font-size: 1em; }

kbd {
  background: var(--bg-soft);
  border: var(--border-w) solid var(--border);
  border-radius: 3px;
  padding: .1em .4em;
  font-size: .8em;
}

/* --------------------------------------------------------------- figures --- */

figure { margin-inline: 0; }
figure img {
  width: 100%;
  background: var(--figure-bg);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
}
figure a { display: block; text-decoration: none; }
figure a:hover img { border-color: var(--accent); }

figcaption {
  font-family: var(--font-ui);
  font-size: .78rem;
  line-height: 1.55;
  color: var(--fg-soft);
  margin-top: .65em;
  max-width: 46rem;
}
figcaption b, figcaption strong { color: var(--fg); font-weight: 650; }

.grid { display: grid; gap: .9rem; }
.grid figure { margin: 0; }
.grid figcaption { margin-top: .5em; font-size: .74rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); }

@media (max-width: 46rem) {
  .grid-3, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 30rem) {
  .grid-2, .grid-3, .grid-5 { grid-template-columns: 1fr; }
}

.contain img { object-fit: contain; }
.pad img { padding: .8rem; }

/* Equal-height row: letterbox every image to one shared height instead of
   letting each set its own. Override with  style="--fig-h: 20rem". */
.grid.even figure img {
  height: var(--fig-h, 15rem);
  object-fit: contain;
  padding: .4rem;
}
@media (max-width: 30rem) {
  .grid.even figure img { height: auto; max-height: var(--fig-h, 15rem); }
}

/* ---------------------------------------------------------------- tables --- */

.table-scroll {
  overflow-x: auto;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-inset);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: .82rem;
  margin: 0;
}
.table-scroll + figcaption { margin-top: .65em; margin-bottom: 1.8em; }
th, td {
  text-align: left;
  padding: .55em .85em;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
th { font-weight: 650; color: var(--fg); background: var(--bg-soft); }
thead th {
  text-transform: var(--eyebrow-transform);
  letter-spacing: var(--eyebrow-tracking);
  font-size: .72rem;
}
/* Row headers stay in sentence case — uppercasing them would turn Greek
   letters into look-alike Latin capitals (T1ρ reading as "T1P"). */
tbody th { background: none; }
td { color: var(--fg-soft); }
td:first-child { color: var(--fg); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- callouts ---- */

.note {
  background: var(--bg-soft);
  border: var(--border-w) solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1em 1.15em;
  font-size: .93em;
}
.note > :last-child { margin-bottom: 0; }
.note__title {
  font-family: var(--font-ui);
  font-size: .68rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: .5em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));
  gap: .8rem;
  padding: 0;
  margin: 0 0 1.8em;
  list-style: none;
}
.stats li {
  margin: 0;
  padding: .85em 1em;
  background: var(--bg-soft);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
}
.stats b {
  display: block;
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: var(--h-tracking);
  line-height: 1.1;
  color: var(--accent);
}
.stats span {
  display: block;
  font-family: var(--font-ui);
  font-size: .72rem;
  line-height: 1.4;
  color: var(--fg-soft);
  margin-top: .35em;
}

.specs {
  margin: 0 0 1.8em;
  font-family: var(--font-ui);
  font-size: .84rem;
  border-top: var(--rule-weight) solid var(--rule);
}
.specs div {
  display: grid;
  grid-template-columns: minmax(7rem, 12rem) 1fr;
  gap: .3em 1.2rem;
  padding: .6em 0;
  border-bottom: 1px solid var(--rule);
}
.specs dt {
  color: var(--fg-faint);
  text-transform: var(--eyebrow-transform);
  letter-spacing: var(--eyebrow-tracking);
  font-size: .72rem;
  font-weight: 700;
  padding-top: .15em;
}
.specs dd { margin: 0; color: var(--fg); }
@media (max-width: 32rem) {
  .specs div { grid-template-columns: 1fr; gap: .1em; }
}

/* --------------------------------------------------------------- home ------ */

.eyebrow {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--eyebrow-size);
  letter-spacing: var(--eyebrow-tracking);
  text-transform: var(--eyebrow-transform);
  font-weight: 700;
  color: var(--fg-faint);
}

.section {
  padding-block: clamp(2.2rem, 5vw, 3.4rem) 0;
}
.section:last-of-type { padding-bottom: clamp(2rem, 5vw, 3.4rem); }
.section > h2 {
  margin: 0 0 1.4rem;
  font-size: 1.75rem;
  padding-bottom: .3em;
  border-bottom: var(--rule-weight) solid var(--rule);
}
.section > p { max-width: var(--measure); color: var(--fg-soft); }

.posts { list-style: none; margin: 0; padding: 0; }
.posts > li { margin: 0; }
.posts > li + li { margin-top: 1.1rem; }

.card {
  display: grid;
  grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
  gap: 0 1.5rem;
  background: var(--bg-inset);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(var(--card-lift));
}
.card__media {
  position: relative;
  overflow: hidden;
  margin: 0;
  min-height: 10.5rem;
  background: var(--figure-bg);
  border-right: var(--border-w) solid var(--border);
}
.card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  border-radius: 0;
}
.card__body { padding: 1.25rem 1.4rem 1.35rem 0; }
.card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem .8rem;
  margin-bottom: .55em;
}
.card h3 { margin: 0 0 .4em; font-size: 1.24rem; font-style: normal; }
.card h3 a { color: var(--fg); text-decoration: none; }
.card:hover h3 a { color: var(--accent); }
.card p { margin: 0 0 .9em; color: var(--fg-soft); font-size: .92rem; }
.card__more {
  font-family: var(--font-ui);
  font-size: .78rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}
.card__more::after { content: " \2192"; }

@media (max-width: 44rem) {
  .card { grid-template-columns: 1fr; }
  .card__media {
    min-height: 0;
    aspect-ratio: 16 / 9;
    border-right: 0;
    border-bottom: var(--border-w) solid var(--border);
  }
  .card__body { padding: 1.15rem 1.2rem 1.3rem; }
}

.tag {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: .66rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: calc(var(--radius) * .8);
  padding: .3em .6em;
  line-height: 1;
}
.dateline {
  font-family: var(--font-ui);
  font-size: .72rem;
  letter-spacing: .05em;
  color: var(--fg-faint);
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- post ----- */

.post-body { padding-block: clamp(1.8rem, 4vw, 2.8rem) 1rem; }
.post-body .byline {
  font-family: var(--font-ui);
  font-size: .8rem;
  color: var(--fg-soft);
  padding-bottom: 1.4em;
  margin-bottom: 1.8em;
  border-bottom: var(--rule-weight) solid var(--rule);
}

.hero { margin: 0 0 2.4rem; }
.hero img { border-radius: var(--radius-lg); }

.resources {
  list-style: none;
  padding: 0;
  margin: 0 0 1.6em;
  font-family: var(--font-ui);
  font-size: .85rem;
}
.resources li {
  margin: 0;
  padding: .65em 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .7rem;
  align-items: baseline;
  min-width: 0;
  overflow-wrap: break-word;
}
.resources li:first-child { border-top: 1px solid var(--rule); }
.resources .kind {
  flex: none;
  /* Wide enough for the longest label in use ("PROCESSING") so it never
     wraps to a second line. */
  width: 6rem;
  white-space: nowrap;
  color: var(--fg-faint);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
}
/* Hanging indent, so a description that runs onto a second line lines up
   under the link rather than under the date in the left column. */
@media (min-width: 34rem) {
  .resources li { padding-left: 6.7rem; }
  .resources .kind { margin-left: -6.7rem; }
}
.section > .resources:last-child { margin-bottom: 0; }

.post-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: 1rem;
  margin: 3.2rem 0 1rem;
}
.post-nav a {
  display: block;
  padding: 1em 1.15em;
  background: var(--bg-soft);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.post-nav a:hover { border-color: var(--accent); transform: translateY(var(--card-lift)); }
.post-nav .eyebrow { margin-bottom: .45em; }
.post-nav strong {
  display: block;
  font-family: var(--font-head);
  font-weight: var(--h-weight);
  letter-spacing: var(--h-tracking);
  text-transform: var(--h-transform);
  color: var(--fg);
  font-size: 1rem;
  line-height: 1.3;
}

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

.site-footer {
  margin-top: 3.5rem;
  background: var(--nav-bg);
  color: var(--nav-fg-dim);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.6rem;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.6rem 2rem;
  font-family: var(--font-ui);
  font-size: .78rem;
}
.site-footer a { color: var(--nav-fg); font-weight: 400; }
.site-footer a:hover { color: var(--nav-fg-strong, #fff); }
.site-footer nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }

/* -------------------------------------------------------------- utilities -- */

.center { text-align: center; }
.muted { color: var(--fg-soft); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
/* Opt out of an inherited text-transform. Wrap Greek letters in this inside
   any small-caps context, so ρ is not uppercased into a Latin-looking P. */
.keep-case { text-transform: none; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media print {
  .site-header, .site-footer, .switcher, .post-nav { display: none; }
  .banner { background: none; color: #000; }
  body { background: #fff; color: #000; }
}
