/* ==========================================================================
   Hrajeme si chytře – přívětivý redakční vzhled
   Barvy a písma jen přes --brand-*; vlastní proměnné mají prefix --c-, --s-, --fs-, --sh-
   ========================================================================== */

:root {
  /* Mezery z jedné stupnice */
  --s-3xs: 0.25rem;
  --s-2xs: 0.5rem;
  --s-xs: 0.75rem;
  --s-sm: 1rem;
  --s-md: 1.5rem;
  --s-lg: 2.25rem;
  --s-xl: 3.5rem;
  --s-2xl: 5rem;

  /* Odvozené odstíny */
  --c-primary-dark: color-mix(in srgb, var(--brand-primary) 82%, black);
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 10%, var(--brand-surface));
  --c-accent-soft: color-mix(in srgb, var(--brand-accent) 14%, var(--brand-surface));
  --c-surface-2: color-mix(in srgb, var(--brand-text) 4%, var(--brand-bg));
  --c-line: color-mix(in srgb, var(--brand-text) 14%, transparent);
  --c-header-line: color-mix(in srgb, var(--brand-header-text) 28%, transparent);
  --c-header-hover: color-mix(in srgb, var(--brand-header-text) 16%, transparent);
  --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%, transparent);
  --c-overlay: color-mix(in srgb, var(--brand-text) 45%, transparent);
  --c-selection: color-mix(in srgb, var(--brand-accent) 38%, var(--brand-surface));

  /* Stíny (vždy s rozostřením) */
  --sh-card: 0 4px 18px color-mix(in srgb, var(--brand-text) 9%, transparent);
  --sh-card-hover: 0 10px 30px color-mix(in srgb, var(--brand-text) 15%, transparent);
  --sh-header: 0 6px 20px color-mix(in srgb, var(--brand-text) 22%, transparent);

  /* Velikosti písma */
  --fs-h1: clamp(1.9rem, 1.4rem + 2.2vw, 3rem);
  --fs-h2: clamp(1.45rem, 1.2rem + 1.1vw, 2.1rem);
  --fs-h3: clamp(1.1rem, 1.02rem + 0.4vw, 1.3rem);
  --fs-card: clamp(1.1rem, 1.04rem + 0.35vw, 1.3rem);
  --fs-body: clamp(1.0625rem, 1.03rem + 0.15vw, 1.1875rem);
  --fs-small: 0.875rem;
  --fs-logo: clamp(1.5rem, 1.3rem + 0.9vw, 1.75rem);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 0.2s;
  --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);
  -webkit-text-size-adjust: 100%;
}

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

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

img {
  max-width: 100%;
  height: auto;
}

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

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

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

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);
  text-wrap: balance;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-h1); margin: 0 0 var(--s-md); }
h2 { font-size: var(--fs-h2); margin: var(--s-lg) 0 var(--s-sm); }
h3 { font-size: var(--fs-h3); margin: var(--s-md) 0 var(--s-xs); }

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

/* ---------- Hlavička (v hlavní barvě, 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-header-line);
  container-type: scroll-state;
  container-name: site-header;
}

@supports (container-type: scroll-state) {
  @container site-header scroll-state(stuck: top) {
    .header__inner {
      padding-block: var(--s-2xs);
    }
  }
}

.header__inner {
  padding-block: var(--s-xs);
  transition: padding var(--t-fast) var(--ease);
}

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

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

.header .logo__name {
  color: var(--brand-header-text);
  letter-spacing: -0.01em;
}

.header .logo__tld {
  font-size: 0.7em;
  font-weight: 500;
  color: var(--brand-header-text);
  opacity: 0.9;
  white-space: nowrap;
}

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

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

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

.header__toggle:hover {
  background: var(--c-header-hover);
}

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

.header .nav a {
  display: inline-block;
  padding: var(--s-2xs) var(--s-xs);
  border-radius: var(--brand-radius);
  text-decoration: none;
  font-weight: 500;
  min-height: 24px;
  transition: background-color var(--t-fast) var(--ease);
}

.header .nav a:hover {
  background: var(--c-header-hover);
}

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

/* ---------- Lišta rubrik pod hlavičkou ---------- */

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

.tray__inner a {
  display: inline-block;
  padding: var(--s-xs) var(--s-sm);
  color: var(--brand-text);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  min-height: 24px;
  border-radius: var(--brand-radius);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

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

/* ---------- Mobilní menu (jen display, bez transform/visibility) ---------- */

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

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

.smallnav a {
  display: block;
  padding: var(--s-xs) var(--s-2xs);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-size: 1.2rem;
  text-decoration: none;
  border-bottom: 1px solid var(--brand-border);
  transition: color var(--t-fast) var(--ease);
}

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

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

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

/* ---------- Hlavní obsah ---------- */

.main {
  padding-block: var(--s-lg) var(--s-xl);
}

.search-form form {
  display: flex;
  gap: var(--s-2xs);
  margin-bottom: var(--s-md);
}

.search-form input[type="text"] {
  flex: 1;
  min-height: 44px;
  padding: 0 var(--s-sm);
  font: inherit;
  color: var(--brand-text);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
}

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

.search-form input[type="submit"] {
  min-height: 44px;
  padding: 0 var(--s-md);
  font: inherit;
  font-weight: 600;
  color: var(--brand-on-primary);
  background: var(--brand-primary);
  border: 0;
  border-radius: var(--brand-radius);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}

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

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

.article {
  container-type: inline-size;
  background: var(--brand-surface);
  border: 0;
  border-radius: var(--brand-radius);
  box-shadow: var(--sh-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--t-fast) var(--ease);
}

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

.article__image {
  margin: 0;
  overflow: hidden;
  background: var(--c-surface-2);
}

.article__image a {
  display: block;
}

.article__image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 0;
}

