/* ==========================================================================
   Moravia Kongresy – redakční vzhled
   Barvy a písma výhradně z --brand-*, rozložení dodává 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-surface) 70%, var(--brand-border));
  --c-primary-dark: color-mix(in srgb, var(--brand-primary) 82%, #000);
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 10%, var(--brand-bg));
  --c-accent-dark: color-mix(in srgb, var(--brand-accent) 82%, #000);
  --c-line-strong: color-mix(in srgb, var(--brand-border) 60%, var(--brand-text));
  --c-footer-line: color-mix(in srgb, var(--brand-footer-text) 22%, transparent);
  --c-header-line: color-mix(in srgb, var(--brand-header-text) 24%, transparent);
  --c-selection: color-mix(in srgb, var(--brand-primary) 22%, var(--brand-bg));

  /* stíny */
  --shadow-sticky: 0 6px 18px rgba(0, 0, 0, 0.14);
  --shadow-popup: 0 12px 36px rgba(0, 0, 0, 0.28);
  --shadow-menu: 0 10px 28px rgba(0, 0, 0, 0.18);

  /* velikosti písma */
  --fs-h1: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem);
  --fs-h2: clamp(1.375rem, 1.1rem + 1.1vw, 1.875rem);
  --fs-h3: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --fs-card-title: clamp(1.125rem, 1.02rem + 0.45vw, 1.375rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.875rem;
  --fs-tiny: 0.8125rem;

  /* pohyb */
  --ease: 0.22s ease;
  --header-height: 4.25rem;
}

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

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

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

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

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(--ease), text-decoration-color var(--ease);
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
.header__toggle: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);
  font-size-adjust: from-font;
  color: var(--brand-text);
  line-height: 1.25;
  text-wrap: balance;
  margin-top: 0;
}

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);
  box-shadow: var(--shadow-sticky);
}

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

.header__logo,
.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;
}

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

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

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

.header a:hover {
  color: var(--brand-header-text);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

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

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

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

.header__toggle:hover {
  border-color: var(--brand-header-text);
  background: color-mix(in srgb, var(--brand-header-text) 12%, transparent);
}

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

.header .nav a:hover {
  text-decoration: underline;
}

/* ---------- Lišta rubrik ---------- */

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

.tray a {
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--ease), text-decoration-color var(--ease);
}

.tray a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
  text-underline-offset: 0.35em;
  text-decoration-thickness: 2px;
}

.tray__more-button {
  background: transparent;
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-body);
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
}

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

.tray__dropdown {
  background: var(--brand-bg);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-menu);
}

/* ---------- Mobilní menu ---------- */

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

.smallnav ul {
  list-style: none;
  margin: 0;
  padding: var(--space-md);
}

.smallnav li + li {
  border-top: 1px solid var(--brand-border);
}

.smallnav a {
  display: block;
  padding: var(--space-sm) var(--space-xs);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.125rem;
  text-decoration: none;
}

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

.smallnav__close {
  background: transparent;
  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(--ease);
}

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

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

.search-form input[type="text"] {
  background: var(--brand-bg);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-body);
  font-size: var(--fs-body);
  padding: var(--space-sm) var(--space-md);
  transition: border-color var(--ease);
}

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

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

.search-form input[type="submit"] {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-body);
  font-size: var(--fs-small);
  font-weight: 700;
  padding: var(--space-sm) var(--space-lg);
  cursor: pointer;
  transition: background-color var(--ease), border-color var(--ease);
}

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

.content > h1,
.content > h2 {
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--brand-text);
  margin-bottom: var(--space-lg);
}

/* ---------- Karty článků (řádky, bez rámečku, linka) ---------- */

.article {
  background: transparent;
  border-bottom: 1px solid var(--brand-border);
  padding-bottom: var(--space-lg);
}

.article__image {
  margin: 0;
}

.article__image a {
  display: block;
}

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

.article__title {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-card-title);
  line-height: 1.3;
  margin: 0;
  text-wrap: balance;
}

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

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

