/* ==========================================================
   Cesty městy – elegantní redakční vzhled
   Barvy a písma dodává kód přes --brand-*, zde jen odvozeniny.
   ========================================================== */

:root {
  /* mezery (vzdušná hustota) */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.25rem;
  --space-xl: 3.5rem;
  --space-2xl: 5rem;

  /* odvozené odstíny */
  --c-surface-2: color-mix(in srgb, var(--brand-bg) 55%, var(--brand-surface));
  --c-tint: color-mix(in srgb, var(--brand-primary) 8%, var(--brand-bg));
  --c-tint-strong: color-mix(in srgb, var(--brand-primary) 16%, var(--brand-bg));
  --c-line: color-mix(in srgb, var(--brand-border) 85%, var(--brand-text));
  --c-primary-dark: color-mix(in srgb, var(--brand-primary) 82%, black);
  --c-accent-dark: color-mix(in srgb, var(--brand-accent) 78%, black);
  --c-link: color-mix(in srgb, var(--brand-primary) 90%, var(--brand-text));
  --c-selection: color-mix(in srgb, var(--brand-accent) 38%, var(--brand-bg));

  /* stíny (jen tam, kde je karta uvádí – hlavička, widgety) */
  --shadow-header: 0 6px 22px rgba(38, 29, 23, 0.16);
  --shadow-soft: 0 8px 24px rgba(38, 29, 23, 0.10);

  /* typografie */
  --fs-h1: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
  --fs-h2: clamp(1.5rem, 1.2rem + 1.1vw, 2.125rem);
  --fs-h3: clamp(1.2rem, 1.05rem + 0.55vw, 1.5rem);
  --fs-card: clamp(1.2rem, 1.1rem + 0.45vw, 1.45rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.875rem;
  --lh-body: 1.8;
  --lh-title: 1.2;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 0.2s;
}

/* ---------- základ ---------- */

html {
  color-scheme: light;
  scroll-padding-top: 6rem;
  scrollbar-color: var(--brand-primary) var(--brand-bg);
}

body {
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-size-adjust: from-font;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  caret-color: var(--brand-accent);
  accent-color: var(--brand-accent);
}

::selection {
  background: var(--c-selection);
  color: var(--brand-text);
}

h1, h2, h3, h4 {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size-adjust: from-font;
  line-height: var(--lh-title);
  color: var(--brand-text);
  text-wrap: balance;
}

p { text-wrap: pretty; }

a {
  color: var(--c-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--t-fast) var(--ease), text-decoration-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

a:hover { color: var(--c-primary-dark); }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 3px;
}

img {
  border-radius: var(--brand-radius);
}

/* ---------- hlavička (přilepená, hlavní barva) ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--brand-header-bg);
  color: var(--brand-header-text);
  box-shadow: var(--shadow-header);
}

.header__inner {
  padding-block: var(--space-sm);
}

.header__logo,
.logo,
.logo__name {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.375rem;
  color: var(--brand-header-text);
  text-decoration: none;
}

.header__logo:hover,
.logo:hover {
  color: var(--brand-header-text);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

@media (min-width: 768px) {
  .header__logo,
  .logo,
  .logo__name {
    font-size: 1.625rem;
  }
}

.header .nav a,
.header .nav li a {
  color: var(--brand-header-text);
  text-decoration: none;
}

.header .nav a:hover {
  color: var(--brand-header-text);
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.header__toggle {
  background: transparent;
  color: var(--brand-header-text);
  border: 1px solid var(--brand-header-text);
  border-radius: var(--brand-radius);
  cursor: pointer;
  min-width: 2.75rem;
  min-height: 2.75rem;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.header__toggle svg { stroke: currentColor; }

.header__toggle:hover {
  background: var(--brand-header-text);
  color: var(--brand-header-bg);
}

/* ---------- lišta rubrik ---------- */

.tray {
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-border);
}

.tray a {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  color: var(--brand-text);
  font-size: var(--fs-small);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.tray a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
  text-underline-offset: 0.35em;
}

.tray__more-button {
  background: transparent;
  color: var(--brand-text);
  border: 0;
  font: inherit;
  font-size: var(--fs-small);
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
}