.article__title {
  margin: var(--s-sm) var(--s-md) var(--s-2xs);
  font-size: var(--fs-card);
  line-height: 1.3;
}

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

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

.article__perex {
  margin: 0 var(--s-md) var(--s-xs);
  color: var(--brand-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.article__category {
  margin: 0 var(--s-md) var(--s-2xs);
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--brand-muted);
}

.article__category a {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease);
}

.article__category a:hover {
  background: color-mix(in srgb, var(--brand-accent) 85%, black);
  color: var(--brand-on-accent);
}

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

@container (max-width: 17rem) {
  .article__title { margin-inline: var(--s-sm); font-size: 1.05rem; }
  .article__perex,
  .article__category,
  .article__date { margin-inline: var(--s-sm); }
}

/* ---------- Rubriky na úvodní stránce ---------- */

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

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

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

.bottom--category {
  padding-bottom: var(--s-sm);
}

/* ---------- Horní bloky (pokud se zobrazí) ---------- */

.top-news .article__perex,
.top .article__perex {
  margin-bottom: var(--s-sm);
}

/* ---------- Text článku ---------- */

.text__title {
  font-size: var(--fs-h1);
  margin-bottom: var(--s-md);
}

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

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

.text__body {
  max-width: 68ch;
  margin-inline: auto;
  font-size: var(--fs-body);
  line-height: 1.8;
  text-wrap: pretty;
}

.text__body h2 {
  margin: var(--s-xl) 0 var(--s-xs);
}

.text__body h3 {
  margin: var(--s-lg) 0 var(--s-2xs);
}

.text__body p,
.text__body li {
  text-wrap: pretty;
}

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

.text__body li + li {
  margin-top: var(--s-3xs);
}

.text__body a {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}

.text__body a:hover {
  text-decoration-thickness: 2.5px;
}

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

.text__body img.author {
  float: left;
  width: 150px;
  max-width: 40%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  margin: 0 var(--s-md) var(--s-sm) 0;
  border-radius: 50%;
}

.text__body blockquote {
  margin: var(--s-md) 0;
  padding: var(--s-xs) var(--s-md);
  border-left: 3px solid var(--brand-primary);
  background: var(--c-primary-soft);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-size: 1.1em;
}

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

.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: var(--s-md) 0;
  font-size: 0.95rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.text__body table th,
.text__body table td {
  padding: var(--s-xs) var(--s-sm);
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--brand-border);
}

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

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

.table-of-content {
  margin: 0 0 var(--s-lg);
  padding: var(--s-md);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-size: 0.95rem;
  line-height: 1.6;
}

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

.table-of-content a {
  text-decoration: none;
}

.table-of-content a:hover {
  text-decoration: underline;
}

.text__info {
  max-width: 68ch;
  margin: var(--s-lg) auto 0;
  padding-top: var(--s-md);
  border-top: 1px solid var(--brand-border);
  color: var(--brand-muted);
  font-size: var(--fs-small);
}

.text__info p {
  margin-bottom: var(--s-2xs);
}

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

/* ---------- Postranní a spodní panel ---------- */

.sidebar h3:not(.article__title) {
  margin: 0 0 var(--s-sm);
  padding-bottom: var(--s-2xs);
  border-bottom: 2px solid var(--brand-accent);
  font-size: 1.2rem;
}

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

.sidebar .nav li + li,
.sidebar .promo li + li,
.sidebar .authors li + li {
  margin-top: var(--s-3xs);
}

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

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

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

.sidebar .tags a {
  padding: var(--s-3xs) var(--s-xs);
  background: var(--c-primary-soft);
  border-radius: var(--brand-radius);
  font-size: var(--fs-small);
}

.sidebar .nav svg,
.sidebar .tags svg,
.sidebar .authors svg,
.sidebar .promo svg {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
}

.sidebar .promo li {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2xs);
}

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

.sidebar .article {
  margin-bottom: var(--s-sm);
}

.sidebar .article__title {
  margin: var(--s-xs) var(--s-sm);
  font-size: 1rem;
}

.prefooter {
  background: var(--c-surface-2);
  border-top: 1px solid var(--brand-border);
  padding-block: var(--s-xl);
}

.prefooter .article__image img {
  aspect-ratio: 16 / 9;
}

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

.pagination {
  margin: var(--s-xl) 0 0;
}

.pagination ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2xs);
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination li {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--s-xs);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-variant-numeric: tabular-nums;
}

.pagination li a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  text-decoration: none;
  color: var(--brand-text);
  transition: color var(--t-fast) var(--ease);
}

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

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

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

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

.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  padding-block: var(--s-lg);
  font-size: var(--fs-small);
  line-height: 1.7;
}

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

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

/* ---------- Popup ---------- */

.popup {
  display: none;
  position: fixed;
  z-index: 100;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 32rem);
  max-height: 85vh;
  overflow: auto;
  padding: var(--s-lg) var(--s-md) var(--s-md);
  background: var(--brand-surface);
  color: var(--brand-text);
  border-radius: var(--brand-radius);
  box-shadow: 0 20px 60px var(--c-overlay);
}

.popup #close {
  position: absolute;
  top: var(--s-2xs);
  right: var(--s-2xs);
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 0;
  border-radius: var(--brand-radius);
  color: var(--brand-text);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}

.popup #close:hover {
  background: var(--c-surface-2);
}

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