/* ==========================================================================
   Artikel Platform — front-end styles
   Visual model: iOS grouped lists, large titles, translucent chrome.
   Brand colours arrive as --brand / --accent / --tint from the active theme.
   ========================================================================== */

/* --- tokens --------------------------------------------------------------- */
:root {
  --bg:          #F2F2F7;
  --surface:     #FFFFFF;
  --surface-2:   #FAFAFC;
  --ink:         #1C1C1E;
  --ink-soft:    #6E6E73;
  --ink-faint:   #9A9AA0;
  --line:        rgba(60, 60, 67, 0.16);
  --line-strong: rgba(60, 60, 67, 0.29);
  --chrome:      rgba(249, 249, 251, 0.82);
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, .05);
  --shadow-md:   0 4px 16px rgba(0, 0, 0, .07);
  --radius-sm:   calc(var(--radius, 16px) * 0.625);
  --radius-lg:   calc(var(--radius, 16px) * 1.25);
  --maxw:        720px;
  --maxw-wide:   1080px;
  --tap:         44px;
  --ease:        cubic-bezier(.32, .72, 0, 1);

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
             system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-read: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
               system-ui, "Helvetica Neue", Arial, sans-serif;
}

[data-scheme="dark"] {
  --bg:          #000000;
  --surface:     #1C1C1E;
  --surface-2:   #2C2C2E;
  --ink:         #F2F2F7;
  --ink-soft:    #A1A1A6;
  --ink-faint:   #7C7C82;
  --line:        rgba(84, 84, 88, 0.55);
  --line-strong: rgba(120, 120, 128, 0.6);
  --chrome:      rgba(28, 28, 30, 0.82);
  --shadow-sm:   none;
  --shadow-md:   0 4px 20px rgba(0, 0, 0, .5);
  --brand:       var(--brand-dm);
  --accent:      var(--accent-dm);
  --tint:        rgba(255, 255, 255, .06);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: calc(17px * var(--font-scale, 1));
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

img, svg, video { max-width: 100%; height: auto; }
figure { margin: 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; color: inherit; cursor: pointer; }

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

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

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

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--brand); color: #fff; padding: 10px 16px;
  border-radius: var(--radius-sm); transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* --- layout --------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw-wide);
  margin-inline: auto;
  padding-inline: 20px;
}
.wrap-narrow { max-width: var(--maxw); }

.stack > * + * { margin-top: 14px; }

main { padding-bottom: 48px; }

/* --- header --------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 90;
  background: var(--chrome);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.site-header.is-static { position: relative; }

.header-bar {
  display: flex; align-items: center; gap: 14px;
  min-height: 52px;
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 1.0625rem; letter-spacing: -.02em;
  color: var(--ink); text-decoration: none; margin-right: auto;
}
.brand:hover { text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand); color: #fff;
  font-size: .875rem; font-weight: 700;
}

.nav-desktop { display: none; gap: 4px; align-items: center; }
.nav-desktop a {
  padding: 7px 12px; border-radius: 999px;
  color: var(--ink-soft); font-size: .9375rem; font-weight: 500;
}
.nav-desktop a:hover { background: var(--tint); color: var(--ink); text-decoration: none; }
.nav-desktop a[aria-current="page"] { color: var(--brand); background: var(--tint); }

.icon-btn {
  display: grid; place-items: center;
  width: var(--tap); height: var(--tap);
  border: 0; background: none; border-radius: 50%;
  color: var(--ink-soft); flex: none;
}
.icon-btn:hover { background: var(--tint); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }

@media (min-width: 860px) {
  .nav-desktop { display: flex; }
  .nav-toggle  { display: none; }
}

/* --- slide-over menu ------------------------------------------------------ */
.sheet {
  position: fixed; inset: 0; z-index: 120;
  display: none; align-items: flex-end;
  background: rgba(0, 0, 0, .4);
}
.sheet[open], .sheet.is-open { display: flex; }

