/* ==========================================================================
   Černá jak noc – elegantní redakční vzhled
   Rozložení dodává společný základ (base-v7); zde je jen vzhled.
   ========================================================================== */

:root {
  /* mezery (vzdušná hustota) */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3rem;

  /* odvozené odstíny */
  --c-surface-2: color-mix(in srgb, var(--brand-bg) 55%, var(--brand-surface));
  --c-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, var(--brand-text));
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 9%, var(--brand-bg));
  --c-accent-hover: color-mix(in srgb, var(--brand-accent) 80%, var(--brand-text));
  --c-line-strong: color-mix(in srgb, var(--brand-border) 70%, var(--brand-muted));
  --c-footer-line: color-mix(in srgb, var(--brand-footer-text) 22%, transparent);
  --c-header-line: color-mix(in srgb, var(--brand-header-text) 22%, transparent);

  /* stíny (jen tam, kde je karta uvádí – hlavička po odrolování, popup) */
  --shadow-header: 0 8px 24px rgba(0, 0, 0, 0.16);
  --shadow-popup: 0 16px 40px rgba(0, 0, 0, 0.28);

  /* typografie */
  --fs-h1: clamp(1.9rem, 1.4rem + 2.2vw, 3rem);
  --fs-h2: clamp(1.45rem, 1.2rem + 1vw, 2rem);
  --fs-h3: clamp(1.15rem, 1.05rem + 0.4vw, 1.4rem);
  --fs-card: clamp(1.25rem, 1.12rem + 0.5vw, 1.55rem);
  --fs-body: clamp(1.0625rem, 1.02rem + 0.2vw, 1.1875rem);
  --fs-small: 0.875rem;

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

/* ---------- základ ---------- */
html {
  color-scheme: light;
  scroll-padding-top: 6rem;
  scrollbar-color: var(--brand-primary) var(--brand-bg);
}

body {
  margin: 0;
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: 1rem;
  font-size-adjust: from-font;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  accent-color: var(--brand-accent);
  caret-color: var(--brand-accent);
}

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

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

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;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); letter-spacing: -0.01em; }
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(--dur) var(--ease), text-decoration-color var(--dur) 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;
}

.header a:focus-visible,
.header button:focus-visible,
.tray a:focus-visible,
.footer a:focus-visible,
.pagination a:focus-visible,
.article__category a:focus-visible,
.search-form input:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 3px;
}

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

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

.header__logo,
.header .logo,
.logo {
  color: var(--brand-header-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.5rem;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.logo__name {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
}

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

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

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

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

.header__toggle {
  background: transparent;
  color: var(--brand-header-text);
  border: 1px solid var(--c-header-line);
  border-radius: var(--brand-radius);
  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: color-mix(in srgb, var(--brand-header-text) 12%, transparent);
  border-color: var(--brand-header-text);
}

.header .nav a {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

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

.tray__inner {
  padding-top: var(--space-xs);
  padding-bottom: var(--space-xs);
}

.tray a {
  display: inline-block;
  color: var(--brand-text);
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--brand-radius);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.tray a:hover {
  color: var(--brand-primary);
  background: var(--c-primary-soft);
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.tray__more-button {
  background: transparent;
  color: var(--brand-text);
  border: 0;
  border-radius: var(--brand-radius);
  font: inherit;
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}

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

/* ---------- mobilní menu ---------- */
.smallnav {
  background: var(--brand-surface);
  color: var(--brand-text);
}

.smallnav a {
  display: block;
  color: var(--brand-text);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-size: 1.4rem;
  padding: var(--space-sm) var(--space-md);
  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-primary-soft);
}

.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);
  transition: border-color var(--dur) var(--ease);
}

.smallnav__close svg { stroke: currentColor; }

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

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

.search-form input[type="text"] {
  flex: 1 1 14rem;
  min-height: 44px;
  padding: 0 var(--space-sm);
  font: inherit;
  color: var(--brand-text);
  background: var(--brand-surface);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--brand-radius);
  transition: border-color var(--dur) var(--ease);
}

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

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

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

/* ---------- výpis článků (řádky) ---------- */
.articles .article,
.bottom .article,
.top .article {
  background: transparent;
}

