/* ==========================================================================
   O5G – technický redakční vzhled
   Barvy a písma jen z --brand-*, vlastní proměnné s prefixem --o5-
   ========================================================================== */

:root {
  /* mezery (hustší) */
  --o5-space-3xs: 0.25rem;
  --o5-space-2xs: 0.375rem;
  --o5-space-xs: 0.5rem;
  --o5-space-sm: 0.75rem;
  --o5-space-md: 1rem;
  --o5-space-lg: 1.5rem;
  --o5-space-xl: 2.25rem;
  --o5-space-2xl: 3.25rem;

  /* odvozené odstíny */
  --o5-surface-2: color-mix(in srgb, var(--brand-text) 4%, var(--brand-surface));
  --o5-surface-3: color-mix(in srgb, var(--brand-primary) 7%, var(--brand-surface));
  --o5-border-strong: color-mix(in srgb, var(--brand-text) 28%, var(--brand-border));
  --o5-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, var(--brand-text));
  --o5-primary-soft: color-mix(in srgb, var(--brand-primary) 12%, transparent);
  --o5-accent-hover: color-mix(in srgb, var(--brand-accent) 85%, var(--brand-text));
  --o5-header-muted: color-mix(in srgb, var(--brand-header-text) 72%, var(--brand-header-bg));
  --o5-header-line: color-mix(in srgb, var(--brand-header-text) 18%, var(--brand-header-bg));
  --o5-header-hover: color-mix(in srgb, var(--brand-header-text) 8%, var(--brand-header-bg));
  --o5-footer-muted: color-mix(in srgb, var(--brand-footer-text) 72%, var(--brand-footer-bg));
  --o5-footer-line: color-mix(in srgb, var(--brand-footer-text) 22%, var(--brand-footer-bg));
  --o5-link-visited: color-mix(in srgb, var(--brand-primary) 80%, var(--brand-accent));

  /* stíny (vždy s rozostřením) */
  --o5-shadow-card: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 12px rgb(0 0 0 / 0.05);
  --o5-shadow-lift: 0 2px 4px rgb(0 0 0 / 0.07), 0 10px 24px rgb(0 0 0 / 0.09);
  --o5-shadow-header: 0 4px 16px rgb(0 0 0 / 0.1);
  --o5-shadow-popup: 0 12px 40px rgb(0 0 0 / 0.28);

  /* typografie */
  --o5-fs-h1: clamp(1.75rem, 1.35rem + 1.6vw, 2.75rem);
  --o5-fs-h2: clamp(1.3rem, 1.15rem + 0.7vw, 1.75rem);
  --o5-fs-h3: clamp(1.05rem, 1rem + 0.3vw, 1.25rem);
  --o5-fs-body: clamp(1.0625rem, 1.03rem + 0.15vw, 1.1875rem);
  --o5-fs-small: 0.8125rem;

  /* ostatní */
  --o5-ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --o5-t: 0.2s;
  --o5-header-h: 4rem;
}

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

html {
  color-scheme: light;
  scroll-padding-top: calc(var(--o5-header-h) + 1rem);
  scrollbar-color: var(--o5-border-strong) var(--brand-bg);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: var(--o5-fs-body);
  font-size-adjust: from-font;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  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(--o5-fs-h1); letter-spacing: -0.02em; }
h2 { font-size: var(--o5-fs-h2); letter-spacing: -0.01em; }
h3 { font-size: var(--o5-fs-h3); }

p { text-wrap: pretty; }

a {
  color: var(--brand-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--o5-t) ease, text-decoration-color var(--o5-t) ease;
}

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

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

