/* ==========================================================
   Střípky mého světa – redakční vzhled
   Rozložení dodává společný základ (base-v7); zde jen vzhled.
   ========================================================== */

:root {
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;

  --fs-small: 0.875rem;
  --fs-base: 1.0625rem;
  --fs-h1: clamp(1.875rem, 1.4rem + 2vw, 3rem);
  --fs-h2: clamp(1.375rem, 1.15rem + 1vw, 1.875rem);
  --fs-h3: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --fs-title: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);

  --c-surface-2: color-mix(in srgb, var(--brand-bg) 55%, var(--brand-border));
  --c-primary-dark: color-mix(in srgb, var(--brand-primary) 78%, #000);
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 9%, var(--brand-surface));
  --c-line: color-mix(in srgb, var(--brand-border) 85%, var(--brand-text));

  --shadow-soft: 0 6px 18px rgba(38, 23, 26, 0.12);
  --shadow-header: 0 4px 16px rgba(0, 0, 0, 0.18);

  --t-fast: 0.2s ease;
}

html {
  color-scheme: light;
  scroll-padding-top: 5rem;
  scrollbar-color: var(--brand-primary) var(--brand-bg);
}

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);
  accent-color: var(--brand-accent);
  -webkit-font-smoothing: antialiased;
}

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

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

a {
  color: var(--brand-primary);
  text-decoration: none;
  transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

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

h1, h2, h3 {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size-adjust: from-font;
  color: var(--brand-text);
  text-wrap: balance;
  line-height: 1.25;
}

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

/* ---------- Hlavička ---------- */

.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 {
  padding-block: var(--space-sm);
}

.header__logo,
.logo,
.logo__name {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.375rem;
  color: var(--brand-header-text);
  transition: color var(--t-fast);
}

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

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

.header__toggle {
  background: transparent;
  border: 2px solid var(--brand-header-text);
  border-radius: var(--brand-radius);
  color: var(--brand-header-text);
  padding: var(--space-xs);
  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);
}

.header .nav a:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

/* ---------- Lišta rubrik ---------- */

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

.tray a {
  display: inline-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: 1rem;
  white-space: nowrap;
  transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

.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: 0;
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  cursor: pointer;
  padding: var(--space-sm) var(--space-md);
}

.tray__more-button:hover {
  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-soft);
}

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

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

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

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

.smallnav__close {
  background: transparent;
  border: 0;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

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

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

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

.search-form input[type="submit"] {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 0;
  border-radius: var(--brand-radius);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--brand-font-body);
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  transition: background-color var(--t-fast), box-shadow var(--t-fast);
}

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

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

.article {
  background: transparent;
  border-bottom: 1px solid var(--c-line);
  padding-bottom: var(--space-md);
}

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

.article__title {
  font-size: var(--fs-title);
  line-height: 1.3;
}

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

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

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

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

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  padding: 0.125rem 0.625rem;
  font-weight: 600;
  line-height: 1.5;
  transition: background-color var(--t-fast), color var(--t-fast);
}

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

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

/* ---------- Úvodní stránka: rubriky ---------- */

.bottom--category {
  border-top: 2px solid var(--brand-text);
}

.bottom__title {
  font-size: var(--fs-h2);
  padding-top: var(--space-sm);
}

.bottom__title a {
  color: var(--brand-text);
  transition: color var(--t-fast);
}

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

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

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

.pagination a {
  display: inline-block;
  min-width: 40px;
  min-height: 40px;
  padding: var(--space-xs) var(--space-sm);
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  line-height: 1.6;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

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

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

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

.text__title {
  font-size: var(--fs-h1);
  line-height: 1.15;
}

.text__body {
  font-size: 1.125rem;
  line-height: 1.8;
}

.text__body p {
  text-wrap: pretty;
}

.text__body h2 {
  margin-block: 2em 0.9em;
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--brand-border);
}

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

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

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

.text__body blockquote {
  margin-inline: 0;
  padding: var(--space-xs) var(--space-lg);
  border-left: 3px solid var(--brand-primary);
  color: var(--brand-muted);
  font-family: var(--brand-font-heading);
  font-size: 1.1875rem;
}

.text__body img {
  max-width: 100%;
  height: auto;
}

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

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

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

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

.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);
  font-size: 1rem;
}

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

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

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

/* ---------- Stránka autora ---------- */

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

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

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

/* ---------- 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) {
  font-size: 1.125rem;
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-sm);
  border-bottom: 2px solid var(--brand-primary);
}

.sidebar .nav a,
.prefooter .nav a,
.tags a,
.authors a,
.promo a {
  color: var(--brand-text);
  transition: color var(--t-fast);
}

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

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

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

.prefooter .article__image img {
  width: 96px;
  height: auto;
}

.tags a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-2xs) var(--space-sm);
  min-height: 28px;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  background: var(--brand-bg);
}

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

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

.footer__inner {
  padding-block: var(--space-lg);
  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;
}

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

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

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

/* ---------- Ukazatel čtení (jen CSS) ---------- */

.reading-progress {
  display: none;
}

@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .reading-progress {
      display: block;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 4px;
      z-index: 60;
      background: var(--brand-accent);
      transform-origin: left center;
      transform: scaleX(0);
      animation: reading-progress-grow linear both;
      animation-timeline: scroll(root);
    }
  }
}

@keyframes reading-progress-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

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