/* ==========================================================================
   Style Without Limits – elegantní redakční vzhled
   Barvy a písma dodává stránka přes --brand-*, zde jen odvozujeme a stylujeme.
   ========================================================================== */

:root {
  /* mezery (vzdušná hustota) */
  --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-body: clamp(1.0625rem, 1.02rem + 0.2vw, 1.1875rem);
  --fs-small: 0.875rem;
  --fs-xs: 0.78rem;
  --fs-h1: clamp(2rem, 1.4rem + 2.6vw, 3.5rem);
  --fs-h2: clamp(1.5rem, 1.2rem + 1.3vw, 2.25rem);
  --fs-h3: clamp(1.2rem, 1.05rem + 0.7vw, 1.55rem);
  --fs-card: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
  --fs-lead: clamp(1.3rem, 1.1rem + 1vw, 1.9rem);

  /* odvozené odstíny */
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 10%, var(--brand-surface));
  --c-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, var(--brand-text));
  --c-surface-2: color-mix(in srgb, var(--brand-bg) 55%, var(--brand-surface));
  --c-line: color-mix(in srgb, var(--brand-border) 85%, transparent);
  --c-muted-strong: color-mix(in srgb, var(--brand-muted) 70%, var(--brand-text));
  --c-footer-muted: color-mix(in srgb, var(--brand-footer-text) 72%, var(--brand-footer-bg));
  --c-footer-line: color-mix(in srgb, var(--brand-footer-text) 22%, var(--brand-footer-bg));
  --c-overlay: rgba(0, 0, 0, 0.55);
  --c-overlay-clear: rgba(0, 0, 0, 0);

  /* stíny (jen tam, kde je karta potřebuje) */
  --shadow-header: 0 8px 24px rgba(38, 23, 29, 0.1);
  --shadow-pop: 0 12px 32px rgba(38, 23, 29, 0.18);

  /* pohyb */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 0.2s;
  --t-med: 0.3s;

  --measure: 68ch;
}

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

html {
  color-scheme: light;
  scroll-padding-top: 6rem;
  scrollbar-color: var(--brand-primary) var(--brand-bg);
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

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);
  accent-color: var(--brand-accent);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

a {
  color: var(--brand-primary);
  text-decoration: none;
  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;
  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;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0 0 var(--space-sm);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p {
  margin: 0 0 var(--space-sm);
}

ul, ol {
  margin: 0;
  padding: 0;
}

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

/* ---------- Hlavička (světlá, přilepená) ---------- */

.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);
  container-type: scroll-state;
  container-name: site-header;
}

.header__inner {
  padding-block: var(--space-sm);
  transition: padding var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}

@supports (container-type: scroll-state) {
  @container site-header scroll-state(stuck: top) {
    .header__inner {
      padding-block: 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;
  letter-spacing: 0;
  text-decoration: none;
}

.header__logo:hover,
.logo:hover {
  color: var(--brand-primary);
}

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

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

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

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

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

.header__toggle svg {
  stroke: currentColor;
}

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

/* ---------- Navigace (lišta pod hlavičkou) ---------- */

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

.tray ul,
.header .nav ul {
  list-style: none;
}

.tray a,
.header .nav a {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  min-height: 24px;
  color: var(--brand-text);
  font-size: var(--fs-small);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  transition: color var(--t-fast) var(--ease);
}

.tray a::after,
.header .nav a::after {
  content: "";
  position: absolute;
  left: var(--space-sm);
  right: var(--space-sm);
  bottom: 0.35rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-med) var(--ease);
}

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

.tray a:hover::after,
.header .nav a:hover::after {
  transform: scaleX(1);
}

/* Mobilní menu (#smallnav – jen display) */

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

.smallnav ul {
  list-style: none;
}

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

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

.smallnav__close {
  background: transparent;
  border: 1px solid var(--brand-border);
  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);
}

/* ---------- Vyhledávání ---------- */

.search-form form {
  display: flex;
  gap: var(--space-2xs);
}

.search-form input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--brand-font-body);
  font-size: 1rem;
  transition: border-color var(--t-fast) var(--ease);
}

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

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

.search-form input[type="submit"] {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 0;
  border-radius: var(--brand-radius);
  padding: var(--space-xs) var(--space-md);
  min-height: 44px;
  font-family: var(--brand-font-body);
  font-size: var(--fs-small);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}

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

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

.article {
  background: transparent;
}

.article__image {
  margin: 0 0 var(--space-xs);
  overflow: hidden;
  border-radius: var(--brand-radius);
}

.article__image a {
  display: block;
}

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

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

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

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

.article__perex {
  color: var(--c-muted-strong);
  font-size: var(--fs-small);
  line-height: 1.65;
  margin: 0 0 var(--space-2xs);
}

