/* ==========================================================================
   LES Theme — Campus Press
   A student-newspaper treatment: editorial serif headlines, humanist sans
   body, monospace for anything numeric or structural.

   Mobile-first, 360px baseline. Rules and weight carry the hierarchy, not
   drop shadows — a newspaper has no shadows.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   Light palette lives on bare :root so it applies in the un-stamped state.
   Dark redefines colour tokens only, guarded so an explicit light choice wins.
   -------------------------------------------------------------------------- */
:root {
  /* Paper and ink. The off-white is warm but not cream; the ink is navy-black. */
  --c-bg:            #fcfcfa;
  --c-surface:       #ffffff;
  --c-bg-subtle:     #f4f4f0;
  --c-bg-inset:      #ebebe5;
  --c-rule:          #e0dfd7;   /* hairline, warm */
  --c-rule-strong:   #c8c7bd;
  --c-text:          #101828;
  --c-text-muted:    #4a5468;
  --c-text-faint:    #7a8496;

  /* Navy is the voice of the paper. Brass is the highlight, used sparingly. */
  --c-accent:        #12325b;
  --c-accent-hover:  #0b2242;
  --c-accent-soft:   #e8eef7;
  --c-accent-text:   #ffffff;
  --c-brass:         #9d6b16;
  --c-brass-soft:    #f7efdd;

  --c-success:       #1b6e4f;
  --c-success-soft:  #e4f2ec;
  --c-warn:          #8a5a00;
  --c-warn-soft:     #f9f0dc;
  --c-danger:        #a32b1c;
  --c-danger-soft:   #f9eae7;

  --c-focus:         #12325b;
  --c-selection:     #dfe8f5;

  /* Type. Fallbacks are metrically close so a slow font swap barely moves. */
  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype",
                  Palatino, Georgia, "Times New Roman", serif;
  --font-body:    "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
                  Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo,
                  Consolas, "Liberation Mono", monospace;

  /* Fluid scale. Clamped so 360px never overflows and 1600px never bloats. */
  --t-xs:   clamp(0.75rem, 0.73rem + 0.10vw, 0.8125rem);
  --t-sm:   clamp(0.8125rem, 0.79rem + 0.15vw, 0.9375rem);
  --t-base: clamp(1.0625rem, 1.02rem + 0.20vw, 1.1875rem);
  --t-lg:   clamp(1.1875rem, 1.13rem + 0.28vw, 1.375rem);
  --t-xl:   clamp(1.375rem, 1.26rem + 0.55vw, 1.75rem);
  --t-2xl:  clamp(1.625rem, 1.42rem + 0.95vw, 2.375rem);
  --t-3xl:  clamp(2rem, 1.6rem + 1.85vw, 3.25rem);
  --t-4xl:  clamp(2.35rem, 1.75rem + 2.75vw, 4.25rem);

  --lh-tight: 1.08;
  --lh-snug:  1.24;
  --lh-body:  1.68;

  --s-1: 0.25rem; --s-2: 0.5rem;  --s-3: 0.75rem; --s-4: 1rem;
  --s-5: 1.5rem;  --s-6: 2rem;    --s-7: 3rem;    --s-8: 4.5rem;

  --r-sm: 3px; --r-md: 5px; --r-lg: 8px; --r-full: 999px;

  --w-prose: 68ch;
  --w-page:  1180px;
  --w-wide:  1400px;
  --gutter:  clamp(1.125rem, 0.7rem + 2vw, 2.5rem);

  --header-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg:            #0f1319;
    --c-surface:       #161b23;
    --c-bg-subtle:     #171c25;
    --c-bg-inset:      #1e242e;
    --c-rule:          #2a313d;
    --c-rule-strong:   #3d4553;
    --c-text:          #eceef2;
    --c-text-muted:    #a6b0c0;
    --c-text-faint:    #7d8798;

    --c-accent:        #8fb2e8;
    --c-accent-hover:  #b3cbf1;
    --c-accent-soft:   #17202f;
    --c-accent-text:   #0f1319;
    --c-brass:         #d9a94f;
    --c-brass-soft:    #2a2113;

    --c-success:       #63c79c;
    --c-success-soft:  #14291f;
    --c-warn:          #dfae5b;
    --c-warn-soft:     #2b2211;
    --c-danger:        #ef8a76;
    --c-danger-soft:   #2e1713;

    --c-focus:         #8fb2e8;
    --c-selection:     #22314a;
  }
}