.article__image {
  margin: 0;
}

.article__image a {
  display: block;
}

.article__image img {
  display: block;
  width: 100%;
  border-radius: var(--brand-radius);
  background: var(--c-surface-2);
}

.article__title {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-card);
  line-height: 1.25;
  margin-top: 0;
  margin-bottom: 0;
}

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

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

.article__perex {
  color: var(--brand-muted);
  font-size: 1rem;
  line-height: 1.7;
  margin-top: 0;
  margin-bottom: 0;
}

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

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

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.4;
  padding: 0.2em 0.7em;
  border-radius: var(--brand-radius);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

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

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

.bottom__title {
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--brand-border);
}

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

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

/* ---------- stránkování ---------- */
.pagination ul {
  list-style: none;
  padding: 0;
}

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

.pagination a {
  display: inline-block;
  min-width: 44px;
  min-height: 44px;
  line-height: 44px;
  padding: 0 var(--space-sm);
  text-align: center;
  color: var(--brand-text);
  text-decoration: none;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  background: var(--brand-surface);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

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

.pagination__active {
  display: inline-block;
  min-width: 44px;
  min-height: 44px;
  line-height: 44px;
  padding: 0 var(--space-sm);
  text-align: center;
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  font-weight: 600;
}

/* ---------- článek ---------- */
.text__title {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-h1);
  line-height: 1.12;
  margin-bottom: var(--space-md);
}

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

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

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

.text__body p {
  margin-top: 0;
  margin-bottom: 1.2em;
  text-wrap: pretty;
}

.text__body h2 {
  font-size: var(--fs-h2);
  margin-top: 2.2em;
  margin-bottom: 0.9em;
}

.text__body h3 {
  font-size: var(--fs-h3);
  margin-top: 1.9em;
  margin-bottom: 0.8em;
}

.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;
  margin-top: 0;
  margin-bottom: 1.2em;
}

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

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

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

.text__body blockquote {
  margin: 1.8em 0;
  padding: 0.2em 0 0.2em 1.2em;
  border-left: 2px solid var(--brand-primary);
  font-family: var(--brand-font-heading);
  font-size: 1.3em;
  line-height: 1.5;
  color: var(--brand-text);
  border-radius: 0;
}

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

.text__body th,
.text__body td {
  text-align: left;
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 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-soft);
  color: var(--brand-text);
  font-weight: 700;
  border-bottom: 1px solid var(--c-line-strong);
}

.text__body hr {
  border: 0;
  border-top: 1px solid var(--brand-border);
  margin: 2.4em 0;
}

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

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

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

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

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

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

.author {
  display: block;
  border-radius: var(--brand-radius);
}

/* ---------- pravý a spodní panel ---------- */
.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.4rem;
  color: var(--brand-text);
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--brand-border);
}

.sidebar .article__title {
  font-size: 1.05rem;
  line-height: 1.3;
}

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

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

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

.sidebar .nav li,
.sidebar .authors li,
.prefooter .nav li,
.prefooter .authors li,
.sidebar .promo li,
.prefooter .promo li {
  padding: var(--space-2xs) 0;
}

.prefooter svg {
  stroke: currentColor;
  flex-shrink: 0;
}

.sidebar .tags a,
.prefooter .tags a {
  display: inline-block;
  background: var(--brand-surface);
  color: var(--brand-text);
  text-decoration: none;
  font-size: var(--fs-small);
  padding: 0.3em 0.8em;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

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

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

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

.prefooter__inner {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

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

.footer__inner {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-lg);
  font-size: var(--fs-small);
  line-height: 1.7;
}

.footer__inner p {
  margin: 0 0 var(--space-2xs);
  color: var(--brand-footer-text);
}

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

.footer a:hover {
  color: var(--brand-footer-text);
  text-decoration-thickness: 2px;
}

/* ---------- 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-popup);
  padding: var(--space-lg);
}

.popup #close {
  background: transparent;
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  min-width: 44px;
  min-height: 44px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

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

/* ---------- komponenty podle kontejneru ---------- */
.sidebar,
.prefooter__inner {
  container-type: inline-size;
}

@container (max-width: 20rem) {
  .article__title { font-size: 1rem; }
}

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