/*
Theme Name: MGA kasinot
Theme URI: https://mga-kasinot.io/
Author: Northlane Digital Ltd
Description: Kevyt, nopea teema rahapelilisenssiin keskittyvälle vertailusivustolle. Sisältää Kasino-sisältötyypin, kasinolista-shortcoden, kelluvan sisällysluettelon ja luottamusmerkit.
Version: 1.0.0
Requires at least: 6.2
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: mga-kasinot
*/

:root {
  /* shell — deep petrol green */
  --ink-900: #0b2320;
  --ink-800: #113630;
  --ink-700: #17473f;
  --ink-600: #1f5d52;
  --blue-500: #0e7c63;
  --blue-400: #2aa98a;

  /* CTA — warm coral on cool ground */
  --gold-500: #ff6a45;
  --gold-400: #ff8a6b;
  --gold-600: #d94a26;
  --gold-ink: #3a1109;

  /* surfaces */
  --bg: #f4f7f5;
  --card: #ffffff;
  --card-alt: #f7faf8;
  --line: #e0e8e4;
  --line-strong: #c4d3cd;

  /* text */
  --tx: #11231f;
  --tx-soft: #455d57;
  --tx-faint: #6b7f79;
  --on-dark: #eaf4f0;
  --on-dark-soft: #a4c4ba;

  /* semantic */
  --pos: #12805c;
  --pos-bg: #e4f5ee;
  --neg: #c0392b;
  --neg-bg: #fdecea;
  --warn: #8a6209;
  --warn-bg: #fff6e0;

  /* metrics */
  --w-text: 720px;
  --w-wide: 1140px;
  --w-toc: 1320px;
  --r: 10px;
  --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(11, 35, 32, .06), 0 2px 8px rgba(11, 35, 32, .05);
  --shadow-2: 0 4px 14px rgba(11, 35, 32, .09), 0 12px 32px rgba(11, 35, 32, .07);
  --shadow-cta: 0 2px 0 var(--gold-600), 0 6px 18px rgba(217, 74, 38, .32);
  --header-h: 66px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------------------------- layout */

.wrap { width: 100%; max-width: var(--w-text); margin-inline: auto; padding-inline: 18px; }
.wrap-wide { width: 100%; max-width: var(--w-wide); margin-inline: auto; padding-inline: 18px; }

main section { scroll-margin-top: calc(var(--header-h) + 14px); }

/* WordPress editor content flows in a narrow column, wide blocks break out */
.entry-content > * { max-width: var(--w-text); margin-inline: auto; }
.entry-content > .alignwide { max-width: var(--w-wide); }
.entry-content > .alignfull { max-width: none; }

/* ---------------------------------------------------------------- type */

h1, h2, h3, h4 {
  font-weight: 800; line-height: 1.2; letter-spacing: -.017em;
  color: var(--ink-900); margin: 0 0 .5em; text-wrap: balance;
}
h1 { font-size: clamp(1.95rem, 5.2vw, 2.85rem); letter-spacing: -.025em; }
h2 { font-size: clamp(1.5rem, 3.6vw, 1.95rem); margin-top: 2.4em; }
h3 { font-size: clamp(1.16rem, 2.5vw, 1.3rem); margin-top: 1.9em; margin-bottom: .4em; }
h4 { font-size: 1.04rem; margin-top: 1.5em; margin-bottom: .3em; }
h2 + h3, h3 + h4 { margin-top: .9em; }

p { margin: 0 0 1.05em; }
p:last-child { margin-bottom: 0; }

a { color: var(--blue-500); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
strong { font-weight: 700; color: var(--ink-800); }

ul, ol { margin: 0 0 1.15em; padding-left: 1.25em; }
li { margin-bottom: .45em; }
li::marker { color: var(--blue-500); }

.lead { font-size: 1.12rem; color: var(--tx-soft); }
.small { font-size: .9rem; color: var(--tx-faint); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.6em 0; }

/* ---------------------------------------------------------------- header */

.topbar {
  position: sticky; top: 0; z-index: 60; height: var(--header-h);
  background: var(--ink-900); border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.admin-bar .topbar { top: 32px; }
@media (max-width: 782px) { .admin-bar .topbar { top: 46px; } }

.topbar .bar {
  max-width: var(--w-wide); margin-inline: auto; padding-inline: 18px;
  height: var(--header-h); display: flex; align-items: center; gap: 16px;
}
.topbar .brand { display: flex; align-items: center; margin-right: auto; }
.topbar .brand img { height: 32px; width: auto; display: block; }

.topbar-nav { display: flex; align-items: center; gap: 22px; }
.topbar-nav ul { list-style: none; display: flex; gap: 22px; margin: 0; padding: 0; }
.topbar-nav li { margin: 0; }
.topbar-nav a { color: var(--on-dark-soft); font-size: .93rem; font-weight: 600; white-space: nowrap; }
.topbar-nav a:hover { color: #fff; text-decoration: none; }
@media (max-width: 900px) { .topbar-nav { display: none; } }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font-family: inherit; font-weight: 800; font-size: 1rem; line-height: 1;
  padding: 14px 22px; border-radius: var(--r); border: 0;
  text-decoration: none; cursor: pointer; text-align: center;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn:hover { text-decoration: none; }

.btn-cta {
  background: linear-gradient(180deg, var(--gold-400), var(--gold-500));
  color: var(--gold-ink); box-shadow: var(--shadow-cta);
}
.btn-cta:hover { transform: translateY(-1px); background: linear-gradient(180deg, #ffce6b, var(--gold-400)); }
.btn-cta:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--gold-600); }

.btn-ghost { background: transparent; color: var(--ink-700); border: 1.5px solid var(--line-strong); font-weight: 700; }
.btn-ghost:hover { border-color: var(--blue-500); color: var(--blue-500); }

.btn-sm { padding: 9px 15px; font-size: .88rem; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }
.topbar-cta { padding: 10px 16px; font-size: .9rem; }

/* ---------------------------------------------------------------- hero */

.hero {
  background:
    radial-gradient(1100px 420px at 78% -12%, rgba(42, 169, 138, .30), transparent 62%),
    linear-gradient(170deg, var(--ink-800) 0%, var(--ink-900) 72%);
  color: var(--on-dark); padding: 44px 0 40px; border-bottom: 3px solid var(--gold-500);
}
.hero h1 { color: #fff; margin-bottom: .35em; }
.hero p { color: var(--on-dark-soft); }
.hero .lead { color: #d8e0f8; font-size: 1.14rem; }
.hero p a { color: var(--gold-400); }

.lede-grid {
  max-width: var(--w-wide); margin-inline: auto; padding-inline: 18px;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 38px; align-items: center;
}
@media (max-width: 900px) {
  .lede-grid { grid-template-columns: 1fr; gap: 26px; }
  .lede-art { order: -1; }
}

.byline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  margin: 0 0 18px; font-size: .88rem; color: var(--on-dark-soft);
}
.byline .who { display: flex; align-items: center; gap: 8px; }
.byline img { width: 30px; height: 30px; border-radius: 50%; display: block; }
.byline a { color: #fff; font-weight: 700; }
.byline .sep { color: rgba(255, 255, 255, .25); }
@media (max-width: 620px) {
  .byline { flex-direction: column; align-items: flex-start; gap: 8px; }
  .byline .sep { display: none; }
}

.lede-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.lede-actions .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .32); }
.lede-actions .btn-ghost:hover { border-color: #fff; color: #fff; }

.assurances {
  display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 22px;
  padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .12);
}
.assurances span {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .13);
  color: #e0e7fb; border-radius: 999px; padding: 6px 13px; font-size: .82rem; font-weight: 600;
}
.assurances svg { flex: none; }

/* ---------------------------------------------------------------- topthree */

.topthree { margin: -26px auto 0; position: relative; z-index: 2; }
.topthree-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 800px) { .topthree-grid { grid-template-columns: 1fr; } }

.topthree-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2); padding: 18px 16px 16px; text-align: center;
  display: flex; flex-direction: column; gap: 10px;
}
.topthree-card.is-top { border-color: var(--gold-500); border-width: 2px; }
.topthree-label {
  align-self: center; background: var(--ink-800); color: #fff; font-size: .72rem;
  font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 11px; border-radius: 999px;
}
.topthree-card.is-top .topthree-label { background: var(--gold-500); color: var(--gold-ink); }
.topthree-mark {
  height: 46px; display: flex; align-items: center; justify-content: center;
  background: var(--card-alt); border-radius: 8px; overflow: hidden;
}
.topthree-mark img { max-height: 40px; width: auto; }
.topthree-mark.is-empty { border: 1px dashed var(--line-strong); color: var(--tx-faint); font-size: .8rem; font-weight: 700; }
.topthree-offer { font-weight: 800; color: var(--ink-900); font-size: 1.02rem; line-height: 1.35; }
.topthree-meta { font-size: .84rem; color: var(--tx-faint); margin-top: -4px; }