:root[data-theme="dark"] {
  --c-bg:            #0f1319;
  --c-surface:       #161b23;
  --c-bg-subtle:     #171c25;
  --c-bg-inset:      #1e242e;
  --c-rule:          #2a313d;
  --c-rule-strong:   #3d4553;
  --c-text:          #eceef2;
  --c-text-muted:    #a6b0c0;
  --c-text-faint:    #7d8798;

  --c-accent:        #8fb2e8;
  --c-accent-hover:  #b3cbf1;
  --c-accent-soft:   #17202f;
  --c-accent-text:   #0f1319;
  --c-brass:         #d9a94f;
  --c-brass-soft:    #2a2113;

  --c-success:       #63c79c;
  --c-success-soft:  #14291f;
  --c-warn:          #dfae5b;
  --c-warn-soft:     #2b2211;
  --c-danger:        #ef8a76;
  --c-danger-soft:   #2e1713;

  --c-focus:         #8fb2e8;
  --c-selection:     #22314a;
}

/* --------------------------------------------------------------------------
   2. Reset and base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--c-selection); color: var(--c-text); }

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: -0.011em;
  margin: 0 0 var(--s-3);
  text-wrap: balance;
  color: var(--c-text);
}
h1 { font-size: var(--t-3xl); line-height: var(--lh-tight); letter-spacing: -0.018em; }
h2 { font-size: var(--t-2xl); }
h3 { font-size: var(--t-xl); }
h4 { font-size: var(--t-lg); }

p { margin: 0 0 var(--s-4); }

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

:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

hr { border: 0; border-top: 1px solid var(--c-rule); margin: var(--s-6) 0; }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.9em; }
code {
  background: var(--c-bg-inset);
  padding: 0.12em 0.36em;
  border-radius: var(--r-sm);
}
pre {
  background: var(--c-bg-inset);
  padding: var(--s-4);
  border-radius: var(--r-md);
  overflow-x: auto;
  border: 1px solid var(--c-rule);
}
pre code { background: none; padding: 0; }

blockquote {
  margin: var(--s-5) 0;
  padding: var(--s-1) 0 var(--s-1) var(--s-5);
  border-left: 3px solid var(--c-brass);
  font-family: var(--font-display);
  font-size: var(--t-lg);
  line-height: 1.45;
  color: var(--c-text-muted);
}
blockquote p:last-child { margin-bottom: 0; }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--c-accent); color: var(--c-accent-text);
  padding: var(--s-3) var(--s-4); border-radius: 0 0 var(--r-md) 0;
}
.skip-link:focus { left: 0; }

.no-js .js-only { display: none !important; }

/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */
.site { display: flex; flex-direction: column; min-height: 100vh; }
.site-main { flex: 1 0 auto; padding-bottom: var(--s-8); }

.container {
  width: 100%;
  max-width: var(--w-page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide  { max-width: var(--w-wide); }
.container--prose { max-width: calc(var(--w-prose) + (var(--gutter) * 2)); }

.stack > * + * { margin-top: var(--s-4); }

.grid { display: grid; gap: var(--s-5); }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
.grid--4 { grid-template-columns: 1fr; }

@media (min-width: 560px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

.section { margin-top: var(--s-8); }

/* Section head: title with a rule running to the edge — a masthead device. */
.section__head {
  display: flex;
  align-items: baseline;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-3);
  border-bottom: 2px solid var(--c-text);
}
.section__head h2,
.section__head h1 { margin: 0; font-size: var(--t-xl); letter-spacing: -0.008em; }
.section__head .section__link {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   4. Masthead
   -------------------------------------------------------------------------- */
.masthead-strip {
  border-bottom: 1px solid var(--c-rule);
  background: var(--c-bg-subtle);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-faint);
}
.masthead-strip__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: 34px;
  padding-block: var(--s-1);
}
.masthead-strip__tag { display: none; }
@media (min-width: 700px) { .masthead-strip__tag { display: block; } }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-rule);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: var(--header-h);
}

