/* ==========================================================================
   Lesnictví – moderní redakční vzhled
   Barvy a písma dodává stránka přes --brand-*; zde jen vlastní proměnné.
   ========================================================================== */

:root {
  /* mezery */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.25rem;
  --space-2xl: 3.5rem;

  /* odvozené odstíny */
  --c-surface-2: color-mix(in srgb, var(--brand-surface) 70%, var(--brand-border));
  --c-border-soft: color-mix(in srgb, var(--brand-border) 60%, var(--brand-bg));
  --c-primary-dark: color-mix(in srgb, var(--brand-primary) 82%, #000);
  --c-primary-tint: color-mix(in srgb, var(--brand-primary) 8%, var(--brand-bg));
  --c-accent-dark: color-mix(in srgb, var(--brand-accent) 82%, #000);
  --c-text-soft: color-mix(in srgb, var(--brand-text) 88%, var(--brand-bg));

  /* stíny */
  --shadow-card: 0 6px 20px rgba(23, 28, 38, 0.1);
  --shadow-header: 0 4px 16px rgba(23, 28, 38, 0.18);
  --shadow-focus: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 30%, transparent);

  /* typografie */
  --fs-body: clamp(1.0625rem, 1rem + 0.2vw, 1.1875rem);
  --fs-small: 0.875rem;
  --fs-xs: 0.8125rem;
  --fs-h1: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
  --fs-h2: clamp(1.375rem, 1.1rem + 1.2vw, 1.875rem);
  --fs-h3: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --fs-card-title: clamp(1.125rem, 1.02rem + 0.45vw, 1.3125rem);

  --transition: 0.2s ease;
  --header-h: 4.25rem;
}

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

html {
  color-scheme: light;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  scrollbar-color: var(--brand-primary) var(--brand-surface);
}

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

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

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

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

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

/* ---------- Hlavička (přilepená) ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  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,
.logo__name {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  color: var(--brand-header-text);
  font-size: 1.375rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

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

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

.header .nav a {
  color: var(--brand-header-text);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--brand-radius);
  transition: background-color var(--transition), color var(--transition);
}

.header .nav a:hover {
  color: var(--brand-header-text);
  background: color-mix(in srgb, var(--brand-header-text) 16%, transparent);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.header .nav a:focus-visible {
  outline-color: var(--brand-header-text);
}

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

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

.header__toggle:hover {
  background: color-mix(in srgb, var(--brand-header-text) 16%, transparent);
  border-color: var(--brand-header-text);
}

.header__toggle:focus-visible {
  outline-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-size: var(--fs-small);
  text-decoration: none;
  transition: color var(--transition), text-decoration-color var(--transition);
}

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

.tray__more-button {
  background: transparent;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

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

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

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

.smallnav a {
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  text-decoration: none;
  transition: color var(--transition);
}

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

.smallnav__close {
  background: transparent;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

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

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

.search-form input[type="text"] {
  background: var(--brand-bg);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-body);
  font-size: 1rem;
  padding: var(--space-sm) var(--space-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.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="text"]:focus-visible {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-focus);
}

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

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

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

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

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

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

.article__title {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-card-title);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

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

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

.article__perex {
  color: var(--c-text-soft);
  font-size: 0.975rem;
  line-height: 1.6;
}

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

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  padding: 0.15rem 0.6rem;
  font-family: var(--brand-font-heading);
  text-decoration: none;
  transition: background-color var(--transition), color var(--transition);
}

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

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

/* ---------- Sekce výpisů ---------- */

.bottom__title {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-h2);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--brand-primary);
}

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

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

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

.pagination a,
.pagination li {
  font-family: var(--brand-font-heading);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}

.pagination a {
  display: inline-block;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: var(--space-xs) var(--space-sm);
  color: var(--brand-text);
  background: var(--brand-bg);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  text-decoration: none;
  text-align: center;
  line-height: 1.5;
  transition: color var(--transition), border-color var(--transition), background-color var(--transition);
}

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

.pagination__active {
  display: inline-block;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: var(--space-xs) var(--space-sm);
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  text-align: center;
  line-height: 1.5;
}

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

.text__title {
  font-size: var(--fs-h1);
  letter-spacing: -0.02em;
}

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

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

.text__body p {
  text-wrap: pretty;
}

.text__body h2 {
  margin-top: 2em;
  margin-bottom: 0.9em;
}

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

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

.text__body a:hover {
  color: var(--c-primary-dark);
  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: 1.8em 0;
  padding: var(--space-xs) var(--space-lg);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0;
  color: var(--c-text-soft);
  font-style: italic;
}

.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.text__body th,
.text__body td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--brand-border);
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}

.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) 60%, var(--brand-bg));
}

.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: var(--fs-h3);
  margin-bottom: var(--space-xs);
}

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

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

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

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

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

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

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

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

/* ---------- Pravý panel ---------- */

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

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

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

.sidebar .tags a {
  display: inline-block;
  background: var(--brand-bg);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: 0.2rem 0.7rem;
  font-size: var(--fs-small);
}

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

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

.sidebar .nav svg,
.sidebar .promo svg,
.sidebar .tags svg,
.sidebar .authors svg {
  stroke: var(--brand-primary);
}

/* ---------- Spodní panel nad patičkou ---------- */

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

.prefooter h3:not(.article__title) {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-h3);
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-sm);
  border-bottom: 2px solid var(--brand-primary);
}

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

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

.prefooter svg {
  stroke: var(--brand-primary);
}

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

.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  font-size: var(--fs-small);
}

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

.footer a:hover {
  text-decoration-thickness: 2px;
}

.footer a:focus-visible {
  outline-color: var(--brand-footer-text);
}

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

.popup {
  background: var(--brand-bg);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-card);
}

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

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

/* ---------- Komponenty podle šířky kontejneru ---------- */

.sidebar,
.content {
  container-type: inline-size;
}

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

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

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