/* ==========================================================================
   Co to je – redakční vzhled (finance)
   Barvy a písma dodávají proměnné --brand-*, rozložení společný základ.
   ========================================================================== */

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

  /* velikosti písma */
  --fs-body: 1.0625rem;
  --fs-small: 0.875rem;
  --fs-tiny: 0.8125rem;
  --fs-h1: clamp(1.75rem, 1.3rem + 2vw, 2.75rem);
  --fs-h2: clamp(1.375rem, 1.15rem + 1vw, 1.875rem);
  --fs-h3: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
  --fs-card: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);

  /* odvozené odstíny z karty */
  --c-bg-deep: color-mix(in srgb, var(--brand-bg) 88%, var(--brand-text));
  --c-surface-tint: color-mix(in srgb, var(--brand-surface) 70%, var(--brand-bg));
  --c-primary-dark: color-mix(in srgb, var(--brand-primary) 82%, black);
  --c-accent-dark: color-mix(in srgb, var(--brand-accent) 84%, black);
  --c-line: color-mix(in srgb, var(--brand-border) 85%, var(--brand-text));
  --c-line-soft: color-mix(in srgb, var(--brand-border) 90%, var(--brand-bg));
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 10%, var(--brand-surface));
  --c-focus-ring: var(--brand-primary);

  /* stíny */
  --shadow-soft: 0 6px 20px rgba(23, 28, 38, 0.1);
  --shadow-header: 0 4px 16px rgba(0, 0, 0, 0.28);
  --shadow-popup: 0 12px 36px rgba(0, 0, 0, 0.3);

  /* pohyb */
  --t-fast: 0.2s ease;

  color-scheme: light;
}

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

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

body {
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: var(--fs-body);
  line-height: 1.75;
  font-size-adjust: from-font;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--brand-accent);
  accent-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);
  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); }

p { text-wrap: pretty; }

a {
  color: var(--brand-primary);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  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(--c-focus-ring);
  outline-offset: 3px;
}

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

/* ---------- Hlavička (tmavá, 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 {
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
}

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

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

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

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

.header .nav a {
  font-size: var(--fs-small);
  padding: var(--space-xs) var(--space-sm);
}

.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);
  min-width: 2.75rem;
  min-height: 2.75rem;
  cursor: pointer;
  transition: border-color var(--t-fast), background-color var(--t-fast);
}

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

.header__toggle:hover {
  border-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-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  transition: color var(--t-fast), box-shadow var(--t-fast);
}

.tray a:hover {
  color: var(--brand-primary);
  box-shadow: inset 0 -2px 0 var(--brand-primary);
}

.tray__more-button {
  background: transparent;
  border: 0;
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-sm) var(--space-md);
  transition: color var(--t-fast);
}

.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 {
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-size: 1.25rem;
  text-decoration: none;
  display: block;
  padding: var(--space-sm) var(--space-md);
  transition: color var(--t-fast);
}

.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);
  min-width: 2.75rem;
  min-height: 2.75rem;
  cursor: pointer;
}

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

/* ---------- Hlavní obsah ---------- */

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

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

.content > h1 {
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--brand-text);
}

/* ---------- Titulky sekcí (řádky rubrik) ---------- */

.bottom__title {
  font-size: var(--fs-h2);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--brand-text);
}

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

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

/* ---------- Karty článků: bez rámečku, oddělené linkou ---------- */

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

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

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

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

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

.article__perex {
  color: var(--brand-muted);
  font-size: var(--fs-small);
  line-height: 1.6;
  margin: 0;
}

.article__category {
  margin: 0;
  font-size: var(--fs-tiny);
  line-height: 1.4;
}

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  font-weight: 600;
  text-decoration: none;
  padding: 0.125rem 0.5rem;
  border-radius: var(--brand-radius);
  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 {
  margin: 0;
  color: var(--brand-muted);
  font-size: var(--fs-tiny);
  font-variant-numeric: tabular-nums;
}

/* ---------- Horní bloky ---------- */

.top .article__title a,
.top .article__title {
  color: var(--brand-text);
}

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

.text {
  background: transparent;
}

.text__title {
  font-size: var(--fs-h1);
  margin-bottom: var(--space-md);
}

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

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

.text__body h2 {
  margin-top: 2.2em;
  margin-bottom: 0.9em;
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--c-line);
}

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

.text__body p,
.text__body ul,
.text__body ol {
  margin-bottom: 1.15em;
}

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

.text__body a:hover {
  color: var(--c-primary-dark);
  text-decoration-thickness: 2px;
}

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

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

.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--fs-small);
  line-height: 1.55;
  margin-bottom: 1.4em;
}

.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(--brand-primary);
  color: var(--brand-on-primary);
  font-weight: 700;
}

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

.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);
  font-size: var(--fs-small);
  line-height: 1.6;
}

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

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

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

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

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

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

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

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

.pagination ul {
  list-style: none;
}

.pagination a,
.pagination li {
  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);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  background: var(--brand-surface);
  color: var(--brand-text);
  text-decoration: none;
  text-align: center;
  transition: color var(--t-fast), border-color var(--t-fast), background-color var(--t-fast);
}

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

.pagination__active {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border-radius: var(--brand-radius);
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: var(--space-xs) var(--space-sm);
  text-align: center;
  font-weight: 700;
}

/* ---------- 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);
  font-family: var(--brand-font-body);
  font-size: var(--fs-body);
  padding: var(--space-sm) var(--space-md);
  min-height: 2.75rem;
}

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

.search-form input[type="submit"] {
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 0;
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-body);
  font-weight: 700;
  font-size: var(--fs-small);
  min-height: 2.75rem;
  padding: var(--space-sm) var(--space-lg);
  cursor: pointer;
  transition: background-color var(--t-fast);
}

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

/* ---------- Spodní panel (sloupce odkazů) ---------- */

.prefooter {
  background: transparent;
  border-top: 2px solid var(--brand-text);
}

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

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

.sidebar ul,
.prefooter ul {
  list-style: none;
}

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

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

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

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

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

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

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

.footer__inner {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-lg);
}

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

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

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

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

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

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

@container (max-width: 20rem) {
  .article__title {
    font-size: 1rem;
  }
}

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