.site-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.6rem);
  letter-spacing: -0.022em;
  line-height: 1;
  color: var(--c-text);
  text-decoration: none;
  white-space: nowrap;
}
.site-brand span { color: var(--c-brass); }
.site-brand:hover { color: var(--c-text); }

.primary-nav { margin-left: auto; }
.primary-nav ul {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 0.3rem + 1.2vw, 1.6rem);
  list-style: none;
  margin: 0;
  padding: 0;
}
.primary-nav a {
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--c-text);
  text-decoration: none;
  padding: var(--s-2) 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.primary-nav a:hover,
.primary-nav .current-menu-item > a {
  color: var(--c-accent);
  border-bottom-color: var(--c-brass);
}

.theme-toggle, .nav-toggle {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-text);
  cursor: pointer;
}
.theme-toggle:hover, .nav-toggle:hover { border-color: var(--c-rule-strong); }
.theme-toggle svg, .nav-toggle svg { width: 19px; height: 19px; }
.nav-toggle { display: none; }

/* Fingers need more than a cursor does. */
@media (max-width: 860px) {
  .theme-toggle, .nav-toggle { width: 44px; height: 44px; }
}

/* Mobile navigation */
@media (max-width: 860px) {
  .primary-nav {
    position: fixed;
    inset: calc(var(--header-h) + 34px) 0 auto 0;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-rule);
    padding: var(--s-3) var(--gutter) var(--s-5);
    display: none;
    max-height: calc(100vh - var(--header-h) - 34px);
    overflow-y: auto;
  }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .primary-nav li { border-bottom: 1px solid var(--c-rule); }
  .primary-nav li:last-child { border-bottom: 0; }
  .primary-nav a {
    display: block;
    padding: var(--s-4) 0;
    font-size: var(--t-lg);
    font-family: var(--font-display);
    border-bottom: 0;
  }
  .nav-toggle { display: grid; }
  .theme-toggle { margin-left: auto; }
  .primary-nav { margin-left: 0; }
}

/* --------------------------------------------------------------------------
   5. Eyebrow / kicker — the mono label used everywhere
   -------------------------------------------------------------------------- */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-brass);
  text-decoration: none;
  margin-bottom: var(--s-2);
}
a.eyebrow:hover { color: var(--c-accent); }

.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.04em;
  color: var(--c-text-faint);
  font-variant-numeric: tabular-nums;
}
.meta-line > * + *::before {
  content: "·";
  margin-right: var(--s-3);
  color: var(--c-rule-strong);
}

/* --------------------------------------------------------------------------
   6. Lead story
   -------------------------------------------------------------------------- */
.lead {
  padding-block: var(--s-6) var(--s-7);
  border-bottom: 1px solid var(--c-rule);
}
.lead__grid { display: grid; gap: var(--s-5); align-items: center; }
@media (min-width: 900px) {
  .lead__grid { grid-template-columns: 1.05fr 0.95fr; gap: var(--s-7); }
}
.lead__title {
  font-size: var(--t-4xl);
  line-height: var(--lh-tight);
  letter-spacing: -0.026em;
  margin-bottom: var(--s-4);
}
.lead__standfirst {
  font-size: var(--t-lg);
  line-height: 1.5;
  color: var(--c-text-muted);
  max-width: 46ch;
  margin-bottom: var(--s-5);
}
.lead__media {
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-bg-subtle);
  aspect-ratio: 16 / 10;
}
.lead__media img { width: 100%; height: 100%; object-fit: cover; }