.sheet-panel {
  width: 100%; max-height: 86vh; overflow-y: auto;
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 8px 20px calc(28px + env(safe-area-inset-bottom));
  animation: sheet-up .28s var(--ease);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

.sheet-grabber {
  width: 38px; height: 5px; border-radius: 3px;
  background: var(--line-strong); margin: 8px auto 16px;
}

@media (min-width: 860px) {
  .sheet { align-items: flex-start; justify-content: flex-end; }
  .sheet-panel {
    max-width: 380px; height: 100%; max-height: 100%;
    border-radius: 0; animation: none;
  }
}

/* --- grouped list (the core iOS pattern) ---------------------------------- */
.group {
  background: var(--surface);
  border-radius: var(--radius, 16px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.group-title {
  font-size: .8125rem; font-weight: 600; color: var(--ink-soft);
  margin: 26px 0 8px; padding-inline: 4px;
}

.row {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); padding: 12px 16px;
  color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); text-decoration: none; }
.row:active { background: var(--tint); }
.row-label { flex: 1; min-width: 0; font-weight: 500; }
.row-value { color: var(--ink-soft); font-size: .9375rem; flex: none; }
.row .ic-chevron { color: var(--ink-faint); flex: none; }
.row-icon {
  display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand); color: #fff;
}

/* --- section heading ------------------------------------------------------ */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 30px 0 12px;
}
.section-head h2 {
  margin: 0; font-size: 1.375rem; font-weight: 700; letter-spacing: -.02em;
}
.section-head a { font-size: .9375rem; font-weight: 500; flex: none; }

/* --- large title ---------------------------------------------------------- */
.page-head { padding: 22px 0 6px; }
.page-head h1 {
  margin: 0 0 6px; font-size: clamp(1.75rem, 5vw, 2.125rem);
  font-weight: 700; letter-spacing: -.03em; line-height: 1.18;
}
.page-head p { margin: 0; color: var(--ink-soft); font-size: 1rem; }

/* --- breadcrumbs ---------------------------------------------------------- */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  font-size: .8125rem; color: var(--ink-soft); padding: 14px 0 0;
}
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--brand); }
.crumbs li { display: flex; align-items: center; gap: 5px; }
.crumbs ol { display: contents; list-style: none; margin: 0; padding: 0; }
.crumbs .sep { color: var(--ink-faint); }
.crumbs [aria-current] { color: var(--ink); }

/* --- pills (segmented control feel) --------------------------------------- */
.pills {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px 20px 4px; margin-inline: -20px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex: none; padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: .875rem; font-weight: 500; color: var(--ink);
  white-space: nowrap;
}
.pill:hover { text-decoration: none; border-color: var(--line-strong); }
.pill.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* --- article cards -------------------------------------------------------- */
.card-list { display: grid; gap: 14px; }
@media (min-width: 700px) { .card-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .card-list.cols-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius, 16px);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card:active { transform: scale(.99); }
.card a { color: inherit; text-decoration: none; }

.card-media {
  aspect-ratio: 16 / 9; background: var(--tint);
  display: block; overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card-kicker {
  font-size: .75rem; font-weight: 600; color: var(--brand);
  letter-spacing: .01em;
}
.card-title {
  margin: 0; font-size: 1.0625rem; font-weight: 650;
  letter-spacing: -.015em; line-height: 1.3;
}
.card-excerpt {
  margin: 0; font-size: .9375rem; color: var(--ink-soft); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  margin-top: auto; padding-top: 4px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: .8125rem; color: var(--ink-faint);
}
.card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

/* Lead card on the homepage */
.card-lead .card-media { aspect-ratio: 21 / 9; }
.card-lead .card-title { font-size: 1.375rem; }
@media (min-width: 700px) { .card-lead { grid-column: 1 / -1; } }

/* Compact numbered list, used for "most read" */
.rank-list { counter-reset: rank; }
.rank-list .row::before {
  counter-increment: rank; content: counter(rank);
  flex: none; width: 24px; font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--brand); font-size: 1rem;
}

/* --- article page --------------------------------------------------------- */
.article-head { padding: 18px 0 4px; }
.article-head h1 {
  margin: 8px 0 10px;
  font-size: clamp(1.75rem, 5.5vw, 2.375rem);
  font-weight: 700; letter-spacing: -.03em; line-height: 1.16;
}
.article-standfirst {
  margin: 0 0 16px; font-size: 1.125rem; line-height: 1.5;
  color: var(--ink-soft);
}

.byline {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 0; border-block: 1px solid var(--line); margin-bottom: 4px;
}
.byline-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  object-fit: cover; background: var(--tint);
}
.byline-text { min-width: 0; font-size: .875rem; line-height: 1.35; }
.byline-name { font-weight: 600; color: var(--ink); }
.byline-meta { color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 6px; }

.trust-strip {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 14px 0 0; font-size: .8125rem;
}
.trust-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--tint); color: var(--ink-soft);
}
.trust-chip .ic { width: 14px; height: 14px; }

