/* ==========================================================
   Magazín Zoom – elegantní redakční vzhled
   Barvy a písma dodává kód přes --brand-*, tady jen odvozeniny.
   ========================================================== */

:root {
  /* Mezerová stupnice (vzdušná) */
  --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;

  /* Velikosti písma */
  --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.1875rem, 1.05rem + 0.6vw, 1.5rem);
  --fs-card: clamp(1.1875rem, 1.05rem + 0.5vw, 1.4375rem);
  --fs-card-lead: clamp(1.625rem, 1.2rem + 1.8vw, 2.5rem);
  --fs-small: 0.8125rem;
  --fs-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);

  /* Odvozené odstíny */
  --c-surface-2: color-mix(in srgb, var(--brand-bg) 55%, var(--brand-surface));
  --c-tint: color-mix(in srgb, var(--brand-primary) 8%, var(--brand-bg));
  --c-tint-strong: color-mix(in srgb, var(--brand-primary) 14%, var(--brand-bg));
  --c-rule: color-mix(in srgb, var(--brand-text) 14%, transparent);
  --c-primary-dark: color-mix(in srgb, var(--brand-primary) 82%, #000);
  --c-accent-dark: color-mix(in srgb, var(--brand-accent) 80%, #000);
  --c-footer-muted: color-mix(in srgb, var(--brand-footer-text) 72%, var(--brand-footer-bg));
  --c-footer-rule: color-mix(in srgb, var(--brand-footer-text) 18%, transparent);
  --c-header-rule: color-mix(in srgb, var(--brand-header-text) 14%, transparent);
  --c-overlay: rgba(0, 0, 0, 0.55);

  /* Stíny */
  --shadow-header: 0 6px 20px rgba(28, 23, 38, 0.1);
  --shadow-popup: 0 18px 48px rgba(28, 23, 38, 0.28);

  /* Pohyb */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 0.25s;
  --header-h: 4.5rem;
}

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

body {
  margin: 0;
  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;
}

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

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

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); letter-spacing: -0.015em; }
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(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}

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

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

/* ---------- Hlavička ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  container-type: scroll-state;
  container-name: site-header;
  background: var(--brand-header-bg);
  color: var(--brand-header-text);
  border-bottom: 1px solid var(--c-header-rule);
  transition: box-shadow var(--dur) var(--ease);
}

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

@supports (container-type: scroll-state) {
  @container site-header scroll-state(stuck: top) {
    .header__inner {
      padding-top: var(--space-2xs);
      padding-bottom: var(--space-2xs);
      box-shadow: var(--shadow-header);
    }
  }
}

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

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

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

.logo__tld {
  font-size: 0.7em;
  white-space: nowrap;
  color: var(--brand-primary);
}

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

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

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

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

/* ---------- Menu rubrik ---------- */
.tray {
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-border);
}

.tray__inner ul,
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tray__inner a {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  color: var(--brand-text);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  border-radius: var(--brand-radius);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

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

.header .nav a {
  color: var(--brand-header-text);
  text-decoration: none;
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--brand-radius);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

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

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

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

.smallnav a {
  display: block;
  padding: var(--space-sm) var(--space-md);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-size: 1.375rem;
  text-decoration: none;
  border-bottom: 1px solid var(--brand-border);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

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

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

.smallnav__close:hover {
  background: var(--c-tint);
}

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

/* ---------- Karty článků ---------- */
.article {
  container-type: inline-size;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.article__image {
  margin: 0 0 var(--space-sm);
  overflow: hidden;
  border-radius: var(--brand-radius);
  background: var(--c-tint);
}

.article__image a {
  display: block;
}

.article__image img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: var(--brand-radius);
}

.article__title {
  margin: 0 0 var(--space-2xs);
  font-size: var(--fs-card);
  line-height: 1.25;
}

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

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

.article__perex {
  margin: 0 0 var(--space-xs);
  color: var(--brand-muted);
  font-size: 0.9375rem;
  line-height: 1.65;
}

.article__category {
  display: inline-block;
  margin: 0 0 var(--space-2xs);
  padding: var(--space-3xs) var(--space-xs);
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.article__category a {
  color: var(--brand-on-accent);
  text-decoration: none;
}

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

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

/* Horní blok – hlavní karta s textem přes fotografii */
.top {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-lg);
}

.top .article__category {
  background: var(--brand-accent);
  color: var(--brand-on-accent);
}

.top .article:first-child .article__title {
  font-size: var(--fs-card-lead);
  line-height: 1.15;
}

/* ---------- Titulky sekcí ---------- */
.bottom__title {
  margin: var(--space-xl) 0 var(--space-md);
  font-size: var(--fs-h2);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--c-rule);
}

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

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

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

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

.search-form input[type="text"] {
  flex: 1;
  min-height: 44px;
  padding: 0 var(--space-sm);
  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;
  transition: border-color var(--dur) var(--ease);
}

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

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

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

/* ---------- Text článku ---------- */
.text {
  color: var(--brand-text);
}

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

.text__cover {
  margin: 0 0 var(--space-lg);
}

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

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

.text__body h2,
.text__body h3 {
  margin-top: 2em;
  margin-bottom: 0.7em;
}

.text__body p {
  margin: 0 0 1.2em;
}

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

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

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

.text__body blockquote {
  margin: 1.8em 0;
  padding: 0.2em 0 0.2em 1.2em;
  border-left: 3px solid var(--brand-accent);
  border-radius: 0;
  color: var(--brand-muted);
  font-family: var(--brand-font-heading);
  font-size: 1.2em;
  line-height: 1.55;
}

.text__body img {
  display: block;
  margin: 1.5em 0;
  border-radius: var(--brand-radius);
}

.text__body img.author {
  max-width: 220px;
  float: left;
  margin: 0 var(--space-md) var(--space-sm) 0;
}

.text__body .table-of-content {
  margin: 0 0 var(--space-lg);
  padding: var(--space-md);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
}

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

/* Tabulky */
.text table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  margin: 1.6em 0;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
}

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

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

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

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

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

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