.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-family: var(--font-body);
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.72em 1.35em;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
.btn--primary { background: var(--c-accent); color: var(--c-accent-text); }
.btn--primary:hover { background: var(--c-accent-hover); color: var(--c-accent-text); }
.btn--ghost {
  background: transparent;
  color: var(--c-text);
  border-color: var(--c-rule-strong);
}
.btn--ghost:hover { border-color: var(--c-text); color: var(--c-text); }

/* --------------------------------------------------------------------------
   7. Trending rail
   CSS scroll-snap. No library, no layout shift, no autoplay.
   -------------------------------------------------------------------------- */
.rail { position: relative; margin-top: var(--s-7); }

.rail__head {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 2px solid var(--c-text);
  margin-bottom: var(--s-5);
}
.rail__head h2 {
  margin: 0;
  font-size: var(--t-xl);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.rail__pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-brass);
  flex: none;
}
@media (prefers-reduced-motion: no-preference) {
  .rail__pulse { animation: les-pulse 2.4s ease-in-out infinite; }
}
@keyframes les-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .45; transform: scale(.8); }
}

.rail__controls { margin-left: auto; display: none; gap: var(--s-2); }
@media (min-width: 900px) { .rail__controls { display: flex; } }
.rail__btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--r-full);
  background: var(--c-surface);
  color: var(--c-text);
  cursor: pointer;
  padding: 0;
}
.rail__btn:hover:not(:disabled) { background: var(--c-accent); color: var(--c-accent-text); border-color: var(--c-accent); }
.rail__btn:disabled { opacity: .35; cursor: default; }
.rail__btn svg { width: 17px; height: 17px; }

.rail__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(255px, 78%);
  gap: var(--s-5);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding-bottom: var(--s-4);
  scrollbar-width: thin;
  scrollbar-color: var(--c-rule-strong) transparent;

  /*
   * Below 900px the rail bleeds to the viewport edge so the cards read as a
   * track that continues off-screen rather than a boxed row. scroll-padding
   * must match the padding, or the first card snaps past the inset and the
   * rail loads already scrolled by one gutter.
   */
  margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
  scroll-padding-inline: var(--gutter);
}
@media (min-width: 900px) {
  /* On desktop the rail lines up with the sections above and below it. */
  .rail__track {
    margin-inline: 0;
    padding-inline: 0;
    scroll-padding-inline: 0;
  }
}
@media (min-width: 560px) { .rail__track { grid-auto-columns: minmax(280px, 46%); } }
@media (min-width: 900px) { .rail__track { grid-auto-columns: minmax(300px, 31%); } }
@media (min-width: 1200px) { .rail__track { grid-auto-columns: minmax(300px, 24%); } }

.rail__track::-webkit-scrollbar { height: 6px; }
.rail__track::-webkit-scrollbar-track { background: transparent; }
.rail__track::-webkit-scrollbar-thumb { background: var(--c-rule-strong); border-radius: var(--r-full); }

.rail__item { scroll-snap-align: start; }

.trend-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.trend-card:hover { border-color: var(--c-rule-strong); }
.trend-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--c-bg-inset);
  display: block;
}
.trend-card__media img { width: 100%; height: 100%; object-fit: cover; }
.trend-card__rank {
  position: absolute;
  left: 0; bottom: 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 0.3em 0.7em;
  background: var(--c-text);
  color: var(--c-bg);
  border-radius: 0 var(--r-md) 0 0;
  font-variant-numeric: tabular-nums;
}
.trend-card__body {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  flex: 1;
}
.trend-card__title {
  font-size: var(--t-lg);
  line-height: 1.28;
  margin: 0;
}
.trend-card__title a { color: var(--c-text); text-decoration: none; }
.trend-card__title a:hover { color: var(--c-accent); text-decoration: underline; }
.trend-card__body .meta-line { margin-top: auto; padding-top: var(--s-2); }

