/* ==========================================================
   Lesnictví – moderní redakční vzhled
   Barvy a písma z --brand-*, rozložení dodává společný základ
   ========================================================== */

:root {
  color-scheme: light;

  /* 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-bg) 60%, var(--brand-surface));
  --c-surface-3: color-mix(in srgb, var(--brand-text) 5%, var(--brand-surface));
  --c-border-strong: color-mix(in srgb, var(--brand-text) 22%, var(--brand-border));
  --c-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, var(--brand-text));
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 9%, var(--brand-surface));
  --c-accent-hover: color-mix(in srgb, var(--brand-accent) 85%, var(--brand-text));
  --c-header-line: color-mix(in srgb, var(--brand-header-text) 16%, transparent);
  --c-header-hover: color-mix(in srgb, var(--brand-header-text) 12%, transparent);
  --c-footer-line: color-mix(in srgb, var(--brand-footer-text) 18%, transparent);
  --c-footer-muted: color-mix(in srgb, var(--brand-footer-text) 72%, var(--brand-footer-bg));
  --c-selection: color-mix(in srgb, var(--brand-primary) 24%, var(--brand-surface));

  /* stíny */
  --shadow-card: 0 6px 20px color-mix(in srgb, var(--brand-text) 10%, transparent);
  --shadow-header: 0 8px 24px rgba(0, 0, 0, 0.22);
  --shadow-popup: 0 18px 48px rgba(0, 0, 0, 0.28);

  /* typografie */
  --fs-h1: clamp(1.75rem, 1.3rem + 1.9vw, 2.75rem);
  --fs-h2: clamp(1.3rem, 1.1rem + 0.9vw, 1.75rem);
  --fs-h3: clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
  --fs-body: clamp(1.0625rem, 1.03rem + 0.15vw, 1.1875rem);
  --fs-small: 0.875rem;
  --fs-title-card: clamp(1.05rem, 1rem + 0.35vw, 1.25rem);

  --measure: 68ch;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 0.2s;
  --header-h: 4.5rem;
}

/* ---------- základ ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  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;
  accent-color: var(--brand-accent);
  caret-color: var(--brand-accent);
}

::selection {
  background: var(--c-selection);
  color: var(--brand-text);
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size-adjust: from-font;
  line-height: 1.2;
  color: var(--brand-text);
  text-wrap: balance;
  margin: 0 0 var(--space-sm);
}

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 {
  margin: 0 0 var(--space-md);
}

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

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

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

ul,
ol {
  margin: 0;
  padding: 0;
}

/* ---------- hlavička ---------- */

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

.header__inner {
  padding-block: var(--space-sm);
  min-height: var(--header-h);
  transition: padding var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

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

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

.header__logo {
  font-size: 1.375rem;
  letter-spacing: -0.01em;
}

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  white-space: nowrap;
}

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

.logo__name {
  color: var(--brand-header-text);
  font-size: 1.375rem;
}

.logo__tld {
  color: var(--brand-header-text);
  font-size: 0.7em;
  opacity: 0.85;
  white-space: nowrap;
}

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

.header__toggle {
  background: transparent;
  color: var(--brand-header-text);
  border: 1px solid var(--c-header-line);
  border-radius: var(--brand-radius);
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: var(--space-xs);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

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

.header__toggle:hover {
  background: var(--c-header-hover);
}

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

.header .nav a,
.header nav a {
  color: var(--brand-header-text);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--brand-radius);
  display: inline-block;
  transition: background var(--t-fast) var(--ease);
}

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

/* ---------- lišta s rubrikami ---------- */

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

.tray__inner ul {
  list-style: none;
}

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

.tray__inner a:hover {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  background: var(--c-primary-soft);
}

/* ---------- mobilní menu ---------- */

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

.smallnav ul {
  list-style: none;
}

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

.smallnav a:hover {
  color: var(--brand-primary);
  background: var(--c-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 var(--t-fast) var(--ease);
}

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

.smallnav__close:hover {
  background: var(--c-surface-3);
}

/* ---------- hlavní obsah ---------- */

.main {
  padding-block: var(--space-xl);
}

.content > h1 {
  margin-bottom: var(--space-lg);
}

.content > h2 {
  margin: var(--space-lg) 0 var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--brand-border);
}

/* ---------- vyhledávání ---------- */

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

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

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

