/* ================================================================
   DB7/CO — Rogue News Agency
   Charcoal ground, one rogue-pink signal, condensed desk type.
   ================================================================ */

/* ─── Design Tokens (dark first) ─────────────────────────────────── */

/* The scene: a reader at a desk after dark, one screen, no other light.
   Dark is the default theme, not a preference switch. */
:root {
  /* Grounds */
  --color-deep: #121212;
  --color-lower: #0e0e10;
  --color-surface: #1f1f1f;
  --color-soft: #252525;
  --color-bg: var(--color-deep);

  /* Ink */
  --color-text: #ffffff;
  --color-muted: #a0a0a0;
  --color-text-muted: var(--color-muted);

  /* Structure */
  --color-border: #333333;
  --color-border-hover: #4a4a4a;
  --color-rule: #333333;

  /* Signal — rogue pink. Fills use --color-accent. Small text on a ground
     uses --color-accent-text, which clears 4.5:1 against #121212. */
  --color-accent: #e6007a;
  --color-accent-hover: #ff2d93;
  --color-accent-text: #ff4d9e;
  --color-accent-soft: rgba(230, 0, 122, 0.1);
  --color-accent-alt: #ff4d9e;

  /* Status */
  --color-alert: #ff6b8a;
  --color-success: #5fd08b;
  --color-gold: #d8cfc0;
  --color-focus: #ff4d9e;
  --color-on-accent: #000000;

  /* Type: condensed desk caps, geometric headlines, neutral body */
  --font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-desk: "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  /* Corner language: editorial, square */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;

  /* Depth: offset plus blur. Never a zero-offset halo. */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 24px -12px rgba(0, 0, 0, 0.7);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.45), 0 18px 40px -16px rgba(0, 0, 0, 0.75);

  /* Rhythm */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;

  --measure: 30em;
  --shell: 1320px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Light Theme ──────────────────────────────────────────────────── */

/* Newsprint: the same desk in daylight. Paper is warm, never blue-white. */
:root[data-theme="light"] {
  --color-deep: #f2f2ef;
  --color-lower: #e9e9e6;
  --color-surface: #ffffff;
  --color-soft: #e6e6e2;
  --color-bg: var(--color-deep);

  --color-text: #0b0b0c;
  --color-muted: #55555b;
  --color-text-muted: var(--color-muted);

  --color-border: #d8d7d2;
  --color-border-hover: #b7b6b0;
  --color-rule: #d8d7d2;

  --color-accent: #e6007a;
  --color-accent-hover: #ff2d93;
  --color-accent-text: #c4006a;
  --color-accent-soft: rgba(230, 0, 122, 0.07);
  --color-accent-alt: #c4006a;

  --color-alert: #b3243f;
  --color-success: #1c6b42;
  --color-gold: #6b6255;
  --color-focus: #c4006a;
  --color-on-accent: #000000;

  --shadow-card: 0 1px 2px rgba(23, 20, 15, 0.06), 0 10px 24px -14px rgba(23, 20, 15, 0.18);
  --shadow-lift: 0 2px 4px rgba(23, 20, 15, 0.08), 0 18px 40px -18px rgba(23, 20, 15, 0.22);
}

/* ─── Base / Reset ─────────────────────────────────────────────────── */

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  scrollbar-color: var(--color-border-hover) transparent;
  caret-color: var(--color-accent);
}

html[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-deep);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

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

a {
  color: var(--color-accent-text);
  text-decoration: none;
  text-underline-offset: 0.18em;
  transition: color 0.18s var(--ease);
}

a:hover {
  color: var(--color-accent);
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-border-hover);
  border: 2px solid var(--color-deep);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-accent); }

/* ─── Typography ───────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--color-text);
  text-wrap: balance;
}

h1 { font-size: clamp(2.1rem, 4.2vw, 3.5rem); }
h2 { font-size: clamp(1.35rem, 2vw, 1.75rem); }
h3 { font-size: clamp(1.05rem, 1.35vw, 1.2rem); letter-spacing: -0.01em; }
h4 { font-size: 1rem; letter-spacing: -0.005em; }

p { margin: 0 0 var(--space-md); }
p:last-child { margin-bottom: 0; }

/* The desk voice: section names, labels, rail headings, badges. */
.desk-label,
.kicker,
.section-heading__title,
.badge,
.wire__label {
  font-family: var(--font-desk);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

/* A badge that rides inline after a title rather than leading a row. */
.badge--inset { margin-left: 0.4rem; }


small {
  font-size: 0.86rem;
  color: var(--color-muted);
}

strong { font-weight: 600; }

/* ─── Utilities ────────────────────────────────────────────────────── */

/* Available to screen readers, absent from the visual layout. Used to give
   relational numbers (high/low, rank, deltas) the words the design drops. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-grow-1 { flex-grow: 1; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }

.mt-auto { margin-top: auto; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-3xl { margin-bottom: var(--space-3xl); }

.chevron { font-size: 0.6rem; }
.chevron--xs { font-size: 0.55rem; }

/* A grid child that spans the full track set, used by desk-level empty states. */
.grid-span-all { grid-column: 1 / -1; }

/* Off-screen but still in the layout and still fillable: the newsletter
   honeypot. Not `display: none`, which most bots skip. */
.honeypot { position: absolute; left: -9999px; }

/* An anchor that inherits its container's colour instead of the link accent. */
.link-plain { color: inherit; }

/* Colour carriers for one-off emphasis that the component has no modifier for. */
.text-accent { color: var(--color-accent); }
.text-alert { color: var(--color-alert); }

.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }

.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }

/* Vertical rhythm only. The `padding` shorthand used to reset the horizontal
   gutter that `.container` sets, which left body copy flush against the
   viewport edge between 560px and the shell width. */
.site-main {
  padding-block: var(--space-xl) var(--space-3xl);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--color-accent);
  color: var(--color-on-accent);
  padding: 0.7rem 1.1rem;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.skip-link:focus {
  left: 0;
  color: var(--color-on-accent);
}

.spinner {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Wire Bar (top signal strip) ──────────────────────────────────── */

.wire {
  background: var(--color-lower);
  border-bottom: 1px solid var(--color-border);
  padding-block: 0.35rem;
  font-family: var(--font-desk);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
}

.wire__inner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  min-height: 30px;
  flex-wrap: wrap;
}

.wire__label {
  color: var(--color-text);
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.wire__dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  background: var(--color-muted);
}