.article__category {
  margin: 0 0 var(--space-3xs);
  font-size: var(--fs-xs);
  color: var(--brand-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.article__category a {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  font-weight: 500;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

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

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

/* ---------- Horní blok (titulní kompozice) ---------- */

.top {
  background: transparent;
}

.top__inner .article {
  position: relative;
}

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

.top .article__image {
  margin-bottom: var(--space-sm);
}

.top .article__perex {
  font-size: 1rem;
}

/* ---------- Sekce výpisů ---------- */

.bottom {
  background: transparent;
}

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

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

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

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

/* ---------- Text článku (klidný sloupec) ---------- */

.text {
  background: transparent;
}

.text__title {
  font-size: var(--fs-h1);
  line-height: 1.12;
  margin-bottom: var(--space-md);
}

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

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

.text__body {
  max-width: var(--measure);
  line-height: 1.8;
  color: var(--brand-text);
}

.text__body > p,
.text__body > ul,
.text__body > ol,
.text__body > blockquote {
  max-width: var(--measure);
}

.text__body p {
  margin-bottom: var(--space-md);
  text-wrap: pretty;
}

.text__body h2 {
  font-size: var(--fs-h2);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-xs);
}

.text__body h3 {
  font-size: var(--fs-h3);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-2xs);
}

.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(--c-primary-hover);
  text-decoration-thickness: 2px;
}

.text__body ul,
.text__body ol {
  margin: 0 0 var(--space-md);
  padding-left: 1.5em;
}

.text__body li {
  margin-bottom: var(--space-2xs);
}

.text__body li::marker {
  color: var(--brand-primary);
}

.text__body img {
  margin: var(--space-md) 0;
}

.text__body blockquote {
  margin: var(--space-lg) 0;
  padding: var(--space-md);
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-heading);
  font-size: 1.2em;
  line-height: 1.5;
  color: var(--brand-text);
}

.text__body blockquote p:last-child {
  margin-bottom: 0;
}

.text__body img.author {
  float: left;
  width: 140px;
  height: 140px;
  object-fit: cover;
  margin: 0 var(--space-md) var(--space-sm) 0;
}

/* Tabulky v článku – textové, zarovnané doleva */

.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: var(--fs-small);
  line-height: 1.55;
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
}

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

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

.table-of-content {
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  padding: var(--space-md);
  margin: 0 0 var(--space-lg);
  font-size: var(--fs-small);
}

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

.table-of-content ul,
.table-of-content ol {
  list-style: none;
}

.table-of-content li {
  padding: var(--space-3xs) 0;
}

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

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

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

.text__info a:hover {
  text-decoration-thickness: 2px;
}

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

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

.pagination ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  align-items: center;
}

.pagination li {
  color: var(--brand-muted);
}

.pagination a,
.pagination__active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--space-sm);
  border-radius: var(--brand-radius);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}

.pagination a {
  background: var(--brand-surface);
  color: var(--brand-text);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) 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);
  font-weight: 700;
}

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

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

.sidebar > * + h3:not(.article__title) {
  margin-top: var(--space-lg);
}

.sidebar .article {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
  margin-bottom: var(--space-sm);
}

.sidebar .article__image {
  flex: 0 0 96px;
  margin: 0;
}

.sidebar .article__image img {
  width: 96px;
  height: 72px;
  object-fit: cover;
}

.sidebar .article__title {
  font-size: 1rem;
  line-height: 1.3;
  margin: 0;
}

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

.sidebar .nav li a,
.sidebar .authors li a,
.prefooter .nav li a,
.prefooter .authors li a {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-2xs) 0;
  min-height: 24px;
  color: var(--brand-text);
  font-size: var(--fs-small);
  border-bottom: 1px solid var(--c-line);
}

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

.sidebar .tags,
.prefooter .tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

.sidebar .tags a,
.prefooter .tags a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: 0.3rem 0.8rem;
  min-height: 28px;
  background: var(--brand-surface);
  color: var(--brand-text);
  border-radius: var(--brand-radius);
  font-size: var(--fs-small);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

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

.sidebar .promo li,
.prefooter .promo li {
  display: flex;
  gap: var(--space-2xs);
  align-items: flex-start;
  padding: var(--space-2xs) 0;
  font-size: var(--fs-small);
}

.sidebar svg,
.prefooter svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* ---------- Spodní panel nad patičkou ---------- */

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

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

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

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

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

/* ---------- Patička (tmavá) ---------- */

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

.footer p {
  margin: 0 0 var(--space-2xs);
  font-size: var(--fs-small);
  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;
  z-index: 100;
  inset: auto var(--space-md) var(--space-md) auto;
  max-width: min(420px, calc(100vw - 2rem));
  padding: var(--space-md);
  background: var(--brand-surface);
  color: var(--brand-text);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-pop);
}

.popup button {
  position: absolute;
  top: var(--space-2xs);
  right: var(--space-2xs);
  min-width: 36px;
  min-height: 36px;
  background: transparent;
  border: 0;
  border-radius: var(--brand-radius);
  color: var(--brand-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease);
}

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

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

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

@container (max-width: 320px) {
  .sidebar .article__image {
    flex-basis: 72px;
  }
  .sidebar .article__image img {
    width: 72px;
    height: 56px;
  }
  .sidebar .article__title {
    font-size: 0.95rem;
  }
}

/* ---------- Pohyb a přístupnost ---------- */

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