/* ==========================================================
   Czech in Prague – moderní tmavý vzhled
   Barvy a písma dodává stránka přes --brand-*, zde jen odvozeniny.
   ========================================================== */

: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) 82%, var(--brand-text) 18%);
  --c-border-soft: color-mix(in srgb, var(--brand-border) 60%, transparent);
  --c-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, var(--brand-text) 18%);
  --c-accent-hover: color-mix(in srgb, var(--brand-accent) 82%, var(--brand-text) 18%);
  --c-link-hover: color-mix(in srgb, var(--brand-primary) 80%, var(--brand-text) 20%);
  --c-focus: var(--brand-primary);
  --c-shade: rgba(0, 0, 0, 0.55);
  --c-shade-strong: rgba(0, 0, 0, 0.8);

  /* stíny */
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-header: 0 6px 20px rgba(0, 0, 0, 0.35);

  /* typografie */
  --fs-body: clamp(1.0625rem, 1.02rem + 0.2vw, 1.1875rem);
  --fs-h1: clamp(1.875rem, 1.4rem + 2.2vw, 3rem);
  --fs-h2: clamp(1.375rem, 1.15rem + 1.1vw, 2rem);
  --fs-h3: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
  --fs-small: 0.875rem;
  --fs-card-title: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);

  --t-fast: 0.2s ease;
  --header-h: 4.5rem;
}

html {
  color-scheme: dark;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  scrollbar-color: var(--brand-border) var(--brand-bg);
}

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.7;
  -webkit-font-smoothing: antialiased;
}

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

input,
textarea,
button {
  caret-color: var(--brand-accent);
  accent-color: var(--brand-accent);
}

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

/* ---------- Nadpisy ---------- */

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.02em; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.01em; }
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(--t-fast), background-color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}

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

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

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

.header {
  background: var(--brand-header-bg);
  color: var(--brand-header-text);
  border-bottom: 1px solid var(--brand-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

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

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

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

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

@media (min-width: 768px) {
  .header__logo,
  .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: border-color var(--t-fast), color var(--t-fast), background-color var(--t-fast);
}

.header__toggle svg {
  stroke: currentColor;
}

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

/* menu v hlavičce (varianta logo) */

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

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

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

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

.tray a {
  color: var(--brand-header-text);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 0.9375rem;
  padding: var(--space-sm) var(--space-md);
  display: inline-block;
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast), background-color var(--t-fast);
}

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

.tray__more-button {
  background: transparent;
  color: var(--brand-header-text);
  border: 0;
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 0.9375rem;
  cursor: pointer;
  padding: var(--space-sm) var(--space-md);
  transition: color var(--t-fast);
}

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

.tray__dropdown a {
  color: var(--brand-text);
  border-bottom: 0;
}

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

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

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

.smallnav ul {
  list-style: none;
}

.smallnav a {
  display: block;
  color: var(--brand-header-text);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.125rem;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--brand-border);
}

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

.smallnav__close {
  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;
}

.smallnav__close svg {
  stroke: currentColor;
}

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

/* ---------- Hledání ---------- */

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

.search-form input[type="text"] {
  flex: 1 1 auto;
  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-family: var(--brand-font-body);
  font-size: 1rem;
}

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

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

.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);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  cursor: pointer;
  min-height: 44px;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}

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

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

.article {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  overflow: hidden;
  padding-bottom: var(--space-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

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

.article__image {
  margin: 0;
}

.article__image img {
  display: block;
  border-radius: 0;
}

.article__title,
.article__perex,
.article__category,
.article__date {
  margin-left: var(--space-md);
  margin-right: var(--space-md);
}

.article__title {
  font-size: var(--fs-card-title);
  line-height: 1.3;
}

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

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

.article__perex {
  color: var(--brand-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

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

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

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

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

/* horní bloky (karty nad obsahem) */

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

.top .article__image img {
  display: block;
}

/* karty ve spodních blocích a podobné články */

.bottom__title {
  font-size: var(--fs-h2);
}

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

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

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

.pagination ul {
  list-style: none;
}

.pagination a,
.pagination li {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
}

.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);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  text-decoration: none;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

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

.pagination__active {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  min-width: 44px;
  min-height: 44px;
  line-height: 44px;
  text-align: center;
}

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

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

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

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

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

.text__body h3 {
  margin-top: 1.8em;
  margin-bottom: 0.8em;
}

.text__body h4 {
  margin-top: 1.6em;
  margin-bottom: 0.7em;
}

.text__body p {
  margin-bottom: 1.1em;
}

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

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

.text__body ul,
.text__body ol {
  margin: 0 0 1.2em 1.4em;
}

.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-md) var(--space-lg);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  color: var(--brand-text);
  font-style: italic;
}

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

.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.9375rem;
  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 {
  background: var(--c-surface-2);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
}

.text__body tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--brand-surface) 70%, transparent);
}

.text__body code {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: calc(var(--brand-radius) / 2);
  padding: 0.1em 0.35em;
  font-size: 0.9em;
}

.text__body pre {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: var(--space-md);
  overflow-x: auto;
}

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

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

.text__info {
  margin-top: var(--space-xl);
  padding: var(--space-md) var(--space-lg);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  color: var(--brand-muted);
  font-size: 0.9375rem;
}

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

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

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

/* autor */

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

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

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

/* ---------- Pravý panel a spodní panel ---------- */

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

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

.sidebar .nav a,
.prefooter .nav a,
.sidebar .authors a,
.prefooter .authors a {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--brand-text);
  text-decoration: none;
  padding: var(--space-xs) 0;
  min-height: 24px;
  border-bottom: 1px solid var(--c-border-soft);
}

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

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

.sidebar .tags a,
.prefooter .tags a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: 0.2rem 0.65rem;
  font-size: 0.875rem;
  text-decoration: none;
}

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

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

.sidebar .article,
.prefooter .article {
  background: transparent;
  border: 1px solid var(--brand-border);
}

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

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

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

.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  border-top: 1px solid var(--brand-border);
  font-size: 0.9375rem;
}

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

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

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

.popup #close {
  background: transparent;
  color: var(--brand-text);
  border: 0;
  font-size: 1.5rem;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

.popup #close:hover {
  color: var(--brand-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; }
