/* ==========================================================
   RC Magazine – styl "bold magazine"
   Paleta: grafitový asfalt, ostrá oranžová, signální žlutá
   ========================================================== */

:root {
  color-scheme: light;

  /* Barvy */
  --color-bg: #ecebe6;
  --color-surface: #ffffff;
  --color-surface-tint: #f6e9dc;
  --color-ink: #17181c;
  --color-ink-soft: #484a52;
  --color-muted: #5e6068;
  --color-primary: #e8480c;
  --color-primary-dark: #b83506;
  --color-accent: #ffc20e;
  --color-dark: #1a1c22;
  --color-dark-2: #262932;
  --color-dark-text: #d9dae0;
  --color-border: #cfcdc4;
  --color-border-strong: #17181c;
  --color-selection: #ffc20e;
  --color-overlay: rgba(23, 24, 28, 0.55);

  /* Písma */
  --font-display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Velikosti textu */
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: 1.1875rem;
  --text-h3: clamp(1.15rem, 1rem + 0.6vw, 1.45rem);
  --text-h2: clamp(1.45rem, 1.15rem + 1.3vw, 2.1rem);
  --text-h1: clamp(2rem, 1.3rem + 3.2vw, 3.6rem);
  --lh-body: 1.78;
  --lh-tight: 1.12;
  --measure: 68ch;

  /* Mezery */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.25rem;
  --space-xl: 3.5rem;
  --space-2xl: 5rem;

  /* Tvary */
  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --border-width: 2px;
  --container: 1200px;
  --header-height: 4.25rem;
  --sidebar-width: 320px;

  /* Stíny a gradienty */
  --shadow-card: 0 6px 18px rgba(23, 24, 28, 0.1);
  --shadow-card-hover: 0 14px 30px rgba(23, 24, 28, 0.2);
  --shadow-header: 0 8px 22px rgba(23, 24, 28, 0.28);
  --gradient-hero: linear-gradient(135deg, var(--color-dark) 0%, var(--color-dark-2) 55%, #3a2214 100%);
  --gradient-heat: linear-gradient(90deg, var(--color-primary), var(--color-accent));

  /* Animace */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --duration-fast: 0.18s;
  --duration: 0.3s;
}

/* ---------- Základ ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-padding-top: calc(var(--header-height) + var(--space-sm));
  scrollbar-color: var(--color-primary) var(--color-dark);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--color-bg);
  background-image:
    linear-gradient(45deg, rgba(23, 24, 28, 0.035) 25%, transparent 25%, transparent 75%, rgba(23, 24, 28, 0.035) 75%),
    linear-gradient(45deg, rgba(23, 24, 28, 0.035) 25%, transparent 25%, transparent 75%, rgba(23, 24, 28, 0.035) 75%);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--lh-body);
  font-size-adjust: from-font;
  accent-color: var(--color-primary);
  caret-color: var(--color-primary);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--color-selection);
  color: var(--color-ink);
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

ul, ol { margin: 0; padding: 0; }
ul { list-style: none; }
p { margin: 0; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  font-size-adjust: from-font;
  text-wrap: balance;
}

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

button { font-family: inherit; cursor: pointer; }

.wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Hlavička ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-dark);
  color: #fff;
  border-bottom: var(--border-width) solid var(--color-primary);
  container-type: scroll-state;
  container-name: site-header;
}

.header__inner {
  max-width: var(--container);
  margin: 0 auto;
  min-height: var(--header-height);
  padding: var(--space-2xs) var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  transition: min-height var(--duration) var(--ease);
}

@supports (container-type: scroll-state) {
  @container site-header scroll-state(stuck: top) {
    .header__inner { min-height: 3.25rem; }
    .header__logo { font-size: 1.4rem; }
    .header__logo img { max-height: 2rem; }
  }
  .header:has(+ *) { box-shadow: none; }
}

.header__logo {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
  transition: font-size var(--duration) var(--ease);
}

.header__logo a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: #fff;
}

.header__logo a:hover { color: var(--color-accent); }

.header__logo img {
  max-height: 2.75rem;
  width: auto;
  transition: max-height var(--duration) var(--ease);
}

.header__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  background: var(--color-primary);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  transition: background-color var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
}

.header__toggle:hover { background: var(--color-primary-dark); }
.header__toggle:active { transform: scale(0.95); }

/* Navigace v hlavičce */
.nav ul { display: flex; flex-wrap: wrap; gap: var(--space-3xs); }

.header .nav { display: none; }

.header .nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-dark-text);
  border-radius: var(--radius-sm);
}