/* ---------- Hlavička (přilepená, světlá) ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--brand-header-bg);
  color: var(--brand-header-text);
  border-bottom: 1px solid var(--o5-header-line);
  container-type: scroll-state;
  container-name: site-header;
}

.header__inner {
  padding-block: var(--o5-space-sm);
  transition: padding var(--o5-t) ease;
}

@supports (container-type: scroll-state) {
  @container site-header scroll-state(stuck: top) {
    .header__inner {
      padding-block: var(--o5-space-2xs);
    }
  }
}

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

/* Logo (jen vzhled) */
.header__logo,
.logo {
  color: var(--brand-header-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.375rem;
  line-height: 1;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

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

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

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

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

/* Tlačítko menu */
.header__toggle {
  background: transparent;
  color: var(--brand-header-text);
  border: 1px solid var(--o5-header-line);
  border-radius: var(--brand-radius);
  min-width: 2.75rem;
  min-height: 2.75rem;
  cursor: pointer;
  transition: background-color var(--o5-t) ease, border-color var(--o5-t) ease;
}

.header__toggle svg {
  stroke: currentColor;
}

.header__toggle:hover {
  background: var(--o5-header-hover);
  border-color: var(--o5-border-strong);
}

/* ---------- Menu rubrik (lišta) ---------- */

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

.tray__inner ul {
  list-style: none;
}

.tray__inner a,
.header .nav a {
  display: inline-block;
  padding: var(--o5-space-xs) var(--o5-space-sm);
  min-height: 24px;
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color var(--o5-t) ease, border-color var(--o5-t) ease, background-color var(--o5-t) ease;
}

.tray__inner a:hover,
.header .nav a:hover {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  background: var(--o5-primary-soft);
}

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

.smallnav ul {
  list-style: none;
}

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

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

.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: background-color var(--o5-t) ease;
}

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

.smallnav__close:hover {
  background: var(--o5-surface-2);
}

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

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

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

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

.search-form input[type="text"] {
  flex: 1;
  min-height: 2.75rem;
  padding: var(--o5-space-xs) var(--o5-space-sm);
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--o5-border-strong);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-body);
  font-size: 1rem;
  transition: border-color var(--o5-t) ease, box-shadow var(--o5-t) ease;
}

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

.search-form input[type="text"]:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.search-form input[type="submit"] {
  min-height: 2.75rem;
  padding: var(--o5-space-xs) var(--o5-space-md);
  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-heading);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background-color var(--o5-t) ease, border-color var(--o5-t) ease;
}

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

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

.article {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: var(--o5-space-sm);
  container-type: inline-size;
  transition: border-color var(--o5-t) ease, background-color var(--o5-t) ease;
}

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

.article__image {
  margin: 0 0 var(--o5-space-xs);
  overflow: hidden;
  border-radius: var(--brand-radius);
  background: var(--o5-surface-2);
}

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

.article__title {
  margin: 0 0 var(--o5-space-2xs);
  font-size: var(--o5-fs-h3);
  line-height: 1.25;
}

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

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

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

.article__category {
  margin: 0 0 var(--o5-space-3xs);
  font-size: var(--o5-fs-small);
  line-height: 1.5;
  color: var(--brand-muted);
}

.article__category a {
  display: inline-block;
  padding: 0.0625rem var(--o5-space-xs);
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--o5-t) ease;
}

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

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

@container (min-width: 22rem) {
  .article__perex {
    font-size: 1rem;
  }
}

/* Titulky sekcí (rubriky) */
.bottom__title {
  margin: 0 0 var(--o5-space-sm);
  padding-bottom: var(--o5-space-2xs);
  border-bottom: 2px solid var(--brand-text);
  font-size: var(--o5-fs-h2);
}

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

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

/* ---------- Horní bloky ---------- */

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

/* ---------- Text článku ---------- */

.text__title {
  margin-block-end: var(--o5-space-md);
  max-width: 28ch;
  letter-spacing: -0.025em;
}

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

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

.text__body {
  max-width: 68ch;
  color: var(--brand-text);
  line-height: 1.8;
}

.text__body > * + * {
  margin-top: 1.1em;
}

.text__body h2 {
  margin-top: 2em;
  margin-bottom: 0.6em;
  font-size: var(--o5-fs-h2);
}

.text__body h3 {
  margin-top: 1.7em;
  margin-bottom: 0.5em;
  font-size: var(--o5-fs-h3);
}

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

.text__body ul,
.text__body ol {
  padding-left: 1.4em;
}

.text__body li + li {
  margin-top: 0.35em;
}

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

.text__body blockquote {
  margin-inline: 0;
  padding: var(--o5-space-xs) var(--o5-space-md);
  border-left: 3px solid var(--brand-primary);
  background: var(--o5-surface-2);
  color: var(--brand-text);
  font-style: italic;
}