.search-form input[type="submit"] {
  min-height: 2.75rem;
  padding: var(--space-xs) var(--space-lg);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1rem;
  color: var(--brand-on-primary);
  background: var(--brand-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

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

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

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

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

.article__image {
  margin: 0;
  overflow: hidden;
  border-radius: var(--brand-radius);
}

.article__image a {
  display: block;
}

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

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

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

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

.article__perex {
  margin: 0 0 var(--space-xs);
  color: var(--brand-muted);
  font-size: 0.975rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.article__category {
  margin: 0 0 var(--space-2xs);
  font-size: var(--fs-small);
  color: var(--brand-muted);
}

.article__category a {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease);
}

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

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

@container (max-width: 220px) {
  .article__title {
    font-size: 1rem;
  }
  .article__perex {
    font-size: 0.9rem;
  }
}

/* ---------- sekce výpisů (bottom, top) ---------- */

.bottom__title {
  margin: 0 0 var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--brand-border);
  font-size: var(--fs-h2);
}

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

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

.bottom {
  margin-top: var(--space-xl);
}

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

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

/* ---------- text článku ---------- */

.text {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: var(--space-lg);
}

@media (min-width: 768px) {
  .text {
    padding: var(--space-xl);
  }
}

.text__title {
  font-size: var(--fs-h1);
  margin-bottom: var(--space-md);
  max-width: 28ch;
  max-width: min(100%, 32ch);
}

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

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

.text__body {
  max-width: var(--measure);
  font-size: var(--fs-body);
  line-height: 1.8;
}

.text__body p {
  margin-bottom: 1.15em;
  text-wrap: pretty;
}

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

.text__body h3 {
  margin: 1.9em 0 0.6em;
}

.text__body h4 {
  margin: 1.6em 0 0.5em;
}

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

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

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

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

.text__body img {
  display: block;
  margin: 1.5em 0;
  border-radius: var(--brand-radius);
}

.text__body img.author {
  float: left;
  width: min(40%, 240px);
  margin: 0.25rem var(--space-lg) var(--space-md) 0;
  border: 1px solid var(--brand-border);
}

.text__body blockquote {
  margin: 1.6em 0;
  padding: var(--space-xs) var(--space-lg);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0;
  color: var(--brand-muted);
  font-style: italic;
}

.text__body blockquote p:last-child {
  margin-bottom: 0;
}

.text__body iframe {
  max-width: 100%;
  border: 0;
  border-radius: var(--brand-radius);
}

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

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

/* tabulky v článku */

.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.975rem;
  line-height: 1.5;
}

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

.text__body tr:first-child th,
.text__body tr:first-child td,
.text__body thead th {
  background: var(--c-primary-soft);
  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: var(--c-surface-2);
}

/* obsah článku */

.table-of-content {
  margin: 0 0 var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background: var(--c-surface-2);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-size: 0.975rem;
  line-height: 1.55;
}

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

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

.table-of-content li {
  margin-bottom: 0.25em;
}

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

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

/* informace pod článkem */

.text__info {
  max-width: var(--measure);
  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);
  line-height: 1.6;
}

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

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

/* ---------- stránkování ---------- */

.pagination {
  margin-top: var(--space-xl);
}

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

.pagination li {
  color: var(--brand-muted);
}

.pagination a,
.pagination__active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0 var(--space-sm);
  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-weight: var(--brand-heading-weight);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

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

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

/* ---------- pravý panel ---------- */

.sidebar h3:not(.article__title) {
  margin: var(--space-lg) 0 var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--brand-primary);
  font-size: 1.15rem;
}

.sidebar > h3:not(.article__title):first-child {
  margin-top: 0;
}

.sidebar .article {
  margin-bottom: var(--space-sm);
}

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

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

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

.sidebar .nav a,
.sidebar .authors a {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-xs);
  min-height: 2.5rem;
  color: var(--brand-text);
  text-decoration: none;
  border-bottom: 1px solid var(--brand-border);
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

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

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

.sidebar .tags a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  min-height: 2rem;
  padding: 0.2rem 0.75rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  background: var(--brand-surface);
  color: var(--brand-text);
  font-size: var(--fs-small);
  text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

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

.sidebar .promo li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--brand-border);
  font-size: 0.95rem;
}

.sidebar svg {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  stroke: var(--brand-primary);
}

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

.prefooter {
  margin-top: var(--space-xl);
  padding-block: var(--space-xl);
  background: var(--brand-surface);
  border-top: 1px solid var(--brand-border);
}

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

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

.prefooter .nav a,
.prefooter .authors a,
.prefooter .tags a {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 2.5rem;
  padding: var(--space-2xs) 0;
  color: var(--brand-text);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}

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

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

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

.prefooter .article {
  margin-bottom: var(--space-sm);
}

.prefooter .article__title {
  font-size: 0.975rem;
}

/* ---------- patička ---------- */

.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  border-top: 1px solid var(--c-footer-line);
  padding-block: var(--space-lg);
  font-size: var(--fs-small);
  line-height: 1.6;
}

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

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

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

/* ---------- popup ---------- */

.popup {
  position: fixed;
  right: var(--space-md);
  bottom: var(--space-md);
  z-index: 100;
  max-width: min(92vw, 380px);
  padding: var(--space-lg);
  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 {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  width: 2.25rem;
  height: 2.25rem;
  background: transparent;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  color: var(--brand-text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

.popup #close:hover {
  background: var(--c-surface-3);
}

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