/* ==========================================================================
   Kamenice bez další výstavby
   Směr: občanský, klidný, „dobře udělaný místní zpravodaj“.
   Papírový podklad, jeden akcent (lesní zeleň), serif na nadpisy.
   ========================================================================== */

:root {
  /* Barvy */
  --paper: #f4f1e8;
  --paper-2: #ebe6d8;
  --paper-3: #e2dccb;
  --ink: #1d2320;
  --ink-2: #4a524d;
  --ink-3: #6b716c;
  --line: #d3ccb8;
  --accent: #1f5b3a;
  --accent-ink: #154029;
  --accent-soft: #dfe8dc;
  --on-accent: #f4f1e8;
  --focus: #b8860b;

  /* Stupnice odpovědí 1–8 */
  --a1: #1f5b3a;
  --a2: #3c7a36;
  --a3: #66731f;
  --a4: #926513;
  --a5: #ad4e1b;
  --a6: #9b2a21;
  --a7: #626864;
  --a8: #626864;

  /* Písmo */
  --font-display: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --font-text: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --fs-xs: 0.8125rem;  /* 13 */
  --fs-sm: 0.9375rem;  /* 15 */
  --fs-base: 1.125rem; /* 18 */
  --fs-md: 1.25rem;    /* 20 */
  --fs-lg: 1.75rem;    /* 28 */
  --fs-xl: clamp(2rem, 1.4rem + 2.4vw, 2.75rem);   /* 32 → 44 */
  --fs-2xl: clamp(2.5rem, 1.6rem + 4vw, 4.25rem);  /* 40 → 68 */

  /* Mezery (8px mřížka) */
  --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;

  --radius: 6px;
  --radius-lg: 12px;
  --wrap: 72rem;
  --narrow: 44rem;
  --gutter: clamp(1.25rem, 5vw, 2rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t: 180ms;
}

/* ---------- Základ ---------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--fs-base);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 var(--s-4);
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--s-4); }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--t) var(--ease), text-decoration-color var(--t) var(--ease);
}
a:hover { color: var(--accent-ink); text-decoration-thickness: 2px; }

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

strong { font-weight: 600; }

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

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

.skip {
  position: absolute;
  left: var(--s-4); top: -100px;
  z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--radius);
}
.skip:focus { top: var(--s-4); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.25em; height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
}

.eyebrow {
  font-family: var(--font-text);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--s-3);
}
.eyebrow-light { color: #b9d3b9; }

.lead {
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 38em;
}

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

/* ---------- Tlačítka a odkazy ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font: 600 var(--fs-sm)/1.2 var(--font-text);
  padding: var(--s-3) var(--s-5);
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn .icon { transition: transform var(--t) var(--ease); }
.btn:hover .icon { transform: translateX(3px); }

.btn-solid { background: var(--accent); color: var(--on-accent); }
.btn-solid:hover { background: var(--accent-ink); color: var(--on-accent); }

.btn-outline { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--paper); }

.btn-lg { font-size: var(--fs-base); padding: var(--s-4) var(--s-6); }

.text-link {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 2px;
}
.text-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ---------- DOČASNÉ: upozornění „web je ve výstavbě“ ---------- */

.build-banner {
  position: relative;
  background: #a91d1d;
  color: #fff;
  font-size: var(--fs-sm);
  line-height: 1.45;
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / .15);
}
.build-banner[hidden] { display: none; }
.build-banner-inner {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding-block: var(--s-3);
}
.build-banner-tag {
  flex: none;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #a91d1d;
  background: #fff;
  border-radius: 999px;
  padding: 2px var(--s-3);
}
.build-banner-text { flex: 1; margin: 0; }
.build-banner-text strong { font-weight: 700; }
.build-banner-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font: 600 var(--fs-xs) var(--font-text);
  color: #fff;
  background: rgb(255 255 255 / .12);
  border: 1px solid rgb(255 255 255 / .45);
  border-radius: 999px;
  padding: var(--s-1) var(--s-3) var(--s-1) var(--s-2);
  cursor: pointer;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.build-banner-close:hover { background: rgb(255 255 255 / .25); border-color: #fff; }
.build-banner-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.build-banner-close .icon { width: 1rem; height: 1rem; stroke-width: 2.4; }

@media (max-width: 640px) {
  .build-banner-inner { align-items: flex-start; gap: var(--s-3); flex-wrap: wrap; }
  .build-banner-tag { order: 0; }
  .build-banner-close { order: 1; margin-left: auto; padding: var(--s-1); width: 2rem; height: 2rem; justify-content: center; }
  .build-banner-close-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .build-banner-text { order: 2; flex-basis: 100%; }
}

/* ---------- Hlavička ---------- */

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-mark svg {
  width: 2.25rem; height: 2.25rem;
  fill: none; stroke: var(--accent); stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
  display: block;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-top { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 600; }
.brand-bottom { font-size: var(--fs-xs); color: var(--ink-2); letter-spacing: .02em; }

.site-nav ul {
  display: flex;
  gap: var(--s-1);
  list-style: none;
  margin: 0; padding: 0;
}
.site-nav a {
  display: block;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.site-nav a:hover { color: var(--ink); background: var(--paper-2); }
.site-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: 0;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: var(--s-2);
  font: 600 var(--fs-sm) var(--font-text);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-2) var(--s-3);
  cursor: pointer;
}
.nav-toggle:hover { background: var(--paper-2); }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    position: fixed;
    inset: 4rem 0 auto 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px -12px rgb(29 35 32 / .25);
    padding: var(--s-2) var(--gutter) var(--s-5);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--t) var(--ease), transform var(--t) var(--ease), visibility 0s linear var(--t);
  }
  .nav-open .site-nav {
    transform: none;
    opacity: 1;
    visibility: visible;
    transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
  }
  .site-nav ul { flex-direction: column; }
  .site-nav a { font-size: var(--fs-md); padding: var(--s-3) 0; border-bottom: 1px solid var(--paper-3); border-radius: 0; }
  .site-nav a:hover { background: transparent; color: var(--accent); }
  .site-nav a[aria-current="page"] { box-shadow: none; }
}