.tray__more-button:hover { color: var(--brand-primary); }

.tray__dropdown {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-soft);
}

/* ---------- mobilní menu ---------- */

.smallnav {
  background: var(--brand-surface);
  color: var(--brand-text);
}

.smallnav a {
  display: block;
  padding: var(--space-xs) var(--space-sm);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-size: 1.5rem;
  text-decoration: none;
}

.smallnav a:hover { color: var(--brand-primary); }

.smallnav__close {
  background: transparent;
  border: 0;
  cursor: pointer;
  border-radius: var(--brand-radius);
}

.smallnav__close svg { stroke: var(--brand-text); }

/* ---------- vyhledávání ---------- */

.search-form form {
  display: flex;
  gap: var(--space-xs);
}

.search-form input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font: inherit;
}

.search-form input[type="text"]::placeholder { color: var(--brand-muted); }

.search-form input[type="submit"] {
  padding: 0.75rem 1.5rem;
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.search-form input[type="submit"]:hover {
  background: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
  color: var(--brand-on-primary);
}

/* ---------- úvodní stránka: řádky rubrik ---------- */

.bottom__title {
  font-size: var(--fs-h2);
  margin: 0 0 var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--c-line);
}

.bottom__title a {
  color: var(--brand-text);
  text-decoration: none;
}

.bottom__title a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* ---------- karty článků (bez rámečku a stínu) ---------- */

.article__image img {
  display: block;
  width: 100%;
  object-fit: cover;
  border-radius: var(--brand-radius);
}

.article__title {
  font-size: var(--fs-card);
  line-height: var(--lh-title);
}

.article__title a {
  color: var(--brand-text);
  text-decoration: none;
}

.article__title a:hover,
.article__title a:focus-visible {
  color: var(--brand-primary);
}

.article__perex {
  color: var(--brand-muted);
  font-size: 0.975rem;
  line-height: 1.7;
}

.article__date {
  color: var(--brand-muted);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}

.article__category {
  font-size: var(--fs-small);
  color: var(--brand-muted);
}

.article__category a {
  display: inline-block;
  padding: 0.15rem 0.7rem;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}

.article__category a:hover,
.article__category a:focus-visible {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
}

/* ---------- stránkování ---------- */

.pagination li {
  color: var(--brand-muted);
}

.pagination a {
  display: inline-block;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 0.85rem;
  color: var(--brand-text);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  text-decoration: none;
  text-align: center;
}

.pagination a:hover,
.pagination a:focus-visible {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.pagination__active {
  display: inline-block;
  min-width: 2.5rem;
  padding: 0.5rem 0.85rem;
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  text-align: center;
  font-weight: 600;
}

/* ---------- výpis kategorie / H1 ---------- */

.content > h1,
.articles + .pagination { margin-top: var(--space-lg); }

.content > h1 {
  font-size: var(--fs-h1);
  margin-bottom: var(--space-lg);
}

/* ---------- článek ---------- */

.text__title {
  font-size: var(--fs-h1);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin-bottom: var(--space-md);
}

.text__cover img {
  display: block;
  width: 100%;
  object-fit: cover;
  border-radius: var(--brand-radius);
}

.text__body {
  font-size: 1.125rem;
  line-height: var(--lh-body);
  color: var(--brand-text);
}

.text__body p { margin-block: 0 1.25em; }

.text__body h2 {
  font-size: var(--fs-h2);
  margin: 2.2em 0 0.9em;
}

.text__body h3 {
  font-size: var(--fs-h3);
  margin: 2em 0 0.8em;
}

.text__body a {
  color: var(--brand-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.text__body a:hover {
  color: var(--c-primary-dark);
  text-decoration-thickness: 2px;
}

.text__body ul,
.text__body ol {
  padding-left: 1.4em;
  margin-block: 0 1.25em;
}

.text__body li { margin-bottom: 0.5em; }
.text__body li::marker { color: var(--brand-primary); }

.text__body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--brand-radius);
}

.text__body blockquote {
  margin: 1.75em 0;
  padding: 0.25em 0 0.25em 1.5em;
  border-left: 3px solid var(--brand-primary);
  border-radius: 0;
  font-family: var(--brand-font-heading);
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--brand-text);
}

