/* ============================================================
   Stock Average Calculator — design system
   Light/dark themes via [data-theme] with prefers-color-scheme
   fallback. No external fonts or libraries.
   ============================================================ */

:root {
  color-scheme: light;

  /* Surfaces & ink — clean white default */
  --page: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --text-primary: #111318;
  --text-secondary: #4b5260;
  --text-muted: #878e9b;
  --border: rgba(17, 19, 24, 0.10);
  --gridline: #e8eaee;
  --axis: #d4d7dd;

  /* Brand & series — emerald / teal */
  --accent: #0e8a68;
  --accent-2: #0d7377;
  --series-bar: #1baf7a;
  --series-bar-hover: #3ec695;
  --series-avg: #eb6834;
  --good: #006300;
  --danger: #d03b3b;

  --grad: linear-gradient(135deg, #109c74, #0d7377);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.06);
  --shadow-pop: 0 4px 10px rgba(15, 23, 42, 0.10), 0 16px 40px rgba(15, 23, 42, 0.14);
  --header-h: 60px;

  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Light is the default for everyone; dark is an explicit opt-in
   via the header toggle (persisted in localStorage). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242423;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --border: rgba(255, 255, 255, 0.10);
  --gridline: #2c2c2a;
  --axis: #383835;
  --accent: #2ebd8c;
  --accent-2: #27a5aa;
  --series-bar: #199e70;
  --series-bar-hover: #22b381;
  --series-avg: #d95926;
  --good: #0ca30c;
  --grad: linear-gradient(135deg, #1db584, #17949a);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-pop: 0 4px 10px rgba(0, 0, 0, 0.5), 0 16px 40px rgba(0, 0, 0, 0.55);
}

/* ============ Base ============ */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

.container {
  width: min(1100px, 100% - 2.5rem);
  margin-inline: auto;
}

.container.narrow { max-width: 760px; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.75rem); }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--surface); color: var(--text-primary);
  padding: 0.5rem 1rem; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop); transition: top 0.15s ease;
}
.skip-link:focus { top: 1rem; }

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

/* ============ Header ============ */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .container { width: 100%; max-width: none; padding-inline: clamp(0.75rem, 2vw, 1.5rem); margin: 0; }

.header-inner {
  display: flex; align-items: center; gap: 0.75rem;
  height: var(--header-h);
}

.brand {
  display: inline-flex; align-items: center;
  text-decoration: none; color: var(--text-primary);
  font-weight: 750; font-size: 1.1rem; letter-spacing: -0.02em;
}
.brand:hover { color: var(--accent); }

.site-nav { display: flex; gap: 0.25rem; margin-left: auto; }
.site-nav a {
  color: var(--text-secondary); text-decoration: none;
  font-size: 0.93rem; font-weight: 500;
  padding: 0.45rem 0.8rem; border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.site-nav a:hover { color: var(--text-primary); background: var(--surface-2); }

.theme-toggle {
  display: inline-grid; place-items: center;
  flex: none;
  width: 38px; height: 38px;
  border: none; border-radius: 10px;
  background: transparent; color: var(--text-secondary);
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { color: var(--text-primary); background: var(--surface-2); }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

@media (max-width: 640px) {
  .site-nav { display: none; }
  .site-nav + .theme-toggle { margin-left: auto; }
  .header-inner { justify-content: space-between; }
}

/* ============ Shell: sidebar + content ============ */

/* The shell is full-bleed: sidebar flush with the left edge, content centered
   in the remaining space. */
.shell.container-wide, .shell {
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  min-height: calc(100vh - var(--header-h));
}

.content {
  min-width: 0;
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding: 0 clamp(1.25rem, 3.5vw, 3rem) 2.5rem;
}
.content > h1 {
  margin-top: 1.75rem;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
}
.content > .page-intro {
  color: var(--text-secondary);
  max-width: 70ch;
  margin-bottom: 1.25rem;
}
/* prose sections on generated tool pages (homepage sections carry
   .section/.hero classes and keep their own full-width layout) */
.content section:not(.section):not(.hero) { max-width: 76ch; }
.content section:not(.section):not(.hero) h2 { margin-top: 1.75rem; }
.content section:not(.section):not(.hero) p { color: var(--text-secondary); }
.content section:not(.section):not(.hero) p strong,
.content section:not(.section):not(.hero) li strong { color: var(--text-primary); }

.sidebar {
  width: 264px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.1rem 0.85rem 2.5rem;
  overflow-x: hidden;
  transition: width 0.25s ease, opacity 0.2s ease, padding 0.25s ease,
              border-width 0.25s ease;
}
/* the inner nav is what sticks and scrolls; the panel itself runs full height */
.sidebar nav {
  position: sticky;
  top: calc(var(--header-h) + 1.1rem);
  width: 238px; /* fixed so links don't reflow during the width animation */
  max-height: calc(100vh - var(--header-h) - 2rem);
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar nav::-webkit-scrollbar { display: none; }

/* Desktop collapse (toggled by the header button, persisted) */
@media (min-width: 1024px) {
  html.sidebar-collapsed .sidebar {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    border-right-width: 0;
    pointer-events: none;
  }
}

.sidebar-group {
  margin: 0.9rem 0.55rem 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sidebar-group:first-child { margin-top: 0.3rem; }

.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a {
  display: block;
  padding: 0.42rem 0.6rem;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
}
.sidebar a:hover {
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
  color: var(--text-primary);
}
.sidebar a[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.nav-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px; height: 38px;
  border: none; border-radius: 10px;
  background: transparent; color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-toggle:hover { color: var(--text-primary); background: var(--surface-2); }

.scrim {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0, 0, 0, 0.45);
}

/* Mobile / tablet: the sidebar becomes an overlay drawer */
@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 80;
    top: 0; left: 0; bottom: 0;
    width: min(300px, 86vw);
    margin: 0;
    padding-top: 1rem;
    overflow-y: auto;
    background: var(--surface);
    border: none;
    border-right: 1px solid var(--border);
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    opacity: 1;
  }
  .sidebar nav {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
  }
  body.drawer-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  body.drawer-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .shell { transition: none; }
}

/* ============ Calc pages ============ */

.calc-card { margin: 1.25rem 0 2rem; }

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}
.calc-grid .field label, .planner-form .field label, .score-grid .field label {
  display: block;
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 0.3rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}

.calc-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}
.calc-results .stat-value-sm { font-size: 1.15rem; overflow-wrap: anywhere; }