/* Rank-only variant when a post has no featured image */
.trend-card--noimg .trend-card__body { padding-top: var(--s-5); }
.trend-card--noimg .trend-card__rank {
  position: static;
  align-self: flex-start;
  border-radius: var(--r-sm);
  margin-bottom: var(--s-1);
}

/* --------------------------------------------------------------------------
   8. Cards
   -------------------------------------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  overflow: hidden;
  height: 100%;
}
.card:hover { border-color: var(--c-rule-strong); }
.card__media {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--c-bg-inset);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  flex: 1;
}
.card__title { font-size: var(--t-lg); line-height: 1.3; margin: 0; }
.card__title a { color: var(--c-text); text-decoration: none; }
.card__title a:hover { color: var(--c-accent); text-decoration: underline; }
.card__excerpt {
  color: var(--c-text-muted);
  font-size: var(--t-sm);
  line-height: 1.55;
  margin: 0;
}
.card__meta, .card .meta-line { margin-top: auto; padding-top: var(--s-2); }

/* Compact list row — used for secondary story lists */
.storylist { list-style: none; margin: 0; padding: 0; }
.storylist li {
  padding-block: var(--s-4);
  border-bottom: 1px solid var(--c-rule);
}
.storylist li:first-child { padding-top: 0; }
.storylist li:last-child { border-bottom: 0; }
.storylist h3 { font-size: var(--t-lg); line-height: 1.3; margin: 0 0 var(--s-2); }
.storylist h3 a { color: var(--c-text); text-decoration: none; }
.storylist h3 a:hover { color: var(--c-accent); text-decoration: underline; }

/* --------------------------------------------------------------------------
   9. Tool links and the statistics strip
   -------------------------------------------------------------------------- */
.tool-link {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  padding: var(--s-4) var(--s-5);
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-left: 3px solid var(--c-brass);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--c-text);
}
.tool-link:hover {
  border-color: var(--c-rule-strong);
  border-left-color: var(--c-accent);
  color: var(--c-text);
}
.tool-link strong {
  font-family: var(--font-display);
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.008em;
}
.tool-link span { color: var(--c-text-muted); font-size: var(--t-sm); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--c-rule);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.stats__item {
  background: var(--c-surface);
  padding: var(--s-5) var(--s-4);
  text-align: center;
}
.stats__value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--t-2xl);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
}
.stats__label {
  display: block;
  margin-top: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-text-faint);
}

/* --------------------------------------------------------------------------
   10. Article
   -------------------------------------------------------------------------- */
.breadcrumbs {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.05em;
  color: var(--c-text-faint);
  padding-block: var(--s-5) 0;
}
.breadcrumbs a { color: var(--c-text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--c-accent); text-decoration: underline; }

.entry-header { padding-block: var(--s-5) var(--s-5); }
.entry-title { margin-bottom: var(--s-4); }

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--c-rule);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.04em;
  color: var(--c-text-faint);
  font-variant-numeric: tabular-nums;
}
.entry-meta a { color: var(--c-text-muted); text-decoration: none; }
.entry-meta a:hover { color: var(--c-accent); text-decoration: underline; }
.entry-meta__author { font-weight: 600; color: var(--c-text); }
.entry-meta__author a { color: var(--c-text); text-decoration: underline; text-decoration-color: var(--c-rule-strong); }

.featured-image {
  margin: 0 0 var(--s-6);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.featured-image img { width: 100%; }

.entry-content { font-size: var(--t-base); }
.entry-content > * { max-width: var(--w-prose); }
.entry-content > .table-wrap,
.entry-content > .les-tool,
.entry-content > figure,
.entry-content > .alignwide { max-width: none; }

.entry-content h2 {
  margin-top: var(--s-7);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--c-rule);
}
.entry-content h3 { margin-top: var(--s-6); }
.entry-content ul, .entry-content ol { padding-left: 1.35em; margin: 0 0 var(--s-4); }
.entry-content li { margin-bottom: var(--s-2); }
.entry-content li::marker { color: var(--c-brass); }
.entry-content img { border-radius: var(--r-md); }
.entry-content figcaption {
  font-size: var(--t-sm);
  color: var(--c-text-faint);
  padding-top: var(--s-2);
}