.wire__dot--live {
  background: var(--color-accent);
  animation: pulse-dot 2.4s var(--ease) infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.wire__rule {
  width: 1px;
  height: 14px;
  background: var(--color-border);
  display: inline-block;
}

.wire__stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.wire__stat strong {
  color: var(--color-text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* The article title in the wire bar is the one stat that must not wrap. */
.wire__stat--clipped {
  max-width: 52ch;
  overflow: hidden;
  text-overflow: ellipsis;
}


.wire__stat--alert strong {
  color: var(--color-accent-text);
}

/* Wire-bar weather doubles as the link to the Desk Window outlook. */
.wire__weather {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.wire__weather:hover,
.wire__weather:focus-visible {
  color: var(--color-text);
  border-bottom-color: var(--color-accent);
}

.wire__spacer { margin-left: auto; }

.wire a { color: var(--color-muted); }
.wire a:hover { color: var(--color-accent-text); }
.wire__stat--alert a,
a.wire__stat--alert { color: var(--color-accent-text); }

@media (max-width: 900px) {
  .wire__inner { gap: var(--space-md); }
  .wire__stat:nth-last-child(-n+3) { display: none; }
}

/* ─── Masthead ─────────────────────────────────────────────────────── */

.masthead {
  background: var(--color-deep);
  border-bottom: 1px solid var(--color-border);
  position: relative;
  z-index: 60;
}

.masthead__main {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
}

.masthead__brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

/* Two supplied lockups: white ink on dark, black ink on light. */
.masthead__lockup {
  height: 96px;
  width: auto;
  transition: opacity 0.18s var(--ease);
}

.masthead__lockup--light { display: none; }

:root[data-theme="light"] .masthead__lockup--dark { display: none; }
:root[data-theme="light"] .masthead__lockup--light { display: block; }

.masthead__brand:hover .masthead__lockup { opacity: 0.82; }

.masthead__meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-left: var(--space-lg);
  border-left: 1px solid var(--color-border);
}

.masthead__dateline {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.masthead__tools {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

.masthead__search {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: border-color 0.18s var(--ease);
}

.masthead__search:focus-within { border-color: var(--color-accent); }

.masthead__search input[type="search"] {
  border: 0;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.5rem 0.7rem;
  width: 190px;
  outline: none;
}

.masthead__search input::placeholder { color: var(--color-muted); }
.masthead__search input::-webkit-search-cancel-button { filter: invert(0.6); }

.masthead__search button {
  border: 0;
  border-left: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  padding: 0 0.7rem;
  cursor: pointer;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}

.masthead__search button:hover {
  color: var(--color-on-accent);
  background: var(--color-accent);
}

/* ─── Hot topics strip ─────────────────────────────────────────────── */

.topics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.topics__label {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-right: 0.25rem;
}

/* ─── Postmark (rail stamp) ────────────────────────────────────────── */

.postmark {
  font-family: var(--font-desk);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  padding: 0.28rem 0.5rem;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.postmark:hover {
  color: var(--color-accent-text);
  border-color: var(--color-accent);
}

/* Anchor targeting for the wire jump */
#breaking { scroll-margin-top: 96px; }

/* ─── Section Rail (primary navigation) ────────────────────────────── */

.rail {
  background: var(--color-deep);
  border-bottom: 1px solid var(--color-border);
  position: relative;
  z-index: 50;
}

.rail__inner {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  min-height: 46px;
}

.rail__links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.rail__link {
  appearance: none;
  background: none;
  border: 0;
  font-family: var(--font-desk);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.78rem;
  color: var(--color-text);
  padding: 0.85rem 0;
  position: relative;
  white-space: nowrap;
  cursor: pointer;
}

.rail__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.32s var(--ease);
}

.rail__link:hover { color: var(--color-accent-text); }
.rail__link:hover::after { transform: scaleX(1); }

@media (max-width: 820px) {
  /* The rail becomes a swipeable strip: every section stays reachable
     instead of being cropped or dropped. */
  .rail__inner { gap: 0; }

  .rail__links {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    gap: var(--space-lg);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-right: var(--space-lg);
  }

  .rail__links::-webkit-scrollbar { display: none; }

  .rail__actions { display: none; }
}

.rail__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ─── Legacy navbar hooks (kept for interior pages) ────────────────── */

/* ─── Theme Toggle ──────────────────────────────────────────────────── */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-family: var(--font-desk);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.theme-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}

.theme-toggle__icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.theme-toggle:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ─── Buttons ───────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-desk);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--color-soft);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.btn:hover { color: var(--color-text); }

.btn--primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-color: var(--color-accent);
}

.btn--primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-on-accent);
}

.btn--ghost {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn--ghost:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-text);
}

.btn--sm {
  padding: 0.5rem 0.8rem;
  font-size: 0.7rem;
}

.btn:active { transform: translateY(1px); }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ─── Cards ────────────────────────────────────────────────────────── */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s var(--ease), transform 0.24s var(--ease),
    box-shadow 0.24s var(--ease);
}

.card__body { padding: var(--space-lg); }

.card__body--fill { flex: 1; }

/* The responsive-image wrapper must not become a layout box.
 *
 * Cards size their photograph with `.card__media img { width:100%; height:100% }`,
 * and a percentage height resolves against a block ancestor — not against an
 * inline <picture>. `display: contents` removes the wrapper from the box tree,
 * so the <img> lays out exactly as it did before WebP srcsets were added, in
 * every slot, without touching each slot's rules. */
picture { display: contents; }

.card__media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-soft);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.card:hover .card__media img { transform: scale(1.035); }

.sidebar-card { background: var(--color-surface); }

.sidebar-card__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: var(--space-sm);
}

.sidebar-card__text {
  color: var(--color-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* ─── Section Heading ──────────────────────────────────────────────── */

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
  position: relative;
}

/* The pink rule draws itself once, when the heading enters the page. */
.section-heading::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 64px;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s var(--ease) 0.1s;
}

.section-heading.is-inview::before,
.no-js .section-heading::before { transform: scaleX(1); }

.section-heading__title {
  font-size: 1.02rem;
  color: var(--color-text);
  letter-spacing: 0.12em;
}

.section-heading__meta {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.7rem;
  color: var(--color-muted);
  white-space: nowrap;
}

/* ─── Kickers / Labels ─────────────────────────────────────────────── */

.kicker {
  font-size: 0.7rem;
  color: var(--color-muted);
  display: inline-block;
}

/* ─── Badges / Pills ───────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  line-height: 1;
  padding: 0.32rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  background: transparent;
  white-space: nowrap;
}

.badge--breaking {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
}

.badge--exclusive {
  border-color: var(--color-accent);
  color: var(--color-accent-text);
}

.badge--exclusive::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--color-accent);
  display: inline-block;
}

.badge--tag { color: var(--color-muted); }
.badge--tag:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-text);
}

.badge--status-draft { color: var(--color-muted); }
.badge--status-pending {
  border-color: var(--color-gold);
  color: var(--color-gold);
}
.badge--status-approved {
  border-color: var(--color-success);
  color: var(--color-success);
}
.badge--status-rejected {
  border-color: var(--color-alert);
  color: var(--color-alert);
}

/* ─── Breadcrumbs ──────────────────────────────────────────────────── */

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin-left: 0;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-bottom: var(--space-lg);
}

.breadcrumbs__item { color: var(--color-muted); }
.breadcrumbs__item + .breadcrumbs__item::before {
  content: "/";
  margin-right: 0.4rem;
  color: var(--color-border-hover);
}
.breadcrumbs__item a { color: var(--color-muted); }
.breadcrumbs__item a:hover { color: var(--color-accent-text); }
.breadcrumbs__item--active {
  color: var(--color-text);
  /* Shown again. The rule was hidden for a while to drop the duplicate of the H1
     right below it; `display: none` stays commented rather than deleted so the
     trade-off is still visible here. */
  /* display: none; */
}

/* ─── Alert / Messages ─────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: var(--space-md);
  font-size: 0.9rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

.alert--error,
.alert--danger {
  border-color: var(--color-alert);
  color: var(--color-alert);
}
.alert--success { border-color: var(--color-success); color: var(--color-success); }
.alert--warning { border-color: var(--color-gold); color: var(--color-gold); }
.alert--info { border-color: var(--color-border); }

/* ─── Empty State ──────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-md);
}

.empty-state__icon {
  font-size: 1.6rem;
  color: var(--color-accent);
  display: block;
  margin-bottom: var(--space-sm);
}

.empty-state__icon--lg { font-size: 2.4rem; }


.empty-state__title {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.85rem;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

/* ─── Pagination ───────────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: var(--space-xl) 0 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

.pagination__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 2.4rem;
  padding: 0 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-desk);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.pagination__link:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-text);
}

.pagination__link--active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
}

.pagination__link--disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ─── Dropdown / Mega Menu ─────────────────────────────────────────── */

.dropdown { position: relative; display: inline-block; }

.dropdown__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 208px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  padding: 0.35rem;
  display: none;
  z-index: 120;
}

.dropdown.is-open > .dropdown__menu { display: block; }

.dropdown__item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.86rem;
  color: var(--color-text);
  border-radius: var(--radius-sm);
}

.dropdown__item--danger { color: var(--color-alert); }


.dropdown__item:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent-text);
}

.dropdown__divider {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 0.35rem 0;
}

/* The section menu hangs off the rail, not off the six-character button it
   opens from: anchored to .rail the panel spans the full width, so the
   section columns get room for their names instead of wrapping inside the
   button's 77px. */
.dropdown--rail { position: static; }

.mega-menu {
  left: 0;
  right: 0;
  width: auto;
  min-width: 0;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding: var(--space-lg);
}

.mega-menu__inner { max-width: var(--shell); margin: 0 auto; }

