/* ==========================================================================
   Factor6 Chiptune Magazín – elegantní redakční vzhled
   Barvy a písma dodává --brand-*, rozložení společný základ base-v7.
   ========================================================================== */

:root {
  /* mezery (vzdušná stupnice) */
  --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;
  --space-2xl: 5rem;

  /* odvozené odstíny */
  --c-primary-deep: color-mix(in srgb, var(--brand-primary) 82%, black);
  --c-primary-soft: color-mix(in srgb, var(--brand-primary) 12%, var(--brand-surface));
  --c-surface-2: color-mix(in srgb, var(--brand-bg) 45%, var(--brand-surface));
  --c-line: color-mix(in srgb, var(--brand-border) 85%, transparent);
  --c-line-strong: color-mix(in srgb, var(--brand-primary) 35%, var(--brand-border));
  --c-text-soft: color-mix(in srgb, var(--brand-text) 82%, var(--brand-surface));
  --c-accent-deep: color-mix(in srgb, var(--brand-accent) 80%, black);
  --c-footer-line: color-mix(in srgb, var(--brand-footer-text) 22%, transparent);
  --c-header-line: color-mix(in srgb, var(--brand-header-text) 22%, transparent);

  /* stíny */
  --shadow-soft: 0 6px 20px color-mix(in srgb, var(--brand-text) 12%, transparent);
  --shadow-header: 0 4px 18px color-mix(in srgb, var(--brand-text) 22%, transparent);
  --shadow-popup: 0 18px 48px color-mix(in srgb, var(--brand-text) 30%, transparent);

  /* velikosti písma */
  --fs-h1: clamp(1.9rem, 1.3rem + 2.4vw, 3rem);
  --fs-h2: clamp(1.45rem, 1.15rem + 1.2vw, 2rem);
  --fs-h3: clamp(1.15rem, 1.05rem + 0.5vw, 1.35rem);
  --fs-title-card: clamp(1.08rem, 1rem + 0.35vw, 1.28rem);
  --fs-small: 0.875rem;
  --fs-body: 1.0625rem;

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur: 0.25s;
}

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

html {
  color-scheme: light;
  scroll-padding-top: 6rem;
  scrollbar-color: var(--brand-primary) var(--brand-bg);
  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.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  caret-color: var(--brand-accent);
  accent-color: var(--brand-accent);
}

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

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

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

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

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.2;
  text-wrap: balance;
  letter-spacing: -0.01em;
}

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

p {
  text-wrap: pretty;
}

/* ---------- Hlavička (hlavní barva, 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-sm);
  padding-bottom: var(--space-sm);
}

.header__logo,
.logo,
.logo__name {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: clamp(1.375rem, 1.2rem + 0.7vw, 1.75rem);
  color: var(--brand-header-text);
  text-decoration: none;
  letter-spacing: 0;
  line-height: 1.1;
}

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

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

.header__toggle {
  background: transparent;
  color: var(--brand-header-text);
  border: 1px solid var(--c-header-line);
  border-radius: var(--brand-radius);
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-2xs);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--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);
}

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

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

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

/* ---------- Lišta rubrik pod hlavičkou ---------- */

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

.tray a {
  color: var(--brand-text);
  text-decoration: none;
  font-family: var(--brand-font-body);
  font-size: 0.95rem;
  padding-block: var(--space-xs);
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}

.tray a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
  text-underline-offset: 0.4em;
  text-decoration-thickness: 2px;
}

.tray a:focus-visible {
  outline-color: var(--brand-primary);
}

.tray__more-button {
  background: transparent;
  color: var(--brand-text);
  border: 0;
  font: inherit;
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}

.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);
  text-decoration: none;
  font-family: var(--brand-font-heading);
  font-size: 1.25rem;
  transition: color var(--dur) var(--ease);
}

.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: 44px;
  min-height: 44px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

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

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

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

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

.content > h1,
.articles + .pagination,
.content > h2 {
  color: var(--brand-text);
}

.content > h2 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

/* ---------- Karty článků (bez rámečku a stínu, jen mezery) ---------- */

.article {
  background: transparent;
  color: var(--brand-text);
}

.article__image {
  margin: 0;
}

.article__image a {
  display: block;
}