/* ---------- Sekce ---------- */

.section { padding-block: var(--s-8); }
.section-tight { padding-top: var(--s-5); }

.section-title { max-width: 20em; margin-bottom: var(--s-7); }
.section-title-sm { font-size: var(--fs-lg); margin-bottom: var(--s-2); }

.page-head {
  padding-block: var(--s-8) var(--s-6);
  border-bottom: 1px solid var(--line);
}
.page-head h1 { max-width: 14em; }
.key-line {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 1.4;
  border-left: 3px solid var(--accent);
  padding-left: var(--s-4);
  margin-top: var(--s-5);
  max-width: 34em;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding-top: var(--s-8);
  background: var(--paper);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: var(--s-8);
  align-items: start;
  padding-bottom: var(--s-6);
}
.hero h1 { max-width: 11em; margin-bottom: var(--s-5); }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-5);
  margin-top: var(--s-6);
}

.hero-ranking {
  background: #fbf9f3;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s-5);
  margin-top: var(--s-2);
}
.ranking-head h2 { font-size: var(--fs-lg); margin-bottom: var(--s-1); }
.ranking-sub { font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: var(--s-4); }
.hero-ranking .text-link { display: inline-block; margin-top: var(--s-4); }

.horizon {
  display: block;
  width: 100%;
  height: clamp(60px, 10vw, 120px);
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.horizon .h-back { stroke: var(--line); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.horizon .h-front { stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.horizon .h-marks { stroke: var(--ink-3); stroke-width: 1.2; vector-effect: non-scaling-stroke; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--s-6); }
}

/* ---------- Pořadí stran ---------- */

.party-rank {
  list-style: none;
  margin: 0; padding: 0;
  border-top: 1px solid var(--line);
}
.party-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: center;
  padding-block: var(--s-3);
  border-bottom: 1px solid var(--line);
}
.party-rank-num {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  color: var(--ink-3);
}
.party-main { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.party-name { font-weight: 600; line-height: 1.25; }
.strip { display: flex; flex-wrap: wrap; gap: 3px; }
.party-score { text-align: right; line-height: 1; }
.party-score-num {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.party-score-label { font-size: var(--fs-xs); color: var(--ink-3); }

.party-row.is-top .party-rank-num,
.party-row.is-top .party-score-num { color: var(--accent); }
.party-row.is-top .party-name { color: var(--accent-ink); }

.loading, .empty { color: var(--ink-3); font-size: var(--fs-sm); padding: var(--s-4) 0; }

/* ---------- Odznaky odpovědí ---------- */

.badge {
  display: inline-grid;
  place-items: center;
  width: 2.25rem; height: 2.25rem;
  border-radius: 50%;
  color: #fff;
  background: var(--badge);
  flex: none;
}
.badge .icon { width: 62%; height: 62%; vertical-align: 0; }
.badge-lg { width: 3.5rem; height: 3.5rem; }
.badge-sm { width: 1.75rem; height: 1.75rem; }
.badge-xs { width: 1.25rem; height: 1.25rem; }
.badge-xs .icon { stroke-width: 2.2; width: 70%; height: 70%; }

.a1 { --badge: var(--a1); }
.a2 { --badge: var(--a2); }
.a3 { --badge: var(--a3); }
.a4 { --badge: var(--a4); }
.a5 { --badge: var(--a5); }
.a6 { --badge: var(--a6); }
.a7 { --badge: var(--a7); }
.a8 { --badge: var(--a8); }
.badge.a7, .badge.a8 {
  background: transparent;
  color: var(--a7);
  box-shadow: inset 0 0 0 1.5px var(--a7);
}

/* ---------- Úvod: hodnoty ---------- */

.values { background: var(--paper-2); }
.big-quote {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 1.2;
  margin-bottom: var(--s-6);
  text-wrap: balance;
}
.big-quote em { font-style: italic; color: var(--accent); }
.values p:not(.big-quote) { color: var(--ink-2); max-width: 38em; }

/* ---------- Úvod: důsledky ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--s-7);
  align-items: center;
  margin-bottom: var(--s-9);
}
.split:last-child { margin-bottom: 0; }
.split-reverse .split-media { order: 2; }

.split-media { margin: 0; }
.split-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-lg);
  filter: saturate(.85);
}
.split-media figcaption {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-top: var(--s-2);
}
.split-text h3 { margin-bottom: var(--s-5); }

.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li {
  position: relative;
  padding: var(--s-3) 0 var(--s-3) var(--s-6);
  border-top: 1px solid var(--line);
  line-height: 1.5;
}
.dash-list li:last-child { border-bottom: 1px solid var(--line); }
.dash-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 1.35em;
  width: var(--s-4); height: 2px;
  background: var(--accent);
}

@media (min-width: 1101px) {
  .split .split-media { margin-left: calc(-1 * var(--s-7)); }
  .split-reverse .split-media { margin-left: 0; margin-right: calc(-1 * var(--s-7)); }
}
@media (max-width: 800px) {
  .split { grid-template-columns: 1fr; gap: var(--s-5); margin-bottom: var(--s-8); }
  .split-reverse .split-media { order: 0; }
}

/* ---------- Úvod: poznámka a závěr ---------- */

.note-band { background: var(--accent-ink); color: var(--on-accent); }
.note-text {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  line-height: 1.35;
  margin: 0;
}

.closing { text-align: left; }
.closing-inner { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-5); }
.closing-title { font-size: var(--fs-xl); max-width: 18em; margin: 0; }

/* ---------- Anketa ---------- */

.options {
  list-style: none;
  margin: 0; padding: 0;
  position: relative;
}
.options::before {
  content: '';
  position: absolute;
  left: 1.75rem; top: var(--s-6); bottom: var(--s-6);
  width: 2px;
  background: linear-gradient(var(--a1), var(--a2), var(--a3), var(--a4), var(--a5), var(--a6), var(--line));
  opacity: .35;
}
.option {
  position: relative;
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: var(--s-5);
  padding-block: var(--s-6);
  border-bottom: 1px solid var(--line);
}
.option:last-child { border-bottom: 0; }
.option .badge { position: relative; box-shadow: 0 0 0 6px var(--paper); }
.option .badge.a7, .option .badge.a8 { background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--a7), 0 0 0 6px var(--paper); }
.option-num {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--s-1);
}
.option h2 { font-size: var(--fs-lg); margin-bottom: var(--s-3); }
.option p { color: var(--ink-2); }
.option strong { color: var(--ink); }
.option-footnote { font-size: var(--fs-sm); color: var(--ink-3) !important; }