.hero-figure {
  margin: 18px 0; border-radius: var(--radius, 16px); overflow: hidden;
  background: var(--tint);
}
.hero-figure img { width: 100%; display: block; }

/* Takeaways box */
.takeaways {
  background: var(--tint); border-radius: var(--radius, 16px);
  padding: 18px 20px; margin: 22px 0;
  border-left: 3px solid var(--brand);
}
.takeaways h2 { margin: 0 0 10px; font-size: 1rem; font-weight: 700; }
.takeaways ul { margin: 0; padding-left: 20px; }
.takeaways li { margin-bottom: 7px; font-size: .9375rem; line-height: 1.5; }
.takeaways li:last-child { margin-bottom: 0; }

/* Table of contents */
.toc {
  background: var(--surface); border-radius: var(--radius, 16px);
  box-shadow: var(--shadow-sm); margin: 20px 0; overflow: hidden;
}
.toc > summary {
  padding: 14px 18px; font-weight: 650; cursor: pointer;
  list-style: none; display: flex; align-items: center; justify-content: space-between;
}
.toc > summary::-webkit-details-marker { display: none; }
.toc > summary::after {
  content: ""; width: 8px; height: 8px; flex: none;
  border-right: 2px solid var(--ink-faint); border-bottom: 2px solid var(--ink-faint);
  transform: rotate(45deg); transition: transform .2s var(--ease);
}
.toc[open] > summary::after { transform: rotate(-135deg); }
.toc ol { margin: 0; padding: 0 18px 16px 34px; }
.toc li { margin: 7px 0; font-size: .9375rem; }
.toc li.lvl-3 { margin-left: 14px; font-size: .875rem; }
.toc a { color: var(--ink); }
.toc a:hover { color: var(--brand); }

/* --- article body typography ---------------------------------------------- */
.prose {
  font-family: var(--font-read);
  font-size: calc(1.0625rem * var(--font-scale, 1));
  line-height: 1.68;
  color: var(--ink);
}
.prose > * + * { margin-top: 1.15em; }
.prose p { margin: 0; }

.prose h2 {
  margin: 2em 0 .6em; font-size: 1.5rem; font-weight: 700;
  letter-spacing: -.022em; line-height: 1.25; scroll-margin-top: 76px;
}
.prose h3 {
  margin: 1.6em 0 .5em; font-size: 1.1875rem; font-weight: 650;
  letter-spacing: -.015em; scroll-margin-top: 76px;
}

.prose ul, .prose ol { margin: 1.1em 0; padding-left: 24px; }
.prose li { margin-bottom: .5em; }
.prose li::marker { color: var(--brand); }

.prose a { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }

.prose strong { font-weight: 650; }

.prose blockquote {
  margin: 1.5em 0; padding: 2px 0 2px 18px;
  border-left: 3px solid var(--brand);
  color: var(--ink-soft); font-style: normal;
}

.prose table {
  width: 100%; border-collapse: collapse; margin: 1.5em 0;
  font-size: .9375rem; display: block; overflow-x: auto;
  white-space: nowrap;
}
.prose th, .prose td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.prose th { font-weight: 650; background: var(--tint); }
.prose tbody tr:last-child td { border-bottom: 0; }

@media (min-width: 700px) {
  .prose table { display: table; white-space: normal; }
}

/* --- infographic figures -------------------------------------------------- */
.infographic {
  margin: 32px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius, 16px);
  overflow: hidden;
}
.infographic-head {
  padding: 14px 18px 0;
  font-size: .75rem; font-weight: 600; color: var(--brand);
}
.infographic-title {
  padding: 4px 18px 0; margin: 0;
  font-size: 1.0625rem; font-weight: 650; letter-spacing: -.015em;
}
.infographic-canvas {
  padding: 16px 14px;
  --ink: var(--ink);
}
.infographic-canvas svg { width: 100%; height: auto; display: block; font-family: var(--font-ui); }
.infographic-caption {
  padding: 0 18px 14px; margin: 0;
  font-size: .875rem; color: var(--ink-soft); line-height: 1.5;
}
.infographic-source {
  padding: 10px 18px; margin: 0;
  border-top: 1px solid var(--line);
  font-size: .75rem; color: var(--ink-faint);
  background: var(--surface-2);
}