.article__image img {
  display: block;
  width: 100%;
  object-fit: cover;
  border-radius: var(--brand-radius);
  background: var(--c-surface-2);
}

.article__title {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-title-card);
  line-height: 1.25;
  margin: 0;
  text-wrap: balance;
}

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

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

.article__perex {
  color: var(--c-text-soft);
  font-size: 0.97rem;
  line-height: 1.65;
  margin: 0;
}

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

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

.article__category a {
  display: inline-block;
  background: var(--brand-accent);
  color: var(--brand-on-accent);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  padding: 0.2em 0.65em;
  border-radius: var(--brand-radius);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

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

/* ---------- Horní blok ---------- */

.top {
  background: transparent;
}

.top .article__title {
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
}

/* ---------- Řádky rubrik a výpisy ---------- */

.bottom--category > .bottom__title,
.bottom__title {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: var(--fs-h2);
  margin: 0 0 var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--c-line-strong);
}

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

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

.bottom {
  margin-bottom: var(--space-lg);
}

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

.pagination {
  margin-top: var(--space-xl);
}

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

.pagination li {
  color: var(--brand-muted);
  font-variant-numeric: tabular-nums;
}

.pagination a {
  display: inline-block;
  min-width: 44px;
  min-height: 44px;
  padding: 0.55em 0.9em;
  color: var(--brand-primary);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  text-decoration: none;
  line-height: 1.4;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

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

.pagination__active {
  display: inline-block;
  min-width: 44px;
  min-height: 44px;
  padding: 0.55em 0.9em;
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  border: 1px solid var(--brand-primary);
  border-radius: var(--brand-radius);
  font-weight: 600;
  line-height: 1.4;
}

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

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

.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: inherit;
  padding: 0.7em 1em;
  min-height: 44px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

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

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

.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);
  font: inherit;
  font-weight: 600;
  padding: 0.7em 1.4em;
  min-height: 44px;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

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

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

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

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

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

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

.text__body p {
  text-wrap: pretty;
}

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

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

.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-deep);
  text-decoration-thickness: 2px;
}

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

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

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

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

.text__body blockquote {
  margin: var(--space-lg) 0;
  padding: var(--space-xs) var(--space-md);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0;
  background: transparent;
  color: var(--c-text-soft);
  font-family: var(--brand-font-heading);
  font-size: 1.25rem;
  line-height: 1.55;
}

.text__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  background: var(--brand-surface);
  font-size: 0.97rem;
  font-variant-numeric: tabular-nums;
}

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

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

.text__body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--c-primary-soft);
  padding: 0.12em 0.4em;
  border-radius: var(--brand-radius);
}

.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: transparent;
  padding: 0;
}

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

.table-of-content {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
}

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

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

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

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

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

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

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

/* ---------- Pravý panel a spodní panel ---------- */

.sidebar h3:not(.article__title) {
  font-family: var(--brand-font-heading);
  font-weight: var(--brand-heading-weight);
  font-size: 1.3rem;
  color: var(--brand-text);
  margin: 0 0 var(--space-sm);
  padding-bottom: var(--space-2xs);
  border-bottom: 1px solid var(--c-line-strong);
}

.sidebar .article__title {
  font-size: 1.02rem;
  line-height: 1.3;
}

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

.nav ul,
.tags,
.promo,
.authors {
  list-style: none;
}

.sidebar .nav a,
.sidebar .authors a,
.sidebar .tags a {
  color: var(--brand-text);
  text-decoration: none;
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}

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

.sidebar .nav svg,
.sidebar .authors svg,
.sidebar .tags svg,
.sidebar .promo svg {
  stroke: var(--brand-primary);
  flex: none;
}

.sidebar .tags a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius);
  padding: 0.3em 0.75em;
  font-size: var(--fs-small);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.sidebar .tags a:hover {
  border-color: var(--brand-primary);
  text-decoration: none;
}

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

/* spodní panel nad patičkou */

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

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

.prefooter .nav a,
.prefooter .authors a,
.prefooter .tags a {
  color: var(--brand-text);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

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

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

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

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

.footer__inner {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-lg);
  font-size: 0.92rem;
}

.footer p {
  color: var(--brand-footer-text);
  margin: 0 0 var(--space-2xs);
}

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

.footer a:hover {
  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(--shadow-popup);
}

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

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

/* ---------- Pohyb ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !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; }
