/* ==========================================================
   Svazek ve Veveří – vzhled (přívětivý, vzdušný, tónované pozadí)
   Rozložení dodává společný základ base-v7; zde jen vzhled.
   ========================================================== */

:root {
  color-scheme: light;

  /* mezery */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.25rem;
  --space-2xl: 3.5rem;

  /* odvozené odstíny z --brand-* */
  --c-surface-2: color-mix(in srgb, var(--brand-primary) 7%, var(--brand-surface));
  --c-surface-3: color-mix(in srgb, var(--brand-primary) 13%, var(--brand-surface));
  --c-line: color-mix(in srgb, var(--brand-border) 85%, var(--brand-primary));
  --c-primary-dark: color-mix(in srgb, var(--brand-primary) 82%, black);
  --c-accent-dark: color-mix(in srgb, var(--brand-accent) 80%, black);
  --c-header-hover: color-mix(in srgb, var(--brand-header-bg) 82%, black);
  --c-footer-line: color-mix(in srgb, var(--brand-footer-text) 25%, transparent);

  /* stíny */
  --shadow-card: 0 6px 20px color-mix(in srgb, var(--brand-text) 11%, transparent);
  --shadow-card-hover: 0 10px 28px color-mix(in srgb, var(--brand-text) 18%, transparent);
  --shadow-header: 0 4px 16px color-mix(in srgb, var(--brand-text) 22%, transparent);
  --shadow-soft: 0 3px 10px color-mix(in srgb, var(--brand-text) 9%, transparent);

  /* typografie */
  --fs-h1: clamp(1.75rem, 1.35rem + 1.9vw, 2.75rem);
  --fs-h2: clamp(1.25rem, 1.1rem + 0.8vw, 1.75rem);
  --fs-h3: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  --fs-body: clamp(1.0625rem, 1.03rem + 0.15vw, 1.125rem);
  --fs-small: 0.875rem;

  --ease: 0.25s ease;
}

/* ---------- Základ ---------- */
html {
  scroll-padding-top: 5rem;
  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: 1.75;
  font-size-adjust: from-font;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--brand-accent);
  accent-color: var(--brand-accent);
}

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

h1, h2, h3, h4 {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  color: var(--brand-text);
  line-height: 1.25;
  font-size-adjust: from-font;
  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(--ease), text-decoration-color var(--ease), box-shadow var(--ease);
}

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

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

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

/* ---------- Hlavička (hlavní barva, přilepená) ---------- */
.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-top: var(--space-md);
  padding-bottom: var(--space-md);
}

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

.header__logo,
.logo {
  font-size: 1.375rem;
}

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

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

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

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

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

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

.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);
  border-radius: var(--brand-radius);
  transition: background-color var(--ease), color var(--ease);
}

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

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

.tray a {
  color: var(--brand-text);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  padding: var(--space-sm) var(--space-md);
  transition: color var(--ease), background-color var(--ease);
}

.tray a:hover {
  color: var(--brand-primary);
  background: var(--c-surface-2);
}

.tray__more-button {
  background: transparent;
  color: var(--brand-text);
  border: 0;
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  cursor: pointer;
  padding: var(--space-sm) var(--space-md);
  transition: color var(--ease), background-color var(--ease);
}

.tray__more-button:hover {
  color: var(--brand-primary);
  background: var(--c-surface-2);
}

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

/* ---------- 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.125rem;
  padding: var(--space-sm) var(--space-md);
  transition: color var(--ease);
}

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

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

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

/* ---------- Hlavní plocha (obaly bez vlastní plochy) ---------- */
.wrapper,
.main,
.main__inner,
.content,
.articles {
  background: transparent;
}

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

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

.search-form input[type="text"] {
  background: var(--brand-surface);
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: 1rem;
  border: 1px solid var(--c-line);
  border-radius: var(--brand-radius);
  padding: var(--space-sm) var(--space-md);
  min-height: 44px;
  box-shadow: var(--shadow-soft);
}

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

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

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

/* ---------- Karty článků ---------- */
.article {
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-card);
  padding: var(--space-md);
  transition: box-shadow var(--ease);
}

.article:hover {
  box-shadow: var(--shadow-card-hover);
}

.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-h3);
  line-height: 1.3;
}

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

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

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

.article__category a {
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-small);
  padding: 0.15rem 0.7rem;
  border-radius: var(--brand-radius);
  transition: background-color var(--ease), color var(--ease);
}

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

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

/* ---------- Sekce výpisů (kategorie, podobné články) ---------- */
.bottom__title {
  margin-bottom: var(--space-lg);
}

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

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

/* ---------- Stránkování ---------- */
.pagination a,
.pagination li {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
}

.pagination a {
  background: var(--brand-surface);
  color: var(--brand-primary);
  text-decoration: none;
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-soft);
  padding: var(--space-xs) var(--space-md);
  min-height: 40px;
  min-width: 40px;
  transition: background-color var(--ease), color var(--ease);
}

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

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

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

.sidebar .nav,
.sidebar .tags,
.sidebar .promo,
.sidebar .authors {
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-soft);
  padding: var(--space-md);
}

.sidebar .article {
  box-shadow: var(--shadow-soft);
  padding: var(--space-sm);
}

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

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

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

.sidebar .tags a {
  background: var(--c-surface-2);
  border-radius: var(--brand-radius);
  padding: 0.2rem 0.7rem;
}

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

/* ---------- Spodní panel nad patičkou ---------- */
.prefooter {
  background: var(--c-surface-3);
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

.prefooter h3:not(.article__title) {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-h2);
  color: var(--brand-text);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--brand-primary);
}

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

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

.prefooter svg { stroke: var(--brand-primary); }

.prefooter .tags a {
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  padding: 0.2rem 0.7rem;
}

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

.prefooter .tags a:hover svg { stroke: var(--brand-on-primary); }

.prefooter .article {
  box-shadow: var(--shadow-soft);
  padding: var(--space-sm);
}

/* ---------- Patička (tmavá) ---------- */
.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
  font-size: var(--fs-small);
}

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

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

.footer__inner p + p {
  border-top: 1px solid var(--c-footer-line);
  padding-top: var(--space-sm);
}

/* ---------- Detail článku ---------- */
.text {
  background: transparent;
}

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

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

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

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

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

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

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

.text__body blockquote {
  margin: 1.75em 0;
  padding: var(--space-sm) var(--space-lg);
  border-left: 3px solid var(--brand-primary);
  color: var(--brand-muted);
  font-style: italic;
}

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

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

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

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

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

.table-of-content {
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-soft);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
}

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

.text__info {
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-soft);
  padding: var(--space-md) var(--space-lg);
  margin-top: var(--space-xl);
  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(--brand-accent); }

/* ---------- Stránka autora ---------- */
.author {
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-soft);
}

.author-list a {
  color: var(--brand-text);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  transition: color var(--ease);
}

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

/* ---------- Popup ---------- */
.popup {
  background: var(--brand-surface);
  color: var(--brand-text);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-card-hover);
}

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

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

/* ---------- 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;
      z-index: 60;
      background: var(--brand-accent);
      transform-origin: left center;
      transform: scaleX(0);
      animation: reading-progress-grow linear both;
      animation-timeline: scroll(root);
    }
  }
}

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

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

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

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