/* First paragraph of an article gets a lift — a newspaper standfirst. */
.single .entry-content > p:first-of-type {
  font-size: var(--t-lg);
  line-height: 1.55;
  color: var(--c-text-muted);
}

.toc {
  max-width: var(--w-prose);
  border: 1px solid var(--c-rule);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--r-md);
  background: var(--c-bg-subtle);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-6);
}
.toc summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-text-faint);
}
.toc ol { margin: var(--s-3) 0 0; padding-left: 1.3em; }
.toc li { margin-bottom: var(--s-1); }
.toc a { color: var(--c-text); text-decoration: none; }
.toc a:hover { color: var(--c-accent); text-decoration: underline; }

/* --------------------------------------------------------------------------
   11. Tables — shared by content and by the calculators
   -------------------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  margin-bottom: var(--s-5);
}
table { border-collapse: collapse; width: 100%; font-size: var(--t-sm); }
th, td {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-rule);
  vertical-align: top;
}
thead th {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-faint);
  background: var(--c-bg-subtle);
  white-space: nowrap;
}
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
td { font-variant-numeric: tabular-nums; }
.entry-content table { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   12. Calculator panels (LES Tools plugin markup)
   Treated as instruments: bordered, monospaced readouts, tabular figures.
   -------------------------------------------------------------------------- */
.les-tool {
  background: var(--c-surface);
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-bottom: var(--s-6);
  max-width: none;
}
@media (min-width: 700px) { .les-tool { padding: var(--s-6); } }

.les-field { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.les-field label {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-faint);
}
.les-hint {
  font-family: var(--font-body);
  font-size: var(--t-sm);
  letter-spacing: 0;
  text-transform: none;
  color: var(--c-text-muted);
}

.les-tool input[type="number"],
.les-tool input[type="text"],
.les-tool select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: var(--t-lg);
  font-variant-numeric: tabular-nums;
  padding: 0.62em 0.75em;
  color: var(--c-text);
  background: var(--c-bg);
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--r-md);
  min-height: 48px; /* comfortable touch target */
}
.les-tool select { font-family: var(--font-body); font-size: var(--t-base); }
.les-tool input:focus-visible, .les-tool select:focus-visible {
  border-color: var(--c-accent);
  outline: 2px solid var(--c-accent);
  outline-offset: 1px;
}

.les-row { display: grid; gap: var(--s-4); }
@media (min-width: 560px) { .les-row { grid-template-columns: 1fr 1fr; } }
.les-inline { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.les-inline input { max-width: 8rem; }

.les-subjects { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-4); }
.les-subject { display: grid; grid-template-columns: 1fr; gap: var(--s-2); }
@media (min-width: 560px) { .les-subject { grid-template-columns: 2fr 1fr 1fr; align-items: center; } }
.les-subject--head {
  display: none;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-faint);
}
@media (min-width: 560px) { .les-subject--head { display: grid; } }

.les-add-row {
  font-family: var(--font-body);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--c-accent);
  background: none;
  border: 1px dashed var(--c-rule-strong);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  width: 100%;
  margin-bottom: var(--s-4);
}
.les-add-row:hover { border-color: var(--c-accent); background: var(--c-accent-soft); }

