/* ==========================================================
   Jóga Lokah – vzhled (moderní, rubriky, přilepená hlavička)
   Barvy a písma jen z --brand-*, vlastní proměnné s prefixem --jl-
   ========================================================== */

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

  --jl-fs-h1: clamp(1.75rem, 1.3rem + 2vw, 2.9rem);
  --jl-fs-h2: clamp(1.35rem, 1.1rem + 1vw, 1.9rem);
  --jl-fs-h3: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  --jl-fs-card: clamp(1.02rem, 0.97rem + 0.3vw, 1.18rem);
  --jl-fs-body: clamp(1.0625rem, 1.03rem + 0.15vw, 1.15rem);
  --jl-fs-small: 0.875rem;

  --jl-surface-2: color-mix(in srgb, var(--brand-surface) 82%, var(--brand-bg));
  --jl-tint: color-mix(in srgb, var(--brand-primary) 8%, var(--brand-surface));
  --jl-tint-strong: color-mix(in srgb, var(--brand-primary) 16%, var(--brand-surface));
  --jl-border-strong: color-mix(in srgb, var(--brand-border) 60%, var(--brand-text));
  --jl-primary-dark: color-mix(in srgb, var(--brand-primary) 80%, #000);
  --jl-accent-dark: color-mix(in srgb, var(--brand-accent) 82%, #000);
  --jl-link: color-mix(in srgb, var(--brand-primary) 88%, #000);

  --jl-shadow-header: 0 6px 20px rgba(0, 0, 0, 0.18);
  --jl-shadow-pop: 0 10px 28px rgba(0, 0, 0, 0.14);
  --jl-ease: 0.25s ease;

  color-scheme: light;
}

html {
  scroll-padding-top: 6rem;
  scrollbar-color: var(--brand-primary) var(--brand-bg);
  accent-color: var(--brand-accent);
  caret-color: var(--brand-accent);
}

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

/* ---------- Základ ---------- */
body {
  margin: 0;
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-body);
  font-size: var(--jl-fs-body);
  line-height: 1.75;
  font-size-adjust: from-font;
  -webkit-font-smoothing: antialiased;
}

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

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

p { text-wrap: pretty; }

a {
  color: var(--jl-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--jl-ease), background-color var(--jl-ease), border-color var(--jl-ease), box-shadow var(--jl-ease);
}

a:hover { color: var(--jl-accent-dark); }

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

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

/* ---------- Hlavička (přilepená) ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--brand-header-bg);
  color: var(--brand-header-text);
  container-type: scroll-state;
  container-name: site-header;
}

.header__inner {
  padding-block: var(--jl-space-sm);
  transition: padding var(--jl-ease), box-shadow var(--jl-ease);
}

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

/* Logo */
.header__logo,
.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 0.1em;
  color: var(--brand-header-text);
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.375rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

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

.logo__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-header-text);
}

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

.logo__tld {
  font-size: 0.7em;
  font-weight: 500;
  color: color-mix(in srgb, var(--brand-header-text) 78%, transparent);
  white-space: nowrap;
}

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

/* Tlačítko menu */
.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: 44px;
  min-height: 44px;
  padding: var(--jl-space-3xs);
  cursor: pointer;
  transition: background-color var(--jl-ease), border-color var(--jl-ease);
}

.header__toggle svg { stroke: currentColor; }

.header__toggle:hover {
  background: color-mix(in srgb, var(--brand-header-text) 14%, transparent);
  border-color: var(--brand-header-text);
}

.header__toggle:focus-visible {
  outline-color: var(--brand-header-text);
}

/* Menu v hlavičce (varianta „logo“) */
.header .nav a {
  color: var(--brand-header-text);
  text-decoration: none;
  padding: var(--jl-space-2xs) var(--jl-space-xs);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-block;
}

.header .nav a:hover {
  background: color-mix(in srgb, var(--brand-header-text) 16%, transparent);
  color: var(--brand-header-text);
}