.article__perex {
  margin: 0;
  color: var(--brand-text);
  font-size: 1rem;
  line-height: 1.65;
}

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

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

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  padding: 0.125rem 0.625rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color var(--ease), color var(--ease);
}

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

/* Sekce a výpisy */

.bottom__title {
  font-size: var(--fs-h2);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--brand-text);
  margin-bottom: var(--space-lg);
}

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

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

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

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

.pagination ul {
  list-style: none;
}

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

.pagination a {
  display: inline-block;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: var(--space-2xs) var(--space-sm);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  color: var(--brand-text);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.8;
  text-align: center;
  transition: color var(--ease), border-color var(--ease), background-color var(--ease);
}

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

.pagination__active {
  display: inline-block;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: var(--space-2xs) var(--space-sm);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  font-weight: 700;
  line-height: 1.8;
  text-align: center;
}

/* ---------- Článek ---------- */

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

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

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

.text__body {
  font-size: 1.125rem;
  line-height: 1.8;
}

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

.text__body h2 {
  margin: 2em 0 0.7em;
  padding-bottom: var(--space-2xs);
  border-bottom: 1px solid var(--brand-border);
}

.text__body h3 {
  margin: 1.8em 0 0.6em;
}

.text__body h4 {
  margin: 1.6em 0 0.5em;
}

.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.25em;
  padding-left: 1.5em;
}

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

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

.text__body blockquote {
  margin: 1.6em 0;
  padding: var(--space-xs) var(--space-lg);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0;
  color: var(--brand-muted);
  font-family: var(--brand-font-heading);
  font-style: italic;
}

.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: 1rem;
  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 table tr:first-child th,
.text__body table tr:first-child td {
  background: var(--brand-surface);
  color: var(--brand-text);
  font-weight: 700;
}

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

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

.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);
  font-size: 1rem;
}

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

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

.table-of-content a {
  color: var(--brand-text);
  text-decoration: none;
}

.table-of-content a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

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

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

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

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

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

/* ---------- Ukazatel čtení (jen v CSS) ---------- */

.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: 0 50%;
      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); }
    }
  }
}

/* ---------- Panely a widgety ---------- */

.sidebar h3:not(.article__title),
.prefooter h3:not(.article__title) {
  font-size: 1.125rem;
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-md);
  border-bottom: 2px solid var(--brand-text);
}

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

.sidebar .nav li,
.sidebar .authors li,
.sidebar .promo li,
.prefooter .nav li,
.prefooter .authors li,
.prefooter .promo li {
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--brand-border);
}

.sidebar .nav a,
.sidebar .authors a,
.prefooter .nav a,
.prefooter .authors a,
.prefooter .tags a,
.sidebar .tags a {
  color: var(--brand-text);
  text-decoration: none;
  transition: color var(--ease);
}

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

.sidebar .nav svg,
.prefooter .nav svg,
.prefooter .tags svg,
.prefooter .authors svg,
.prefooter .promo svg {
  width: 1rem;
  height: 1rem;
  stroke: var(--brand-primary);
  flex-shrink: 0;
}

.sidebar .tags a,
.prefooter .tags a {
  display: inline-block;
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: 0.125rem 0.75rem;
  font-size: var(--fs-small);
}

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

.sidebar .article,
.prefooter .article {
  padding-bottom: var(--space-sm);
}

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

.sidebar .article__image img,
.prefooter .article__image img {
  border-radius: var(--brand-radius);
}

/* Spodní panel nad patičkou */

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

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

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

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

.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  font-size: var(--fs-small);
}

.footer__inner {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-top: 1px solid var(--c-footer-line);
}

.footer p {
  margin: 0 0 var(--space-xs);
  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;
}

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

.popup {
  background: var(--brand-bg);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-popup);
}

.popup button {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 0;
  border-radius: var(--brand-radius);
  min-width: 2rem;
  min-height: 2rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--ease);
}

.popup button:hover {
  background: var(--c-primary-dark);
  color: var(--brand-on-primary);
}

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