.les-result {
  background: var(--c-accent-soft);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-md);
  padding: var(--s-5);
  text-align: center;
  margin-bottom: var(--s-4);
}
.les-result__value {
  font-family: var(--font-display);
  font-size: var(--t-3xl);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.022em;
  font-variant-numeric: tabular-nums;
  color: var(--c-accent);
  overflow-wrap: anywhere;
}
.les-result__label {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  margin-top: var(--s-2);
}
.les-result__formula {
  font-size: var(--t-sm);
  color: var(--c-text-muted);
  margin-top: var(--s-3);
  line-height: 1.5;
}

.les-tool-error {
  background: var(--c-danger-soft);
  border: 1px solid var(--c-danger);
  color: var(--c-danger);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-sm);
  margin-bottom: var(--s-4);
}

.les-source {
  font-size: var(--t-sm);
  line-height: 1.55;
  color: var(--c-text-muted);
  padding-top: var(--s-4);
  margin-top: var(--s-4);
  margin-bottom: 0;
  border-top: 1px solid var(--c-rule);
}
.les-source + .les-source { border-top: 0; padding-top: 0; margin-top: var(--s-3); }

.les-grades, .les-conversion { font-size: var(--t-sm); }
.les-conversion tbody th { width: 40%; }

/* --------------------------------------------------------------------------
   13. Pagination, search form, comments
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--c-rule);
}
.pagination .page-numbers {
  display: inline-grid;
  place-items: center;
  min-width: 42px; min-height: 42px;
  padding-inline: var(--s-3);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--c-text);
  text-decoration: none;
  background: var(--c-surface);
}
.pagination .page-numbers:hover { border-color: var(--c-text); }
.pagination .page-numbers.current {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-accent-text);
}

.search-form { display: flex; gap: var(--s-2); max-width: 34rem; }
.search-form input[type="search"] {
  flex: 1;
  font-family: var(--font-body);
  font-size: var(--t-base);
  padding: 0.62em 0.85em;
  min-height: 48px;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--r-md);
}
.search-form button {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--t-sm);
  padding-inline: var(--s-5);
  background: var(--c-accent);
  color: var(--c-accent-text);
  border: 0;
  border-radius: var(--r-md);
  cursor: pointer;
}

.comment-list { list-style: none; padding: 0; }
.comment-list li { padding-block: var(--s-4); border-bottom: 1px solid var(--c-rule); }

/* --------------------------------------------------------------------------
   14. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  background: var(--c-bg-subtle);
  border-top: 2px solid var(--c-text);
  padding-block: var(--s-7) var(--s-5);
  font-size: var(--t-sm);
}
.footer-grid { display: grid; gap: var(--s-6); }
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: var(--s-6); } }
.footer-grid h3 {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-text-faint);
  margin-bottom: var(--s-3);
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.footer-grid a { color: var(--c-text-muted); text-decoration: none; }
.footer-grid a:hover { color: var(--c-accent); text-decoration: underline; }
.footer-note { color: var(--c-text-muted); margin-top: var(--s-3); max-width: 44ch; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  justify-content: space-between;
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--c-rule);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.05em;
  color: var(--c-text-faint);
}

/* --------------------------------------------------------------------------
   15. Motion — additive only, and never applied to the LCP element
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
    transition: opacity 480ms cubic-bezier(.22,.61,.36,1),
                transform 480ms cubic-bezier(.22,.61,.36,1);
    transition-delay: var(--reveal-delay, 0ms);
  }
  .js [data-reveal].is-revealed { opacity: 1; transform: none; }
  .js [data-reveal-group] > *:nth-child(1) { --reveal-delay: 0ms; }
  .js [data-reveal-group] > *:nth-child(2) { --reveal-delay: 55ms; }
  .js [data-reveal-group] > *:nth-child(3) { --reveal-delay: 110ms; }
  .js [data-reveal-group] > *:nth-child(4) { --reveal-delay: 165ms; }
  .js [data-reveal-group] > *:nth-child(5) { --reveal-delay: 220ms; }
  .js [data-reveal-group] > *:nth-child(6) { --reveal-delay: 275ms; }
}

/* --------------------------------------------------------------------------
   16. Print
   -------------------------------------------------------------------------- */