.mega-menu__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: start;
  gap: var(--space-xl);
}

.mega-menu__cat {
  display: block;
  font-family: var(--font-desk);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  color: var(--color-text);
  padding-bottom: 0.3rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
}

.mega-menu__cat:hover { color: var(--color-accent-text); }

.mega-menu__subs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.35rem var(--space-md);
}

.mega-menu__sub {
  font-size: 0.84rem;
  color: var(--color-muted);
}
.mega-menu__sub:hover { color: var(--color-accent-text); }

.mega-menu__empty-text { color: var(--color-muted); font-size: 0.85rem; }

/* ─── Breaking Ticker ──────────────────────────────────────────────── */

.breaking-ticker {
  background: var(--color-lower);
  border-block: 1px solid var(--color-border);
  color: var(--color-text);
  overflow: hidden;
}

.breaking-ticker .container {
  display: flex;
  align-items: center;
  min-height: 40px;
}

.breaking-ticker__badge {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
  flex-shrink: 0;
  margin-right: var(--space-md);
}

.breaking-ticker__scroll {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* Two identical groups, so a -50% shift lands exactly on the seam. Spacing
   lives on the links rather than on the track gap: a track-level gap would
   add one extra space that the -50% offset cannot account for. */
.breaking-ticker__track {
  display: flex;
  width: max-content;
  animation: wire-ticker 52s linear infinite;
  will-change: transform;
}

.breaking-ticker__group {
  display: flex;
  flex: 0 0 auto;
}

.breaking-ticker:hover .breaking-ticker__track,
.breaking-ticker:focus-within .breaking-ticker__track {
  animation-play-state: paused;
}

/* The reader's motion preference wins over the ribbon's own loop. */
@media (prefers-reduced-motion: reduce) {
  .breaking-ticker__track { animation: none; }
}

@keyframes wire-ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.breaking-ticker__link {
  color: var(--color-text);
  font-family: var(--font-desk);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
  white-space: nowrap;
  padding-right: var(--space-xl);
}

.breaking-ticker__link:hover { color: var(--color-accent-text); }

/* Wire ribbon at phone width: stack the headlines instead of hiding them
   behind a horizontal crawl the reader has to chase. This stack is also the
   fallback for the rolling window below — it needs no script and no motion, so
   every headline stays readable when either is unavailable. */
@media (max-width: 768px) {
  .breaking-ticker .container {
    flex-wrap: wrap;
    row-gap: 0.45rem;
    padding-block: 0.5rem;
  }

  /* Desktop separates badge from wire by a full 1rem; the container's 0.6rem gap
     leaves the mobile band tighter than that, so the badge carries 7px to match. */
  .breaking-ticker__badge { margin-right: 7px; }

  .breaking-ticker__scroll {
    flex-basis: 100%;
    overflow: visible;
  }

  .breaking-ticker__track {
    flex-direction: column;
    width: auto;
    animation: none;
  }

  /* The track stacks the two groups; without flipping the group too, its links
     stay side by side and become four squeezed columns instead of a wire. */
  .breaking-ticker__group { flex-direction: column; }

  /* One set is enough when the headlines stack. */
  .breaking-ticker__group[aria-hidden="true"] { display: none; }

  .breaking-ticker__link {
    display: block;
    white-space: normal;
    font-size: 0.78rem;
    line-height: 1.3;
    text-transform: none;
    letter-spacing: 0.01em;
    padding-right: 0;
    padding-block: 0.35rem;
  }

  .breaking-ticker__track .breaking-ticker__link:first-child { padding-top: 0; }

  .breaking-ticker__link + .breaking-ticker__link {
    border-top: 1px solid var(--color-border);
  }
}

/* A phone held in one hand scrolls vertically all day, so the wire turns its
   axis and rolls up instead: a single slot, one headline moving per beat. One
   slot rather than two on purpose — at 390px a headline needs two lines, and two
   two-line slots is a 100px band that reads as a paragraph. `scripting` and the
   motion preference gate the whole block, so a reader without either keeps the
   full stack above and loses nothing: the window is an enhancement, never the
   only way to read the wire. The script only sets scrollTop; every dimension
   here is server-known, so nothing shifts at load. */
@media (max-width: 768px) and (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .breaking-ticker {
    /* One slot: two clamped lines at 0.78rem / 1.3, plus 5px of air on each
       side so the outgoing headline is not touching the band's rules. */
    --wire-row: 2.65rem;
  }

  .breaking-ticker .container {
    flex-wrap: nowrap;
    row-gap: 0;
    padding-block: 0.5rem;
  }

  .breaking-ticker__scroll {
    flex: 1 1 auto;
    flex-basis: auto;
    min-width: 0;
    height: var(--wire-row);
    overflow: hidden;
    /* A hairline of fade at each edge, so a headline enters and leaves the slot
       instead of being guillotined by it. It sits inside the 5px of air the row
       keeps above and below its two lines, never over the type. */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 4px, #000 calc(100% - 4px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 4px, #000 calc(100% - 4px), transparent 100%);
    /* The script owns this scroller. A page flick passing through it should
       move the page, not the wire. */
    overscroll-behavior: contain;
  }

  /* The duplicate group is the seam the roll wraps through, so it comes back. */
  .breaking-ticker__group[aria-hidden="true"] { display: flex; }

  .breaking-ticker__link {
    display: grid;
    align-content: center;
    height: var(--wire-row);
    padding-block: 0;
  }

  /* Two lines hold a full headline at this width; a third is more than the slot
     can show, and the clamp is what keeps every slot exactly one slot tall. */
  .breaking-ticker__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Slots move against each other, so a rule between them would scroll with
     the text and read as a tear in the band. */
  .breaking-ticker__link + .breaking-ticker__link { border-top: 0; }
}

/* ─── Desk (front page) ────────────────────────────────────────────── */

.desk {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-xl);
  align-items: start;
}

.desk__lead { grid-column: span 7; }
.desk__board { grid-column: span 5; }

.desk__page {
  grid-column: span 8;
  display: flex;
  flex-direction: column;
}
.desk__rail { grid-column: span 4; }

/* The feed column runs to the same baseline as the rail: the pager anchors
   the bottom, so a short page never leaves a torn edge beside the sidebar. */
.desk__page .pagination { margin-top: auto; padding-top: var(--space-xl); }

/* Below the shell the desk is a single column. Collapsing the *tracks* matters:
   leaving twelve tracks and eleven 2rem gaps meant the gap total alone (352px)
   exceeded the content box on a 320px screen, so every child overflowed. */
@media (max-width: 1024px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .desk__lead,
  .desk__board,
  .desk__page,
  .desk__rail { grid-column: 1 / -1; }
  .desk__rail { position: static; }
}

/* ─── Wire slab (between the desks) ────────────────────────────────── */

/* Full bleed inside `.site-main.container`: `left: 50%` is measured from the
   container's content box, and the container's gutters are symmetrical, so
   `-50vw` lands the band exactly on the viewport edges. `overflow-x: clip`
   on `body` absorbs the 100vw/scrollbar difference. */
.ribbon {
  position: relative;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  margin-bottom: var(--space-3xl);
}

/* The band is the page recessed, not a colour field: the same plane as the wire
   bar that opens the page and the footer that closes it, one step below the
   desk. Pink appears exactly once, as the 2px liveness rule cap, and again only
   at the live dot. The photograph on the stage is the one bright thing inside. */
.ribbon--wire {
  background: var(--color-lower);
  color: var(--color-text);
  border-top: 2px solid var(--color-accent);
  border-bottom: 1px solid var(--color-border);
  padding-block: var(--space-2xl);
}

.ribbon__inner {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-xl);
  align-items: center;
}
.ribbon__watch { grid-column: span 7; }
.ribbon__stage { grid-column: span 5; }

@media (max-width: 1024px) {
  .ribbon__inner { grid-template-columns: minmax(0, 1fr); }
  .ribbon__watch,
  .ribbon__stage { grid-column: 1 / -1; }
  .ribbon--wire { padding-block: var(--space-xl); }
}

