/* ==========================================================
   Naše adresa – moderní tmavý redakční vzhled
   Barvy a písma jen přes --brand-*, rozložení dodává základ.
   ========================================================== */

:root {
  color-scheme: dark;

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

  /* odvozené odstíny */
  --c-surface-2: color-mix(in srgb, var(--brand-surface) 80%, var(--brand-bg));
  --c-surface-3: color-mix(in srgb, var(--brand-surface) 88%, var(--brand-text));
  --c-border-soft: color-mix(in srgb, var(--brand-border) 60%, transparent);
  --c-border-strong: color-mix(in srgb, var(--brand-border) 70%, var(--brand-text));
  --c-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, var(--brand-text));
  --c-accent-hover: color-mix(in srgb, var(--brand-accent) 82%, var(--brand-text));
  --c-link-underline: color-mix(in srgb, var(--brand-primary) 55%, transparent);
  --c-selection: color-mix(in srgb, var(--brand-primary) 45%, var(--brand-bg));

  /* stíny */
  --shadow-card: 0 6px 18px rgba(0, 0, 0, 0.28);
  --shadow-card-hover: 0 10px 28px rgba(0, 0, 0, 0.38);
  --shadow-header: 0 6px 20px rgba(0, 0, 0, 0.3);

  /* velikosti písma */
  --fs-h1: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
  --fs-h2: clamp(1.35rem, 1.1rem + 1.1vw, 1.9rem);
  --fs-h3: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  --fs-card: clamp(1.02rem, 0.98rem + 0.25vw, 1.15rem);
  --fs-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --fs-small: 0.875rem;

  --header-h: 4.5rem;
}

/* ---------- Základ ---------- */

html {
  scroll-padding-top: calc(var(--header-h) + var(--space-md));
  scrollbar-color: var(--brand-border) var(--brand-bg);
}

body {
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: 1rem;
  line-height: 1.6;
  font-size-adjust: from-font;
  -webkit-font-smoothing: antialiased;
}

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

