/*
 * Kreatin.bg — site.css
 * Single stylesheet for the public site. Structure:
 *   0. Fonts    1. Tokens   2. Base   3. Layout   4. Header & navigation   5. Shared components
 *   6. Home     7. Category hub        8. Article              9. Search & errors
 *   10. Footer  11. Utilities          12. Print
 * Documented in DESIGN-SYSTEM.md. Change tokens, not hard-coded values.
 */

/* 0. Fonts ----------------------------------------------------------------- */
/* Self-hosted variable WOFF2, Cyrillic + Latin subsets only (SIL OFL, see assets/fonts/OFL-*.txt).
 * Bulgarian letterforms come from OpenType `locl` and need lang="bg" on the page. */

@font-face {
  font-family: "Sofia Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/sofia-sans-normal-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Sofia Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/sofia-sans-normal-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Sofia Sans";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/sofia-sans-italic-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Sofia Sans";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/sofia-sans-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --paper: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f5f2;
  --ink: #111412;
  --ink-2: #5b625e;
  --rule: #e7eae6;
  --rule-strong: #cdd3ce;
  --field-border: #848b86;
  --accent: #0a7a50;
  --accent-hover: #065c3b;
  --accent-soft: #e6f4ec;
  --volt: #d8f45e;
  --caution: #a2400f;
  --caution-soft: #fdf0e6;
  --mark: #eafaa8;

  /* One family for everything: headings are heavy Sofia Sans, not a separate serif. */
  --font-sans: "Sofia Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: var(--font-sans);

  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-base: 1.0625rem;
  --fs-lede: 1.1875rem;
  --fs-h4: 1.1875rem;
  --fs-h3: clamp(1.3125rem, 1.15rem + 0.6vw, 1.5rem);
  --fs-h2: clamp(1.625rem, 1.3rem + 1.3vw, 2.25rem);
  --fs-h1: clamp(2.125rem, 1.5rem + 2.6vw, 3.25rem);
  --fs-display: clamp(2.5rem, 1.5rem + 4.2vw, 4.5rem);

  --lh-body: 1.65;
  --lh-tight: 1.05;
  --lh-heading: 1.2;

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

  --measure: 42rem;
  --container: 76rem;
  --gutter: 1rem;
  --radius: 10px;
  --radius-lg: 18px;
  --header-h: 4rem;
}

@media (min-width: 37.5em) {
  :root {
    --fs-base: 1.125rem;
    --fs-lede: 1.25rem;
    --gutter: 1.5rem;
  }
}

@media (min-width: 56.25em) {
  :root {
    --gutter: 2rem;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1110;
    --surface: #161917;
    --surface-2: #1b1f1c;
    --ink: #eef1ee;
    --ink-2: #a6aea9;
    --rule: #262b28;
    --rule-strong: #3b423e;
    --field-border: #66706a;
    --accent: #5fd39c;
    --accent-hover: #8ee6bb;
    --accent-soft: #15291f;
    --volt: #c9e84f;
    --caution: #f0a77c;
    --caution-soft: #2e221c;
    --mark: #3d4a12;
  }
}

/* 2. Base ------------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--s-5);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 800;
  line-height: var(--lh-heading);
  text-wrap: balance;
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
}

h4 {
  font-size: var(--fs-h4);
}

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

p {
  text-wrap: pretty;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

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

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

mark {
  background: var(--mark);
  color: inherit;
  padding: 0 0.1em;
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

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

input,
button {
  font: inherit;
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 3. Layout ---------------------------------------------------------------- */

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

.section {
  padding-block: var(--s-7);
}

@media (min-width: 56.25em) {
  .section {
    padding-block: var(--s-8);
  }
}

.section--tint {
  background: var(--surface-2);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2) var(--s-5);
  margin-bottom: var(--s-6);
}

.section-head p {
  color: var(--ink-2);
  max-width: 36rem;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -10rem;
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  background: var(--ink);
  color: var(--paper);
}

.skip-link:focus {
  top: var(--s-2);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 4. Header & navigation -------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: baseline;
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}

.logo:hover {
  color: var(--ink);
}

.logo__tld {
  color: var(--accent);
  font-weight: 800;
}