/* The `.watch` card chrome would read as a panel on a panel; the slab is the
   container, so the card flattens into it. */
.ribbon--wire .watch {
  background: transparent;
  border: 0;
  padding: 0;
  margin-bottom: 0;
}

/* Stacked, not side by side: at seven columns the rows need the full width for
   their headline, so the list reads as a list rather than a squeezed column. */
.ribbon--wire .watch__item { padding-block: 0.7rem; }

/* The active row is the one the stage is showing. Colour alone does not carry
   it: the row also gains the accent rule on its left edge. */
.ribbon--wire .watch__item.is-active {
  box-shadow: inset 2px 0 0 var(--color-accent);
  padding-left: var(--space-sm);
  margin-left: calc(var(--space-sm) * -1);
}
.ribbon--wire .watch__item.is-active a { color: var(--color-accent-text); }
.ribbon--wire .watch__item.is-active i { color: var(--color-accent); }

/* ─── The stage: the hovered row's photograph ─────────────────────── */

.ribbon__stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-soft);
  border: 1px solid var(--color-border);
}

.ribbon__stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Monochrome by design: the band carries one colour signal (the pink rule) and
     the wire's rows are meta, not editorial. A full-colour photograph of a story
     the reader is only skim-reading would outrank the lead's own image. */
  filter: grayscale(100%);
}

/* No crossfade: the script preloads the next photograph and swaps only once it
   has decoded, so the change is already seamless and there is no second layer
   to fade against. That also means nothing to disable under reduced motion. */

/* Caption on a scrim. The scrim is what makes white type legal here: it never
   sits on the band's ground, so it needs no per-theme variant and cannot
   inherit a muted ink that would fail on a busy photograph. */
.ribbon__stage-cap {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--space-lg) var(--space-md) var(--space-md);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.45) 55%, transparent);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ribbon__stage-kicker {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: var(--color-accent-text);
}

.ribbon__stage-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  letter-spacing: -0.012em;
  color: #ffffff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* A row with no photograph clears the stage rather than leaving the previous
   story's picture under the new headline, which would be a lie. */
.ribbon__stage-empty {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  justify-items: center;
  gap: var(--space-sm);
  color: var(--color-muted);
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.7rem;
}
.ribbon__stage-empty i { font-size: 1.4rem; color: var(--color-accent); }
.ribbon__stage.is-empty .ribbon__stage-empty { display: grid; }
.ribbon__stage.is-empty img,
.ribbon__stage.is-empty .ribbon__stage-cap { visibility: hidden; }

/* The stage needs a picture to preview. An empty wire (no rows at all) has no
   row to announce, so the plate speaks for itself — the list's own "Nothing new
   on the wire." is the copy the reader actually needs. */
.ribbon__stage:not(:has(img)) .ribbon__stage-cap { display: none; }
.ribbon__stage:not(:has(img)) .ribbon__stage-empty { display: grid; }

/* Lead story */
.lead {
  display: block;
  color: inherit;
}

.lead__media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-soft);
  margin-bottom: var(--space-lg);
  position: relative;
}

.lead__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}

.lead:hover .lead__media img { transform: scale(1.03); }

.lead__flags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.lead__title {
  font-size: clamp(2rem, 3.6vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.035em;
  margin-bottom: var(--space-md);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lead__title a { color: var(--color-text); }
.lead__title a:hover { color: var(--color-accent-text); }

.lead__excerpt {
  color: var(--color-muted);
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 56ch;
  margin-bottom: var(--space-md);
}

/* Story meta line with the bolt */
.story-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
}

.story-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.story-meta__bolt {
  color: var(--color-accent);
  font-size: 0.7rem;
}

/* Breaking board: rule-separated secondary rows */
.board {
  border-top: 1px solid var(--color-border);
}

.board__item {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
  align-items: start;
}

.board__item--no-media { grid-template-columns: 1fr; }

.board__thumb {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--color-soft);
}

.board__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.board__item:hover .board__thumb img { transform: scale(1.06); }

.board__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-bottom: 0.3rem;
}

/* Meta above a headline rather than inline with it. */
.board__meta--spaced { margin-bottom: 0.5rem; }


.board__cat { color: var(--color-accent-text); }

.board__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.012em;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board__title a { color: var(--color-text); }
.board__title a:hover { color: var(--color-accent-text); }

/* ─── Launch (first viewport reveal) ───────────────────────────────── */

.reveal-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.reveal-line > * {
  animation: line-rise 0.9s var(--ease) 0.08s both;
}

@keyframes line-rise {
  from { transform: translateY(105%); }
  to { transform: translateY(0); }
}

/* ─── Feed (Latest Stories) ────────────────────────────────────────── */

.feed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-lg);
}

@media (max-width: 700px) {
  .feed-grid { grid-template-columns: 1fr; }
}

.feed-item {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: var(--space-md);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  align-items: start;
}

.feed-item__thumb {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--color-soft);
}

.feed-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.feed-item:hover .feed-item__thumb img { transform: scale(1.05); }

.feed-item__cat {
  display: inline-block;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: var(--color-accent-text);
  margin-bottom: 0.25rem;
}

.feed-item__title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.012em;
  margin: 0 0 0.35rem;
}

.feed-item__title a { color: var(--color-text); }
.feed-item__title a:hover { color: var(--color-accent-text); }

.feed-item__text {
  color: var(--color-muted);
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 0 0 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-item__date {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

/* ─── Rogue Watch rail ─────────────────────────────────────────────── */

.watch {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.watch__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-accent);
  margin-bottom: var(--space-md);
}

.watch__title {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.82rem;
  color: var(--color-text);
  margin: 0;
}

.watch__live {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: var(--color-accent-text);
}

.watch__live::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  animation: pulse-dot 2.4s var(--ease) infinite;
}

.watch__list { display: flex; flex-direction: column; }

.watch__item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: var(--space-sm);
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.86rem;
  line-height: 1.4;
}

.watch__item:last-child { border-bottom: 0; }

.watch__item i { color: var(--color-accent-text); font-size: 0.6rem; margin-top: 0.35rem; }

.watch__item a { color: var(--color-text); }
.watch__item a:hover { color: var(--color-accent-text); }

.watch__time {
  display: block;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-top: 0.2rem;
}

/* Popular list with desk numerals */
.popular { display: flex; flex-direction: column; }

.popular__item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: var(--space-sm);
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--color-border);
  align-items: baseline;
}

.popular__item:last-child { border-bottom: 0; }

.popular__rank {
  font-family: var(--font-desk);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--color-accent-text);
  font-variant-numeric: tabular-nums;
}

.popular__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--color-text);
  font-weight: 500;
}

.popular__title:hover { color: var(--color-accent-text); }

.popular__meta {
  display: block;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-top: 0.2rem;
}

/* ─── Sidebar: radar, forecast, protocol list ──────────────────────── */

.radar { display: flex; flex-direction: column; }

.radar__item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: var(--space-sm);
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-border);
  align-items: baseline;
}

.radar__item:last-child { border-bottom: 0; }