@media print {
  .site-header, .masthead-strip, .site-footer, .rail, .toc,
  .theme-toggle, .nav-toggle, .pagination { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .entry-content > * { max-width: none; }
}

/* --------------------------------------------------------------------------
   17. Lead panel — the tool index that sits opposite the lead headline
   -------------------------------------------------------------------------- */
.lead__panel {
  border: 1px solid var(--c-rule);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  overflow: hidden;
}
.lead__panel .stats {
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--c-rule);
}
/* Three cells, always in one row — two-plus-an-orphan reads as a mistake. */
.lead__panel .stats { grid-template-columns: repeat(3, 1fr); }
.lead__panel .stats__item { padding: var(--s-4) var(--s-2); }
.lead__panel .stats__value { font-size: var(--t-lg); }
.lead__panel .stats__label { font-size: 0.65rem; letter-spacing: 0.06em; }
@media (min-width: 420px) {
  .lead__panel .stats__item { padding: var(--s-4) var(--s-3); }
  .lead__panel .stats__value { font-size: var(--t-xl); }
  .lead__panel .stats__label { font-size: var(--t-xs); letter-spacing: 0.09em; }
}

.lead__links { list-style: none; margin: 0; padding: 0; }
.lead__links li + li { border-top: 1px solid var(--c-rule); }
.lead__links a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--s-4) var(--s-5);
  text-decoration: none;
  color: var(--c-text);
}
.lead__links a:hover { background: var(--c-accent-soft); color: var(--c-text); }
.lead__links strong {
  font-family: var(--font-display);
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.008em;
}
.lead__links span { color: var(--c-text-muted); font-size: var(--t-sm); }

/* ============================================================
   Share bar
   Sits between the content and whatever follows it. Buttons are
   chips rather than brand-coloured blocks — six saturated logos in
   a row is the single loudest thing on most pages, and this is a
   newspaper.
   ============================================================ */

.share {
  margin-block: var(--s-8, 2.5rem);
  padding-block: var(--s-6, 1.75rem);
  border-top: 1px solid var(--c-rule);
  border-bottom: 1px solid var(--c-rule);
}

.share__heading {
  font-family: var(--font-body);
  font-size: var(--t-sm, .875rem);
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--c-text);
  margin: 0 0 var(--s-3, .75rem);
}

.share__note {
  font-size: var(--t-sm, .875rem);
  color: var(--c-text-muted);
  margin: 0 0 var(--s-3, .75rem);
  max-width: 60ch;
}

.share__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2, .5rem);
}

.share__btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .8rem;
  min-height: 44px;               /* touch target */
  border: 1px solid var(--c-rule-strong);
  border-radius: 4px;
  background: var(--c-surface);
  color: var(--c-text-muted);
  font-family: var(--font-body);
  font-size: var(--t-sm, .875rem);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.share__btn svg { width: 18px; height: 18px; flex: none; }

.share__btn:hover,
.share__btn:focus-visible {
  border-color: var(--c-accent);
  color: var(--c-accent);
  background: var(--c-bg-subtle);
}

.share__btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* The native sheet is the primary action where it exists, so it is the
   one button that carries the accent. */
.share__btn--native {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #fff;
}
.share__btn--native:hover,
.share__btn--native:focus-visible {
  background: var(--c-text);
  border-color: var(--c-text);
  color: #fff;
}

.share__live {
  font-size: var(--t-xs, .8125rem);
  color: var(--c-text-faint);
  margin: var(--s-2, .5rem) 0 0;
  min-height: 1.2em;
}

/* Below 380px six chips with labels wrap into a tall stack. Drop the
   labels on the network buttons only — the icons and aria-labels carry
   the meaning, and Share and Copy keep their words. */
@media (max-width: 379px) {
  .share__btn[data-share-net] span { display: none; }
  .share__btn[data-share-net] { padding: .55rem .7rem; }
}