.field-hint { font-size: 0.8rem; color: var(--text-muted); margin: -0.4rem 0 0.9rem; }

/* live "reads as" hint under large money inputs (set via data-echo) */
.field-echo {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  min-height: 1em;
  font-variant-numeric: tabular-nums;
}

.pos { color: var(--good) !important; }
.neg { color: var(--danger) !important; }

/* percentage page */
.pct-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}
.pct-row:last-child { border-bottom: none; }
.pct-q { margin: 0; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.inline-num {
  width: 100px;
  display: inline-block;
  padding: 0.4rem 0.5rem !important;
}
.pct-a { margin: 0; font-weight: 700; font-size: 1.1rem; min-width: 7ch; text-align: right; }

/* stock score page */
.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
}
.score-grid select { width: 100%; }
.score-result { text-align: center; padding-top: 1.25rem; }
.score-band { color: var(--text-secondary); max-width: 46ch; margin: 0.4rem auto 0; }
.score-band.band-strong { color: var(--good); font-weight: 600; }
.score-band.band-mid { color: var(--series-avg); font-weight: 600; }
.score-band.band-weak { color: var(--danger); font-weight: 600; }

/* books page */
.book-list {
  list-style: none; padding: 0; margin: 0 0 1rem;
  display: grid; gap: 0.6rem;
}
.book-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
}
.book-list strong { color: var(--text-primary); }

/* ============ Homepage head (tool-first, no hero band) ============ */

.page-head { padding-top: 1.75rem; margin-bottom: 1.25rem; }
.page-head h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
}
.page-head .page-intro {
  color: var(--text-secondary);
  max-width: 72ch;
  margin: 0;
}

/* ============ Sections & cards ============ */

.section { padding: clamp(1.5rem, 4vw, 2.5rem) 0; }
.section-content { padding-block: clamp(2rem, 5vw, 3rem); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: clamp(1.25rem, 3vw, 1.75rem);
}

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 880px) { .calc-layout { grid-template-columns: 1fr; } }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}
.card-head h2 { margin: 0; font-size: 1.2rem; }

select, input[type="number"] {
  font: inherit; color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem; /* >=44px tall — comfortable touch target */
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select { width: auto; cursor: pointer; }
input[type="number"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
/* hide number spinners for a cleaner look */
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { appearance: none; margin: 0; }

/* Buy rows */
.rows { display: grid; gap: 0.75rem; }

.buy-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.6rem; align-items: end;
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  animation: row-in 0.25s ease;
}
@keyframes row-in { from { opacity: 0; transform: translateY(-4px); } }

.buy-row .row-badge {
  align-self: center;
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--grad); color: #fff;
  font-size: 0.8rem; font-weight: 700;
}

.buy-row .field label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 0.25rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}

.buy-row input { background: var(--surface); }

.row-remove {
  align-self: center;
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  border: none; border-radius: 50%;
  background: transparent; color: var(--text-muted);
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.row-remove:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.row-remove:disabled { opacity: 0.3; cursor: not-allowed; }

@media (max-width: 420px) {
  .buy-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .buy-row .field-price { grid-column: 2 / 3; }
}

.row-actions { display: flex; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font: inherit; font-weight: 600; font-size: 0.92rem;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--grad); color: #fff; border: none;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 45%, transparent); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  background: transparent; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-ghost:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }

.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* ============ Results ============ */

.stat-hero { text-align: center; padding: 0.5rem 0 1rem; }

.stat-label {
  margin: 0 0 0.2rem;
  font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-muted);
}

