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

:root {
  /* mezery */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;

  /* velikosti písma */
  --fs-small: 0.8125rem;
  --fs-base: 1.0625rem;
  --fs-h1: clamp(1.875rem, 1.4rem + 2vw, 2.875rem);
  --fs-h2: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  --fs-h3: clamp(1.1875rem, 1.1rem + 0.45vw, 1.4375rem);
  --fs-card-title: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);

  /* odvozené odstíny */
  --c-line: color-mix(in srgb, var(--brand-text) 16%, var(--brand-bg));
  --c-line-strong: color-mix(in srgb, var(--brand-text) 32%, var(--brand-bg));
  --c-surface-tint: color-mix(in srgb, var(--brand-primary) 6%, var(--brand-surface));
  --c-primary-dark: color-mix(in srgb, var(--brand-primary) 82%, #000);
  --c-header-line: color-mix(in srgb, var(--brand-header-text) 22%, var(--brand-header-bg));
  --c-header-hover: color-mix(in srgb, var(--brand-header-bg) 86%, #fff);
  --c-footer-line: color-mix(in srgb, var(--brand-footer-text) 24%, var(--brand-footer-bg));
  --c-footer-soft: color-mix(in srgb, var(--brand-footer-bg) 88%, #fff);
  --c-selection: color-mix(in srgb, var(--brand-primary) 28%, var(--brand-bg));

  /* stíny */
  --shadow-header: 0 6px 20px rgba(0, 0, 0, 0.22);
  --shadow-soft: 0 6px 18px color-mix(in srgb, var(--brand-text) 14%, transparent);
  --shadow-popup: 0 18px 48px rgba(0, 0, 0, 0.3);

  /* pohyb */
  --ease: cubic-bezier(0.2, 0.6, 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-base);
  font-size-adjust: from-font;
  line-height: 1.7;
  accent-color: var(--brand-accent);
  caret-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;
  color: var(--brand-text);
  line-height: 1.2;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { text-wrap: pretty; }

a {
  color: var(--brand-primary);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  transition: color var(--t-fast) var(--ease), text-decoration-color 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 ---------- */

.header {
  background: var(--brand-header-bg);
  color: var(--brand-header-text);
  border-bottom: 1px solid var(--c-header-line);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-header);
}

.header__inner {
  padding-top: var(--space-xs);
  padding-bottom: var(--space-xs);
}

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

.header__logo { font-size: 1.375rem; }

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

.header__logo:hover,
.logo:hover { color: var(--brand-header-text); }

.logo__mark { color: var(--brand-header-text); }

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

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

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

.header .nav a {
  color: var(--brand-header-text);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease), text-decoration-color var(--t-fast) var(--ease);
}

.header .nav a:hover {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

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

.tray {
  background: var(--brand-header-bg);
  border-bottom: 1px solid var(--c-header-line);
}

.tray a {
  color: var(--brand-header-text);
  text-decoration: none;
  font-family: var(--brand-font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: var(--space-2xs) var(--space-xs);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), text-decoration-color var(--t-fast) var(--ease);
}

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

.tray a:focus-visible {
  outline: 2px solid var(--brand-header-text);
  outline-offset: 2px;
}

.tray__more-button {
  background: transparent;
  color: var(--brand-header-text);
  border: 0;
  font-family: var(--brand-font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: text-decoration-color var(--t-fast) var(--ease);
}

.tray__more-button:hover {
  text-decoration: underline;
  text-underline-offset: 0.35em;
}

.tray__dropdown {
  background: var(--brand-header-bg);
  border: 1px solid var(--c-header-line);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-header);
}

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

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

.smallnav a {
  color: var(--brand-text);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.375rem;
  transition: color var(--t-fast) var(--ease);
}

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

.smallnav li { border-bottom: 1px solid var(--brand-border); }

.smallnav__close {
  background: transparent;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease);
}

.smallnav__close svg { stroke: var(--brand-text); }
.smallnav__close:hover { border-color: var(--brand-primary); }

/* ---------- horní blok ---------- */

.top {
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
}

.top .article__title {
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
}

.top .article:first-child .article__title {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
}

/* ---------- karty článků (bez rámečku, oddělené linkou) ---------- */

.article {
  background: transparent;
  border-bottom: 1px solid var(--c-line-strong);
  padding-bottom: var(--space-sm);
}

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

.article__title {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-card-title);
  line-height: 1.25;
  text-wrap: balance;
}

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

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

.article__perex {
  color: var(--brand-text);
  font-size: 0.9688rem;
  line-height: 1.6;
}

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

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  font-weight: 600;
  text-decoration: none;
  padding: 0.15rem 0.6rem;
  border-radius: var(--brand-radius);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

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

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

/* ---------- hlavní obsah ---------- */

.content > h1,
.content > h2 {
  margin-bottom: var(--space-sm);
}

.content > h2 {
  padding-bottom: var(--space-2xs);
  border-bottom: 2px solid var(--brand-text);
}

.bottom__title {
  font-size: var(--fs-h2);
  padding-bottom: var(--space-2xs);
  border-bottom: 2px solid var(--brand-text);
}

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

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

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

.pagination a,
.pagination li {
  font-family: var(--brand-font-body);
  font-weight: 600;
}

.pagination a {
  color: var(--brand-primary);
  text-decoration: none;
  border: 1px solid var(--brand-border);
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  padding: var(--space-3xs) var(--space-xs);
  min-width: 2.25rem;
  min-height: 2.25rem;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

.pagination a:hover {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  background: var(--c-surface-tint);
}

.pagination__active {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border-radius: var(--brand-radius);
}

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

.text__title {
  font-size: var(--fs-h1);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

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

.text__body {
  background: transparent;
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--brand-text);
}

.text__body h2,
.text__body h3,
.text__body h4 {
  margin-top: 2em;
  margin-bottom: 0.9em;
}

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

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

.text__body blockquote {
  margin: var(--space-md) 0;
  padding: var(--space-xs) var(--space-md);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0;
  font-family: var(--brand-font-heading);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--brand-text);
}

.text__body ul,
.text__body ol { padding-left: 1.4em; }

.text__body li { margin-bottom: 0.4em; }

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

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

.text__body table tr:first-child th,
.text__body table tr:first-child td {
  background: var(--brand-text);
  color: var(--brand-bg);
  font-weight: 700;
}

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

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

.table-of-content > span {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.125rem;
}

.table-of-content a { text-decoration: none; }
.table-of-content a:hover { text-decoration: underline; }

.text__info {
  border-top: 1px solid var(--c-line-strong);
  padding-top: var(--space-sm);
  color: var(--brand-muted);
  font-size: 0.9375rem;
}

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

.author {
  border-radius: var(--brand-radius);
}

/* ---------- hledání ---------- */

.search-form input[type="text"] {
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-body);
  font-size: var(--fs-base);
  padding: var(--space-2xs) var(--space-sm);
  min-height: 44px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

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

.search-form input[type="text"]:focus {
  border-color: var(--brand-primary);
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.search-form input[type="submit"] {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-body);
  font-weight: 600;
  padding: var(--space-2xs) var(--space-md);
  min-height: 44px;
  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);
}