/* ---------- Ukazatel čtení ---------- */
.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-grow linear both;
      animation-timeline: scroll(root);
    }

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

/* ---------- Stránkování ---------- */
.pagination ul {
  list-style: none;
  margin: var(--space-xl) 0 0;
  padding: 0;
}

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

.pagination a,
.pagination__active {
  display: inline-block;
  min-width: 24px;
  min-height: 24px;
  padding: var(--space-2xs) var(--space-sm);
  border-radius: var(--brand-radius);
  text-decoration: none;
  line-height: 1.4;
}

.pagination a {
  color: var(--brand-primary);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

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

.pagination__active {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  font-weight: 600;
}

/* ---------- Pravý panel ---------- */
.sidebar h3:not(.article__title) {
  margin: 0 0 var(--space-sm);
  padding-bottom: var(--space-2xs);
  border-bottom: 1px solid var(--c-rule);
  font-size: var(--fs-h3);
}

.sidebar .nav ul,
.sidebar .tags,
.sidebar .promo,
.sidebar .authors {
  list-style: none;
  margin: 0 0 var(--space-lg);
  padding: 0;
}

.sidebar .nav li,
.sidebar .tags li,
.sidebar .promo li,
.sidebar .authors li {
  border-bottom: 1px solid var(--c-rule);
}

.sidebar .nav a,
.sidebar .tags a,
.sidebar .authors a {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  min-height: 24px;
  padding: var(--space-2xs) 0;
  color: var(--brand-text);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

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

.sidebar svg {
  flex: none;
  stroke: var(--brand-primary);
}

.sidebar .promo li {
  display: flex;
  gap: var(--space-2xs);
  padding: var(--space-2xs) 0;
}

.sidebar .article {
  margin-bottom: var(--space-md);
}

.sidebar .article .article__title {
  font-size: 1.0625rem;
  line-height: 1.3;
}

.sidebar .article__image {
  margin-bottom: var(--space-2xs);
}

/* ---------- Spodní panel (sloupce odkazů) ---------- */
.prefooter {
  margin-top: var(--space-2xl);
  padding: var(--space-xl) 0;
  background: var(--brand-surface);
  border-top: 1px solid var(--brand-border);
}

.prefooter h3:not(.article__title) {
  margin: 0 0 var(--space-sm);
  padding-bottom: var(--space-2xs);
  border-bottom: 1px solid var(--c-rule);
  font-size: var(--fs-h3);
}

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

.prefooter li {
  border-bottom: 1px solid var(--c-rule);
}

.prefooter li a {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  min-height: 24px;
  padding: var(--space-2xs) 0;
  color: var(--brand-text);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

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

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

.prefooter .promo li {
  display: flex;
  gap: var(--space-2xs);
  padding: var(--space-2xs) 0;
}

.prefooter .article {
  margin-bottom: var(--space-sm);
}

.prefooter .article .article__title {
  font-size: 1.0625rem;
  line-height: 1.3;
}

/* ---------- Patička ---------- */
.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  padding: var(--space-xl) 0;
  font-size: 0.9375rem;
}

.footer__inner p {
  margin: 0 0 var(--space-2xs);
  color: var(--c-footer-muted);
}

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

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

/* ---------- Popup ---------- */
.popup {
  display: none;
  position: fixed;
  right: var(--space-md);
  bottom: var(--space-md);
  z-index: 100;
  max-width: min(92vw, 420px);
  padding: var(--space-md);
  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 button {
  position: absolute;
  top: var(--space-2xs);
  right: var(--space-2xs);
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

/* ---------- Pohyb ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .reading-progress {
    display: none !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; }