.radar__rank {
  font-family: var(--font-desk);
  font-weight: 700;
  color: var(--color-accent-text);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.radar__content a { color: var(--color-text); font-size: 0.88rem; line-height: 1.35; }
.radar__content a:hover { color: var(--color-accent-text); }

/* Fragment targets for pagination and the wire-bar weather link. Everything in
   the chrome scrolls away with the page, so this is breathing room rather than
   clearance under a sticky bar. Focus is programmatic, so no ring is drawn. */
.pagination-target {
  scroll-margin-top: var(--space-lg);
}

.pagination-target:focus { outline: none; }

/* ─── The Desk Window: current conditions + three-day outlook ───────── */

.desk-window { display: flex; flex-direction: column; }

/* Anchor target for the wire bar's temperature. */
#desk-window { scroll-margin-top: var(--space-lg); }

/* Lead block: what it is doing outside right now. The icon is the card's one
   graphic moment; the rows below carry words instead of repeating it. */
.desk-window__now {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.desk-window__now-icon {
  font-size: 1.45rem;
  line-height: 1;
  color: var(--color-accent-text);
}

.desk-window__now-temp {
  font-family: var(--font-display);
  font-size: 2.05rem;
  font-weight: 700;
  line-height: 0.9;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.desk-window__now-caption {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.desk-window__now-label {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--color-text);
}

.desk-window__now-meta {
  font-family: var(--font-desk);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

/* Three rows, one per day. Each row's rule is also its temperature band: the
   lit segment spans that day's low-high against one shared scale for the
   window, so the rows are comparable rather than three unrelated numbers. */
.desk-window__days {
  list-style: none;
  margin: 0;
  padding: 0;
}

.desk-window__day {
  position: relative;
  display: grid;
  grid-template-columns: 3.3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.5rem 0 0.6rem;
  font-size: 0.82rem;
}

.desk-window__date {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  line-height: 1.1;
  color: var(--color-muted);
}

.desk-window__day--today .desk-window__date { color: var(--color-accent-text); }

.desk-window__day-num {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

.desk-window__cond {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desk-window__precip {
  flex-shrink: 0;
  font-family: var(--font-desk);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--color-accent-text);
  font-variant-numeric: tabular-nums;
}

/* The rule under each row, lit from low to high on the window's scale. */
.desk-window__band {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--color-border);
}

/* Zero-width by default: a day without band data leaves a plain track rather
   than a fully lit rule that would read as spanning the whole scale. */
.desk-window__band::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 var(--band-start, 0%);
  width: calc(var(--band-end, 0%) - var(--band-start, 0%));
  background: var(--color-muted);
}

.desk-window__day--today .desk-window__band::after { background: var(--color-accent); }

.desk-window__temps {
  display: inline-flex;
  justify-content: flex-end;
  gap: 0.35rem;
  font-family: var(--font-desk);
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  white-space: nowrap;
}

.desk-window__high { color: var(--color-text); }
.desk-window__low { color: var(--color-muted); }

/* Provenance, not boilerplate: when the reading is from, and when the light
   goes. Replaces the old "updated hourly, highs and lows in °F" sentence. */
.desk-window__foot {
  margin: var(--space-sm) 0 0;
  font-family: var(--font-desk);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

/* The condition is the only field allowed to truncate; the date and the
   temperatures keep their columns at every width, so rows stay one line. */

/* ─── Cards: story card, article grid, search results ──────────────── */

.story-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.story-card:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.story-card .card__body { display: flex; flex-direction: column; flex: 1; }

.story-card__title {
  font-size: 1.05rem;
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.story-card__title a { color: var(--color-text); }
.story-card__title a:hover { color: var(--color-accent-text); }

.story-card__text {
  color: var(--color-muted);
  font-size: 0.86rem;
  line-height: 1.55;
  margin-bottom: var(--space-md);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.search-result {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--space-lg);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--color-border);
  align-items: start;
}

@media (max-width: 640px) {
  .search-result { grid-template-columns: 1fr; }
}

.search-result__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-soft);
}

.search-result__media img { width: 100%; height: 100%; object-fit: cover; }

/* The text column of a result, beside its thumbnail. */
.search-result__body {
  flex: 1;
  padding: 0.85rem 1rem;
}

/* The page-scale search field: the masthead component widened to the measure,
   so the results page does not inherit the masthead's 190px input. */
.search-form {
  display: flex;
  align-items: stretch;
  max-width: 640px;
  margin-bottom: var(--space-2xl);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.search-form:focus-within { border-color: var(--color-accent); }

.search-form input[type="search"] {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.85rem 1rem;
  outline: none;
}


.search-result__keycap {
  font-family: var(--font-mono);
  border: 1px solid var(--color-border);
  padding: 0.1rem 0.35rem;
}

.search-result__title {
  font-size: 1.15rem;
  line-height: 1.25;
  margin-bottom: 0.35rem;
}

.search-result__title a { color: var(--color-text); }
.search-result__title a:hover { color: var(--color-accent-text); }

.search-result__excerpt {
  color: var(--color-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  /* Full-width rows were rendering ~108 characters per line; at this size a
     ch unit carries roughly 1.35 characters, so cap it where lines land
     under ~80 characters. */
  max-width: 58ch;
}

/* ─── Page head (archive, profile, dashboard) ───────────────────────── */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xl);
}

.page-head__title {
  font-size: clamp(1.9rem, 3.2vw, 2.7rem);
  letter-spacing: -0.03em;
  line-height: 1;
}

.page-head__desc {
  color: var(--color-muted);
  max-width: 56ch;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.page-head__stats {
  display: flex;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.stat { display: flex; flex-direction: column; gap: 0.1rem; }

.stat__value {
  font-family: var(--font-desk);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.stat__label {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

/* ─── Sub-filter pills ─────────────────────────────────────────────── */

.sub-filter { margin-bottom: var(--space-xl); }

.sub-filter__label {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-bottom: var(--space-sm);
  display: block;
}

.sub-filter__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sub-filter__pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.sub-filter__pill:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-text);
}

.sub-filter__pill--active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
}

/* ─── Article body (CKEditor content) ─────────────────────────────── */

.article-body {
  max-width: 30em;
  font-size: 1.06rem;
  line-height: 1.72;
  color: var(--color-text);
}

.article-body > * {
  max-width: var(--measure);
}

.article-body p { margin-bottom: 1.15rem; }

.article-body > p:first-of-type::first-letter {
  float: left;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.4em;
  line-height: 0.82;
  padding: 0.06em 0.1em 0 0;
  color: var(--color-accent);
}

.article-body h2, .article-body h3 {
  margin: 2rem 0 0.75rem;
  max-width: var(--measure);
}

.article-body a {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  /* A pasted URL with no spaces would otherwise widen the page. */
  overflow-wrap: anywhere;
}

.article-body a:hover { color: var(--color-accent-text); }

.article-body blockquote {
  margin: 1.75rem 0;
  padding-left: var(--space-lg);
  border-left: 2px solid var(--color-accent);
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.45;
  color: var(--color-text);
  max-width: var(--measure);
}

.article-body img {
  margin: 1.5rem 0;
  max-width: 100%;
}

.article-body ul, .article-body ol {
  margin: 0 0 1.15rem 1.2rem;
  max-width: var(--measure);
}

.article-body li { margin-bottom: 0.4rem; }

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-soft);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}

.article-body pre {
  background: var(--color-lower);
  border: 1px solid var(--color-border);
  padding: var(--space-md);
  overflow-x: auto;
  margin-bottom: 1.15rem;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.15rem;
  font-size: 0.94rem;
}

.article-body th, .article-body td {
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 0.6rem;
  text-align: left;
}

/* ─── Story detail ─────────────────────────────────────────────────── */

.story-detail { max-width: 820px; margin: 0 auto; }

.story-detail__header { margin-bottom: var(--space-lg); }

.story-detail__flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: var(--space-md);
}

/* Reading measure: a 68ch column with a sticky action rail beside it. */
.story-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  gap: var(--space-xl);
  align-items: start;
  justify-content: center;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

@media (max-width: 820px) {
  .story-layout { grid-template-columns: 1fr; gap: var(--space-md); }
}

.story-rail {
  position: sticky;
  top: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
  order: 2;
}

.story-body {
  order: 1;
  min-width: 0;
  max-width: 100%;
  justify-self: center;
}

/* Provenance note under a story: the AI disclosure plus the source list.
   Source URLs are frequently long opaque feed links (Google News wraps them in
   base64), and an unbreakable 400-character string sets a min-content width of
   thousands of pixels. Without the break rules that string widens the grid and
   the whole page scrolls sideways. */