.letter-section { background: var(--paper-2); }
.letter-section .section-title { margin-bottom: var(--s-3); }
.letter {
  background: #fbf9f3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(var(--s-5), 5vw, var(--s-7));
  margin-top: var(--s-6);
  font-size: var(--fs-base);
  line-height: 1.7;
}
.letter a { word-break: break-all; }
.letter-sign { font-family: var(--font-display); font-style: italic; font-size: var(--fs-md); margin: var(--s-5) 0 0; }

@media (max-width: 560px) {
  .options::before { display: none; }
  .option {
    grid-template-columns: 2.75rem minmax(0, 1fr);
    column-gap: var(--s-4);
    row-gap: 0;
    padding-block: var(--s-6);
  }
  .option-body { display: contents; }
  .option .badge,
  .option .badge.a7, .option .badge.a8 { box-shadow: none; }
  .option .badge.a7, .option .badge.a8 { box-shadow: inset 0 0 0 1.5px var(--a7); }
  .option .badge-lg { width: 2.75rem; height: 2.75rem; grid-row: 1 / span 2; align-self: center; }
  .option-num { grid-column: 2; align-self: end; margin: 0; }
  .option h2 { grid-column: 2; margin: 0; font-size: var(--fs-md); line-height: 1.2; }
  .option p:not(.option-num) { grid-column: 1 / -1; margin-top: var(--s-4); margin-bottom: 0; }
  .option p + p:not(.option-num) { margin-top: var(--s-3); }
}