.site-nav {
  display: none;
  margin-left: auto;
}

.site-nav ul {
  display: flex;
  gap: var(--s-1);
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: var(--s-2) var(--s-4);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
}

.site-nav a:hover {
  background: var(--surface-2);
}

.site-nav a[aria-current] {
  background: var(--surface-2);
}

.site-header .header-search {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  margin-left: auto;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 2.75rem;
  min-width: 2.75rem;
  justify-content: center;
  padding: 0 var(--s-3);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-button svg {
  width: 1.25rem;
  height: 1.25rem;
}

.no-js .menu-button,
.js .menu-link {
  display: none;
}

@media (min-width: 56.25em) {
  .site-nav {
    display: block;
  }

  .header-actions {
    display: none;
  }

  .site-header .header-search {
    display: flex;
    width: auto;
    flex-shrink: 0;
  }
}

/* Mobile menu panel (enhanced by site.js) */

.menu-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  background: var(--paper);
}

.menu-panel[hidden] {
  display: none;
}

.menu-panel__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  border-bottom: 1px solid var(--rule);
}

.menu-panel__body {
  display: grid;
  gap: var(--s-6);
  padding-block: var(--s-5) var(--s-7);
}

.menu-panel h2 {
  margin-bottom: var(--s-2);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
}

.menu-panel ul {
  padding: 0;
  list-style: none;
}

.menu-panel li + li {
  border-top: 1px solid var(--rule);
}

.menu-panel a {
  display: block;
  padding: var(--s-3) 0;
  color: var(--ink);
  text-decoration: none;
}

.menu-panel .menu-panel__topics a {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 600;
}

html.menu-open {
  overflow: hidden;
}

/* 5. Shared components ---------------------------------------------------- */

/* Draft preview notice (signed preview links only) */
.preview-banner {
  margin: 0;
  padding: var(--s-2) var(--s-4);
  border-bottom: 1px solid var(--caution);
  background: var(--caution-soft);
  color: var(--caution);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-align: center;
}

/* Eyebrow / category label */
.eyebrow {
  display: inline-block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-2);
}

a.eyebrow {
  color: var(--accent);
  text-decoration: none;
}

a.eyebrow:hover {
  text-decoration: underline;
}

/* Breadcrumbs */
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-2);
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.breadcrumbs li:not(:last-child)::after {
  content: "›";
  margin-left: var(--s-2);
  color: var(--rule-strong);
}

.breadcrumbs a {
  color: var(--ink-2);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 2.75rem;
  padding: var(--s-2) var(--s-5);
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .btn:hover {
    color: #0f1110;
  }
}

.btn--quiet {
  background: transparent;
  color: var(--accent);
}

.btn--quiet:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

/* Arrow link */
.more {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-weight: 600;
  text-decoration: none;
}

.more::after {
  content: "→";
  transition: transform 0.15s ease;
}

.more:hover::after {
  transform: translateX(3px);
}

/* Search form */
.search-form {
  display: flex;
  width: 100%;
}

.search-form input {
  flex: 1;
  min-width: 0;
  min-height: 2.75rem;
  padding: var(--s-2) var(--s-5);
  border: 1px solid var(--field-border);
  border-right: 0;
  border-radius: 999px 0 0 999px;
  background: var(--surface);
}

.search-form input::placeholder {
  color: var(--ink-2);
  opacity: 1;
}

.search-form input:focus-visible {
  outline-offset: -2px;
}

.search-form button {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0 var(--s-5) 0 var(--s-4);
  border: 1px solid var(--ink);
  border-radius: 0 999px 999px 0;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  cursor: pointer;
}

.search-form button:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.search-form button svg {
  width: 1.125rem;
  height: 1.125rem;
}

.search-form--compact input {
  width: 12rem;
  min-height: 2.5rem;
  font-size: var(--fs-sm);
}

.search-form--compact button {
  padding: 0 var(--s-3);
}

.search-form--large input {
  min-height: 3.25rem;
  font-size: var(--fs-lede);
}

