/* ==========================================================================
   Ritta recepty – redakční vzhled
   Barvy a písma jen z --brand-*, vlastní proměnné s prefixem --s-/--c-
   ========================================================================== */

:root {
  /* mezery */
  --s-3xs: 0.25rem;
  --s-2xs: 0.375rem;
  --s-xs: 0.5rem;
  --s-sm: 0.75rem;
  --s-md: 1rem;
  --s-lg: 1.5rem;
  --s-xl: 2.25rem;
  --s-2xl: 3.5rem;

  /* velikosti písma */
  --f-xs: 0.8125rem;
  --f-sm: 0.9375rem;
  --f-md: 1.0625rem;
  --f-article: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --f-h1: clamp(1.875rem, 1.3rem + 2.4vw, 3rem);
  --f-h2: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
  --f-h3: clamp(1.1875rem, 1.05rem + 0.6vw, 1.5rem);
  --f-card: clamp(1.125rem, 1.02rem + 0.4vw, 1.3125rem);

  /* odvozené odstíny */
  --c-surface-2: color-mix(in srgb, var(--brand-bg) 55%, var(--brand-surface));
  --c-border-soft: color-mix(in srgb, var(--brand-border) 60%, transparent);
  --c-border-strong: color-mix(in srgb, var(--brand-text) 22%, var(--brand-border));
  --c-primary-deep: color-mix(in srgb, var(--brand-primary) 82%, var(--brand-text));
  --c-primary-tint: color-mix(in srgb, var(--brand-primary) 10%, var(--brand-bg));
  --c-accent-deep: color-mix(in srgb, var(--brand-accent) 80%, var(--brand-text));
  --c-link-line: color-mix(in srgb, var(--brand-primary) 45%, transparent);

  /* stíny (jen měkké) */
  --shadow-header: 0 6px 18px color-mix(in srgb, var(--brand-text) 16%, transparent);
  --shadow-soft: 0 6px 20px color-mix(in srgb, var(--brand-text) 10%, transparent);
  --shadow-pop: 0 12px 32px color-mix(in srgb, var(--brand-text) 22%, transparent);

  /* pohyb */
  --t-fast: 0.18s ease;
  --t-base: 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
  color-scheme: light;
  scroll-padding-top: 5.5rem;
  scrollbar-color: var(--brand-primary) var(--brand-bg);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: var(--f-md);
  font-size-adjust: from-font;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

input,
textarea,
select {
  caret-color: var(--brand-accent);
  accent-color: var(--brand-accent);
}

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

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

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

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;
  color: var(--brand-text);
  line-height: 1.18;
  text-wrap: balance;
  letter-spacing: -0.01em;
}

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

p { text-wrap: pretty; }

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

.content > h2 {
  padding-top: var(--s-lg);
  border-top: 1px solid var(--brand-border);
}

/* ---------- Hlavička (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-block: var(--s-sm);
}

.header__logo,
.logo,
.logo__name {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  color: var(--brand-header-text);
  font-size: 1.375rem;
  letter-spacing: -0.01em;
}

.header__logo:hover,
.logo:hover {
  color: var(--brand-header-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

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

.header .nav a {
  color: var(--brand-header-text);
  font-size: var(--f-sm);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.35em;
}

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

.header__toggle {
  background: transparent;
  color: var(--brand-header-text);
  border: 1px solid color-mix(in srgb, var(--brand-header-text) 55%, transparent);
  border-radius: var(--brand-radius);
  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);
  background: color-mix(in srgb, var(--brand-header-text) 12%, transparent);
}

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

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

.tray__inner {
  padding-block: var(--s-2xs);
}

.tray a {
  color: var(--brand-text);
  font-size: var(--f-sm);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  display: inline-block;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.4em;
  text-decoration-thickness: 2px;
}

.tray a:hover {
  color: var(--brand-primary);
  text-decoration-color: var(--brand-primary);
}

.tray__more-button {
  background: transparent;
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-family: inherit;
  font-size: var(--f-sm);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.tray__more-button:hover {
  color: var(--brand-primary);
  border-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-pop);
}

/* ---------- Mobilní menu (jen vzhled) ---------- */

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

.smallnav ul {
  list-style: none;
}

.smallnav a {
  display: block;
  padding: var(--s-sm) var(--s-md);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-size: var(--f-h3);
  border-bottom: 1px solid var(--brand-border);
}

.smallnav a:hover {
  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: border-color var(--t-fast);
}

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

/* ---------- Hledání ---------- */

.search-form form {
  display: flex;
  gap: var(--s-xs);
  flex-wrap: wrap;
}

.search-form input[type="text"] {
  flex: 1 1 14rem;
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: 0.7rem 0.9rem;
  font-family: inherit;
  font-size: var(--f-md);
  transition: border-color var(--t-fast);
}

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