input,
textarea,
button,
select {
  caret-color: var(--brand-accent);
  accent-color: var(--brand-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.22;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s 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 {
  max-width: 100%;
  border-radius: var(--brand-radius);
}

/* ---------- Hlavička ---------- */

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

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

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

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

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

.header__toggle {
  background: transparent;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--brand-radius);
  color: var(--brand-header-text);
  min-width: 2.75rem;
  min-height: 2.75rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.header__toggle svg {
  stroke: currentColor;
}

.header__toggle:hover {
  background: var(--c-surface-3);
  border-color: var(--brand-primary);
}

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

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

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

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

.tray a {
  color: var(--brand-header-text);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  font-size: var(--fs-small);
  padding: var(--space-sm) var(--space-md);
  display: inline-block;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.tray a:hover,
.tray a:focus-visible {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.tray__more-button {
  background: transparent;
  color: var(--brand-header-text);
  border: 0;
  font-family: var(--brand-font-heading);
  font-weight: 600;
  font-size: var(--fs-small);
  cursor: pointer;
  transition: color 0.2s ease;
}

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

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

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

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

.smallnav a {
  color: var(--brand-header-text);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  display: block;
  padding: var(--space-sm) var(--space-md);
}

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

.smallnav__close {
  background: transparent;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--brand-radius);
  color: var(--brand-header-text);
  cursor: pointer;
}

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

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

/* ---------- Plochy a obaly ---------- */

.wrapper,
.main,
.main__inner,
.content,
.top,
.articles {
  background: transparent;
}

/* ---------- Karty článků ---------- */

.article {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding-bottom: var(--space-md);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.25s ease;
}

.article:hover {
  border-color: var(--c-border-strong);
  box-shadow: var(--shadow-card);
}

.article__image img {
  display: block;
  width: 100%;
  border-radius: 0;
}

.article__title,
.article__perex,
.article__category,
.article__date {
  margin-inline: var(--space-md);
}

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

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

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

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

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

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  padding: 0.1rem 0.6rem;
  font-weight: 600;
  line-height: 1.6;
}

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

/* Horní blok */

.top .article {
  border-color: var(--brand-border);
}

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

/* Spodní bloky a výpisy rubrik */

.bottom__title {
  font-size: var(--fs-h2);
  margin-block: 0 var(--space-md);
}

.bottom__title a {
  color: var(--brand-text);
  border-bottom: 2px solid var(--brand-primary);
  padding-bottom: var(--space-2xs);
}

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

.bottom .article {
  background: var(--brand-surface);
}

/* ---------- Nadpisy stránky ---------- */

.content > h1,
.content > h2,
.articles + h2 {
  font-size: var(--fs-h2);
}

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

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

.pagination a,
.pagination li {
  font-family: var(--brand-font-heading);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pagination a {
  display: inline-block;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.8rem;
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  text-align: center;
}

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

.pagination__active {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  min-width: 2.5rem;
  padding: 0.45rem 0.8rem;
  text-align: center;
}

/* ---------- 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: 0.65rem 0.9rem;
  font-family: var(--brand-font-body);
  font-size: 1rem;
}

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

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

.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);
  padding: 0.65rem 1.2rem;
  font-family: var(--brand-font-heading);
  font-weight: 600;
  cursor: pointer;
  min-height: 2.75rem;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

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

/* ---------- Pravý panel ---------- */

.sidebar h3:not(.article__title) {
  font-size: var(--fs-h3);
  color: var(--brand-text);
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-sm);
  border-bottom: 2px solid var(--brand-primary);
}

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

.sidebar .nav a,
.sidebar .authors a {
  display: block;
  color: var(--brand-text);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--c-border-soft);
}

.sidebar .nav a:hover,
.sidebar .nav a:focus-visible,
.sidebar .authors a:hover,
.sidebar .authors a:focus-visible {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

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

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

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

.sidebar .article {
  background: var(--brand-surface);
  margin-bottom: var(--space-sm);
}

.sidebar .article__title {
  font-size: 1rem;
  margin-block: var(--space-xs) 0;
}

/* ---------- Spodní panel ---------- */

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

.prefooter__inner h3:not(.article__title) {
  font-size: var(--fs-h3);
  color: var(--brand-text);
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-sm);
  border-bottom: 2px solid var(--brand-primary);
}

.prefooter ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.prefooter .nav a,
.prefooter .authors a,
.prefooter .tags a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--brand-text);
  padding: var(--space-2xs) 0;
  min-height: 1.75rem;
}

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

.prefooter svg {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  flex-shrink: 0;
}

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

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

.prefooter .article {
  background: var(--brand-bg);
}

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

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

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

.footer__inner {
  padding-block: var(--space-lg);
  font-size: var(--fs-small);
}

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

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

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

.text__title {
  font-size: var(--fs-h1);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

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

.text__body {
  font-size: var(--fs-body);
  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.9em;
  margin-bottom: 0.8em;
}

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

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

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

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

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

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

.text__body 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-align: left;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--brand-border);
}

.text__body table tr:first-child th,
.text__body table tr:first-child td {
  background: var(--brand-surface);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  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) var(--space-lg);
  margin-bottom: var(--space-lg);
  font-size: 1rem;
  line-height: 1.6;
}

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

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

.table-of-content a:hover,
.table-of-content a:focus-visible {
  color: var(--brand-primary);
  text-decoration: underline;
}

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

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

.text__info a:hover,
.text__info a:focus-visible {
  color: var(--c-primary-hover);
  text-decoration: underline;
}

/* ---------- Autor ---------- */

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

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

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

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

.popup button {
  background: transparent;
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  cursor: pointer;
  min-width: 2rem;
  min-height: 2rem;
}

.popup button:hover,
.popup button:focus-visible {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* ---------- Ukazatel čtení (jen CSS, jen stránka článku) ---------- */

.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: 0 50%;
      transform: scaleX(0);
      z-index: 60;
      pointer-events: none;
      animation: reading-progress-grow linear both;
      animation-timeline: scroll(root);
    }
  }
}

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

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

.sidebar,
.content,
.prefooter__inner {
  container-type: inline-size;
}

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