.text__body blockquote p:last-child { margin-bottom: 0; }

.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin-block: 0 1.5em;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.text__body th,
.text__body td {
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--brand-border);
  vertical-align: top;
}

.text__body tr:first-child th,
.text__body tr:first-child td {
  background: var(--c-tint-strong);
  color: var(--brand-text);
  font-weight: 600;
}

.text__body tr:nth-child(even) td { background: var(--c-surface-2); }
.text__body tr:first-child td { background: var(--c-tint-strong); }

.table-of-content {
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
}

.table-of-content > span {
  display: block;
  margin-bottom: var(--space-xs);
  font-family: var(--brand-font-heading);
  font-size: 1.25rem;
  color: var(--brand-text);
}

.table-of-content ul,
.table-of-content ol {
  margin: 0;
  padding-left: 1.2em;
}

.table-of-content a {
  color: var(--brand-text);
  text-decoration: none;
}

.table-of-content a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

.text__info {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--c-line);
  color: var(--brand-muted);
  font-size: var(--fs-small);
}

.text__info a {
  color: var(--brand-primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.text__info a:hover { color: var(--c-primary-dark); }

/* autor */

.text__body img.author {
  border-radius: var(--brand-radius);
  object-fit: cover;
}

.author-list a {
  color: var(--brand-text);
  text-decoration: none;
}

.author-list a:hover { color: var(--brand-primary); }

/* ---------- panel (widgety) a spodní panel ---------- */

.sidebar h3:not(.article__title),
.prefooter h3:not(.article__title) {
  font-size: var(--fs-h3);
  margin: 0 0 var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--c-line);
}

.prefooter {
  background: var(--brand-surface);
  border-top: 1px solid var(--brand-border);
  color: var(--brand-text);
}

.prefooter__inner { padding-block: var(--space-xl); }

.sidebar .nav a,
.prefooter .nav a,
.sidebar .authors a,
.prefooter .authors a,
.sidebar .promo a,
.prefooter .promo a {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-2xs) 0;
  color: var(--brand-text);
  text-decoration: none;
}

.sidebar .nav a:hover,
.prefooter .nav a:hover,
.sidebar .authors a:hover,
.prefooter .authors a:hover,
.sidebar .promo a:hover,
.prefooter .promo a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.prefooter svg {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  stroke: var(--brand-primary);
}

.prefooter .promo li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
}

.tags a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: 0.3rem 0.8rem;
  background: var(--c-tint);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-size: var(--fs-small);
  text-decoration: none;
}

.tags a:hover,
.tags a:focus-visible {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--brand-on-primary);
}

.sidebar .article__title,
.prefooter .article__title {
  font-size: 1.05rem;
  line-height: 1.35;
}

/* ---------- patička (tmavá) ---------- */

.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
}

.footer__inner {
  padding-block: var(--space-xl);
  font-size: var(--fs-small);
}

.footer p { color: var(--brand-footer-text); }

.footer a {
  color: var(--brand-footer-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.footer a:hover { text-decoration-thickness: 2px; }

/* ---------- popup ---------- */

.popup {
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-soft);
}

.popup button {
  background: transparent;
  color: var(--brand-text);
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  min-width: 2.25rem;
  min-height: 2.25rem;
  cursor: pointer;
}

.popup button:hover { color: var(--brand-primary); }

/* ---------- komponenty podle šířky kontejneru ---------- */

.bottom__inner,
.articles,
.top__inner,
.sidebar {
  container-type: inline-size;
}

@container (max-width: 22rem) {
  .article__title { font-size: 1.1rem; }
  .article__perex { font-size: 0.9rem; }
}

/* ---------- pohyb ---------- */

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

/* Template::addOverflowGuard: dlouhé slovo nebo doména v titulku nepřeteče úzký sloupec ani kartu */
:where(body) { overflow-wrap: break-word; }
:where(h1, h2, h3, h4, h5, h6, .article__title, .sidebar a) { overflow-wrap: anywhere; }