/* --- FAQ, sources, author ------------------------------------------------- */
.faq { margin: 34px 0; }
.faq h2, .sources h2, .author-box h2 {
  font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 12px;
}
.faq-item {
  background: var(--surface); border-radius: var(--radius-sm);
  margin-bottom: 8px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.faq-item > summary {
  padding: 14px 16px; font-weight: 600; cursor: pointer;
  list-style: none; display: flex; gap: 12px; align-items: flex-start;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: "+"; margin-left: auto; flex: none;
  font-size: 1.25rem; font-weight: 400; color: var(--ink-faint); line-height: 1;
}
.faq-item[open] > summary::after { content: "−"; }
.faq-answer { padding: 0 16px 16px; color: var(--ink-soft); font-size: .9375rem; line-height: 1.6; }

.sources { margin: 34px 0; }
.sources ol { margin: 0; padding-left: 22px; }
.sources li { margin-bottom: 9px; font-size: .875rem; line-height: 1.5; color: var(--ink-soft); }
.sources li a { word-break: break-word; }
.sources .pub { color: var(--ink-faint); }

.author-box {
  background: var(--surface); border-radius: var(--radius, 16px);
  padding: 20px; margin: 34px 0; box-shadow: var(--shadow-sm);
}
.author-box-inner { display: flex; gap: 16px; align-items: flex-start; }
.author-box img {
  width: 60px; height: 60px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--tint);
}
.author-box .name { font-weight: 650; font-size: 1.0625rem; }
.author-box .role { color: var(--ink-soft); font-size: .875rem; margin-bottom: 8px; }
.author-box .bio { font-size: .9375rem; color: var(--ink-soft); line-height: 1.55; margin: 0 0 10px; }
.author-credentials {
  font-size: .8125rem; color: var(--ink-faint);
  padding-top: 10px; border-top: 1px solid var(--line); margin-top: 10px;
}

.disclaimer {
  background: var(--tint); border-radius: var(--radius-sm);
  padding: 14px 16px; margin: 26px 0;
  font-size: .8125rem; color: var(--ink-soft); line-height: 1.55;
}
.disclaimer strong { color: var(--ink); }

/* --- share / actions ------------------------------------------------------ */
.actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 26px 0; padding: 16px 0; border-block: 1px solid var(--line);
}
.action-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: .875rem; font-weight: 500; color: var(--ink);
}
.action-btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.action-btn .ic { width: 17px; height: 17px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.tag-chip {
  padding: 6px 12px; border-radius: 999px; background: var(--tint);
  font-size: .8125rem; color: var(--ink-soft);
}
.tag-chip:hover { color: var(--brand); text-decoration: none; }

/* --- prev / next ---------------------------------------------------------- */
.sibling-nav { display: grid; gap: 10px; margin: 30px 0; }
@media (min-width: 640px) { .sibling-nav { grid-template-columns: 1fr 1fr; } }
.sibling {
  display: block; padding: 15px 17px;
  background: var(--surface); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); color: var(--ink);
}
.sibling:hover { text-decoration: none; box-shadow: var(--shadow-md); }
.sibling .label { font-size: .75rem; color: var(--ink-faint); margin-bottom: 4px; }
.sibling .title { font-weight: 600; font-size: .9375rem; line-height: 1.35; }
.sibling.next { text-align: right; }

/* --- pagination ----------------------------------------------------------- */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 34px 0 8px;
}
.pager-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--tap); padding: 0 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: .9375rem; font-weight: 500; color: var(--ink);
}
.pager-btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pager-status { font-size: .875rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* --- search --------------------------------------------------------------- */
.search-field { position: relative; margin: 16px 0 8px; }
.search-field .ic {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); pointer-events: none;
}
.search-field input {
  width: 100%; min-height: var(--tap);
  padding: 12px 16px 12px 44px;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); -webkit-appearance: none;
}
.search-field input:focus { outline: none; border-color: var(--brand); }
.search-field input::placeholder { color: var(--ink-faint); }

/* --- newsletter ----------------------------------------------------------- */
.newsletter {
  background: var(--surface); border-radius: var(--radius, 16px);
  padding: 22px; margin: 34px 0; box-shadow: var(--shadow-sm);
}
.newsletter h2 { margin: 0 0 6px; font-size: 1.1875rem; font-weight: 700; }
.newsletter p { margin: 0 0 14px; color: var(--ink-soft); font-size: .9375rem; }
.newsletter-form { display: flex; gap: 8px; flex-wrap: wrap; }
.newsletter-form input[type="email"] {
  flex: 1 1 220px; min-height: var(--tap); padding: 10px 14px;
  font: inherit; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink);
}
.newsletter-form input:focus { outline: none; border-color: var(--brand); }
.btn-primary {
  min-height: var(--tap); padding: 0 22px; border: 0;
  border-radius: var(--radius-sm); background: var(--brand); color: #fff;
  font-weight: 600; font-size: .9375rem;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(.98); }