.header .nav a:hover {
  background: var(--color-primary);
  color: #fff;
}

/* Lišta kategorií */
.tray {
  background: var(--color-dark-2);
  border-bottom: var(--border-width) solid var(--color-dark);
  display: none;
}

.tray__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-sm);
}

.tray ul { display: flex; flex-wrap: wrap; gap: 0; }

.tray a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-dark-text);
}

.tray a:hover {
  background: var(--color-accent);
  color: var(--color-ink);
}

/* Mobilní menu (pouze display) */
.smallnav {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: var(--space-xl) var(--space-md) var(--space-md);
  background: var(--color-dark);
  overflow-y: auto;
}

.smallnav__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  background: var(--color-primary);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
}

.smallnav ul { display: grid; gap: var(--space-2xs); }

.smallnav a {
  display: block;
  padding: var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  border: var(--border-width) solid var(--color-dark-2);
  border-radius: var(--radius-sm);
}

.smallnav a:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-ink);
}

/* ---------- Hlavní rozvržení ---------- */
.main { flex: 1; }

.main__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-sm) var(--space-xl);
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.content { min-width: 0; }

.list-heading {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: var(--border-width) solid var(--color-border-strong);
}

.list-heading::after {
  content: "";
  display: block;
  width: 4.5rem;
  height: 6px;
  margin-bottom: calc(var(--space-xs) * -1 - 4px);
  margin-top: var(--space-xs);
  background: var(--gradient-heat);
  position: relative;
  top: 2px;
}

/* ---------- Vyhledávání ---------- */
.search-form {
  grid-column: 1 / -1;
  container-type: inline-size;
}

.search-form form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  padding: var(--space-xs);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.search-form input[type="text"] {
  flex: 1 1 14rem;
  min-height: 2.75rem;
  padding: 0 var(--space-sm);
  font: inherit;
  color: var(--color-ink);
  background: var(--color-bg);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-sm);
}

.search-form input[type="text"]:focus-visible {
  border-color: var(--color-primary);
  outline-offset: 0;
}

.search-form input[type="submit"] {
  min-height: 2.75rem;
  padding: 0 var(--space-md);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--color-primary);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease);
}

.search-form input[type="submit"]:hover { background: var(--color-primary-dark); }
.search-form input[type="submit"]:active { transform: translateY(1px); }

/* ---------- Karty článků ---------- */
.article {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-primary);
}

.article__image {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--color-dark-2);
}

.article__image a { display: block; width: 100%; height: 100%; }

.article__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.article:hover .article__image img { transform: scale(1.05); }

.article__title {
  padding: var(--space-sm) var(--space-sm) 0;
  font-size: var(--text-h3);
  line-height: 1.15;
}

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

.article__perex {
  padding: var(--space-2xs) var(--space-sm) 0;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--color-ink-soft);
}

.article__category {
  order: -1;
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  z-index: 2;
  max-width: calc(100% - var(--space-md));
  padding: var(--space-3xs) var(--space-xs);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.3;
  color: var(--color-ink);
  background: var(--color-accent);
  border-radius: var(--radius-sm);
  box-shadow: 0 3px 10px rgba(23, 24, 28, 0.25);
}

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

.article__date {
  margin-top: auto;
  padding: var(--space-xs) var(--space-sm) var(--space-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.article__perex + .article__category,
.article__title + .article__category { margin-top: 0; }

/* Mřížky článků */
.articles,
.bottom__inner,
.top__inner {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: minmax(0, 1fr);
}

.articles { margin-bottom: var(--space-lg); }

/* Titulní blok */
.top {
  position: relative;
  background: var(--gradient-hero);
  border-bottom: var(--border-width) solid var(--color-primary);
}

.top__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-sm);
}

.top .article {
  background: var(--color-surface);
  border-color: var(--color-dark-2);
}

.top .article:hover { border-color: var(--color-accent); }

.top-news .article:first-child .article__title { font-size: var(--text-h2); }

/* Spodní bloky */
.bottom { margin-top: var(--space-xl); }

.bottom--category {
  padding: var(--space-md);
  background: var(--color-surface-tint);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-md);
}

.bottom__title {
  margin-bottom: var(--space-md);
  font-size: var(--text-h2);
}

.bottom__title a {
  display: inline-block;
  padding-bottom: var(--space-3xs);
  border-bottom: 5px solid var(--color-primary);
}

.bottom__title a:hover { border-bottom-color: var(--color-accent); }

/* ---------- Stránkování ---------- */
.pagination { margin: var(--space-lg) 0; }

.pagination ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  align-items: center;
}

.pagination li {
  min-width: 2.75rem;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
}