/* ---------- spodní panel ---------- */

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

.sidebar h3:not(.article__title),
.prefooter h3:not(.article__title) {
  font-size: 1.1875rem;
  padding-bottom: var(--space-2xs);
  margin-bottom: var(--space-xs);
  border-bottom: 2px solid var(--brand-text);
}

.sidebar a,
.prefooter a {
  color: var(--brand-text);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

.sidebar a:hover,
.prefooter a:hover { color: var(--brand-primary); }

.sidebar .nav li,
.prefooter .nav li,
.authors li,
.promo li {
  border-bottom: 1px solid var(--c-line);
}

.sidebar svg,
.prefooter svg {
  stroke: var(--brand-primary);
  flex-shrink: 0;
}

.tags a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  background: var(--brand-bg);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: var(--space-3xs) var(--space-xs);
  font-size: 0.875rem;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

.tags a:hover {
  border-color: var(--brand-primary);
  background: var(--c-surface-tint);
}

.sidebar .article {
  border-bottom: 1px solid var(--c-line);
}

.sidebar .article__title,
.prefooter .article__title {
  font-size: 1rem;
}

.similar { background: transparent; }

/* ---------- patička ---------- */

.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  border-top: 1px solid var(--c-footer-line);
}

.footer__inner {
  font-size: 0.9375rem;
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
}

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

.footer a {
  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-popup);
}

.popup #close {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 0;
  border-radius: var(--brand-radius);
  min-width: 36px;
  min-height: 36px;
  font-size: 1.25rem;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}

.popup #close:hover { background: var(--c-primary-dark); }

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

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

@container (max-width: 520px) {
  .article__title { font-size: 1.125rem; }
  .article__perex { font-size: 0.9375rem; }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !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; }