.form-note { font-size: .8125rem; color: var(--ink-soft); margin-top: 10px; }
.form-note.is-ok { color: var(--accent); }
.form-note.is-error { color: #D7263D; }

/* --- ad slots ------------------------------------------------------------- */
.ad-slot {
  margin: 24px auto;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
}
.ad-slot .ad-label {
  display: block; font-size: .625rem; letter-spacing: .06em;
  color: var(--ink-faint); margin-bottom: 6px;
}
.ad-slot .ad-body { min-height: 1px; }
.ad-article-top { margin-top: 18px; }
.ad-global-header { margin: 14px auto 0; }
.ad-global-footer { margin: 28px auto 8px; }

@media (max-width: 699px) { .ad-desktop-only { display: none; } }
@media (min-width: 700px) { .ad-mobile-only  { display: none; } }

/* --- footer --------------------------------------------------------------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 34px 0 calc(28px + env(safe-area-inset-bottom));
  margin-top: 40px;
  font-size: .875rem;
}
.footer-grid { display: grid; gap: 26px; }
@media (min-width: 700px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-col h3 { margin: 0 0 10px; font-size: .8125rem; font-weight: 650; color: var(--ink-soft); }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--ink); }
.footer-col a:hover { color: var(--brand); }
.footer-about { color: var(--ink-soft); line-height: 1.6; margin: 0 0 12px; }
.footer-bottom {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  color: var(--ink-faint); font-size: .8125rem;
}

/* --- bottom tab bar (mobile) ---------------------------------------------- */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 95;
  display: flex; background: var(--chrome);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 7px 4px 6px;
  font-size: .625rem; font-weight: 500; color: var(--ink-faint);
}
.tabbar a:hover { text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--brand); }
.tabbar .ic { width: 24px; height: 24px; }

body.has-tabbar { padding-bottom: 58px; }
@media (min-width: 860px) {
  .tabbar { display: none; }
  body.has-tabbar { padding-bottom: 0; }
}

/* --- back to top ---------------------------------------------------------- */
.to-top {
  position: fixed; right: 16px; z-index: 80;
  bottom: calc(70px + env(safe-area-inset-bottom));
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-md); color: var(--ink);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
@media (min-width: 860px) { .to-top { bottom: 24px; } }

/* --- consent banner ------------------------------------------------------- */
.consent {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 150;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, .12);
}
.consent-inner {
  max-width: var(--maxw-wide); margin-inline: auto;
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
}
.consent-text { flex: 1 1 300px; font-size: .875rem; color: var(--ink-soft); line-height: 1.5; }
.consent-text strong { display: block; color: var(--ink); margin-bottom: 3px; font-size: .9375rem; }
.consent-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-ghost {
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: none; color: var(--ink); font-size: .9375rem; font-weight: 500;
}
.btn-ghost:hover { border-color: var(--line-strong); }

/* --- empty state ---------------------------------------------------------- */
.empty {
  text-align: center; padding: 48px 20px; color: var(--ink-soft);
}
.empty h2 { margin: 0 0 8px; font-size: 1.25rem; color: var(--ink); }
.empty p { margin: 0 0 18px; }

/* --- print ---------------------------------------------------------------- */
@media print {
  .site-header, .tabbar, .to-top, .consent, .ad-slot,
  .actions, .newsletter, .sibling-nav, .site-footer, .toc { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .prose { font-size: 11pt; }
  .infographic { break-inside: avoid; border: 1px solid #ccc; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
}

/* ------------------------------------------------------------------
   Infographic used as a card thumbnail. The stored SVG has no width or
   height attributes, so it is scaled by the box and cropped to a
   consistent aspect ratio rather than letting each diagram set its own.
   ------------------------------------------------------------------ */
.card-media-svg {
  display: block;
  background: var(--tint);
  padding: 10px;
  overflow: hidden;
}
.card-media-svg svg {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 200px;
  object-fit: contain;
}
[data-scheme="dark"] .card-media-svg { background: rgba(255, 255, 255, .04); }