/* ---------------------------------------------------------------- caslist */

.caslist { display: flex; flex-direction: column; gap: 14px; margin: 26px 0 8px; }

.cas-row {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); padding: 18px;
  display: grid; gap: 16px;
  grid-template-columns: 54px minmax(140px, 1fr) minmax(155px, 1fr) minmax(165px, 1.15fr) minmax(175px, .95fr);
  align-items: center; position: relative;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.cas-row:hover { box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.cas-row.is-top { border: 2px solid var(--gold-500); padding-top: 30px; }

.cas-flag {
  position: absolute; top: -1px; left: -1px; background: var(--gold-500); color: var(--gold-ink);
  font-size: .71rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 13px; border-radius: 14px 0 12px 0;
}

.cas-pos {
  width: 54px; height: 54px; border-radius: 12px; background: var(--ink-800); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 800;
}
.cas-row.is-top .cas-pos { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); color: var(--gold-ink); }

.cas-id { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cas-mark {
  height: 52px; border-radius: 8px; background: var(--card-alt);
  display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 4px;
}
.cas-mark img { max-height: 44px; width: auto; }
.cas-mark.is-empty { border: 1px dashed var(--line-strong); color: var(--tx-faint); font-size: .78rem; font-weight: 700; text-align: center; }
.cas-title { font-weight: 800; color: var(--ink-900); font-size: 1.06rem; }
.cas-rating { display: flex; align-items: center; gap: 7px; font-size: .84rem; color: var(--tx-faint); }
.cas-rating b { color: var(--ink-900); font-size: 1rem; }
.cas-stars { color: var(--gold-500); letter-spacing: .5px; }

.cas-specs { margin: 0; font-size: .88rem; }
.cas-specs div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dotted var(--line); }
.cas-specs div:last-child { border-bottom: 0; }
.cas-specs dt { color: var(--tx-faint); }
.cas-specs dd { margin: 0; font-weight: 700; color: var(--ink-800); text-align: right; }

