@layer base {
/* ═══════════════════════════════════════════════════════════════════
   RESET + ELEMENT DEFAULTS
   ═══════════════════════════════════════════════════════════════════ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-6));
  /* Avoid layout shift when a page grows past one viewport. */
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: var(--lh-read);
  color: var(--fg);
  background: var(--bg);
  /* --chrome-h, NOT --chrome-total. WordPress's own admin-bar.min.css
     already applies `html { margin-top: 32px/46px !important }`, so
     adding --admin-h here counted the bar twice and left a 46px band
     of dead white under the header on every page while logged in. */
  padding-top: var(--chrome-h);
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
}
/* --chrome-total already folds in the mobile header height and the
   admin bar, so there are no per-breakpoint overrides to keep in sync. */

img, picture, video, canvas, svg, iframe {
  display: block;
  max-width: 100%;
}
img, video { height: auto; }
img { background-color: var(--bg-sunken); }

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; font-weight: 700; }
p, li { text-wrap: pretty; }

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

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

::selection { background: var(--tdn-red); color: #fff; }

/* ── Focus ───────────────────────────────────────────────────────────
   One ring, everywhere, keyboard-only. Components never remove it;
   they may only reposition it via outline-offset.                    */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }

/* ── Motion preferences ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Screen-reader utilities (base, not utilities — always available) */
.sr-only, .screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.sr-only:focus-within, .screen-reader-text:focus {
  position: fixed;
  width: auto; height: auto;
  clip-path: none;
  margin: 0;
}

.tdn-skip-link {
  position: fixed;
  top: 0; left: var(--s-2);
  z-index: 10000;
  translate: 0 -110%;
  background: var(--tdn-red);
  color: #fff;
  font-weight: 700;
  font-size: var(--step--1);
  padding: var(--s-3) var(--s-5);
  border-radius: 0 0 var(--radius) var(--radius);
  transition: translate var(--t-base) var(--ease-out);
}
.tdn-skip-link:focus { translate: 0 0; color: #fff; }

/* ── Typography defaults inside prose ──────────────────────────────── */
.tdn-prose {
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  line-height: var(--lh-read);
  color: var(--fg-soft);
}
.tdn-prose > * + * { margin-block-start: 1.35em; }
.tdn-prose h2 {
  font-family: var(--font-display);
  font-size: var(--step-3);
  line-height: var(--lh-snug);
  color: var(--fg);
  margin-block-start: 1.9em;
  font-weight: 400;
}
.tdn-prose h3 {
  font-family: var(--font-ui);
  font-size: var(--step-1);
  line-height: var(--lh-snug);
  color: var(--fg);
  margin-block-start: 1.7em;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.tdn-prose h4 { font-size: var(--step-0); color: var(--fg); margin-block-start: 1.5em; }
.tdn-prose a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.16em;
  transition: text-decoration-color var(--t-fast) var(--ease);
}
.tdn-prose a:hover { color: var(--accent); text-decoration-color: currentColor; }
.tdn-prose ul, .tdn-prose ol { padding-inline-start: 1.4em; }
.tdn-prose ul { list-style: disc; }
.tdn-prose ol { list-style: decimal; }
.tdn-prose li + li { margin-block-start: 0.5em; }
.tdn-prose li::marker { color: var(--fg-faint); }
.tdn-prose blockquote {
  border-inline-start: 3px solid var(--cat, var(--accent));
  padding-inline-start: var(--s-6);
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: var(--lh-snug);
  color: var(--fg);
}
.tdn-prose figure { margin-block: var(--s-8); }
.tdn-prose figcaption {
  font-size: var(--step--1);
  color: var(--fg-muted);
  line-height: var(--lh-snug);
  padding-block-start: var(--s-3);
  border-block-start: 1px solid var(--rule);
  margin-block-start: var(--s-3);
}
.tdn-prose img { border-radius: var(--radius); }
.tdn-prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-sunken);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-xs);
}
.tdn-prose pre {
  background: var(--bg-sunken);
  padding: var(--s-5);
  border-radius: var(--radius);
  overflow-x: auto;
}
.tdn-prose table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.tdn-prose th, .tdn-prose td { border: 1px solid var(--rule); padding: var(--s-3); text-align: start; }
.tdn-prose th { background: var(--bg-sunken); font-weight: 700; }

/* Drop cap on the opening paragraph of a feature. */
.tdn-prose--dropcap > p:first-of-type::first-letter {
  font-family: var(--font-display);
  float: inline-start;
  font-size: 3.6em;
  line-height: 0.82;
  padding-inline-end: 0.08em;
  padding-block-start: 0.06em;
  color: var(--cat, var(--accent));
}

/* Embeds keep their aspect ratio without the legacy padding hack. */
.wp-block-embed__wrapper iframe,
.tdn-prose iframe[src*="youtube"],
.tdn-prose iframe[src*="vimeo"] {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: var(--radius);
}
}