/* Evidence meter: four segments, filled according to grade A–D */
.meter {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  white-space: nowrap;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.meter__bars {
  display: inline-grid;
  grid-template-columns: repeat(4, 0.4375rem);
  gap: 2px;
}

.meter__bars i {
  height: 0.875rem;
  background: var(--rule-strong);
}

.meter[data-grade="A"] .meter__bars i,
.meter[data-grade="B"] .meter__bars i:nth-child(-n + 3),
.meter[data-grade="C"] .meter__bars i:nth-child(-n + 2),
.meter[data-grade="D"] .meter__bars i:nth-child(1) {
  background: var(--accent);
}

.meter__label {
  font-weight: 500;
  color: var(--ink-2);
}

/* Evidence table ("Какво знаем") */
.evidence {
  border-top: 1px solid var(--rule);
}

.evidence__caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-2);
  padding-block: var(--s-3);
  border-bottom: 1px solid var(--rule);
}

.evidence__caption h2,
.evidence__caption h3 {
  font-size: var(--fs-h4);
}

.evidence__caption a {
  font-size: var(--fs-sm);
}

.evidence__list {
  padding: 0;
  list-style: none;
}

.evidence__item {
  display: grid;
  gap: var(--s-1) var(--s-5);
  padding-block: var(--s-3);
  border-bottom: 1px solid var(--rule);
}

.evidence__claim {
  font-size: var(--fs-sm);
}

@media (min-width: 37.5em) {
  .evidence__item {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
}

/* Callouts */
.note {
  padding: var(--s-4) var(--s-5);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}

.note > * + * {
  margin-top: var(--s-2);
}

.note__title {
  font-weight: 700;
  font-size: var(--fs-sm);
}

.note--caution {
  background: var(--caution-soft);
}

.note--caution .note__title {
  color: var(--caution);
}

.note--example {
  background: var(--accent-soft);
}

/* Answer box */
.answer {
  padding: var(--s-5) var(--s-6);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
}

.answer__title {
  margin-bottom: var(--s-2);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--accent);
}

.answer p {
  font-size: var(--fs-lede);
  line-height: 1.55;
}

.answer ul {
  padding-left: 1.2em;
}

.answer li + li {
  margin-top: var(--s-2);
}

/* Figures (content images, see Content\ImageMarkup) */
.figure {
  margin: 0;
}

.figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.figure figcaption {
  margin-top: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* Calculators (templates/tools) */
.tool {
  padding: var(--s-5);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

@media (min-width: 37.5em) {
  .tool {
    padding: var(--s-6);
  }
}

.tool__title {
  margin-bottom: var(--s-4);
  font-size: var(--fs-h4);
}

.tool-form {
  display: grid;
  gap: var(--s-5);
}

.field {
  display: grid;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field__label {
  padding: 0;
  font-weight: 700;
}

.field__input {
  width: 100%;
  max-width: 14rem;
  min-height: 2.75rem;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--paper);
  font-size: var(--fs-base);
}

.field__input--short {
  max-width: 6rem;
}

.field__input[aria-invalid="true"] {
  border-color: var(--caution);
  border-width: 2px;
}

.field__error {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--caution);
}

.choices {
  display: grid;
  gap: var(--s-2);
}

.choice {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice input {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.2em;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.choice__meta {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.choice__hint {
  display: block;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.tool-form .btn {
  justify-self: start;
}

.result {
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}

.result > * + * {
  margin-top: var(--s-2);
}

.result__label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
}

.result__label:not(:first-child) {
  margin-top: var(--s-5);
}

.result__value {
  font-family: var(--font-serif);
  font-size: var(--fs-h1);
  font-weight: 600;
  line-height: var(--lh-tight);
}

.result__value span {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink-2);
}

.result__value--secondary {
  font-size: var(--fs-h2);
}

.plan {
  display: grid;
  gap: var(--s-4);
  padding: 0;
  list-style: none;
}

.plan__phase {
  padding-left: var(--s-4);
  border-left: 3px solid var(--accent);
}

.plan__phase > * + * {
  margin-top: var(--s-1);
}

.result__note {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* Price comparison (tools/creatine-cost) */
.products {
  display: grid;
  gap: var(--s-4);
}

@media (min-width: 40em) {
  .products {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  }
}

.product {
  display: grid;
  gap: var(--s-3);
  align-content: start;
  margin: 0;
  padding: var(--s-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

.product__title {
  padding: 0 var(--s-1);
  font-weight: 700;
}

.product__title span,
.muted {
  font-weight: 400;
  color: var(--ink-2);
}

.field__hint {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.field__input--medium {
  max-width: 10rem;
}

.badge {
  display: inline-block;
  padding: 0 var(--s-2);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.is-best th,
.is-best td {
  background: var(--accent-soft);
}

.result td {
  white-space: nowrap;
}

/* Self-check (tools/creatine-fit) */
.quiz__step {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
}

.verdict {
  padding: var(--s-4);
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
}

.verdict--caution {
  border-color: var(--caution);
  background: var(--caution-soft);
}

.verdict--neutral {
  border-color: var(--rule-strong);
  background: var(--surface-2);
}

.verdict__title {
  font-family: var(--font-serif);
  font-size: var(--fs-h4);
  font-weight: 600;
}

.verdict > * + * {
  margin-top: var(--s-2);
}

.checklist {
  display: grid;
  gap: var(--s-2);
  padding-left: var(--s-5);
}

/* Responsive table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left / 2.5rem 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right / 2.5rem 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgb(0 0 0 / 0.14), transparent) left / 0.75rem 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgb(0 0 0 / 0.14), transparent) right / 0.75rem 100% no-repeat scroll,
    var(--surface);
}

.table-wrap table {
  width: 100%;
  min-width: 32rem;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.table-wrap caption {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  font-weight: 700;
  border-bottom: 1px solid var(--rule);
}

.table-wrap th,
.table-wrap td {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.table-wrap thead th {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface-2);
}

.table-wrap tbody tr:last-child > * {
  border-bottom: 0;
}

.table-note {
  margin-top: var(--s-2);
  font-size: var(--fs-xs);
  color: var(--ink-2);
}

/* Story list (compact list of articles) */
.story-list {
  padding: 0;
  list-style: none;
}

.story-list > li {
  padding-block: var(--s-4);
  border-bottom: 1px solid var(--rule);
}

.story-list > li:first-child {
  padding-top: 0;
}

.story {
  display: grid;
  gap: var(--s-1);
}

.story__title {
  font-size: var(--fs-h4);
  line-height: 1.3;
}

.story__title a {
  color: var(--ink);
  text-decoration: none;
}

.story__title a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.story__summary {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.story__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-3);
  font-size: var(--fs-xs);
  color: var(--ink-2);
}

.story__body {
  display: grid;
  gap: var(--s-1);
  align-content: start;
}

.story--media {
  grid-template-columns: 6rem 1fr;
  gap: var(--s-3);
  align-items: start;
}

@media (min-width: 40em) {
  .story--media {
    grid-template-columns: 9rem 1fr;
    gap: var(--s-4);
  }
}

.story__media img,
.lead__media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.lead__media {
  margin: calc(var(--s-5) * -1) calc(var(--s-5) * -1) var(--s-2);
}

.lead__media img {
  border-radius: 0;
}

/* Article meta line */
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) 0;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.meta > span + span::before {
  content: "·";
  margin-inline: var(--s-2);
}

.meta a {
  color: var(--ink);
  font-weight: 600;
}

/* Placeholder for data the owner has not provided yet */
.placeholder {
  padding: 0 0.2em;
  border: 1px dashed var(--rule-strong);
  border-radius: 2px;
  color: var(--ink-2);
  font-style: normal;
}

/* 6. Home ----------------------------------------------------------------- */

/* Headline, search and a large photo */
.intro {
  padding-block: var(--s-6) var(--s-7);
}

.intro__grid {
  display: grid;
  gap: var(--s-6);
  align-items: center;
}

@media (min-width: 56.25em) {
  .intro {
    padding-block: var(--s-8);
  }

  .intro__grid--media {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: var(--s-8);
  }
}

.intro__text > * + * {
  margin-top: var(--s-5);
}

.intro__title {
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: -0.035em;
}

.intro__lede {
  max-width: 34rem;
  font-size: var(--fs-lede);
  color: var(--ink-2);
}

.intro__search {
  max-width: 34rem;
}

.intro__media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

/* Small pill links (popular searches) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding: 0;
  list-style: none;
}

.chips a {
  display: inline-block;
  padding: var(--s-1) var(--s-3);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
}

.chips a:hover {
  border-color: var(--ink);
  background: var(--volt);
  color: #111412;
}

/* Photo cards */
.cards {
  display: grid;
  gap: var(--s-6) var(--s-5);
}

@media (min-width: 37.5em) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 56.25em) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  position: relative;
  display: grid;
  gap: var(--s-2);
  align-content: start;
}

.card__media {
  margin-bottom: var(--s-2);
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.card__media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--surface-2);
  transition: transform 0.4s ease;
}

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

.card__title {
  font-size: var(--fs-h4);
  line-height: 1.25;
}

.card__title a {
  color: var(--ink);
  text-decoration: none;
}

/* The whole card is clickable through the title link. */
.card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card:hover .card__title a {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.card__summary {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* Tool links */
.tool-cards {
  display: grid;
  gap: var(--s-3);
  padding: 0;
  list-style: none;
}

@media (min-width: 37.5em) {
  .tool-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 56.25em) {
  .tool-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tool-card {
  display: grid;
  gap: var(--s-1);
  height: 100%;
  padding: var(--s-5);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tool-card:hover {
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgb(17 20 18 / 0.08);
}

.tool-card__title {
  font-size: var(--fs-h4);
  font-weight: 800;
  letter-spacing: -0.015em;
}

.tool-card__title::after {
  content: " →";
  color: var(--accent);
}

.tool-card__summary {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* Questions */
.narrow {
  max-width: calc(48rem + 2 * var(--gutter));
}

.narrow > h2 {
  margin-bottom: var(--s-5);
}

.questions {
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.questions li {
  border-bottom: 1px solid var(--rule);
}

.questions a {
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  padding-block: var(--s-4);
  color: var(--ink);
  font-size: var(--fs-h4);
  font-weight: 700;
  text-decoration: none;
}

.questions a::after {
  content: "→";
  color: var(--accent);
}

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

/* How we write */
.trust > * + * {
  margin-top: var(--s-4);
}

.trust p {
  color: var(--ink-2);
}

.trust__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  font-weight: 600;
}

/* Creatine band (category hub) */
.band {
  background: var(--surface-2);
}

.band + .section {
  border-top: 0;
}

.band__grid {
  display: grid;
  gap: var(--s-7);
}

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

.band__intro > p {
  color: var(--ink-2);
}

.routes {
  display: grid;
  gap: 0;
  margin-top: var(--s-5);
  padding: 0;
  list-style: none;
}

.routes li {
  display: grid;
  gap: var(--s-1);
  padding-block: var(--s-3);
  border-top: 1px solid var(--rule-strong);
}

.routes span {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
}

@media (min-width: 37.5em) {
  .routes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--s-5);
  }
}

@media (min-width: 56.25em) {
  .band__grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: var(--s-8);
  }
}

.band .evidence {
  background: var(--surface);
  padding: 0 var(--s-5);
  border-radius: var(--radius-lg);
}

.band .evidence__item:last-child {
  border-bottom: 0;
}

/* 7. Category hub ---------------------------------------------------------- */

.page-head {
  padding-block: var(--s-5) var(--s-6);
}

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

.page-head .breadcrumbs + * {
  margin-top: var(--s-6);
}

.page-head__summary {
  max-width: var(--measure);
  font-size: var(--fs-lede);
  color: var(--ink-2);
}

.hub-top {
  display: grid;
  gap: var(--s-6);
  padding-bottom: var(--s-7);
}

@media (min-width: 56.25em) {
  .hub-top {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: var(--s-7);
    align-items: start;
  }
}

.catalogue {
  display: grid;
  gap: var(--s-7);
  padding-bottom: var(--s-8);
}

.measure-wide {
  max-width: calc(48rem + 2 * var(--gutter));
}

.hub-more .container > * + * {
  margin-top: var(--s-6);
}

.hub-more .evidence,
.hub-more .sources {
  padding: var(--s-2) var(--s-5) var(--s-4);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.catalogue__group {
  display: grid;
  gap: var(--s-4);
}

.catalogue__group h2 {
  font-size: var(--fs-h3);
}

.catalogue__group > div > p {
  margin-top: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

@media (min-width: 56.25em) {
  .catalogue__group {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: var(--s-7);
    padding-top: var(--s-5);
    border-top: 1px solid var(--rule);
  }

  .catalogue__group > div:first-child {
    position: sticky;
    top: var(--s-5);
    align-self: start;
  }
}

@media (max-width: 56.24em) {
  .catalogue__group {
    padding-top: var(--s-4);
    border-top: 1px solid var(--rule);
  }
}

/* Glossary hub */
.glossary {
  margin: 0;
}

.glossary__term {
  padding-block: var(--s-3);
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: var(--s-5);
}

.glossary__term:target {
  background: var(--accent-soft);
}

.glossary dt {
  font-family: var(--font-serif);
  font-size: var(--fs-h4);
  font-weight: 600;
}

.glossary dd {
  margin: var(--s-1) 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* 8. Article --------------------------------------------------------------- */

/* Lead photo under the title: a wide crop keeps the text close to the top. Diagrams keep their shape. */
.article-body > .figure picture img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Grid: header and body share the reading column; the TOC sits beside the body on wide screens. */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--measure));
  justify-content: center;
  padding-bottom: var(--s-8);
}

.article-head {
  padding-block: var(--s-5);
}

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

.article-head .breadcrumbs + * {
  margin-top: var(--s-6);
}

.article-head .meta {
  margin-top: var(--s-5);
}

.article-body > * + * {
  margin-top: var(--s-7);
}

.article-aside {
  display: none;
}

@media (min-width: 70em) {
  .article-layout {
    grid-template-columns: 14rem minmax(0, var(--measure));
    column-gap: var(--s-8);
  }

  .article-head,
  .article-body {
    grid-column: 2;
  }

  .article-aside {
    display: block;
    grid-column: 1;
    grid-row: 2;
  }

  .toc-mobile {
    display: none;
  }
}

.toc {
  font-size: var(--fs-sm);
}

.toc__title {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
}

.toc ol {
  margin-top: var(--s-3);
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--rule);
}

.toc li a {
  display: block;
  padding: var(--s-1) 0 var(--s-1) var(--s-3);
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-2);
  line-height: 1.4;
  text-decoration: none;
}

.toc li a:hover {
  border-left-color: var(--accent);
  color: var(--ink);
}

.toc li a[aria-current] {
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.article-aside .toc {
  position: sticky;
  top: var(--s-5);
}

.toc-mobile {
  border-block: 1px solid var(--rule);
}

.toc-mobile summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 3rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.toc-mobile summary::-webkit-details-marker {
  display: none;
}

.toc-mobile summary::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--accent);
}

.toc-mobile[open] summary::after {
  content: "−";
}

.toc-mobile .toc {
  padding-bottom: var(--s-4);
}

/* Prose */
.prose > * + * {
  margin-top: var(--s-5);
}

.prose > h2 {
  margin-top: var(--s-7);
  scroll-margin-top: var(--s-5);
}

.prose > h3 {
  margin-top: var(--s-6);
  scroll-margin-top: var(--s-5);
}

.prose > h2 + *,
.prose > h3 + * {
  margin-top: var(--s-3);
}

.prose ul,
.prose ol {
  padding-left: 1.25em;
}

.prose li + li {
  margin-top: var(--s-2);
}

.prose li::marker {
  color: var(--ink-2);
}

.prose strong {
  font-weight: 700;
}

.prose .table-wrap,
.prose .note,
.prose .evidence,
.prose figure {
  margin-top: var(--s-6);
}

.prose .table-wrap + .table-note {
  margin-top: var(--s-2);
}

.cite {
  font-size: 0.72em;
  font-weight: 700;
  line-height: 0;
  vertical-align: super;
  white-space: nowrap;
}

.cite a {
  padding: 0 0.1em;
  text-decoration: none;
}

.cite + .cite::before {
  content: ",";
}

/* Sources */
.sources {
  font-size: var(--fs-sm);
}

.sources h2 {
  font-size: var(--fs-h3);
}

.sources ol {
  margin-top: var(--s-4);
  padding-left: 1.75em;
}

.sources li {
  padding-left: var(--s-2);
}

.sources li + li {
  margin-top: var(--s-3);
}

.sources li:target {
  background: var(--accent-soft);
}

.source__type {
  display: inline-block;
  margin-right: var(--s-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
}

.source__back {
  margin-left: var(--s-2);
  text-decoration: none;
}

/* Editorial info */
.editorial {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}

.editorial > summary {
  cursor: pointer;
  list-style-position: outside;
}

.editorial > summary h2 {
  display: inline;
  font-size: var(--fs-base);
}

.editorial[open] > summary {
  margin-bottom: var(--s-2);
}

.editorial dl {
  display: grid;
  gap: var(--s-3);
}

.editorial dt {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
}

.editorial dd {
  margin: var(--s-1) 0 0;
}

@media (min-width: 37.5em) {
  .editorial dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4) var(--s-5);
  }
}

.changelog {
  padding: 0;
  list-style: none;
}

.changelog li + li {
  margin-top: var(--s-2);
}

.changelog time {
  font-weight: 700;
  margin-right: var(--s-2);
}

/* Article end: topic list + related */
.article-end {
  padding-block: var(--s-7) var(--s-8);
  background: var(--surface-2);
}

.article-end h2 {
  margin-bottom: var(--s-5);
  font-size: var(--fs-h2);
}

/* 9. Search & errors ------------------------------------------------------- */

.search-page {
  max-width: var(--measure);
  padding-bottom: var(--s-8);
}

.search-page__count {
  margin-top: var(--s-5);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.search-results {
  padding: 0;
  list-style: none;
}

.search-results li {
  padding-block: var(--s-5);
  border-bottom: 1px solid var(--rule);
}

.search-results .story__summary {
  margin-top: var(--s-1);
}

.empty-state {
  margin-top: var(--s-6);
  padding: var(--s-6) var(--s-5);
  border: 1px dashed var(--rule-strong);
}

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

.empty-state h2 {
  font-size: var(--fs-h3);
}

.empty-state ul {
  padding-left: 1.25em;
}

.error-page {
  max-width: var(--measure);
  padding-block: var(--s-8) var(--s-9);
}

.error-page > * + * {
  margin-top: var(--s-5);
}

.error-page__code {
  font-family: var(--font-serif);
  font-size: var(--fs-h4);
  font-weight: 600;
  color: var(--accent);
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  padding: 0;
  list-style: none;
}

/* 10. Footer --------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}

.site-footer__grid {
  display: grid;
  gap: var(--s-6) var(--s-5);
  padding-block: var(--s-7);
}

.site-footer h2 {
  margin-bottom: var(--s-3);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
}

.site-footer ul {
  padding: 0;
  list-style: none;
}

.site-footer li + li {
  margin-top: var(--s-2);
}

.site-footer a {
  color: var(--ink);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.site-footer__brand p {
  margin-top: var(--s-3);
  max-width: 22rem;
  color: var(--ink-2);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-2) var(--s-5);
  padding-block: var(--s-5);
  border-top: 1px solid var(--rule-strong);
  font-size: var(--fs-xs);
  color: var(--ink-2);
}

.site-footer__bottom p {
  max-width: 48rem;
}

@media (min-width: 37.5em) {
  .site-footer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer__brand {
    grid-column: 1 / -1;
  }
}

@media (min-width: 64em) {
  .site-footer__grid {
    grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr));
  }

  .site-footer__brand {
    grid-column: auto;
  }
}

/* 11. Utilities ------------------------------------------------------------ */

.text-muted {
  color: var(--ink-2);
}

.measure {
  max-width: var(--measure);
}

.mt-4 {
  margin-top: var(--s-4);
}

.mt-6 {
  margin-top: var(--s-6);
}

/* 12. Print ---------------------------------------------------------------- */

@media print {
  .site-header,
  .site-footer,
  .article-aside,
  .toc-mobile,
  .article-end,
  .skip-link {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .sources a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }
}
