/* ==========================================================================
   Naše rodina – vzhled (přívětivý, vzdušný, jemné stíny bez rámečků)
   Rozložení dodává společný základ base-v7; tento soubor řeší jen vzhled.
   ========================================================================== */

:root {
  /* Mezery – jedna stupnice */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4.5rem;

  /* Stíny (vždy s posunem i rozostřením) */
  --shadow-card: 0 4px 18px color-mix(in srgb, var(--brand-text) 9%, transparent);
  --shadow-card-hover: 0 10px 28px color-mix(in srgb, var(--brand-text) 15%, transparent);
  --shadow-header: 0 6px 20px color-mix(in srgb, var(--brand-text) 12%, transparent);
  --shadow-soft: 0 2px 10px color-mix(in srgb, var(--brand-text) 7%, transparent);

  /* Odvozené odstíny */
  --c-surface-2: color-mix(in srgb, var(--brand-primary) 6%, var(--brand-surface));
  --c-surface-3: color-mix(in srgb, var(--brand-primary) 12%, var(--brand-surface));
  --c-primary-dark: color-mix(in srgb, var(--brand-primary) 82%, #000);
  --c-accent-dark: color-mix(in srgb, var(--brand-accent) 82%, #000);
  --c-line: color-mix(in srgb, var(--brand-border) 70%, var(--brand-bg));
  --c-footer-muted: color-mix(in srgb, var(--brand-footer-text) 72%, var(--brand-footer-bg));
  --c-footer-line: color-mix(in srgb, var(--brand-footer-text) 22%, var(--brand-footer-bg));

  /* Velikosti písma */
  --fs-body: clamp(1.0625rem, 1.02rem + 0.2vw, 1.1875rem);
  --fs-small: 0.875rem;
  --fs-h1: clamp(1.875rem, 1.4rem + 2vw, 2.875rem);
  --fs-h2: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  --fs-h3: clamp(1.1875rem, 1.1rem + 0.4vw, 1.4375rem);
  --fs-card-title: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);

  /* Pohyb */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 0.2s;
  --t-med: 0.3s;

  --measure: 68ch;
}

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

html {
  color-scheme: light;
  scroll-padding-top: 6rem;
  scrollbar-color: color-mix(in srgb, var(--brand-primary) 55%, var(--brand-bg)) var(--brand-bg);
  accent-color: var(--brand-accent);
}

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

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.75;
  caret-color: var(--brand-accent);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

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

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

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 3px;
  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;
  color: var(--brand-text);
  line-height: 1.25;
  text-wrap: balance;
  margin-top: 0;
}

h1 { font-size: var(--fs-h1); letter-spacing: -0.015em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p {
  margin-top: 0;
}

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

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--brand-header-bg);
  color: var(--brand-header-text);
  box-shadow: var(--shadow-soft);
  container-type: scroll-state;
  container-name: site-header;
  transition: box-shadow var(--t-med) var(--ease);
}

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

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

.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.1;
  text-decoration: none;
  white-space: nowrap;
}

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

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

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

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

.header__toggle {
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-2xs);
  background: transparent;
  border: 0;
  border-radius: var(--brand-radius);
  color: var(--brand-header-text);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.header__toggle svg {
  stroke: currentColor;
}

.header__toggle:hover {
  background: var(--c-surface-3);
  color: var(--brand-primary);
}

/* ---------- Menu rubrik – lišta pod hlavičkou ---------- */

.tray {
  background: var(--brand-surface);
  box-shadow: var(--shadow-soft);
}

.tray ul,
.header .nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tray a,
.header .nav a {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--brand-radius);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.tray a:hover,
.header .nav a:hover {
  background: var(--c-surface-3);
  color: var(--brand-primary);
}

.tray a:focus-visible,
.header .nav a:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
}

/* ---------- Mobilní menu (jen display, bez transform) ---------- */

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

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

.smallnav a {
  display: block;
  padding: var(--space-sm) var(--space-md);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--c-line);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.smallnav a:hover {
  background: var(--c-surface-2);
  color: var(--brand-primary);
}

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

.smallnav__close svg {
  stroke: currentColor;
}

/* ---------- Hlavní plocha ---------- */

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

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

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

.article {
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--t-med) var(--ease);
  container-type: inline-size;
}

.article:hover {
  box-shadow: var(--shadow-card-hover);
}

.article__image {
  margin: 0;
  line-height: 0;
}

.article__image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
}

.article__title {
  margin: 0;
  padding: var(--space-sm) var(--space-md) 0;
  font-size: var(--fs-card-title);
  line-height: 1.3;
}

.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;
  padding: var(--space-2xs) var(--space-md) 0;
  color: var(--brand-muted);
  font-size: 0.9688rem;
  line-height: 1.6;
  text-wrap: pretty;
}

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

