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

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

  --fs-small: 0.875rem;
  --fs-body: 1.0625rem;
  --fs-article: 1.125rem;
  --fs-h1: clamp(1.875rem, 1.4rem + 2vw, 3rem);
  --fs-h2: clamp(1.375rem, 1.15rem + 1vw, 1.875rem);
  --fs-h3: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
  --fs-card-title: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);

  --c-surface-2: color-mix(in srgb, var(--brand-surface) 70%, var(--brand-border));
  --c-line: var(--brand-border);
  --c-line-strong: color-mix(in srgb, var(--brand-border) 60%, var(--brand-text));
  --c-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, black);
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 10%, var(--brand-bg));
  --c-accent-hover: color-mix(in srgb, var(--brand-accent) 82%, black);
  --c-footer-line: color-mix(in srgb, var(--brand-footer-text) 25%, transparent);
  --c-header-line: color-mix(in srgb, var(--brand-header-text) 30%, transparent);

  --shadow-header: 0 6px 18px rgba(0, 0, 0, 0.14);
  --shadow-soft: 0 8px 24px rgba(38, 29, 23, 0.12);

  --ease: cubic-bezier(0.25, 0.8, 0.3, 1);
  --t-fast: 0.2s;
}

/* ---------- Základ ---------- */
html {
  color-scheme: light;
  scroll-padding-top: 6rem;
  scrollbar-color: var(--brand-primary) var(--brand-surface);
  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);
  line-height: 1.7;
  font-size-adjust: from-font;
  caret-color: var(--brand-accent);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--brand-accent);
  color: var(--brand-on-accent);
}

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-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-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 {
  background: var(--brand-header-bg);
  color: var(--brand-header-text);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-header);
}

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

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

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

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

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

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

.header__toggle svg { stroke: currentColor; }

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

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

.header .nav a {
  color: var(--brand-header-text);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
}

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

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

.tray a {
  color: var(--brand-text);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--fs-small);
  padding: var(--space-sm) var(--space-md);
  display: inline-block;
}

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

.tray__more-button {
  background: transparent;
  border: 0;
  color: var(--brand-text);
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-small);
  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-soft);
}

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

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

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

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

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

/* ---------- Horní blok ---------- */
.top { background: transparent; }

.top .article { background: transparent; }

.top .article__title {
  font-size: var(--fs-h3);
}

.top .article:first-child .article__title {
  font-size: var(--fs-h2);
}

.top .article__perex {
  color: var(--brand-muted);
  font-size: 0.97rem;
}

/* ---------- Karty článků ---------- */
.article {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--c-line);
  padding-bottom: var(--space-md);
}

.article__image img {
  border-radius: var(--brand-radius);
  background: var(--c-surface-2);
}

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

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

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

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

.article__category {
  font-size: 0.8125rem;
  color: var(--brand-muted);
}

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  text-decoration: none;
  font-weight: 700;
  border-radius: var(--brand-radius);
  padding: 0.1rem 0.6rem;
}

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

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

/* ---------- Sekce a titulky ---------- */
.bottom__title,
.main h1 {
  font-family: var(--brand-font-heading);
}

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

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

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

.content > h2 {
  font-size: var(--fs-h2);
}

/* ---------- Vyhledávání ---------- */
.search-form input[type="text"] {
  background: var(--brand-bg);
  color: var(--brand-text);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--brand-radius);
  font: inherit;
  padding: var(--space-sm) var(--space-md);
}

.search-form input[type="text"]:focus {
  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: inherit;
  font-weight: 700;
  padding: var(--space-sm) var(--space-lg);
  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-hover);
  border-color: var(--c-primary-hover);
  color: var(--brand-on-primary);
}

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

.pagination a {
  color: var(--brand-text);
  border: 1px solid var(--c-line);
  border-radius: var(--brand-radius);
  background: var(--brand-bg);
  text-decoration: none;
  padding: var(--space-xs) var(--space-md);
  display: inline-block;
  min-width: 44px;
  text-align: center;
}

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

.pagination__active {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  font-weight: 700;
  padding: var(--space-xs) var(--space-md);
  min-width: 44px;
  text-align: center;
}

/* ---------- Článek ---------- */
.text__title {
  font-size: var(--fs-h1);
  letter-spacing: -0.01em;
}

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

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

.text__body p { text-wrap: pretty; }

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

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

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

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

.text__body li + li { margin-top: 0.35em; }

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

.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.97rem;
}

.text__body th,
.text__body td {
  text-align: left;
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--c-line);
  font-variant-numeric: tabular-nums;
  vertical-align: top;
}

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

.text__body tbody tr:nth-child(even) td { background: var(--brand-surface); }
.text__body table tr:first-child td { background: var(--brand-primary); }

.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);
  font-size: 0.97rem;
}

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

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

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

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

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

/* ---------- Pravý panel ---------- */
.sidebar h3:not(.article__title) {
  font-size: var(--fs-h3);
  border-bottom: 2px solid var(--brand-primary);
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-md);
}

.sidebar .article {
  background: transparent;
}

.sidebar .article__title {
  font-size: 1rem;
  font-family: var(--brand-font-heading);
}

.sidebar .nav a,
.sidebar .authors a,
.sidebar .promo a {
  color: var(--brand-text);
  text-decoration: none;
}

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

.sidebar .tags a {
  display: inline-block;
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--c-line);
  border-radius: var(--brand-radius);
  text-decoration: none;
  font-size: var(--fs-small);
  padding: 0.2rem 0.7rem;
}

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

.sidebar svg { stroke: currentColor; flex: none; }

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

.prefooter .nav a,
.prefooter .authors a,
.prefooter .tags a,
.prefooter .promo a {
  color: var(--brand-text);
  text-decoration: none;
}

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

.prefooter svg { stroke: currentColor; }

/* ---------- Patička ---------- */
.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  font-size: var(--fs-small);
  border-top: 1px solid var(--c-footer-line);
}

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

/* ---------- Popup ---------- */
.popup {
  background: var(--brand-bg);
  color: var(--brand-text);
  border: 1px solid var(--c-line);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-soft);
}

.popup #close {
  background: transparent;
  border: 0;
  color: var(--brand-text);
  font-size: 1.5rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

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

/* ---------- Ukazatel čtení (jen článek) ---------- */
.reading-progress { display: none; }

@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .reading-progress {
      display: block;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 4px;
      background: var(--brand-accent);
      transform-origin: left center;
      transform: scaleX(0);
      z-index: 100;
      animation: reading-progress-grow linear both;
      animation-timeline: scroll(root);
    }
  }
}

@keyframes reading-progress-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ---------- Komponenty podle kontejneru ---------- */
.sidebar,
.content { container-type: inline-size; }

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

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