.story-provenance {
  margin-top: var(--space-xl);
  padding: var(--space-md);
  border-left: 2px solid var(--color-border);
  background: var(--color-lower);
  color: var(--color-muted);
  font-size: 0.88rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.story-provenance > p { margin: 0; }

.story-provenance > p.story-provenance__label {
  margin-top: var(--space-sm);
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.story-provenance ul {
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.story-provenance li { min-width: 0; }

.story-provenance a {
  color: var(--color-muted);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.story-provenance a:hover { color: var(--color-accent-text); }

.story-rail .share-bar {
  flex-direction: column;
  gap: 0.35rem;
}

.story-rail .btn {
  width: 100%;
  padding: 0.55rem 0;
  justify-content: center;
}

.story-rail .btn > span { display: none; }

@media (max-width: 820px) {
  .story-rail { position: static; flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
  .story-rail .share-bar { flex-direction: row; }
  .story-rail .btn { width: auto; padding: 0.5rem 0.7rem; }
  .story-rail .btn > span { display: inline; }
}

.story-detail__tags {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.story-detail__tags .tags { margin-bottom: 0; }

.story-detail__tags-label {
  color: var(--color-muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.story-detail__title {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: -0.032em;
  margin-bottom: var(--space-md);
}

.story-detail__excerpt {
  font-size: 1.12rem;
  line-height: 1.6;
  color: var(--color-muted);
  max-width: 58ch;
  margin-bottom: var(--space-lg);
}

.story-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.story-detail__meta > span,
.story-detail__meta > a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-muted);
}

.story-detail__media {
  margin: var(--space-lg) 0 var(--space-xl);
  background: var(--color-soft);
}

.story-detail__media img { width: 100%; }

/* Share bar */
.share-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.share-bar a,
.share-bar button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.share-bar a:hover,
.share-bar button:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-text);
}

/* Author block */
.author-block {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-top: var(--space-xl);
}

.author-block__avatar {
  width: 56px;
  height: 56px;
}

.author-block__text {
  flex: 1;
  min-width: 0;
}

.author-block__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
}

.author-block__bio { margin-top: 0.25rem; }


/* ─── Tags ─────────────────────────────────────────────────────────── */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: var(--space-md);
}

.tag {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  padding: 0.28rem 0.5rem;
}

.tag:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-text);
}

/* ─── Comments ─────────────────────────────────────────────────────── */

.comments {
  max-width: 820px;
  margin: var(--space-2xl) auto 0;
}

.comments__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
  margin-bottom: var(--space-lg);
}

.comments__form { margin-bottom: var(--space-xl); }

.comment-list { display: flex; flex-direction: column; }

.comment-list__item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
}

/* Rows without a portrait (the profile's own comments) take the full width
   instead of being squeezed into the empty 36px avatar track. */
.comment-list__item--plain { grid-template-columns: minmax(0, 1fr); }

.comment-list__text { margin: 0 0 0.45rem; }

.comment-list__body { min-width: 0; }

.comment-list__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-bottom: 0.3rem;
}

.comment-list__date { color: var(--color-muted); }

.comment-list__score {
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

.comment-list__article {
  font-size: 0.8rem;
  color: var(--color-muted);
}

.comment-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
}

.comment-card__body { margin-bottom: 0.3rem; }

/* A rejected post keeps its words on screen with the alert rule around them. */
.comment-card--error { border-color: rgba(240, 96, 128, 0.3); }


.comment__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-soft);
}

.comment__author {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--color-text);
}

.comment__meta {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.comment__text {
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--color-text);
  margin: 0.2rem 0 0.5rem;
}

.comment__author-info { display: flex; flex-direction: column; }

.comment__votes,
.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.vote-btn {
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  font-family: var(--font-desk);
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.16s var(--ease), color 0.16s var(--ease);
}

.vote-btn:hover { border-color: var(--color-accent); color: var(--color-accent-text); }
.vote-btn--up.is-active,
.vote-btn--up.vote-btn--active { border-color: var(--color-accent); color: var(--color-accent-text); }
.vote-btn--down.is-active,
.vote-btn--down.vote-btn--active { border-color: var(--color-alert); color: var(--color-alert); }
.vote-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.vote-score {
  font-family: var(--font-desk);
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  font-weight: 700;
  font-size: 0.82rem;
  min-width: 1.4rem;
  text-align: center;
}

.login-prompt {
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* ─── Similar articles ─────────────────────────────────────────────── */

.similar-articles { margin-top: var(--space-2xl); }

.similar-articles__loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* ─── Profile ──────────────────────────────────────────────────────── */

.profile-page { max-width: 980px; margin: 0 auto; }

/* Identity header. Same `.page-head` as the public byline, so the private file
   and the author page read as one system rather than two treatments. */
.profile-head { align-items: flex-start; }
.profile-head__main { flex: 1 1 auto; min-width: 0; }
.profile-head__identity { display: flex; align-items: flex-start; gap: var(--space-lg); min-width: 0; }
.profile-head__text { min-width: 0; }
.profile-head .profile-avatar { width: 96px; height: 96px; }
.profile-head__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.profile-head__desc { margin-top: var(--space-md); max-width: 58ch; overflow-wrap: break-word; }
.profile-head .page-head__title { overflow-wrap: break-word; }
.profile-head__handle {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  color: var(--color-muted);
}
.profile-head__actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-left: auto; }

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-soft);
  flex-shrink: 0;
}

.profile-avatar__img { width: 100%; height: 100%; object-fit: cover; }

.profile-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }

/* Record sheet: label above value in a two-up grid. The old fixed 140px label
   column forced the paired values into a 300px track, where a normal email
   address was already wider than the column. */
.profile-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-2xl);
  margin: 0;
}

.profile-info__row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--color-border);
  min-width: 0;
}

.profile-info__row--full { grid-column: 1 / -1; }

.profile-info__label {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.profile-info__value {
  color: var(--color-text);
  font-size: 0.98rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.profile-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
  margin: var(--space-xl) 0 var(--space-md);
}

.profile-section-header__title {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.9rem;
  color: var(--color-text);
}

/* Activity: what the reader has left on the site is the content of this page,
   so it takes the wide column; the reading list sits beside it. */
.profile-activity {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--space-2xl);
  align-items: start;
}

.profile-saved { list-style: none; margin: 0; padding: 0; }

.profile-saved__item {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--color-border);
}

.profile-saved__item:first-child { padding-top: 0; }

.profile-saved__title {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.profile-saved__title:hover { color: var(--color-accent-text); }

.profile-saved__meta {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.profile-empty {
  max-width: 44ch;
  padding: var(--space-xs) 0 var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.profile-empty__title {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  color: var(--color-text);
  margin-bottom: 0.3rem;
}

@media (max-width: 860px) {
  .profile-activity { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .profile-info { grid-template-columns: minmax(0, 1fr); }
  .profile-head .profile-avatar { width: 76px; height: 76px; }
  .profile-head__actions { margin-left: 0; }
}

.profile-edit-page { max-width: 720px; margin: 0 auto; }

.profile-form__divider {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--space-lg) 0;
}

.profile-form__actions { display: flex; gap: var(--space-sm); margin-top: var(--space-lg); }

.profile-avatar-upload { display: flex; align-items: center; gap: var(--space-md); flex-wrap: wrap; }

.profile-avatar-upload__preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-soft);
}

/* ─── Dashboard ────────────────────────────────────────────────────── */

.dashboard-page { max-width: 100%; }

.dashboard-table-wrap { overflow-x: auto; }

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.dashboard-table th {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.7rem;
  color: var(--color-muted);
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.dashboard-table td {
  padding: 0.7rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.dashboard-table tbody tr:hover { background: var(--color-soft); }

.dashboard-table__title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text);
}

.dashboard-table__muted { color: var(--color-muted); font-size: 0.84rem; }

/* The desk's rejection note under a row title: short measure, no leading gap. */
.dashboard-table__note {
  margin: 0.25rem 0 0;
  max-width: 32ch;
}


.dashboard-table__actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.dashboard-table__th-actions { text-align: right; }

/* ─── Forms ────────────────────────────────────────────────────────── */

.form-group { margin-bottom: var(--space-md); }

.form-label {
  display: block;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-bottom: 0.35rem;
}

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"], input[type="number"], select, textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--color-lower);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  outline: none;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--color-accent);
  background: var(--color-deep);
}

::placeholder { color: var(--color-muted); opacity: 1; }

textarea { resize: vertical; min-height: 120px; }

.form-help {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-top: 0.3rem;
}

.form-error {
  font-size: 0.8rem;
  color: var(--color-alert);
  margin-top: 0.3rem;
}

