/* Lidem.cz – elegantní redakční vzhled
   Barvy a písma dodává --brand-*, zde jen odvozené hodnoty a vzhled. */

: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-primary-dark: color-mix(in srgb, var(--brand-primary) 82%, #000);
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 12%, var(--brand-bg));
  --c-accent-dark: color-mix(in srgb, var(--brand-accent) 80%, #000);
  --c-rule: color-mix(in srgb, var(--brand-primary) 28%, var(--brand-bg));
  --c-rule-strong: color-mix(in srgb, var(--brand-primary) 55%, var(--brand-bg));
  --c-surface-2: color-mix(in srgb, var(--brand-surface) 60%, var(--brand-bg));
  --c-footer-rule: color-mix(in srgb, var(--brand-footer-text) 22%, transparent);
  --c-footer-soft: color-mix(in srgb, var(--brand-footer-text) 92%, var(--brand-footer-bg));
  --c-header-rule: color-mix(in srgb, var(--brand-header-text) 25%, transparent);
  --c-selection: color-mix(in srgb, var(--brand-accent) 28%, var(--brand-bg));

  /* stíny */
  --shadow-header: 0 6px 22px rgba(23, 28, 38, 0.18);
  --shadow-popup: 0 18px 48px rgba(23, 28, 38, 0.35);
  --shadow-soft: 0 6px 20px rgba(23, 28, 38, 0.10);

  /* velikosti písma */
  --fs-h1: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
  --fs-h2: clamp(1.5rem, 1.2rem + 1.3vw, 2.25rem);
  --fs-h3: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
  --fs-card: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  --fs-body: clamp(1.0625rem, 1rem + 0.2vw, 1.15rem);
  --fs-small: 0.8125rem;
  --fs-label: 0.75rem;

  --t-fast: 0.2s ease;
  --t-base: 0.3s ease;
}

/* ---------- Základ ---------- */
html {
  color-scheme: light;
  scroll-padding-top: 6rem;
  scrollbar-color: var(--brand-primary) var(--brand-bg);
  accent-color: var(--brand-accent);
}

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

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

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

a {
  color: var(--brand-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--t-fast), text-decoration-color var(--t-fast), background-color var(--t-fast);
}

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

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

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.15;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { text-wrap: pretty; }

/* ---------- Hlavička (hlavní barva, přilepená) ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--brand-header-bg);
  color: var(--brand-header-text);
  border-bottom: 1px solid var(--c-header-rule);
  box-shadow: var(--shadow-header);
}

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

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

.logo__name {
  color: var(--brand-header-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  letter-spacing: 0.01em;
}

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

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

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

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

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

.header__toggle:hover {
  background: color-mix(in srgb, var(--brand-header-text) 14%, transparent);
  border-color: var(--brand-header-text);
}

.header__toggle:focus-visible,
.smallnav__close:focus-visible {
  outline-color: var(--brand-header-text);
}

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

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

.header a:focus-visible {
  outline-color: var(--brand-header-text);
}

/* ---------- Lišta rubrik pod hlavičkou ---------- */
.tray {
  background: var(--brand-surface);
  border-bottom: 1px solid var(--c-rule);
}

.tray a {
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

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

.tray__more-button {
  background: transparent;
  color: var(--brand-text);
  border: 1px solid var(--c-rule);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-body);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}

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

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

.tray__dropdown a {
  color: var(--brand-text);
}

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

/* ---------- Mobilní menu ---------- */
.smallnav {
  background: var(--brand-surface);
  color: var(--brand-text);
}

.smallnav ul {
  list-style: none;
}

.smallnav a {
  display: block;
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.5rem;
  text-decoration: none;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--c-rule);
  transition: color var(--t-fast);
}

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

.smallnav__close {
  background: transparent;
  border: 1px solid var(--c-rule);
  border-radius: var(--brand-radius);
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

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

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

/* ---------- Horní blok (pokud se objeví) ---------- */
.top .article__title a {
  color: var(--brand-text);
}

/* ---------- Karty článků (bez rámečku, vzdušné) ---------- */
.article {
  color: var(--brand-text);
}

.article__image img {
  border-radius: var(--brand-radius);
  transition: opacity var(--t-base);
}

.article__image a:hover img {
  opacity: 0.92;
}

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

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

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

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

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

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  padding: 0.15em 0.7em;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color var(--t-fast), color var(--t-fast);
}

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

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

