/* ==========================================================================
   Světlo Atlantidy – elegantní redakční vzhled
   Barvy a písma dodává stránka přes --brand-*; zde jen odvozeniny.
   ========================================================================== */

:root {
  /* mezery (vzdušná hustota) */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4.5rem;

  /* velikosti písma */
  --fs-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --fs-small: 0.875rem;
  --fs-h1: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
  --fs-h2: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
  --fs-h3: clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --fs-card-title: clamp(1.15rem, 1.05rem + 0.45vw, 1.4rem);

  /* odvozené odstíny */
  --c-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, var(--brand-text));
  --c-accent-hover: color-mix(in srgb, var(--brand-accent) 84%, var(--brand-text));
  --c-surface-2: color-mix(in srgb, var(--brand-surface) 55%, var(--brand-bg));
  --c-line: color-mix(in srgb, var(--brand-border) 80%, transparent);
  --c-line-strong: color-mix(in srgb, var(--brand-primary) 35%, var(--brand-border));
  --c-tint: color-mix(in srgb, var(--brand-primary) 8%, var(--brand-surface));
  --c-footer-line: color-mix(in srgb, var(--brand-footer-text) 24%, transparent);
  --c-footer-soft: color-mix(in srgb, var(--brand-footer-text) 88%, var(--brand-footer-bg));
  --c-selection: color-mix(in srgb, var(--brand-primary) 28%, var(--brand-surface));

  /* stíny (jen tam, kde jsou nutné) */
  --shadow-header: 0 6px 20px color-mix(in srgb, var(--brand-text) 10%, transparent);
  --shadow-popup: 0 16px 40px color-mix(in srgb, var(--brand-text) 24%, transparent);
  --shadow-drop: 0 10px 28px color-mix(in srgb, var(--brand-text) 16%, transparent);

  /* ostatní */
  --measure-line: 1.8;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 0.2s;
}

/* ---------- 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: var(--measure-line);
  -webkit-font-smoothing: antialiased;
  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;
  letter-spacing: -0.01em;
  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-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--t-fast) var(--ease), text-decoration-color var(--t-fast) var(--ease);
}

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

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 {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--brand-header-bg);
  color: var(--brand-header-text);
  border-bottom: 1px solid var(--c-line-strong);
  box-shadow: var(--shadow-header);
}

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

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

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

.header .nav a,
.header .nav li a {
  color: var(--brand-header-text);
  text-decoration: none;
  font-size: 0.9375rem;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--brand-radius);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

.header .nav a:hover {
  color: var(--brand-primary);
  background: var(--c-tint);
}

.header__toggle {
  background: transparent;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--brand-radius);
  color: var(--brand-header-text);
  padding: var(--space-xs);
  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-tint);
  border-color: var(--brand-primary);
}

/* ---------- Lišta rubrik ---------- */

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

.tray__inner { padding: 0 var(--space-md); }

.tray a {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  color: var(--brand-text);
  text-decoration: none;
  font-size: 0.9375rem;
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.45em;
  text-decoration-thickness: 2px;
  transition: color var(--t-fast) var(--ease), text-decoration-color var(--t-fast) var(--ease);
}

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

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

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

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

/* ---------- Mobilní menu ---------- */

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

.smallnav a {
  display: block;
  padding: var(--space-sm) var(--space-md);
  color: var(--brand-text);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-size: 1.25rem;
  border-bottom: 1px solid var(--c-line);
}

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

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

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

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

/* ---------- Hlavní obsah ---------- */

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

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

/* ---------- Karty článků (bez rámečku a stínu, jen mezery) ---------- */

.article {
  background: transparent;
  container-type: inline-size;
}

.article__image img {
  width: 100%;
  object-fit: cover;
  border-radius: var(--brand-radius);
  transition: opacity var(--t-fast) var(--ease);
}

.article__title {
  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-muted);
  font-size: 0.9875rem;
  line-height: 1.7;
}

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

.article__category a {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  text-decoration: none;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.article__category a:hover,
.article__category a:focus-visible {
  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;
}

/* ---------- Rubriky na úvodní stránce ---------- */

.bottom--category { margin-bottom: var(--space-xl); }

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

.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); }

/* ---------- Horní bloky ---------- */

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

/* ---------- Stránkování ---------- */

.pagination {
  margin-top: var(--space-xl);
}

.pagination a,
.pagination li {
  font-variant-numeric: tabular-nums;
}

.pagination a {
  display: inline-block;
  min-width: 44px;
  padding: var(--space-xs) var(--space-sm);
  color: var(--brand-text);
  text-decoration: none;
  border-radius: var(--brand-radius);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

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

.pagination__active {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border-radius: var(--brand-radius);
  padding: var(--space-xs) var(--space-sm);
  min-width: 44px;
}

/* ---------- Vyhledává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);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--brand-font-body);
  font-size: 1rem;
  min-height: 44px;
}

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

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

.search-form input[type="submit"],
.popup button {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 0;
  border-radius: var(--brand-radius);
  padding: var(--space-sm) var(--space-md);
  min-height: 44px;
  font-family: var(--brand-font-body);
  font-size: 1rem;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}

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

/* ---------- Článek ---------- */

.text__title {
  margin-bottom: var(--space-lg);
  letter-spacing: -0.02em;
}

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

.text__body {
  font-size: var(--fs-body);
  line-height: var(--measure-line);
  color: var(--brand-text);
}

.text__body p { margin-bottom: 1.25em; text-wrap: pretty; }

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

.text__body h3 {
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  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(--c-primary-hover);
  text-decoration-thickness: 2px;
}

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

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

.text__body blockquote {
  margin: 2em 0;
  padding: var(--space-xs) var(--space-lg);
  border-left: 2px solid var(--brand-primary);
  border-radius: 0;
  font-family: var(--brand-font-heading);
  font-size: 1.15em;
  color: var(--brand-text);
}

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

/* tabulky v článku */
.text table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin-bottom: 1.5em;
  font-variant-numeric: tabular-nums;
}

.text table th,
.text table td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--c-line);
  vertical-align: top;
}

.text table thead th,
.text table tr:first-child th,
.text table tr:first-child td {
  background: var(--c-tint);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  color: var(--brand-text);
}

/* obsah článku */
.table-of-content {
  background: var(--brand-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--brand-radius);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
}

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

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

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

.text__info p { margin-bottom: var(--space-xs); }

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

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

/* podobné články */
.text + .bottom {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--c-line-strong);
}

/* ---------- Panely (widgety) ---------- */

.sidebar h3:not(.article__title) {
  font-size: 1.2rem;
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--c-line-strong);
}

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

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

.sidebar .tags a {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  background: var(--c-tint);
  border-radius: var(--brand-radius);
  font-size: var(--fs-small);
}

.sidebar svg {
  stroke: currentColor;
  flex-shrink: 0;
}

.sidebar .promo a { color: var(--brand-primary); }
.sidebar .promo a:hover { color: var(--c-primary-hover); }

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

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

/* spodní panel nad patičkou */
.prefooter {
  background: var(--brand-surface);
  border-top: 1px solid var(--c-line-strong);
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

.prefooter__inner > div { padding: var(--space-xs) 0; }

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

.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  padding: var(--space-xl) var(--space-md);
}

.footer__inner p {
  color: var(--brand-footer-text);
  font-size: var(--fs-small);
  line-height: 1.7;
  margin-bottom: var(--space-xs);
}

.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; }

/* ---------- Popup ---------- */

.popup {
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-popup);
  padding: var(--space-lg);
}

.popup #close {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
}

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

@container (max-width: 260px) {
  .article__title { font-size: 1.05rem; }
  .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; }
