/* ==========================================================================
   Lin Heart – moderní magazín, tónované pozadí, hlavička v hlavní barvě
   Rozložení dodává společný základ (base-v7); zde je jen vzhled.
   ========================================================================== */

:root {
  --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;

  --fs-sm: 0.875rem;
  --fs-base: 1.0625rem;
  --fs-lead: 1.1875rem;
  --fs-h3: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
  --fs-h2: clamp(1.375rem, 1.2rem + 0.9vw, 1.875rem);
  --fs-h1: clamp(1.75rem, 1.35rem + 2vw, 2.875rem);
  --fs-logo: clamp(1.375rem, 1.25rem + 0.6vw, 1.625rem);

  --c-surface-2: color-mix(in srgb, var(--brand-bg) 55%, var(--brand-surface));
  --c-border-strong: color-mix(in srgb, var(--brand-border) 70%, var(--brand-text));
  --c-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, var(--brand-text));
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 10%, var(--brand-surface));
  --c-accent-hover: color-mix(in srgb, var(--brand-accent) 82%, var(--brand-text));
  --c-header-hover: color-mix(in srgb, var(--brand-header-bg) 80%, #000);
  --c-footer-muted: color-mix(in srgb, var(--brand-footer-text) 88%, var(--brand-footer-bg));
  --c-footer-line: color-mix(in srgb, var(--brand-footer-text) 24%, var(--brand-footer-bg));

  --shadow-card: 0 2px 10px color-mix(in srgb, var(--brand-text) 8%, transparent);
  --shadow-hover: 0 8px 24px color-mix(in srgb, var(--brand-text) 14%, transparent);
  --shadow-header: 0 4px 16px color-mix(in srgb, #000 22%, transparent);
  --shadow-popup: 0 12px 40px color-mix(in srgb, #000 30%, transparent);

  --t-fast: 0.2s ease;
  --header-h: 4.25rem;

  color-scheme: light;
}

/* ---------- Základ ---------- */
html {
  scroll-padding-top: calc(var(--header-h) + 1rem);
  scrollbar-color: var(--brand-primary) var(--brand-bg);
  accent-color: var(--brand-accent);
}

body {
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: var(--fs-base);
  font-size-adjust: from-font;
  line-height: 1.7;
  caret-color: var(--brand-accent);
  -webkit-font-smoothing: antialiased;
}

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

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

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

p { text-wrap: pretty; }

a {
  color: var(--brand-primary);
  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-primary-hover); }

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

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

/* ---------- Hlavička (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 {
  min-height: var(--header-h);
}

.header__logo,
.logo,
.header .logo {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-logo);
  color: var(--brand-header-text);
  text-decoration: none;
}

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

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

.header__toggle {
  background: transparent;
  color: var(--brand-header-text);
  border: 1px solid var(--brand-header-text);
  border-radius: var(--brand-radius);
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast);
}

.header__toggle svg { stroke: currentColor; }

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

.header .nav a {
  color: var(--brand-header-text);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--brand-radius);
}

.header .nav a:hover {
  background: var(--c-header-hover);
  color: var(--brand-header-text);
}

/* ---------- 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-heading);
  font-weight: 600;
  font-size: var(--fs-sm);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

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

.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-heading);
  cursor: pointer;
}

.tray__more-button:hover {
  border-color: var(--brand-primary);
  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-hover);
}

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

.smallnav a {
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  text-decoration: none;
  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);
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

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

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

/* ---------- Hlavní část (bez vlastní plochy) ---------- */
.wrapper,
.main,
.main__inner,
.content,
.top,
.articles {
  background: transparent;
}

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

.search-form input[type="text"] {
  flex: 1;
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: var(--space-xs) var(--space-sm);
  font: inherit;
}

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

.search-form input[type="text"]:focus-visible {
  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-xs) var(--space-md);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background-color var(--t-fast);
}

.search-form input[type="submit"]:hover {
  background: 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);
  box-shadow: var(--shadow-card);
  padding: var(--space-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

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

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

.article__title {
  font-size: var(--fs-h3);
  line-height: 1.28;
}

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

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

.article__perex {
  color: var(--brand-muted);
  font-size: 0.97rem;
}

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

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border: 1px solid var(--brand-accent);
  border-radius: var(--brand-radius);
  padding: 0.1rem 0.6rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

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

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

/* ---------- Titulky sekcí ---------- */
.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); }

.content > h1,
.content > h2,
.articles + h2 {
  color: var(--brand-text);
}

/* ---------- Stránkování ---------- */
.pagination li {
  font-family: var(--brand-font-heading);
  font-weight: 600;
  color: var(--brand-muted);
}

.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--space-xs);
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  text-decoration: none;
}

.pagination a:hover {
  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;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Článek ---------- */
.text__title {
  font-size: var(--fs-h1);
  letter-spacing: -0.01em;
}

.text__cover img {
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-card);
}

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

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

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

.text__body a,
.text__info a,
.static a {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

.text__body a:hover,
.text__info a:hover {
  text-decoration-thickness: 2px;
}

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

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

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

.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.96rem;
  font-variant-numeric: tabular-nums;
}

.text__body th,
.text__body td,
.text__body thead th,
.text__body tbody td {
  text-align: left;
  padding: var(--space-2xs) var(--space-xs);
  border: 1px solid var(--brand-border);
  vertical-align: top;
}

.text__body tr:first-child th,
.text__body tr:first-child td {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  font-family: var(--brand-font-heading);
  font-weight: 600;
}

.text__body tr:nth-child(even) td {
  background: var(--c-surface-2);
}

.text__body img {
  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-sm) var(--space-md);
  margin-bottom: var(--space-md);
  font-size: 0.98rem;
}

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

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

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

.text__tags a,
.text__category a {
  text-decoration: none;
  font-weight: 600;
}

.text__tags a:hover,
.text__category a:hover { text-decoration: underline; }

img.author {
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-card);
}

/* ---------- Autoři ---------- */
.author-list a {
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  text-decoration: none;
}

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

/* ---------- Pravý panel ---------- */
.sidebar > *:not(.article):not(nav):not(ul):not([id^="sklik_"]):not(div) {
  max-width: 100%;
}

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

.sidebar .article {
  padding: var(--space-xs);
  box-shadow: none;
}

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

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

.sidebar .nav a,
.sidebar .authors a {
  display: block;
  padding: var(--space-2xs) var(--space-xs);
  color: var(--brand-text);
  text-decoration: none;
  border-radius: var(--brand-radius);
}

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

.sidebar .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.15rem 0.7rem;
  font-size: var(--fs-sm);
  text-decoration: none;
}

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

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

/* ---------- Spodní panel (sloupce odkazů) ---------- */
.prefooter {
  background: var(--brand-surface);
  border-top: 1px solid var(--brand-border);
}

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

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

.prefooter .nav a,
.prefooter .tags a,
.prefooter .authors a {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-3xs) 0;
  color: var(--brand-text);
  text-decoration: none;
}

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

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

.prefooter .promo li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
  padding: var(--space-3xs) 0;
}

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

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

.prefooter .article {
  box-shadow: none;
  padding: var(--space-xs);
}

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

.footer__inner {
  border-top: 1px solid var(--c-footer-line);
  font-size: var(--fs-sm);
}

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

.footer a:hover { color: var(--c-footer-muted); }

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

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

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

/* ---------- Karty podle šířky kontejneru ---------- */
.content,
.sidebar,
.prefooter__inner {
  container-type: inline-size;
}

@container (max-width: 420px) {
  .article { padding: var(--space-xs); }
  .article__title { font-size: 1.0625rem; }
}

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