.form-error ul { margin: 0; padding-left: 1rem; }

/* Newsletter form */
.newsletter-form {
  display: flex;
  gap: 0;
  border: 1px solid var(--color-border);
  background: var(--color-lower);
}

.newsletter-form:focus-within { border-color: var(--color-accent); }

.newsletter-form input[type="email"] {
  border: 0;
  background: transparent;
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  /* Inputs inherit `width: 100%` from the base form rules, which in a flex row
     means "the whole track plus a button". Letting the field shrink keeps the
     fixed-width button inside the row at every width. */
  flex: 1 1 auto;
  min-width: 0;
}

.newsletter-form input[type="email"]:focus { background: transparent; }

.newsletter-form button {
  border: 0;
  border-radius: 0;
  background: var(--color-accent);
  color: var(--color-on-accent);
  flex-shrink: 0;
}

.newsletter-form button:hover { background: var(--color-accent-hover); color: var(--color-on-accent); }

.newsletter-form .form-error { padding: 0 0.75rem 0.5rem; }

/* ─── Auth pages (allauth) ─────────────────────────────────────────── */

.entrance {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 520px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  margin: var(--space-xl) 0 var(--space-3xl);
}

@media (max-width: 860px) {
  .entrance { grid-template-columns: 1fr; min-height: 0; }
}

.entrance__aside {
  background: var(--color-lower);
  border-right: 1px solid var(--color-border);
  padding: var(--space-2xl);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-xl);
}

@media (max-width: 860px) {
  .entrance__aside { border-right: 0; border-bottom: 1px solid var(--color-border); padding: var(--space-xl); }
}

.entrance__lockup { height: 96px; width: auto; }

.entrance__lockup--light { display: none; }
:root[data-theme="light"] .entrance__lockup--dark { display: none; }
:root[data-theme="light"] .entrance__lockup--light { display: block; }

.entrance__claim {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-text);
  max-width: 24ch;
}

.entrance__claim em {
  font-style: normal;
  color: var(--color-accent-text);
}

.entrance__fine {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.entrance__body { padding: var(--space-2xl); }

@media (max-width: 860px) {
  .entrance__body { padding: var(--space-xl); }
}

.entrance__body h1 { margin-bottom: var(--space-sm); }
.entrance__body > p { color: var(--color-muted); margin-bottom: var(--space-lg); }

.entrance__body form p { margin-bottom: var(--space-md); }

.entrance__body label {
  display: block;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.7rem;
  color: var(--color-muted);
  margin-bottom: 0.3rem;
}

.entrance__body .btn { width: 100%; }

/* "Stay logged in" row: checkbox and label on one line, in body voice rather
   than the desk-caps voice the field labels above use. */
.remember-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.remember-row label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-muted);
}

.checkbox {
  width: 1rem;
  height: 1rem;
}

/* Centred single-message page: reset link sent, logged out. */
.panel-narrow {
  max-width: 420px;
  margin: var(--space-2xl) auto;
  text-align: center;
}

.panel-narrow__actions {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}
.entrance__body a { text-decoration: underline; text-decoration-color: var(--color-accent); }

.auth-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: var(--space-lg);
  font-size: 0.88rem;
}

/* "No account yet?" sits below the button, quieter than the form itself. */
.auth-links__muted { color: var(--color-muted); }


/* Social sign-in. A hairline rule with the word "or" set in desk caps, then a
   ghost button so it never competes with the primary password form above it. */
.auth-alt { margin-top: var(--space-lg); }

.auth-alt__divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: 0 0 var(--space-md);
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.auth-alt__divider::before,
.auth-alt__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-rule);
}

/* The entrance card underlines every anchor; a button is not a link. */
.auth-alt .btn { text-decoration: none; }

/* ─── Error and confirmation pages ─────────────────────────────────── */

.error-page {
  max-width: 640px;
  margin: var(--space-3xl) auto;
  padding: var(--space-2xl) 0;
  border-top: 2px solid var(--color-accent);
}

.error-page--wide { max-width: 560px; }
.error-page__title--display { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }


.error-page__code {
  font-family: var(--font-desk);
  font-weight: 700;
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 0.85;
  letter-spacing: -0.03em;
  color: var(--color-accent);
  margin: 0 0 var(--space-md);
  font-variant-numeric: tabular-nums;
}

.error-page__title {
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-md);
}

.error-page__text {
  color: var(--color-muted);
  font-size: 1rem;
  line-height: 1.65;
  max-width: 52ch;
  margin-bottom: var(--space-xl);
}

.error-page__actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; }

/* ─── Morning briefing: the newsletter signup page ─────────────────── */

.briefing {
  max-width: 780px;
  margin: var(--space-xl) auto var(--space-3xl);
  padding-top: var(--space-lg);
  border-top: 2px solid var(--color-accent);
}

.briefing__title {
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
}

.briefing__desc {
  color: var(--color-muted);
  font-size: 1.04rem;
  line-height: 1.6;
  max-width: 46ch;
  margin-bottom: var(--space-xl);
}

.briefing__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: var(--space-2xl);
  align-items: start;
}

/* The form is the page's one loud element; the facts sit beside it as a
   hairline ledger rather than a second card. */
.briefing__label {
  display: block;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  color: var(--color-muted);
  margin-bottom: 0.4rem;
}

.briefing__field {
  display: flex;
  border: 1px solid var(--color-border);
  background: var(--color-lower);
}

.briefing__field:focus-within { border-color: var(--color-accent); }

.briefing__field input[type="email"] {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
}

.briefing__field button {
  border: 0;
  border-radius: 0;
  flex-shrink: 0;
  padding-inline: var(--space-lg);
}

.briefing__facts {
  margin: 0;
  border-top: 1px solid var(--color-border);
}

.briefing__facts > div {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-border);
}

.briefing__facts dt {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: var(--color-accent-text);
  margin-bottom: 0.15rem;
}

.briefing__facts dd {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--color-muted);
}

@media (max-width: 620px) {
  .briefing__grid { grid-template-columns: 1fr; gap: var(--space-lg); }
  .briefing__field { flex-direction: column; }
  .briefing__field input[type="email"] { padding: 0.75rem 0.85rem; }
  .briefing__field button { padding-block: 0.7rem; }
}

/* ─── Prose pages (about, privacy, terms) ──────────────────────────── */

.prose-page { max-width: 640px; margin: 0 auto; }

.prose { font-size: 1.04rem; line-height: 1.72; }

.prose__lead {
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.45;
  letter-spacing: -0.015em;
  color: var(--color-text);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.prose h2 {
  font-size: 1.15rem;
  margin: var(--space-xl) 0 var(--space-sm);
  letter-spacing: -0.015em;
}

.prose p { color: var(--color-muted); margin-bottom: var(--space-md); }
.prose p a { color: var(--color-text); text-decoration: underline; text-decoration-color: var(--color-accent); }
.prose p a:hover { color: var(--color-accent-text); }

/* ─── Editor (journalist filing) ───────────────────────────────────── */

.editor-page { max-width: 880px; margin: 0 auto; }

.editor-actions__trail { margin-left: auto; }

.editor-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

/* ─── Footer ───────────────────────────────────────────────────────── */

.site-footer {
  background: var(--color-lower);
  border-top: 1px solid var(--color-border);
  padding: var(--space-3xl) 0 var(--space-xl);
  margin-top: var(--space-3xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr 0.8fr;
  gap: var(--space-2xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--color-border);
}

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-xl); }
}

@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-lockup { height: 104px; width: auto; margin-bottom: var(--space-md); }
.footer-lockup--light { display: none; }
:root[data-theme="light"] .footer-lockup--dark { display: none; }
:root[data-theme="light"] .footer-lockup--light { display: block; }

.footer-text {
  color: var(--color-muted);
  font-size: 0.88rem;
  line-height: 1.65;
  max-width: 42ch;
}