.header .nav a:focus-visible { outline-color: var(--brand-header-text); }

/* ---------- Lišta rubrik (tray) ---------- */
.tray {
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-border);
}

.tray__inner a {
  display: inline-block;
  padding: var(--jl-space-xs) var(--jl-space-sm);
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: var(--brand-radius);
}

.tray__inner a:hover {
  background: var(--jl-tint);
  color: var(--jl-primary-dark);
}

/* ---------- Mobilní menu ---------- */
.smallnav {
  background: var(--brand-surface);
  color: var(--brand-text);
  padding: var(--jl-space-md);
}

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

.smallnav a {
  display: block;
  padding: var(--jl-space-xs) 0;
  color: var(--brand-text);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  text-decoration: none;
  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: 44px;
  min-height: 44px;
  cursor: pointer;
  color: var(--brand-text);
  transition: background-color var(--jl-ease);
}

.smallnav__close svg { stroke: currentColor; }
.smallnav__close:hover { background: var(--jl-tint); }

/* ---------- Karty článků ---------- */
.article {
  container-type: inline-size;
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  overflow: hidden;
  transition: border-color var(--jl-ease), box-shadow var(--jl-ease);
}

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

.article__image {
  margin: 0;
}

.article__image a {
  display: block;
  line-height: 0;
}

.article__image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.article__title {
  margin: var(--jl-space-sm) var(--jl-space-sm) var(--jl-space-2xs);
  font-size: var(--jl-fs-card);
  line-height: 1.3;
  text-wrap: balance;
}

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

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

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

.article__category,
.article__date {
  margin: 0 var(--jl-space-sm) var(--jl-space-xs);
  font-size: var(--jl-fs-small);
  color: var(--brand-muted);
}

.article__category {
  margin-bottom: var(--jl-space-3xs);
}

.article__category a {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-decoration: none;
}

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

.article__category a:focus-visible {
  outline-color: var(--brand-text);
}

.article:last-child .article__date,
.article__date:last-child {
  margin-bottom: var(--jl-space-sm);
}

/* ---------- Rubriky na úvodní stránce ---------- */
.bottom__title {
  margin: var(--jl-space-xl) 0 var(--jl-space-md);
  font-size: var(--jl-fs-h2);
}

.bottom__title a {
  color: var(--brand-text);
  text-decoration: none;
  border-bottom: 2px solid var(--brand-primary);
  padding-bottom: var(--jl-space-3xs);
}

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

/* Horní bloky (pokud se zobrazí) */
.top {
  background: transparent;
}

.top .article__title { font-size: var(--jl-fs-card); }

/* Ztmavení fotografie pod textem u karet s překrytím */
.top--overlay .article__image a::after,
.top .article--overlay .article__image a::after {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
}

/* ---------- Vyhledávání ---------- */
.search-form form {
  display: flex;
  gap: var(--jl-space-2xs);
}

.search-form input[type="text"] {
  flex: 1;
  min-height: 44px;
  padding: 0 var(--jl-space-sm);
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--jl-border-strong);
  border-radius: var(--brand-radius);
  font: inherit;
}

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

