/* ==========================================================================
   Dětský pohár – vzhled (moderní, světlá hlavička, tmavá patička)
   Barvy a písma jen z --brand-*; rozložení dodává společný základ base-v7.
   ========================================================================== */

: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 */
  --c-surface-2: color-mix(in srgb, var(--brand-bg) 60%, var(--brand-surface));
  --c-tint: color-mix(in srgb, var(--brand-primary) 8%, var(--brand-surface));
  --c-tint-strong: color-mix(in srgb, var(--brand-primary) 16%, var(--brand-surface));
  --c-border-strong: color-mix(in srgb, var(--brand-text) 22%, var(--brand-border));
  --c-primary-dark: color-mix(in srgb, var(--brand-primary) 82%, black);
  --c-accent-dark: color-mix(in srgb, var(--brand-accent) 80%, black);
  --c-text-soft: color-mix(in srgb, var(--brand-text) 82%, var(--brand-surface));
  --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) 18%, var(--brand-footer-bg));
  --c-overlay: rgba(0, 0, 0, 0.55);

  /* stíny */
  --shadow-card: 0 1px 2px rgba(38, 29, 23, 0.04);
  --shadow-card-hover: 0 10px 28px rgba(38, 29, 23, 0.10);
  --shadow-header: 0 6px 20px rgba(38, 29, 23, 0.10);

  /* typografie */
  --fs-h1: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
  --fs-h2: clamp(1.35rem, 1.1rem + 1.1vw, 1.85rem);
  --fs-h3: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  --fs-body: clamp(1.0625rem, 1.03rem + 0.15vw, 1.1875rem);
  --fs-small: 0.875rem;
  --fs-card-title: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur: 0.2s;
}

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

html {
  color-scheme: light;
  scroll-padding-top: 5.5rem;
  scrollbar-color: var(--brand-muted) 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);
  line-height: 1.7;
  font-size-adjust: from-font;
  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);
}

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

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

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;
  letter-spacing: -0.01em;
}

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

p {
  text-wrap: pretty;
}

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

.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);
  container-type: scroll-state;
  container-name: site-header;
  transition: box-shadow var(--dur) var(--ease);
}

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

.header__inner {
  background: var(--brand-header-bg);
  transition: box-shadow var(--dur) 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: 1.375rem;
  text-decoration: none;
  line-height: 1.1;
}

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

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

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

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

@media (min-width: 768px) {
  .header__logo,
  .header .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;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.header__toggle svg {
  stroke: currentColor;
}

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

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

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

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

.tray a,
.header .nav a {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1rem;
  text-decoration: none;
  border-radius: var(--brand-radius);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

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

/* ---------- Mobilní menu (jen display) ---------- */

.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-md) var(--space-lg);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.15rem;
  text-decoration: none;
  border-bottom: 1px solid var(--brand-border);
  transition: color var(--dur) var(--ease), background-color 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);
  color: var(--brand-text);
}

.smallnav__close svg {
  stroke: currentColor;
}

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

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

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

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

/* ---------- Výpis článků (řádky) ---------- */

.article {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-card);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  overflow: hidden;
}

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

.article__image {
  margin: 0;
}

.article__image a {
  display: block;
}

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

.article__title {
  margin: 0 0 var(--space-xs);
  font-size: var(--fs-card-title);
  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-sm);
  color: var(--c-text-soft);
  font-size: 0.975rem;
  line-height: 1.6;
}

.article__category,
.article__date {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--brand-muted);
}

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

.article__category a {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background-color var(--dur) var(--ease);
}

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

/* Titulky sekcí */

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

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

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

/* ---------- Horní bloky (kdyby je web měl) ---------- */

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

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

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

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

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

.pagination a,
.pagination__active {
  display: inline-block;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  box-sizing: border-box;
  text-align: center;
  line-height: 1.5;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  background: var(--brand-surface);
  color: var(--brand-text);
  text-decoration: none;
  font-weight: 600;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

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

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

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

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

.search-form input[type="text"] {
  flex: 1;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  background: var(--brand-surface);
  color: var(--brand-text);
  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(--c-border-strong);
}

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

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

/* ---------- Stránka článku ---------- */

.text {
  max-width: 100%;
}

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

.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;
  color: var(--brand-text);
}

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

.text__body h2 {
  margin: 2em 0 0.7em;
  font-size: var(--fs-h2);
}

.text__body h3 {
  margin: 1.8em 0 0.6em;
  font-size: var(--fs-h3);
}

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

.text__body ul,
.text__body ol {
  margin: 0 0 1.15em;
  padding-left: 1.5em;
}

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

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

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

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

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

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

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

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

.text__body tr:first-child td {
  background: var(--c-tint);
}

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

img.author {
  float: left;
  width: 8rem;
  max-width: 35%;
  margin: 0 var(--space-lg) var(--space-md) 0;
  border-radius: var(--brand-radius);
}

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

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

.table-of-content ul,
.table-of-content ol {
  margin: 0;
  padding-left: 1.25em;
}

.table-of-content li {
  margin-bottom: 0.3em;
}

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

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

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

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

/* ---------- Ukazatel průběhu čtení (jen CSS, jen článek) ---------- */

.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;
      z-index: 60;
      height: 4px;
      background: var(--brand-accent);
      transform-origin: 0 50%;
      transform: scaleX(0);
      animation: reading-progress linear both;
      animation-timeline: scroll(root);
      pointer-events: none;
    }

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

/* ---------- Boční a spodní panel ---------- */

.sidebar h3:not(.article__title),
.prefooter h3:not(.article__title) {
  margin: 0 0 var(--space-sm);
  font-size: 1.15rem;
  color: var(--brand-text);
}

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

.sidebar li {
  margin: 0;
}

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

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

.sidebar svg {
  flex: none;
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.sidebar ul.promo li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  padding: var(--space-xs) 0;
}

.sidebar ul.promo a {
  color: var(--brand-text);
  text-decoration: none;
}

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

.sidebar .article {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.sidebar .article:hover {
  box-shadow: none;
}

.sidebar .article__image {
  flex: none;
  width: 96px;
}

.sidebar .article__image img {
  aspect-ratio: 1 / 1;
  border-radius: var(--brand-radius);
}

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

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

.prefooter .nav a,
.prefooter ul.tags a,
.prefooter ul.authors a {
  color: var(--brand-text);
}

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

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

.footer__inner {
  padding-block: var(--space-xl);
}

.footer p {
  margin: 0 0 var(--space-xs);
  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 {
  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#close {
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 0;
  color: var(--brand-text);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: var(--brand-radius);
}

.popup button#close:hover {
  background: var(--c-tint);
}

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