.pagination a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 var(--space-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-sm);
}

.pagination a:hover {
  background: var(--color-ink);
  border-color: var(--color-ink);
  color: #fff;
}

.pagination__active {
  background: var(--color-primary);
  color: #fff !important;
  border: var(--border-width) solid var(--color-primary);
  border-radius: var(--radius-sm);
}

/* ---------- Článek ---------- */
.text {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-md) var(--space-sm);
}

.text__title {
  max-width: 22ch;
  margin-bottom: var(--space-md);
  font-size: var(--text-h1);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.text__cover {
  margin: 0 calc(var(--space-sm) * -1) var(--space-lg);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-dark-2);
}

.text__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.text__body {
  max-width: var(--measure);
  margin: 0 auto;
  font-size: var(--text-lg);
  line-height: var(--lh-body);
  color: var(--color-ink);
  text-wrap: pretty;
  overflow-wrap: break-word;
}

.text--static .text__title,
.text--author .text__title { max-width: var(--measure); margin-left: auto; margin-right: auto; }

.text__body > * + * { margin-top: var(--space-sm); }

.text__body p { text-wrap: pretty; }

.text__body h2,
.text__body h3,
.text__body h4 {
  margin-top: var(--space-lg);
  margin-bottom: 0;
}

.text__body h2 { font-size: var(--text-h2); }
.text__body h3 { font-size: var(--text-h3); }

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

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

.text__body ul,
.text__body ol { padding-left: var(--space-md); }
.text__body ul { list-style: disc; }
.text__body li + li { margin-top: var(--space-2xs); }
.text__body li::marker { color: var(--color-primary); }

.text__body img {
  border-radius: var(--radius-sm);
  margin-left: auto;
  margin-right: auto;
}

.text__body blockquote {
  margin-left: 0;
  margin-right: 0;
  padding: var(--space-xs) var(--space-md);
  border-left: 4px solid var(--color-primary);
  color: var(--color-ink-soft);
  font-style: italic;
}

.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--text-sm);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.text__body th,
.text__body td {
  min-width: 8rem;
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--color-border);
}

.text__body tr:first-child th,
.text__body tr:first-child td {
  background: var(--color-dark);
  color: #fff;
  font-weight: 700;
}

.text__body tr:nth-child(even) td { background: var(--color-bg); }
.text__body tr:first-child:nth-child(even) td { background: var(--color-dark); }

/* Obsah článku */
.table-of-content {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-tint);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--text-md);
  line-height: 1.55;
}

.table-of-content span {
  display: block;
  margin-bottom: var(--space-2xs);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
}

.table-of-content ul,
.table-of-content ol { padding-left: var(--space-md); }
.table-of-content ul { list-style: disc; }
.table-of-content li + li { margin-top: var(--space-3xs); }

.text__body .author {
  float: left;
  width: 9rem;
  height: 9rem;
  margin: 0 var(--space-md) var(--space-sm) 0;
  object-fit: cover;
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-md);
}

/* Informace pod článkem */
.text__info {
  max-width: var(--measure);
  margin: var(--space-lg) auto 0;
  padding: var(--space-sm);
  display: grid;
  gap: var(--space-2xs);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--color-ink-soft);
}

.text__info a {
  font-weight: 600;
  color: var(--color-primary-dark);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

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

/* Ukazatel čtení (jen 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;
      z-index: 60;
      height: 5px;
      background: var(--gradient-heat);
      transform-origin: left center;
      transform: scaleX(0);
      animation: reading-progress linear both;
      animation-timeline: scroll(root);
    }

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

/* ---------- Sidebar ---------- */
.sidebar {
  display: grid;
  gap: var(--space-lg);
  padding: var(--space-md) var(--space-sm);
  background: var(--color-dark);
  color: var(--color-dark-text);
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--color-dark);
  container-type: inline-size;
  align-content: start;
}

.sidebar h3 {
  margin-bottom: var(--space-xs);
  padding-bottom: var(--space-2xs);
  font-size: 1.5rem;
  color: #fff;
  border-bottom: 3px solid var(--color-primary);
}

.sidebar a:hover { color: var(--color-accent); }

.sidebar .nav ul,
.sidebar .authors,
.sidebar .promo {
  display: grid;
  gap: 0;
}

.sidebar .nav a,
.sidebar .authors a {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  min-height: 2.75rem;
  padding: var(--space-2xs) 0;
  border-bottom: 1px solid var(--color-dark-2);
  font-weight: 500;
}

.sidebar .nav svg,
.sidebar .authors svg,
.sidebar .tags svg,
.sidebar .promo svg {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  stroke: var(--color-accent);
}