.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: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  padding: 0.7rem 1.4rem;
  font-family: inherit;
  font-size: var(--f-md);
  font-weight: 600;
  cursor: pointer;
  min-height: 2.75rem;
  transition: background-color var(--t-fast), border-color var(--t-fast);
}

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

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

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

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

.article__title {
  font-size: var(--f-card);
  line-height: 1.22;
}

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

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

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

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

.article__category {
  font-size: var(--f-xs);
  color: var(--brand-muted);
}

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  padding: 0.15rem 0.6rem;
  border-radius: var(--brand-radius);
  font-weight: 600;
  line-height: 1.5;
}

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

/* ---------- Rubriky na úvodní stránce ---------- */

.bottom__title {
  font-size: var(--f-h2);
  padding-bottom: var(--s-xs);
  border-bottom: 2px solid var(--brand-text);
}

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

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

/* ---------- Horní bloky (pokud se vykreslí) ---------- */

.top .article {
  border-bottom: 1px solid var(--c-border-strong);
}

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

.pagination ul {
  list-style: none;
}

.pagination a,
.pagination__active {
  display: inline-block;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.8rem;
  text-align: center;
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  background: var(--brand-surface);
  color: var(--brand-text);
  font-size: var(--f-sm);
  font-weight: 600;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

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

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

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

.text__title {
  font-size: var(--f-h1);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: var(--s-md);
}

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

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

.text__body p {
  margin-block: 0 1.15em;
}

.text__body h2 {
  font-size: var(--f-h2);
  margin-top: 2em;
  margin-bottom: 0.9em;
}

.text__body h3 {
  font-size: var(--f-h3);
  margin-top: 1.8em;
  margin-bottom: 0.8em;
}

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

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

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

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

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

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

.text__body blockquote {
  margin: 1.6em 0;
  padding: 0.2em 0 0.2em 1.2em;
  border-left: 3px solid var(--brand-primary);
  border-radius: 0;
  color: var(--brand-muted);
  font-family: var(--brand-font-heading);
  font-size: 1.15em;
  font-style: italic;
}

.text__body hr {
  border: 0;
  border-top: 1px solid var(--brand-border);
  margin-block: 2em;
}

/* Tabulky v článku – bez obalu, posuv na úzkém displeji */
.text table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin-block: 1.4em;
  font-size: var(--f-sm);
}

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

.text th,
.text td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--brand-border);
  font-variant-numeric: tabular-nums;
  vertical-align: top;
}

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

/* Obsah článku */
.table-of-content {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: var(--s-md) var(--s-lg);
  margin-bottom: var(--s-lg);
  font-size: var(--f-sm);
}

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

.table-of-content a {
  color: var(--brand-text);
  text-decoration: underline;
  text-decoration-color: var(--c-link-line);
  text-underline-offset: 0.2em;
}

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

/* Informace pod článkem */
.text__info {
  margin-top: var(--s-lg);
  padding-top: var(--s-md);
  border-top: 1px solid var(--brand-border);
  font-size: var(--f-sm);
  color: var(--brand-muted);
}

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

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

.text__info a:hover {
  color: var(--c-primary-deep);
  text-decoration-color: currentColor;
}

/* Autor */
.author {
  border-radius: var(--brand-radius);
  margin: 0 var(--s-md) var(--s-sm) 0;
}

.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 nad patičkou ---------- */

.prefooter {
  background: var(--c-surface-2);
  border-top: 1px solid var(--brand-border);
  margin-top: var(--s-xl);
}

.sidebar h3:not(.article__title),
.prefooter h3:not(.article__title) {
  font-size: var(--f-h3);
  padding-bottom: var(--s-2xs);
  margin-bottom: var(--s-sm);
  border-bottom: 2px solid var(--brand-text);
}

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

.sidebar .nav a,
.prefooter .nav a,
.sidebar .tags a,
.prefooter .tags a,
.sidebar .authors a,
.prefooter .authors a,
.sidebar .promo a,
.prefooter .promo a {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2xs);
  min-height: 1.75rem;
  color: var(--brand-text);
  font-size: var(--f-sm);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.25em;
}

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

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

.prefooter .article,
.sidebar .article {
  padding-bottom: var(--s-sm);
}

.prefooter .article__title,
.sidebar .article__title {
  font-size: var(--f-md);
  line-height: 1.3;
}

.promo div {
  font-size: var(--f-sm);
  color: var(--brand-muted);
}

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

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

.footer__inner {
  padding-block: var(--s-lg);
}

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

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

.footer a:hover {
  color: var(--brand-footer-text);
  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-pop);
  padding: var(--s-lg);
}

.popup #close {
  background: transparent;
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  min-width: 2.25rem;
  min-height: 2.25rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}

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

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

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

@container (max-width: 520px) {
  .article__title {
    font-size: var(--f-md);
  }
  .article__perex {
    font-size: var(--f-xs);
  }
}

/* ---------- Pohyb a přístupnost ---------- */

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