/* ---------- Výsledky ---------- */

.results-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  gap: var(--s-7);
  align-items: start;
}
.results-parties { position: sticky; top: 5.5rem; }
.results-parties .small { margin-bottom: var(--s-4); }

.method { margin-top: var(--s-4); font-size: var(--fs-sm); color: var(--ink-2); }
.method summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  padding-block: var(--s-2);
}
.method summary:hover { color: var(--accent); }
.method p { margin-top: var(--s-2); }

@media (max-width: 960px) {
  .results-layout { grid-template-columns: 1fr; }
  .results-parties { position: static; }
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-5);
  padding: var(--s-5);
  background: var(--paper-2);
  border-radius: var(--radius-lg);
  margin-bottom: var(--s-4);
}
.control-group { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.control-group legend {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 0;
  margin-bottom: var(--s-2);
}
.radio {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.radio input[type="radio"] { accent-color: var(--accent); transform: translateY(2px); width: 1.05rem; height: 1.05rem; flex: none; }
.radio.is-disabled { color: var(--ink-3); cursor: not-allowed; }
.soon {
  font-style: normal;
  font-size: var(--fs-xs);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 var(--s-2);
  margin-left: var(--s-1);
  white-space: nowrap;
}

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--a6); }

.num {
  width: 3.5rem;
  padding: 2px var(--s-2);
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-inline: 2px;
}
.select select {
  width: 100%;
  padding: var(--s-2) var(--s-6) var(--s-2) var(--s-3);
  font-size: var(--fs-sm);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a524d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-2) center;
  background-size: 1.1rem;
  cursor: pointer;
}
.search { position: relative; display: block; margin-top: var(--s-2); }
.search .icon { position: absolute; left: var(--s-3); top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; padding: var(--s-2) var(--s-3) var(--s-2) 2.5rem; font-size: var(--fs-sm); }

