/* Gradus – angličtina: moderní redakční vzhled, světlá hlavička, tmavá patička */

:root {
  color-scheme: light;

  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.25rem;
  --space-xl: 3.5rem;

  --c-surface-2: color-mix(in srgb, var(--brand-surface) 70%, var(--brand-border));
  --c-border-strong: color-mix(in srgb, var(--brand-border) 60%, var(--brand-text));
  --c-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, black);
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 10%, var(--brand-bg));
  --c-accent-soft: color-mix(in srgb, var(--brand-accent) 14%, var(--brand-bg));
  --c-link-underline: color-mix(in srgb, var(--brand-primary) 45%, transparent);
  --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));
  --c-header-muted: color-mix(in srgb, var(--brand-header-text) 72%, var(--brand-header-bg));
  --c-image-fade: rgba(0, 0, 0, 0.55);

  --shadow-header: 0 6px 20px rgba(38, 32, 23, 0.10);
  --shadow-popup: 0 18px 48px rgba(38, 32, 23, 0.28);

  --fs-h1: clamp(1.75rem, 1.3rem + 2vw, 2.75rem);
  --fs-h2: clamp(1.3rem, 1.1rem + 0.9vw, 1.75rem);
  --fs-h3: clamp(1.1rem, 1rem + 0.4vw, 1.25rem);
  --fs-body: clamp(1.0625rem, 1.02rem + 0.2vw, 1.15rem);
  --fs-small: 0.875rem;
  --fs-logo: clamp(1.5rem, 1.35rem + 0.6vw, 1.75rem);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --header-h: 4.25rem;
}

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

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

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

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

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

h1, h2, h3, h4, h5, h6 {
  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: none;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s 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;
}

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

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

.header__inner {
  min-height: var(--header-h);
  padding-block: var(--space-xs);
  transition: padding 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

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

.header__logo,
.logo {
  color: var(--brand-header-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-logo);
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-decoration: none;
}

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

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

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

.header__toggle {
  background: transparent;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  color: var(--brand-header-text);
  min-width: 2.75rem;
  min-height: 2.75rem;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.header__toggle svg { stroke: currentColor; }

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

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

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

.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);
  min-height: 2.75rem;
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.tray a:hover,
.header .nav a:hover {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

/* Mobilní menu */

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

.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: var(--brand-heading-weight);
  font-size: 1.15rem;
  border-bottom: 1px solid var(--brand-border);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

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

.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-color 0.2s var(--ease);
}

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

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

.article {
  background: var(--brand-bg);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  overflow: hidden;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

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

.article__image {
  margin: 0;
  background: var(--brand-surface);
}

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

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

.article__title a {
  color: var(--brand-text);
  transition: color 0.2s var(--ease);
}

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

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

.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-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 0.8rem;
  line-height: 1.6;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.article__category a:hover {
  background: color-mix(in srgb, var(--brand-accent) 85%, black);
  color: var(--brand-on-accent);
}

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

/* Titulky sekcí na úvodní stránce */

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

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

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

/* Blok s výběrem nahoře (pokud je zapnutý) */

.top-news .article__title,
.top .article__title { font-size: var(--fs-h2); }

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

.text__title {
  margin: 0 0 var(--space-md);
  line-height: 1.15;
}

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

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

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

.text__body h2 {
  margin-top: 2.2em;
  margin-bottom: 0.9em;
  padding-top: 0;
}

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

.text__body p { margin: 0 0 1.1em; }

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

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

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

.text__body li { margin-bottom: 0.4em; }
.text__body li::marker { color: var(--brand-primary); }

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

.text__body img.author {
  float: right;
  width: min(220px, 40%);
  margin: 0 0 var(--space-sm) var(--space-md);
}

.text__body blockquote {
  margin: 1.6em 0;
  padding: var(--space-xs) var(--space-md);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0;
  background: var(--brand-surface);
  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;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95em;
  font-variant-numeric: tabular-nums;
}

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

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

.text__body code {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: calc(var(--brand-radius) / 2);
  padding: 0.1em 0.4em;
  font-size: 0.9em;
}

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

.text__body pre code { background: none; border: 0; padding: 0; }

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

.table-of-content {
  margin: 0 0 var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-size: 0.95rem;
}

.table-of-content > span {
  display: block;
  margin-bottom: var(--space-2xs);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  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 { color: var(--brand-primary); }

.text__info {
  max-width: 68ch;
  margin-top: var(--space-lg);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--brand-border);
  color: var(--brand-muted);
  font-size: var(--fs-small);
}

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

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

/* ---------- Postranní panel ---------- */

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

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

.sidebar .nav li,
.sidebar .authors li,
.sidebar .promo li {
  border-bottom: 1px solid var(--brand-border);
}

.sidebar .nav a,
.sidebar .authors a {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-2xs) 0;
  min-height: 2.5rem;
  color: var(--brand-text);
  transition: color 0.2s var(--ease), padding-left 0.2s var(--ease);
}

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

.sidebar .nav svg,
.sidebar .authors svg,
.sidebar .tags svg,
.sidebar .promo svg {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  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: 0.35rem;
  min-height: 2rem;
  padding: 0.2rem 0.7rem;
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  color: var(--brand-text);
  font-size: 0.9rem;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

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

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

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

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

.sidebar .article__title {
  font-size: 1rem;
  line-height: 1.3;
  margin: 0;
}

/* Spodní panel nad patičkou */

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

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

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

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

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

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

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

.prefooter .tags a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.2rem 0.7rem;
  background: var(--brand-bg);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  color: var(--brand-text);
  font-size: 0.9rem;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

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

.prefooter .promo li { display: flex; gap: var(--space-2xs); padding: var(--space-2xs) 0; }
.prefooter .promo a { color: var(--brand-primary); }

.prefooter .article { margin-bottom: var(--space-sm); }
.prefooter .article__title { font-size: 1rem; line-height: 1.3; margin: 0; }

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

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

.search-form input[type="text"] {
  flex: 1;
  min-height: 2.75rem;
  padding: 0.5rem var(--space-sm);
  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;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

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

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

.search-form input[type="text"]:focus-visible {
  border-color: var(--brand-primary);
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.search-form input[type="submit"] {
  min-height: 2.75rem;
  padding: 0.5rem var(--space-md);
  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);
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

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

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

.pagination ul {
  list-style: none;
  margin: var(--space-lg) 0 0;
  padding: 0;
}

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

.pagination a,
.pagination li.pagination__active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  background: var(--brand-bg);
  color: var(--brand-text);
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

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

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

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

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

.footer__inner { padding-block: var(--space-md); }

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

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

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

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

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

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

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

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

@container (max-width: 320px) {
  .sidebar .article__title { font-size: 0.95rem; }
}

@container (max-width: 520px) {
  .article__perex { font-size: 0.925rem; }
}

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