.search-form input[type="submit"] {
  min-height: 44px;
  padding: 0 var(--jl-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: 600;
  cursor: pointer;
  transition: background-color var(--jl-ease);
}

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

/* ---------- Text článku ---------- */
.text__title {
  margin-bottom: var(--jl-space-md);
  font-size: var(--jl-fs-h1);
  text-wrap: balance;
}

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

.text__cover img {
  display: block;
  width: 100%;
  height: auto;
}

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

.text__body > * { max-width: 100%; }

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

.text__body h2 {
  margin: 2em 0 0.7em;
  font-size: var(--jl-fs-h2);
}

.text__body h3 {
  margin: 1.8em 0 0.6em;
  font-size: var(--jl-fs-h3);
}

.text__body a {
  color: var(--jl-link);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
}

.text__body a:hover {
  color: var(--jl-accent-dark);
  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 img {
  max-width: 100%;
  height: auto;
}

.text__body blockquote {
  margin: 1.6em 0;
  padding: var(--jl-space-xs) var(--jl-space-md);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0;
  background: var(--jl-tint);
  color: var(--brand-text);
}

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

/* Tabulky v článku */
.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.text__body th,
.text__body td {
  padding: var(--jl-space-xs) var(--jl-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(--jl-tint-strong);
  font-family: var(--brand-font-heading);
  font-weight: 700;
}

.text__body tr:nth-child(even) td { background: var(--jl-surface-2); }
.text__body tr:first-child td { background: var(--jl-tint-strong); }

/* Obsah článku */
.table-of-content {
  margin: 0 0 var(--jl-space-md);
  padding: var(--jl-space-sm) var(--jl-space-md);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
}

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

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

.table-of-content a {
  color: var(--jl-link);
  text-decoration: none;
}

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

/* Info pod článkem */
.text__info {
  max-width: 68ch;
  margin-top: var(--jl-space-lg);
  padding-top: var(--jl-space-sm);
  border-top: 1px solid var(--brand-border);
  color: var(--brand-muted);
  font-size: var(--jl-fs-small);
}

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

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

.text__info a:hover { color: var(--jl-accent-dark); }

.author {
  float: left;
  width: 120px;
  height: 120px;
  margin: 0 var(--jl-space-md) var(--jl-space-sm) 0;
  object-fit: cover;
}

/* ---------- Stránkování ---------- */
.pagination ul {
  list-style: none;
  margin: var(--jl-space-lg) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--jl-space-2xs);
}

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

.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--jl-space-xs);
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  font-family: var(--brand-font-heading);
  font-weight: 600;
  text-decoration: none;
}

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

.pagination__active {
  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: 700;
}

/* ---------- Panely, widgety ---------- */
.sidebar h3:not(.article__title),
.prefooter h3:not(.article__title) {
  margin: 0 0 var(--jl-space-sm);
  font-size: var(--jl-fs-h3);
}

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

.sidebar li,
.prefooter li { margin: 0; }

.sidebar a,
.prefooter a {
  color: var(--jl-link);
  text-decoration: none;
}

.sidebar a:hover,
.prefooter a:hover {
  color: var(--jl-accent-dark);
  text-decoration: underline;
}

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

.prefooter .nav li a,
.prefooter .tags li a,
.prefooter .authors li a {
  display: flex;
  align-items: center;
  gap: var(--jl-space-2xs);
  min-height: 32px;
  padding: var(--jl-space-3xs) 0;
}

.prefooter .promo li {
  display: flex;
  align-items: flex-start;
  gap: var(--jl-space-2xs);
  padding: var(--jl-space-3xs) 0;
}

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

.sidebar .article,
.prefooter .article {
  margin-bottom: var(--jl-space-xs);
}

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

.sidebar .tags a,
.prefooter .tags a {
  border-radius: var(--brand-radius);
}

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

.sidebar .tags li a,
.sidebar .authors li a,
.sidebar .nav li a {
  display: block;
  padding: var(--jl-space-2xs) 0;
}

/* ---------- Patička ---------- */
.footer {
  background: var(--brand-footer-bg);
  color: var(--brand-footer-text);
  padding-block: var(--jl-space-lg);
  font-size: var(--jl-fs-small);
}

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

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

.footer a:focus-visible { outline-color: var(--brand-footer-text); }

/* ---------- Popup ---------- */
.popup {
  background: var(--brand-surface);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  box-shadow: var(--jl-shadow-pop);
}

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

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

/* ---------- Úpravy kontejnerů ---------- */
@container (max-width: 260px) {
  .article__title { font-size: 1rem; margin-inline: var(--jl-space-xs); }
  .article__category,
  .article__date,
  .article__perex { margin-inline: var(--jl-space-xs); }
}

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