.sidebar .promo li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
  padding: var(--space-2xs) 0;
  border-bottom: 1px solid var(--color-dark-2);
}

.sidebar .promo a { text-decoration: underline; text-underline-offset: 0.2em; }

.sidebar .tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

.sidebar .tags a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  min-height: 2rem;
  padding: var(--space-3xs) var(--space-xs);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--color-dark-text);
  background: var(--color-dark-2);
  border: 1px solid var(--color-dark-2);
  border-radius: var(--radius-pill);
}

.sidebar .tags a:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-ink);
}

.sidebar .tags a:hover svg { stroke: var(--color-ink); }

/* Malé karty v sidebaru */
.sidebar .article {
  flex-direction: row;
  align-items: stretch;
  margin-bottom: var(--space-xs);
  background: var(--color-dark-2);
  border-color: var(--color-dark-2);
  box-shadow: none;
}

.sidebar .article:hover {
  transform: none;
  border-color: var(--color-accent);
  box-shadow: none;
}

.sidebar .article__image {
  flex: none;
  width: 6rem;
  aspect-ratio: 1 / 1;
}

.sidebar .article__title {
  padding: var(--space-xs);
  align-self: center;
  font-size: 1.0625rem;
  line-height: 1.2;
  color: #fff;
}

.sidebar .article__title a:hover { color: var(--color-accent); }

@container (min-width: 22rem) {
  .sidebar .article__image { width: 7rem; }
}

/* Spodní postranní panel */
.prefooter {
  background: var(--color-dark-2);
  border-top: var(--border-width) solid var(--color-primary);
}

.prefooter__inner.sidebar {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-sm);
  background: transparent;
  border: 0;
  border-radius: 0;
  grid-template-columns: minmax(0, 1fr);
}

/* ---------- Patička ---------- */
.footer {
  background: var(--color-dark);
  color: var(--color-dark-text);
  border-top: var(--border-width) solid var(--color-primary);
  font-size: var(--text-sm);
}

.footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-sm);
  display: grid;
  gap: var(--space-2xs);
}

.prefooter + .footer { border-top-color: var(--color-dark-2); }

/* ---------- Popup ---------- */
.popup {
  display: none;
  position: fixed;
  right: var(--space-sm);
  bottom: var(--space-sm);
  z-index: 200;
  max-width: min(26rem, calc(100vw - 2 * var(--space-sm)));
  padding: var(--space-lg) var(--space-md) var(--space-md);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card-hover);
}

.popup #close {
  position: absolute;
  top: var(--space-2xs);
  right: var(--space-2xs);
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.75rem;
  line-height: 1;
  color: #fff;
  background: var(--color-primary);
  border: 0;
  border-radius: var(--radius-sm);
}

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

/* ---------- Tablet ---------- */
@media (min-width: 600px) {
  .articles,
  .bottom__inner,
  .top__inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .top-news .article:first-child { grid-column: 1 / -1; flex-direction: row; }
  .top-news .article:first-child .article__image { flex: 0 0 55%; aspect-ratio: auto; min-height: 16rem; }
  .top-news .article:first-child .article__title { align-self: center; padding: var(--space-md); }
  .top-news .article:first-child .article__perex { display: none; }

  .text { padding: var(--space-lg) var(--space-md); }
  .text__cover { margin-left: calc(var(--space-md) * -1); margin-right: calc(var(--space-md) * -1); }
}

/* ---------- Mobil: menu ---------- */
@media (max-width: 767px) {
  .header__toggle { display: flex; }
}

/* ---------- Desktop ---------- */
@media (min-width: 768px) {
  .header .nav { display: block; }
  .tray { display: block; }
}

@media (min-width: 1024px) {
  .main__inner {
    grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
    gap: var(--space-xl);
    padding-top: var(--space-xl);
  }

  .search-form { grid-column: 1 / -1; }

  .sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--space-sm));
    padding: var(--space-md);
  }

  .articles,
  .bottom__inner,
  .top__inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .top__inner { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .top-news .article:first-child { grid-column: 1 / -1; }

  .text { padding: var(--space-xl) var(--space-xl); }
  .text__cover { margin-left: calc(var(--space-xl) * -1); margin-right: calc(var(--space-xl) * -1); }

  .prefooter__inner.sidebar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-xl);
  }

  .footer__inner { grid-template-columns: 1fr auto; align-items: center; }
}

@media (min-width: 1200px) {
  .bottom__inner { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .articles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

  .article:hover,
  .article:hover .article__image img { transform: none; }
}

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