@media (max-width: 640px) {
  .controls { grid-template-columns: 1fr; padding: var(--s-4); }
}

.result-count { font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: var(--s-3); }

/* Tabulka kandidátů */
.cand-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.cand-table thead th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: var(--s-2) var(--s-3);
  border-bottom: 2px solid var(--ink);
}
.cand-table td {
  padding: var(--s-3);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.cand-row { transition: background-color var(--t) var(--ease); }
.cand-row:hover { background: #fbf9f3; }

.c-icon { width: 1%; white-space: nowrap; }
.c-icon .answer-text { display: none; }
.c-name { font-weight: 600; font-size: var(--fs-base); }
.c-name .pos {
  display: inline-block;
  min-width: 1.75rem;
  font-weight: 400;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
}
.c-party { color: var(--ink-2); }
.c-link { width: 1%; white-space: nowrap; }
.c-note { color: var(--ink-2); font-style: italic; }
.tag {
  display: inline-block;
  margin-left: var(--s-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 0 var(--s-2);
  border-radius: 999px;
}

.ext-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-weight: 600;
  text-decoration: none;
  padding: var(--s-1) var(--s-2);
  border-radius: var(--radius);
}
.ext-link:hover { background: var(--accent-soft); }
.ext-link .icon { width: 1rem; height: 1rem; }

.group-row th {
  text-align: left;
  padding: var(--s-6) var(--s-3) var(--s-2);
  border-bottom: 1px solid var(--ink);
  font-weight: 400;
}
.group-row:first-child th { padding-top: var(--s-3); }
.group-name { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 500; margin-right: var(--s-3); }
.group-score { font-size: var(--fs-sm); color: var(--ink-3); white-space: nowrap; }

.cand-table.is-grouped .c-party,
.cand-table.is-grouped thead th:nth-child(3) { display: none; }

/* Na mobilu se řádky mění na kompaktní karty */
@media (max-width: 640px) {
  .cand-table thead { display: none; }
  .cand-table, .cand-table tbody { display: block; }
  .group-row { display: block; }
  .group-row th { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding-inline: 0; }
  .group-name { min-width: 0; font-size: var(--fs-md); }
  .cand-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "icon name link"
      "icon answer link"
      ". party party"
      ". note note";
    column-gap: var(--s-3);
    row-gap: 2px;
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--line);
  }
  .cand-row td { display: block; padding: 0; border: 0; width: auto; }
  .c-icon { grid-area: icon; display: contents !important; }
  .c-icon .badge { grid-area: icon; align-self: start; }
  .c-icon .answer-text { display: block; grid-area: answer; font-size: var(--fs-xs); color: var(--ink-2); padding-left: 1.5rem; white-space: normal; line-height: 1.4; }
  .cand-row .c-name { grid-area: name; display: flex; flex-wrap: wrap; align-items: baseline; line-height: 1.3; }
  .c-name .pos { min-width: 1.5rem; }
  .c-name .name { flex: 1; min-width: 0; }
  .cand-row .c-party { grid-area: party; font-size: var(--fs-xs); padding-left: 1.5rem; }
  .c-link { grid-area: link; align-self: start; margin: calc(-1 * var(--s-2)) calc(-1 * var(--s-2)) 0 0; }
  .c-link .ext-text { display: none; }
  .ext-link { width: 2.75rem; height: 2.75rem; justify-content: center; padding: 0; }
  .ext-link .icon { width: 1.125rem; height: 1.125rem; }
  .cand-row .c-note { grid-area: note; font-size: var(--fs-xs); margin-top: var(--s-1); padding-left: 1.5rem; }
  .c-note:empty { display: none; }
  .cand-table tr:not(.cand-row):not(.group-row) { display: block; }
  .cand-table tr:not(.cand-row):not(.group-row) td { display: block; }
}