.footer-heading {
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.72rem;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.footer-links a {
  font-size: 0.88rem;
  color: var(--color-muted);
}

.footer-links a:hover { color: var(--color-accent-text); }

.footer-bottom__note {
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--color-text);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding-top: var(--space-lg);
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

/* ─── Inline admin edit ────────────────────────────────────────────── */

.story-edit-fab {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-accent);
  color: var(--color-on-accent);
  border: 0;
  padding: 0.7rem 1rem;
  font-family: var(--font-desk);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  cursor: pointer;
  box-shadow: var(--shadow-lift);
}

.story-edit-fab:hover { background: var(--color-accent-hover); color: var(--color-on-accent); }

.inline-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-xl);
  overflow-y: auto;
  z-index: 150;
}

.inline-edit-overlay.is-open { display: flex; }

.inline-edit-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  width: 100%;
  max-width: 760px;
  box-shadow: var(--shadow-lift);
}

.inline-edit-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.inline-edit-modal__header h2 { font-size: 1.05rem; }

.inline-edit-modal__close {
  background: transparent;
  border: 0;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 1.1rem;
}

.inline-edit-modal__close:hover { color: var(--color-accent-text); }

.inline-edit-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.inline-edit__flags { display: flex; flex-wrap: wrap; gap: var(--space-md); }
.inline-edit__image-preview { margin-top: var(--space-sm); max-width: 220px; }
.inline-edit__errors { color: var(--color-alert); font-size: 0.85rem; }
.inline-edit__clear { font-size: 0.8rem; }

.inline-edit__flag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-desk);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--color-muted);
}

/* ─── CKEditor: bring the stock moono skin onto the site's ground ────
   The bundled skin is built for a white page: a white writing area and
   dark grey toolbar glyphs. Both read as broken against the dark system,
   so the chrome is re-tokenised here and the sprite is inverted to light
   ink. These rules are theme-agnostic — every colour is a token, so the
   light theme gets a white editor back automatically.

   `!important` is load-bearing here and nowhere else in this file: the moono
   skin loads after site.css and paints with selectors of equal or higher
   specificity (`.cke_inner`, `.cke_button`), so nothing here would win
   without it. Every declaration below earns its flag the same way. */

.cke_chrome {
  border: 1px solid var(--color-border) !important;
  background: var(--color-surface) !important;
}

/* moono paints the slab white on .cke_inner, not .cke_chrome. */
.cke_inner {
  background: var(--color-surface) !important;
  border-color: var(--color-border) !important;
}

.cke_top,
.cke_bottom {
  background: var(--color-surface) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text) !important;
}

.cke_bottom { border-top: 1px solid var(--color-border) !important; }

/* moono ships one dark sprite set; invert it rather than shipping a skin.
   The light theme keeps the sprite as drawn. */
.cke_button_icon { filter: invert(0.88) grayscale(1); }
:root[data-theme="light"] .cke_button_icon { filter: none; }

.cke_toolgroup a.cke_button:hover,
.cke_toolgroup a.cke_button:focus,
.cke_toolgroup a.cke_button.cke_button_on {
  background: var(--color-soft) !important;
  border-radius: 2px;
}

.cke_toolgroup a.cke_button.cke_button_disabled .cke_button_icon { opacity: 0.3; }

.cke_combo_text,
.cke_combo_arrow,
.cke_button_label { color: var(--color-text) !important; }

.cke_combo_arrow {
  border-top-color: var(--color-text) !important;
  border-bottom-color: var(--color-text) !important;
}

.cke_path a,
.cke_path_item { color: var(--color-muted) !important; }

.cke_toolbar_separator { background-color: var(--color-border) !important; }
.cke_combo__label { color: var(--color-text) !important; }

.cke_resizer { border-color: transparent var(--color-border) transparent transparent; }

/* The writing area is a same-origin iframe, so site CSS cannot reach the text
   itself — `static/js/editor-theme.js` mirrors the tokens into that document.
   These rules only paint the frame behind it, closing the white flash before
   the mirror runs. */
.cke_contents { background: var(--color-deep) !important; }
.cke_wysiwyg_frame { background: var(--color-deep) !important; }

/* CKEditor's own dialogs float above the overlay and need the same ground. */
.cke_dialog {
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
}
.cke_dialog_body,
.cke_dialog_contents,
.cke_dialog_tabs {
  background: var(--color-surface) !important;
  color: var(--color-text);
}
.cke_dialog_title { background: var(--color-soft) !important; color: var(--color-text) !important; }
.cke_dialog label,
.cke_dialog .cke_dialog_ui_labeled_label { color: var(--color-text) !important; }
.cke_dialog input[type="text"],
.cke_dialog textarea,
.cke_dialog select {
  background: var(--color-deep) !important;
  color: var(--color-text) !important;
  border: 1px solid var(--color-border) !important;
}

/* ─── Motion: one authored moment ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .section-heading::before { transform: scaleX(1); }
  .reveal-line > span { animation: none; }
}

/* ─── Responsive: masthead ─────────────────────────────────────────── */

@media (max-width: 1080px) {
  .masthead__meta { display: none; }
  .masthead__lockup { height: 68px; }
  .masthead__search input[type="search"] { width: 140px; }
}

@media (max-width: 820px) {
  .masthead__main {
    flex-wrap: wrap;
    gap: var(--space-md);
    padding: var(--space-md) 0;
  }
  /* The lockup sits alone on its own row once the tools wrap below it, so
     auto margins centre it. Scoped to the brand rather than justify-content
     on the parent, which would also re-align the tool row. */
  .masthead__brand { margin-inline: auto; }
  .masthead__tools { margin-left: 0; width: 100%; }
  .masthead__search { flex: 1; }
  .masthead__search input[type="search"] { width: 100%; }
  .theme-toggle__label { display: none; }
  .rail__inner { flex-wrap: wrap; gap: var(--space-md); padding: 0.35rem 0; }
  .rail__links {
    gap: var(--space-lg);
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .rail__links::-webkit-scrollbar { display: none; }
  .rail__actions { display: none; }
}

@media (max-width: 560px) {
  .container { padding: 0 var(--space-md); }
  .masthead__lockup { height: 64px; margin-top: 15px; }
  /* The tool row owns the full width here and carries the gap to the content
     below, since the search's own box is gone. */
  .masthead__tools {
    margin-left: 0;
    width: 100%;
    margin-bottom: 15px;
  }
  /* `display: contents` drops the form's own box, so the field and its button
     become items of the tools row. The frame and the button's full height lived
     on that box, so each part carries its own from here: otherwise the button is
     a 15px icon stub with a floating rule, and the field has no visible edge. */
  .masthead__search { display: contents; }
  .masthead__search input[type="search"] {
    /* Grow into whatever the row has left, and stretch to the row's height so the
       field and its button stay one 44px control. */
    flex: 1 1 0;
    min-width: 0;
    align-self: stretch;
    min-height: 44px;
    /* 16px: iOS zooms the page when a focused field is smaller than this. */
    font-size: 1rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
  }
  .masthead__search input[type="search"]:focus { border-color: var(--color-accent); }
  .masthead__search button {
    /* Stretch rather than centre: centring shrinks the button to the icon. The
       negative margin cancels the tools row's gap, which would otherwise split a
       field and its submit button into two objects. */
    align-self: stretch;
    min-height: 44px;
    margin-left: calc(-1 * var(--space-sm));
    border: 1px solid var(--color-border);
    border-left: 0;
    background: var(--color-surface);
  }
  .lead__title { font-size: 1.75rem; }
  .feed-item { grid-template-columns: 96px 1fr; }
  .board__item { grid-template-columns: 64px 1fr; }
  .site-footer { padding-top: var(--space-2xl); }
  .footer-lockup { height: 76px; }
}

/* ─── Mobile touch targets ─────────────────────────────────────────── */

@media (max-width: 820px) {
  .btn,
  .pagination__link,
  .sub-filter__pill,
  .share-bar a,
  .share-bar button,
  .vote-btn { min-height: 40px; }
  .rail__link { padding: 0.9rem 0; }
  /* Same 40px touch square as the buttons above. The label is hidden at this
     width, so without the extra padding the toggle is a 36x30px target next to
     the 44px search field. */
  .theme-toggle { padding: 0.8rem 0.8rem; }
}