.stat-value {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 3.2rem);
  font-weight: 750; letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.stat-value.pulse { animation: pulse 0.35s ease; }
@keyframes pulse { 50% { transform: scale(1.03); } }

.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.stat-tile {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  text-align: center;
}
.stat-value-sm { margin: 0; font-size: 1.35rem; font-weight: 700; }

/* Chart */
.chart-block { position: relative; margin-bottom: 1rem; }

.chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 0.25rem;
}
.chart-title { margin: 0; font-size: 0.92rem; font-weight: 600; color: var(--text-secondary); }

.chart-legend { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-secondary); }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--series-bar); }
.legend-line { width: 16px; height: 2px; border-radius: 1px; background: var(--series-avg); }

.chart { width: 100%; min-height: 0; }
.chart svg { display: block; width: 100%; height: auto; }

.chart .bar { fill: var(--series-bar); transition: fill 0.12s ease; }
.chart .bar.lift { fill: var(--series-bar-hover); }
.chart .gridline { stroke: var(--gridline); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .avg-line { stroke: var(--series-avg); stroke-width: 2; stroke-linecap: round; }
.chart .tick, .chart .cat-label { font-size: 11px; fill: var(--text-muted); font-family: var(--font); }
.chart .tick { font-variant-numeric: tabular-nums; }
.chart .avg-label { font-size: 11px; font-weight: 600; fill: var(--text-secondary); font-family: var(--font); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:focus-visible { outline: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; }

.chart-tooltip {
  position: absolute; z-index: 10;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem; line-height: 1.45;
  max-width: 220px;
}
.chart-tooltip .tt-value { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }
.chart-tooltip .tt-label { color: var(--text-secondary); }

.chart-empty {
  color: var(--text-muted); font-size: 0.9rem;
  text-align: center; padding: 2rem 0; margin: 0;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
}

/* Breakdown table */
.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.breakdown {
  width: 100%; border-collapse: collapse;
  font-size: 0.88rem;
}
.breakdown th, .breakdown td {
  text-align: right; padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.breakdown th:first-child, .breakdown td:first-child { text-align: left; }
.breakdown thead th {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600;
}
.breakdown tfoot td, .breakdown .total-row td { font-weight: 700; border-bottom: none; }

.result-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.result-hint { margin: 0; font-size: 0.8rem; color: var(--text-muted); }

/* ============ Planner ============ */

.card-planner {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem; align-items: start;
}
@media (max-width: 760px) { .card-planner { grid-template-columns: 1fr; gap: 1rem; } }

.planner-copy p { color: var(--text-secondary); margin-bottom: 0; }

.planner-form { display: grid; gap: 0.9rem; }
.planner-form .field label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 0.3rem;
}

.planner-result {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  font-size: 0.95rem;
}
.planner-result p { margin: 0; }
.planner-placeholder { color: var(--text-muted); }
.planner-result .plan-num { font-weight: 700; }
.planner-result .plan-warn { color: var(--danger); }
.planner-result .plan-ok strong { color: var(--good); }

/* ============ Content sections ============ */

.steps { padding-left: 1.3rem; display: grid; gap: 0.6rem; color: var(--text-secondary); }
.steps strong, .example-list strong { color: var(--text-primary); }

.note {
  background: color-mix(in srgb, var(--series-avg) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--series-avg) 25%, transparent);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.1rem;
  font-size: 0.9rem; color: var(--text-secondary);
  margin-top: 1.25rem;
}

/* FAQ */
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer; list-style: none;
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; font-size: 1.2rem; font-weight: 500;
  color: var(--accent); transition: transform 0.2s ease;
  flex: none;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 1.1rem 1rem; margin: 0; color: var(--text-secondary); }

/* ============ Ad slots (reserved, hidden until monetized) ============ */

.ad-slot[hidden] { display: none; }
.ad-slot:not([hidden]) {
  min-height: 90px;
  margin-block: 1rem;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

/* ============ Footer ============ */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding: 2.25rem 0 1.25rem;
  margin-top: 2.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; gap: 1.25rem; } }

.footer-brand { margin: 0 0 0.4rem; font-weight: 750; font-size: 1.05rem; letter-spacing: -0.02em; }
.footer-about { max-width: 34ch; }
.footer-fine { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

.footer-head {
  margin: 0 0 0.5rem;
  font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-muted);
}
.footer-grid nav { display: grid; gap: 0.35rem; align-content: start; }
.footer-grid nav a {
  color: var(--text-secondary); text-decoration: none; font-size: 0.9rem;
  width: fit-content;
}
.footer-grid nav a:hover { color: var(--accent); text-decoration: underline; }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  color: var(--text-muted); font-size: 0.85rem;
}
.footer-bottom p { margin: 0; }
.footer-bottom a { color: var(--text-secondary); }

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