.legend { margin-top: var(--s-7); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.legend-list {
  list-style: none;
  margin: var(--s-4) 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--s-3) var(--s-5);
  font-size: var(--fs-sm);
}
.legend-list li { display: flex; align-items: center; gap: var(--s-3); }
.legend-num { min-width: 0.75rem; margin-right: calc(-1 * var(--s-2)); }

/* ---------- Textové stránky ---------- */

.prose h2 { font-size: var(--fs-lg); margin-top: var(--s-7); }
.prose p { max-width: 38em; }
.lead-first {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  line-height: 1.55;
}
.inline-cta {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: var(--s-4) var(--s-5);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-block: var(--s-6);
}
.inline-cta p { margin: 0; }
.after-link { margin-top: var(--s-7); }

.signature {
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}
.signature p { margin-bottom: var(--s-1); color: var(--ink-2); }
.signature .signature-name { font-family: var(--font-display); font-size: var(--fs-lg); font-style: italic; color: var(--ink); }

/* ---------- Patička ---------- */

.site-footer {
  background: var(--ink);
  color: #d9d6cc;
  padding-top: var(--s-8);
  margin-top: var(--s-8);
}
.site-footer a { color: #cfe3cf; }
.site-footer a:hover { color: #fff; }
.site-footer h2 { font-size: var(--fs-lg); color: var(--paper); }

.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-8);
  padding-bottom: var(--s-7);
}
.footer-block p { color: #bdbab0; font-size: var(--fs-sm); }

.form { display: flex; flex-direction: column; gap: var(--s-4); align-items: flex-start; }
.field { display: flex; flex-direction: column; gap: var(--s-1); width: 100%; }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--paper); }
.optional { font-weight: 400; color: #a9a69d; }
.site-footer input, .site-footer textarea {
  width: 100%;
  padding: var(--s-3);
  background: #2a312d;
  border-color: #414a45;
  color: var(--paper);
}
.site-footer input::placeholder { color: #8f948f; }
.site-footer input:hover, .site-footer textarea:hover { border-color: #6b736e; }
.site-footer input:focus-visible, .site-footer textarea:focus-visible { border-color: #9cc59c; box-shadow: 0 0 0 3px rgb(156 197 156 / .25); }
.site-footer textarea { resize: vertical; min-height: 7rem; }

.field-row { display: flex; gap: var(--s-2); width: 100%; }
.field-row input { flex: 1; min-width: 0; }
.site-footer .btn-solid { background: #cfe3cf; color: var(--ink); }
.site-footer .btn-solid:hover { background: #fff; }
.site-footer .btn-outline { color: var(--paper); border-color: #6b736e; }
.site-footer .btn-outline:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }

.form-status { margin: 0; font-size: var(--fs-sm); min-height: 1.4em; }
.form-status.is-ok { color: #a8d8a8 !important; }
.form-status.is-error { color: #f0a58f !important; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.share { margin-top: var(--s-6); }
.site-footer .share-title { font-size: var(--fs-md); margin-bottom: var(--s-3); }
.share-buttons { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font: 500 var(--fs-sm) var(--font-text);
  color: var(--paper) !important;
  background: transparent;
  border: 1px solid #414a45;
  border-radius: 999px;
  padding: var(--s-2) var(--s-4);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.share-btn:hover { background: #2a312d; border-color: #6b736e; }
.share-btn.is-done { border-color: #9cc59c; }
.share-btn .icon { width: 1.1rem; height: 1.1rem; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-2) var(--s-5);
  border-top: 1px solid #353c38;
  padding-block: var(--s-5);
  font-size: var(--fs-xs);
  color: #a9a69d;
}
.footer-bottom p { margin: 0; }

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--s-7); }
}
@media (max-width: 400px) {
  .field-row { flex-direction: column; }
}

/* ---------- Telefon: klidnější měřítko a čistší hrany ---------- */

@media (max-width: 640px) {
  :root {
    --fs-2xl: 2.375rem;
    --fs-xl: 1.75rem;
    --fs-lg: 1.375rem;
    --fs-base: 1.0625rem;
  }

  .section { padding-block: var(--s-7); }
  .section-tight { padding-top: var(--s-5); }
  .page-head { padding-block: var(--s-7) var(--s-5); }
  .section-title { margin-bottom: var(--s-5); }
  .lead { font-size: var(--fs-base); }
  .key-line { font-size: var(--fs-base); }

  /* Úvod */
  .hero { padding-top: var(--s-7); }
  .hero h1 { margin-bottom: var(--s-4); }
  .hero-actions { margin-top: var(--s-5); flex-direction: column; align-items: stretch; gap: var(--s-4); }
  .hero-actions .text-link { align-self: flex-start; }
  .btn-lg { width: 100%; padding-inline: var(--s-5); }
  .hero-ranking {
    background: none;
    border: 0;
    border-top: 2px solid var(--ink);
    border-radius: 0;
    padding: var(--s-5) 0 0;
    margin-top: var(--s-2);
  }
  .badge-xs { width: 1.375rem; height: 1.375rem; }
  .party-row { grid-template-columns: 1.75rem minmax(0, 1fr) auto; }

  .big-quote { font-size: 1.625rem; margin-bottom: var(--s-5); }
  .split { margin-bottom: var(--s-8); }
  .split-text h3 { margin-bottom: var(--s-4); }
  .split-media img { aspect-ratio: 3 / 2; border-radius: var(--radius); }
  .dash-list li { padding-left: var(--s-5); }
  .dash-list li::before { width: var(--s-3); }
  .note-text { font-size: 1.3125rem; line-height: 1.4; }
  .closing-title { font-size: 1.625rem; }

  /* Anketa: dopis bez rámečku, širší řádky */
  .letter {
    background: none;
    border: 0;
    border-left: 2px solid var(--line);
    border-radius: 0;
    padding: 0 0 0 var(--s-4);
    margin-top: var(--s-5);
    font-size: var(--fs-sm);
  }

  /* Výsledky */
  .results-layout { gap: var(--s-6); }
  .controls { margin-inline: calc(-1 * var(--gutter) / 2); }
  .section-title-sm { font-size: var(--fs-lg); }

  /* Texty */
  .lead-first { font-size: var(--fs-base); }
  .prose h2 { margin-top: var(--s-6); }
  .inline-cta { padding: var(--s-4); }

  /* Patička */
  .site-footer { padding-top: var(--s-7); margin-top: var(--s-7); }
  .footer-grid { gap: var(--s-6); padding-bottom: var(--s-6); }
  .share-buttons { gap: var(--s-2); }
  .share-btn { flex: 1 1 40%; justify-content: center; padding: var(--s-3); white-space: nowrap; }
  .footer-block + .footer-block { border-top: 1px solid #353c38; padding-top: var(--s-6); }
}

/* ---------- Pohyb ---------- */

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

/* ---------- Tisk (leták) ---------- */

@media print {
  body { background: #fff; font-size: 11pt; }
  .site-header, .site-footer, .nav-toggle, .controls, .skip, .hero-actions, .closing, .horizon, .method, .result-count { display: none !important; }
  .section, .page-head, .hero { padding-block: 12pt; }
  .results-layout, .hero-grid, .split { display: block; }
  .results-parties { position: static; margin-bottom: 12pt; }
  .note-band { background: none; color: #000; border-top: 1px solid #000; }
  .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .split-media img { max-height: 6cm; width: auto; }
  a { color: #000; text-decoration: none; }
  .cand-row { break-inside: avoid; }
}