.article__category a {
  display: inline-block;
  padding: 0.15rem 0.65rem;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  border-radius: var(--brand-radius);
  transition: background-color var(--t-fast) var(--ease);
}

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

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

.article__category:last-child {
  padding-bottom: var(--space-md);
}

.article__title:last-child {
  padding-bottom: var(--space-md);
}

@container (max-width: 260px) {
  .article__title,
  .article__perex,
  .article__category,
  .article__date {
    padding-inline: var(--space-sm);
  }
}

/* ---------- Horní blok ---------- */

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

.top-news .article__title {
  font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.75rem);
}

/* ---------- Sekce rubrik (řádky po třech) ---------- */

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

.bottom__title {
  margin: 0 0 var(--space-md);
  padding: 0;
  font-size: var(--fs-h2);
}

.bottom__title a {
  color: var(--brand-text);
  text-decoration: none;
  display: inline-block;
  transition: color var(--t-fast) var(--ease);
}

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

.bottom__title a::after {
  content: "\2192";
  margin-left: 0.5rem;
  color: var(--brand-primary);
  font-weight: 400;
}

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

.text {
  background: var(--brand-surface);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg) var(--space-md);
}

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

.text__title {
  margin-bottom: var(--space-md);
  max-width: 24em;
}

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

.text__cover img {
  display: block;
  width: 100%;
  height: auto;
  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-top: 2em;
  margin-bottom: 0.9em;
}

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

.text__body h4 {
  margin-top: 1.6em;
  margin-bottom: 0.7em;
}

.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 {
  margin: 0 0 1.3em;
  padding-left: 1.5em;
}

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

.text__body li::marker {
  color: var(--brand-primary);
}

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

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

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

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

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

.text__body table tr:first-child th,
.text__body table tr:first-child td {
  background: var(--c-surface-3);
  font-family: var(--brand-font-heading);
  font-weight: 600;
}

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

.text__body table tr:first-child td {
  background: var(--c-surface-3);
}

.text__body img.author {
  float: right;
  width: 160px;
  height: auto;
  margin: 0 0 var(--space-sm) var(--space-md);
  border-radius: var(--brand-radius);
}

.table-of-content {
  margin: 0 0 var(--space-lg);
  padding: var(--space-md);
  background: var(--c-surface-2);
  border-radius: var(--brand-radius);
}

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

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

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

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

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

.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);
}

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

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

.text__body iframe {
  display: block;
  margin: var(--space-md) 0;
  border-radius: var(--brand-radius);
}

/* ---------- Vyhledávání ---------- */

.search-form {
  margin-bottom: var(--space-md);
}

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

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

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

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

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

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

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

.pagination ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination li {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-muted);
  font-variant-numeric: tabular-nums;
}

.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--space-sm);
  background: var(--brand-surface);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-size: 0.9375rem;
  text-decoration: none;
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-soft);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

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

.pagination__active {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  border-radius: var(--brand-radius);
}

/* ---------- Pravý panel a spodní panel ---------- */

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

.sidebar h3.article__title {
  padding: 0;
  font-size: 1rem;
}

.sidebar .article {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs);
  margin-bottom: var(--space-sm);
  box-shadow: var(--shadow-soft);
}

.sidebar .article__image {
  flex: 0 0 96px;
  width: 96px;
}

.sidebar .article__image img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--brand-radius);
}

.sidebar .article__title {
  padding: 0;
  font-size: 1rem;
}

.sidebar .nav ul,
.sidebar .tags,
.sidebar .promo,
.sidebar .authors {
  list-style: none;
  margin: 0 0 var(--space-lg);
  padding: 0;
}

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

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

.sidebar .nav svg,
.sidebar .tags svg,
.sidebar .promo svg,
.sidebar .authors svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  stroke: var(--brand-primary);
}

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

.sidebar .tags a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: 0.25rem var(--space-xs);
  min-height: 32px;
  background: var(--c-surface-3);
  color: var(--brand-text);
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: var(--brand-radius);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

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

.sidebar .tags a:hover svg {
  stroke: var(--brand-on-primary);
}

.sidebar .promo li {
  display: flex;
  gap: var(--space-2xs);
  padding: var(--space-2xs) 0;
}

.prefooter {
  background: var(--brand-surface);
  margin-top: var(--space-xl);
}

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

.prefooter .nav a,
.prefooter .authors a {
  font-size: 0.9688rem;
}

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

.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  margin-top: var(--space-xl);
}

.footer__inner {
  padding-block: var(--space-xl);
  font-size: var(--fs-small);
  line-height: 1.7;
}

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

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

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

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

.popup {
  background: var(--brand-surface);
  color: var(--brand-text);
  border-radius: var(--brand-radius);
  box-shadow: var(--shadow-card-hover);
}

.popup button {
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  color: var(--brand-text);
  font-size: 1.5rem;
  border: 0;
  border-radius: var(--brand-radius);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}

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

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