/* ---------- Řádky rubrik na úvodní stránce ---------- */
.bottom__title {
  font-size: var(--fs-h2);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--c-rule-strong);
}

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

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

/* ---------- Vyhledávání ---------- */
.search-form form {
  display: flex;
  gap: var(--space-xs);
}

.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: 1rem;
  padding: 0.7rem 1rem;
  transition: border-color var(--t-fast);
}

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

.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: 0.7rem 1.4rem;
  cursor: pointer;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}

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

/* ---------- Článek ---------- */
.text__title {
  font-size: var(--fs-h1);
  line-height: 1.1;
}

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

.text__body {
  font-size: var(--fs-body);
  line-height: 1.8;
}

.text__body h2 {
  margin-top: 2em;
  margin-bottom: 0.5em;
  font-size: var(--fs-h2);
}

.text__body h3 {
  margin-top: 1.8em;
  margin-bottom: 0.45em;
  font-size: var(--fs-h3);
}

.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(--brand-accent);
  text-decoration-thickness: 2px;
}

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

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

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

.text__body blockquote {
  margin: var(--space-lg) 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.3em;
  line-height: 1.5;
  color: var(--brand-text);
}

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

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

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

.text__body table thead th {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  font-weight: 600;
}

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

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

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

.text__info {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--c-rule-strong);
  color: var(--brand-muted);
  font-size: 0.9rem;
}

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

.text__info a:hover {
  color: var(--brand-accent);
}

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

/* ---------- Stránkování ---------- */
.pagination a,
.pagination li {
  font-variant-numeric: tabular-nums;
}

.pagination a {
  display: inline-block;
  min-width: 44px;
  padding: 0.5rem 0.9rem;
  text-align: center;
  color: var(--brand-primary);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  text-decoration: none;
  transition: color var(--t-fast), border-color var(--t-fast), background-color var(--t-fast);
}

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

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

/* ---------- Spodní panel nad patičkou (sloupce odkazů) ---------- */
.prefooter {
  border-top: 1px solid var(--c-rule-strong);
}

.prefooter h3,
.sidebar h3:not(.article__title) {
  font-size: 1.4rem;
  padding-bottom: var(--space-2xs);
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--c-rule-strong);
  color: var(--brand-text);
}

.prefooter .nav ul,
.prefooter .tags,
.prefooter .authors,
.prefooter .promo,
.sidebar .nav ul,
.sidebar .tags,
.sidebar .authors,
.sidebar .promo {
  list-style: none;
  padding: 0;
  margin: 0;
}

.prefooter li,
.sidebar li {
  margin-bottom: var(--space-2xs);
}

.prefooter .nav a,
.prefooter .tags a,
.prefooter .authors a,
.sidebar .nav a,
.sidebar .tags a,
.sidebar .authors a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  min-height: 24px;
  color: var(--brand-text);
  text-decoration: none;
  transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

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

.prefooter svg {
  flex: none;
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

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

.prefooter .promo svg {
  margin-top: 0.3em;
  color: var(--brand-muted);
}

.prefooter .promo a {
  color: var(--brand-primary);
}

.prefooter .promo a:hover {
  color: var(--brand-accent);
}

.prefooter .article__title {
  font-size: 1.05rem;
}

/* ---------- Patička (tmavá) ---------- */
.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  border-top: 1px solid var(--c-footer-rule);
}

.footer p {
  color: var(--brand-footer-text);
  font-size: 0.9rem;
}

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

.footer a:hover {
  color: var(--c-footer-soft);
  text-decoration-thickness: 2px;
}

.footer a:focus-visible {
  outline-color: var(--brand-footer-text);
}

/* ---------- 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: transparent;
  color: var(--brand-text);
  border: 0;
  font-size: 1.75rem;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  transition: color var(--t-fast);
}

.popup #close:hover {
  color: var(--brand-accent);
}

/* ---------- Komponenty podle šířky kontejneru ---------- */
.articles,
.bottom__inner,
.sidebar {
  container-type: inline-size;
}

@container (max-width: 360px) {
  .article__title {
    font-size: 1.15rem;
  }
  .article__perex {
    font-size: 0.9rem;
  }
}

/* ---------- 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; }