.cas-plus { list-style: none; margin: 0; padding: 0; font-size: .89rem; }
.cas-plus li { display: flex; gap: 7px; align-items: flex-start; margin-bottom: .35em; line-height: 1.45; }
.cas-plus li::before {
  content: "✓"; flex: none; color: var(--pos); font-weight: 800; background: var(--pos-bg);
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  font-size: .72rem; margin-top: 2px;
}

.cas-go { display: flex; flex-direction: column; gap: 8px; }
.cas-go .cas-fine { font-size: .73rem; color: var(--tx-faint); text-align: center; line-height: 1.35; }

@media (max-width: 1040px) {
  .cas-row { grid-template-columns: 54px minmax(140px, 1fr) minmax(150px, 1fr); row-gap: 14px; }
  .cas-plus { grid-column: 2 / -1; }
  .cas-go { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .cas-row { grid-template-columns: 46px 1fr; row-gap: 14px; }
  .cas-pos { width: 46px; height: 46px; font-size: 1.2rem; }
  .cas-specs, .cas-plus, .cas-go { grid-column: 1 / -1; }
}

/* empty-state when no Kasino posts exist yet */
.caslist-slot {
  border: 2px dashed var(--gold-500);
  background: repeating-linear-gradient(135deg, #fffaf0, #fffaf0 12px, #fff3dc 12px, #fff3dc 24px);
  border-radius: var(--r-lg); padding: 26px 20px; text-align: center; margin: 24px 0;
}
.caslist-slot .flag {
  display: inline-block; background: var(--gold-500); color: var(--gold-ink);
  font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 13px; border-radius: 999px; margin-bottom: 10px;
}
.caslist-slot p { margin: 0; color: var(--warn); font-weight: 600; font-size: .93rem; }
.caslist-slot code { background: rgba(0, 0, 0, .06); padding: 1px 6px; border-radius: 4px; font-size: .88em; }

/* ---------------------------------------------------------------- inline CTA */

.actionbar {
  background: linear-gradient(135deg, var(--ink-800), var(--ink-700));
  color: #fff; border-radius: var(--r-lg); padding: 24px 26px; margin: 2.4em auto;
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between;
  border-left: 5px solid var(--gold-500);
}
.actionbar h3 { color: #fff; margin: 0 0 .25em; font-size: 1.18rem; }
.actionbar p { color: var(--on-dark-soft); margin: 0; font-size: .95rem; max-width: 48ch; }
.actionbar .btn { flex: none; }

/* ---------------------------------------------------------------- TOC */

.toc {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px 22px; margin: 30px auto; box-shadow: var(--shadow-1);
}
.toc h2 { margin: 0 0 .6em; font-size: 1.1rem; }
.toc ol { margin: 0; padding-left: 1.2em; columns: 2; column-gap: 28px; font-size: .92rem; }
.toc li { margin-bottom: .34em; break-inside: avoid; }
.toc a { color: var(--tx-soft); font-weight: 500; }
.toc a:hover { color: var(--blue-500); }
@media (max-width: 640px) { .toc ol { columns: 1; } }

/* ---------------------------------------------------------------- blocks */

.note {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--blue-500);
  border-radius: var(--r); padding: 16px 20px; margin: 1.6em auto;
}
.note.warn { background: var(--warn-bg); border-color: #f2e2ba; border-left-color: var(--gold-500); }
.note.warn strong { color: var(--warn); }
.note p:last-child { margin-bottom: 0; }
.note h3, .note h4 { margin-top: 0; }

.factbox {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px 24px; margin: 1.8em auto; box-shadow: var(--shadow-1);
}
.factbox ul { list-style: none; padding: 0; margin: 0; }
.factbox li { display: flex; gap: 10px; align-items: flex-start; margin-bottom: .55em; }
.factbox li::before {
  content: "✓"; flex: none; color: var(--pos); background: var(--pos-bg);
  width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center;
  font-size: .78rem; font-weight: 800; margin-top: 2px;
}

figure { margin: 1.9em auto; }
figure img, figure svg { border-radius: var(--r); display: block; width: 100%; }
figcaption { font-size: .85rem; color: var(--tx-faint); margin-top: .6em; text-align: center; }

.table-wrap { overflow-x: auto; margin: 1.7em auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; background: var(--card); border-radius: var(--r); overflow: hidden; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--ink-800); color: #fff; font-weight: 700; font-size: .88rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: var(--card-alt); }

.plusminus { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 1.8em auto; }
@media (max-width: 680px) { .plusminus { grid-template-columns: 1fr; } }
.plusminus > div { border-radius: var(--r-lg); padding: 18px 20px; border: 1px solid var(--line); }
.plusminus .pro { background: var(--pos-bg); border-color: #bfe6d5; }
.plusminus .con { background: var(--neg-bg); border-color: #f5ccc8; }
.plusminus h3 { margin-top: 0; font-size: 1.05rem; }
.plusminus .pro h3 { color: var(--pos); }
.plusminus .con h3 { color: var(--neg); }
.plusminus ul { list-style: none; padding: 0; margin: 0; font-size: .93rem; }
.plusminus li { display: flex; gap: 8px; align-items: flex-start; margin-bottom: .5em; }
.plusminus .pro li::before { content: "+"; color: var(--pos); font-weight: 800; flex: none; }
.plusminus .con li::before { content: "−"; color: var(--neg); font-weight: 800; flex: none; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 1.8em auto; }
.steps > li { counter-increment: s; position: relative; padding: 0 0 0 52px; margin-bottom: 1.5em; }
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 36px; height: 36px;
  border-radius: 10px; background: var(--ink-800); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 1.05rem;
}
.steps h3 { margin-top: 0; margin-bottom: .3em; }

.writer {
  display: flex; gap: 16px; align-items: flex-start; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px;
  margin: 1.4em auto; box-shadow: var(--shadow-1);
}
.writer img { width: 64px; height: 64px; border-radius: 50%; flex: none; }
.writer h3 { margin: 0 0 .15em; font-size: 1.05rem; }
.writer .role { color: var(--blue-500); font-weight: 700; font-size: .87rem; margin-bottom: .5em; }
.writer p { margin: 0 0 .5em; font-size: .93rem; color: var(--tx-soft); }

.labcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px 24px; margin: 1.8em auto; box-shadow: var(--shadow-1); border-top: 4px solid var(--blue-500);
}
.labcard h3 { margin-top: 0; }

/* FAQ */
.faq { margin: 1.6em auto; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; overflow: hidden; }
.faq details[open] { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.faq summary {
  cursor: pointer; padding: 15px 44px 15px 18px; font-weight: 700; color: var(--ink-900);
  position: relative; list-style: none; font-size: 1rem; line-height: 1.45;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px;
  border-right: 2.5px solid var(--blue-500); border-bottom: 2.5px solid var(--blue-500);
  transform: translateY(-70%) rotate(45deg); transition: transform .18s ease;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq .answer { padding: 0 18px 16px; color: var(--tx-soft); font-size: .96rem; }
.faq .answer p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- sticky mobile CTA */

.dockbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  background: rgba(15, 21, 48, .97); backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
  display: none; align-items: center; gap: 12px;
}
.dockbar .txt { color: #fff; font-size: .82rem; line-height: 1.3; min-width: 0; }
.dockbar .txt b { display: block; font-size: .93rem; }
.dockbar .txt span { color: var(--on-dark-soft); }
.dockbar .btn { flex: none; margin-left: auto; }
@media (max-width: 860px) {
  .dockbar { display: flex; }
  body { padding-bottom: 68px; }
}

/* ---------------------------------------------------------------- page head / crumbs */

.crumbs { font-size: .85rem; color: var(--tx-faint); padding: 14px 0 0; }
.crumbs a { color: var(--tx-faint); font-weight: 500; }
.crumbs a:hover { color: var(--blue-500); }
.crumbs span.sep { margin: 0 6px; opacity: .55; }

.pagetop {
  background: linear-gradient(170deg, var(--ink-800), var(--ink-900));
  color: #fff; padding: 34px 0 32px; border-bottom: 3px solid var(--gold-500);
}
.pagetop h1 { color: #fff; margin-bottom: .3em; }
.pagetop p { color: var(--on-dark-soft); margin: 0; }
.pagetop .crumbs, .pagetop .crumbs a { color: var(--on-dark-soft); }
.pagetop .crumbs { padding: 0 0 14px; }
.pagetop .updated { font-size: .86rem; color: var(--on-dark-soft); margin-top: 12px; }
.pagetop .byline { margin-top: 14px; margin-bottom: 0; }

.legal h2 { font-size: 1.4rem; margin-top: 2.1em; padding-top: .8em; border-top: 1px solid var(--line); }
.legal h2:first-of-type { border-top: 0; padding-top: 0; }
.legal h3 { font-size: 1.08rem; }

/* ---------------------------------------------------------------- footer */

.botbar {
  background: var(--ink-900); color: var(--on-dark-soft); font-size: .9rem;
  padding: 40px 0 26px; margin-top: 56px;
}
.botbar a { color: var(--on-dark-soft); font-weight: 500; }
.botbar a:hover { color: #fff; }
.botbar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 30px 26px; }
.botbar h3 { color: #fff; font-size: .95rem; margin: 0 0 .8em; }
.botbar ul { list-style: none; padding: 0; margin: 0; }
.botbar li { margin-bottom: .45em; }
.botbar .botbar-brand img { height: 30px; margin-bottom: 14px; }
.botbar .addr { font-style: normal; line-height: 1.7; }

/* --- footer trust badges --- */
.badgerow {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch;
  margin-top: 34px; padding-top: 26px; border-top: 1px solid rgba(255, 255, 255, .12);
}
.badge {
  display: inline-flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px; padding: 9px 14px; color: var(--on-dark);
  font-size: .8rem; font-weight: 600; line-height: 1.25; text-decoration: none;
  transition: border-color .12s ease, background-color .12s ease;
}
a.badge:hover { border-color: rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.badge svg, .badge img { flex: none; display: block; }
.badge b { display: block; color: #fff; font-weight: 800; }
.badge span { display: block; color: var(--on-dark-soft); font-size: .72rem; font-weight: 500; }
.badge-18 {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--gold-500);
  color: var(--gold-400); font-weight: 800; font-size: .78rem;
  display: inline-grid; place-items: center; flex: none;
}
@media (max-width: 560px) { .badge { flex: 1 1 100%; } }

.botbar-base {
  border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 26px; padding-top: 20px;
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  font-size: .84rem;
}
.age-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--gold-500); color: var(--gold-400); font-weight: 800; font-size: .82rem; flex: none;
}
.botbar-resp { display: flex; align-items: center; gap: 12px; }

/* ---------------------------------------------------------------- sticky TOC rail */

/* On wide screens the article sits in a two-column grid with a sticky
   table of contents on the right. Below 1180px the rail collapses back
   into the inline card, so the markup works either way. */
.article-shell { width: 100%; max-width: var(--w-toc); margin-inline: auto; padding-inline: 18px; }

/* Base state: rail hidden, inline card visible. The media query below flips
   both — it must come after this rule, not before. */
.toc-rail { display: none; }

@media (min-width: 1180px) {
  .article-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 274px;
    gap: 44px;
    align-items: start;
  }
  .article-shell > .entry-content { min-width: 0; }
  .article-shell > .entry-content > * { margin-inline: 0; }
  .toc-rail { position: sticky; top: calc(var(--header-h) + 18px); display: block; }
  .toc-inline { display: none; }
}

.toc-rail nav {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); padding: 16px 18px; max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto; overscroll-behavior: contain;
}
.toc-rail h2 { margin: 0 0 .6em; font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--tx-faint); }
.toc-rail ol { list-style: none; margin: 0; padding: 0; font-size: .87rem; counter-reset: toc; }
.toc-rail li { margin-bottom: .18em; counter-increment: toc; }
.toc-rail a {
  display: block; padding: 5px 9px; border-radius: 7px; color: var(--tx-soft);
  font-weight: 500; border-left: 2px solid transparent;
}
.toc-rail a:hover { background: var(--card-alt); color: var(--blue-500); text-decoration: none; }
.toc-rail a.is-active { background: var(--pos-bg); color: var(--ink-800); border-left-color: var(--blue-500); font-weight: 700; }

/* ---------------------------------------------------------------- sources + changelog */

.sources { background: var(--card-alt); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 24px; margin: 2em auto; }
.sources h2, .sources h3 { margin-top: 0; }
.sources ol, .sources ul { margin: 0; padding-left: 1.2em; font-size: .92rem; }
.sources li { margin-bottom: .45em; }
.sources .src-note { font-size: .84rem; color: var(--tx-faint); margin: .8em 0 0; }

.changelog { list-style: none; margin: 1.2em 0 0; padding: 0; font-size: .9rem; }
.changelog li { display: flex; gap: 14px; padding: 8px 0; border-bottom: 1px dotted var(--line); }
.changelog li:last-child { border-bottom: 0; }
.changelog time { flex: none; width: 78px; color: var(--tx-faint); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- utils */

.visually-hidden, .screen-reader-text {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.center { text-align: center; }
.mt0 { margin-top: 0; }
.alignwide { max-width: var(--w-wide); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
