/* =========================================================
   Dětský pohár – vzhled (moderní, tónované pozadí, světlá hlavička, tmavá patička)
   Rozložení dodává společný základ base-v7; zde jen vzhled.
   ========================================================= */

:root {
  /* 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 z --brand-* */
  --c-surface-2: color-mix(in srgb, var(--brand-bg) 55%, var(--brand-surface));
  --c-border-soft: color-mix(in srgb, var(--brand-border) 60%, transparent);
  --c-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, black);
  --c-primary-tint: color-mix(in srgb, var(--brand-primary) 10%, var(--brand-surface));
  --c-accent-hover: color-mix(in srgb, var(--brand-accent) 80%, black);
  --c-text-soft: color-mix(in srgb, var(--brand-text) 85%, var(--brand-bg));

  /* stíny */
  --shadow-header: 0 6px 18px color-mix(in srgb, var(--brand-text) 10%, transparent);
  --shadow-card: 0 2px 10px color-mix(in srgb, var(--brand-text) 6%, transparent);
  --shadow-card-hover: 0 8px 24px color-mix(in srgb, var(--brand-text) 12%, transparent);

  /* velikosti písma */
  --fs-h1: clamp(1.875rem, 1.4rem + 2vw, 3rem);
  --fs-h2: clamp(1.375rem, 1.15rem + 1vw, 1.875rem);
  --fs-h3: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
  --fs-card-title: clamp(1.1875rem, 1.1rem + 0.5vw, 1.5rem);
  --fs-body: clamp(1.0625rem, 1.03rem + 0.15vw, 1.1875rem);
  --fs-small: 0.875rem;
  --fs-logo: clamp(1.375rem, 1.2rem + 0.8vw, 1.625rem);

  /* ostatní */
  --transition: 0.25s ease;
  --header-h: 4.5rem;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 35%, transparent);
}

/* ---------- Základ ---------- */
html {
  color-scheme: light;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  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.7;
  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.2;
  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(--transition), background-color var(--transition), box-shadow var(--transition), text-decoration-color var(--transition);
}

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 { border-radius: var(--brand-radius); }

/* ---------- 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(--brand-border);
  box-shadow: var(--shadow-header);
}

.header__inner {
  min-height: var(--header-h);
}

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

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

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

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

.header__toggle svg { stroke: currentColor; }

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

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

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

/* ---------- Lišta rubrik pod hlavičkou ---------- */
.tray {
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-border);
}

.tray a {
  color: var(--brand-text);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-weight: 600;
  font-size: 0.9375rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--brand-radius);
  transition: color var(--transition), background-color var(--transition);
}

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

.tray__more-button {
  background: transparent;
  color: var(--brand-text);
  border: 0;
  font-family: var(--brand-font-heading);
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition);
}

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

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

/* ---------- 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.25rem;
  transition: color var(--transition);
}

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

.smallnav__close {
  background: transparent;
  border: 0;
  cursor: pointer;
}

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

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

.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: var(--space-sm) var(--space-md);
  font: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

.search-form input[type="submit"] {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 0;
  border-radius: var(--brand-radius);
  padding: var(--space-sm) var(--space-lg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 2.75rem;
  transition: background-color var(--transition);
}

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

/* ---------- Karty článků ---------- */
.article {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  overflow: hidden;
  container-type: inline-size;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.article:hover { border-color: color-mix(in srgb, var(--brand-primary) 45%, var(--brand-border)); }

.article__image { margin: 0; }

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

.article__title {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-card-title);
  line-height: 1.25;
  margin-left: var(--space-md);
  margin-right: var(--space-md);
}

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

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

.article__perex {
  color: var(--c-text-soft);
  font-size: 0.9688rem;
  line-height: 1.6;
  margin-left: var(--space-md);
  margin-right: var(--space-md);
}

.article__category {
  margin-left: var(--space-md);
  margin-right: var(--space-md);
  font-size: var(--fs-small);
  color: var(--brand-muted);
}

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  padding: 0.125rem 0.625rem;
  border-radius: var(--brand-radius);
  transition: background-color var(--transition), color var(--transition);
}

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

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

.article > :last-child { margin-bottom: var(--space-md); }

/* ---------- Titulky sekcí ---------- */
.bottom__title,
.content > h1,
.content > h2 {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
}

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

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

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

.pagination a {
  display: inline-block;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: var(--space-xs) var(--space-md);
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  text-decoration: none;
  line-height: 1.5;
  transition: color var(--transition), border-color var(--transition), background-color var(--transition);
}

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

.pagination__active {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border-radius: var(--brand-radius);
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: var(--space-xs) var(--space-md);
  line-height: 1.5;
  text-align: center;
}

/* ---------- Článek ---------- */
.text__title {
  font-size: var(--fs-h1);
  letter-spacing: -0.02em;
}

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

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

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

.text__body p { text-wrap: pretty; }

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

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

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

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

.text__body blockquote {
  margin: var(--space-lg) 0;
  padding: var(--space-xs) var(--space-lg);
  border-left: 3px solid var(--brand-border);
  color: var(--c-text-soft);
  font-style: italic;
}

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

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

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

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

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

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

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

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

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

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

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

/* ---------- Autoři ---------- */
.author-list a {
  color: var(--brand-text);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-weight: 600;
  transition: color var(--transition);
}

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

/* ---------- Panel (widgety) a spodní panel nad patičkou ---------- */
.sidebar h3:not(.article__title),
.prefooter h3:not(.article__title) {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.1875rem;
  color: var(--brand-text);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--brand-border);
  margin-bottom: var(--space-md);
}

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

.sidebar li,
.prefooter li { margin-bottom: var(--space-xs); }

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

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

.sidebar svg,
.prefooter svg {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  stroke: var(--brand-primary);
}

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

.prefooter .article,
.sidebar .article {
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.prefooter .article__title,
.sidebar .article__title {
  font-size: 1rem;
  margin-left: 0;
  margin-right: 0;
}

.prefooter .article > :last-child,
.sidebar .article > :last-child { margin-bottom: 0; }

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

.sidebar .promo a:hover,
.prefooter .promo a:hover { color: var(--c-primary-hover); }

/* ---------- Patička (tmavá) ---------- */
.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
}

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

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

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

/* ---------- 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 #close {
  background: transparent;
  color: var(--brand-text);
  border: 0;
  font-size: 1.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  cursor: pointer;
  transition: color var(--transition);
}

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

/* ---------- Komponenty podle šířky kontejneru ---------- */
@container (max-width: 22rem) {
  .article__title { font-size: 1.125rem; }
  .article__perex { font-size: 0.9375rem; }
}

/* ---------- Přilepená hlavička – posun kotev na mobilu ---------- */
@media (max-width: 767px) {
  :root { --header-h: 4rem; }
}

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

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

/* ---------- Omezení pohybu ---------- */
@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; }