.text__body code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  background: var(--o5-surface-3);
  border-radius: calc(var(--brand-radius) / 2);
}

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

.text__body pre code {
  padding: 0;
  background: none;
}

/* Tabulky */
.text table,
.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.text table th,
.text table td {
  padding: var(--o5-space-xs) var(--o5-space-sm);
  border: 1px solid var(--brand-border);
  text-align: left;
  vertical-align: top;
}

.text table tr:first-child th,
.text table tr:first-child td {
  background: var(--brand-text);
  color: var(--brand-bg);
  font-family: var(--brand-font-heading);
  font-weight: 600;
}

.text table tbody tr:nth-child(even) td {
  background: var(--o5-surface-2);
}

/* Obsah článku */
.table-of-content {
  padding: var(--o5-space-sm) var(--o5-space-md);
  background: var(--o5-surface-3);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-size: 0.9375rem;
}

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

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

.table-of-content a {
  text-decoration: none;
}

.table-of-content a:hover {
  text-decoration: underline;
}

/* Informace pod článkem */
.text__info {
  max-width: 68ch;
  margin-top: var(--o5-space-lg);
  padding-top: var(--o5-space-sm);
  border-top: 1px solid var(--brand-border);
  color: var(--brand-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

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

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

/* Autor */
img.author {
  border-radius: var(--brand-radius);
  border: 1px solid var(--brand-border);
  object-fit: cover;
}

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

.pagination ul {
  list-style: none;
  padding: 0;
}

.pagination li {
  font-variant-numeric: tabular-nums;
}

.pagination a,
.pagination li.pagination__active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0 var(--o5-space-xs);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  background: var(--brand-surface);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: background-color var(--o5-t) ease, border-color var(--o5-t) ease, color var(--o5-t) ease;
}

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

.pagination li.pagination__active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--brand-on-primary);
  font-weight: 700;
}

/* ---------- Spodní panel a widgety ---------- */

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

.sidebar h3:not(.article__title),
.prefooter h3:not(.article__title) {
  margin: 0 0 var(--o5-space-xs);
  padding-bottom: var(--o5-space-2xs);
  border-bottom: 2px solid var(--brand-text);
  font-size: 1.0625rem;
  letter-spacing: 0;
  color: var(--brand-text);
}

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

.sidebar .nav li + li,
.sidebar .authors li + li,
.sidebar .promo li + li {
  border-top: 1px solid var(--brand-border);
}

.sidebar .nav a,
.sidebar .authors a,
.sidebar .promo a,
.sidebar .tags a {
  display: flex;
  align-items: center;
  gap: var(--o5-space-2xs);
  min-height: 24px;
  padding: var(--o5-space-2xs) 0;
  color: var(--brand-text);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: color var(--o5-t) ease;
}

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

.sidebar svg {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  stroke: var(--brand-primary);
}

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

.sidebar .tags a {
  padding: var(--o5-space-3xs) var(--o5-space-xs);
  background: var(--o5-surface-2);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-size: 0.8125rem;
}

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

.sidebar .promo li {
  display: flex;
  align-items: center;
  gap: var(--o5-space-2xs);
  padding: var(--o5-space-2xs) 0;
  font-size: 0.9375rem;
}

.sidebar .promo a {
  display: inline;
  padding: 0;
  color: var(--brand-primary);
}

.sidebar .article {
  padding: var(--o5-space-xs);
  margin-bottom: var(--o5-space-xs);
}

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

/* ---------- Patička (tmavá) ---------- */

.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  font-size: 0.875rem;
  line-height: 1.6;
}

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

.footer p {
  margin: 0 0 var(--o5-space-3xs);
  color: var(--o5-footer-muted);
}

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

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

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

.popup {
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: var(--o5-shadow-popup);
  padding: var(--o5-space-md);
}

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

.popup #close:hover {
  background: var(--o5-surface-2);
}

/* ---------- Reklamy (jen vnější vzhled okolí) ---------- */

[data-szn-ssp-ad] {
  max-width: 100%;
}

/* ---------- Pohyb ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !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; }
