/**
 * Component skins — colors, radius, spacing, typography per component.
 * Mobile-first defaults live here; column/flow changes for wider screens live in layout.css.
 */

:root {
  /* In-page anchor scroll offset for the sticky .site-header (below).
     Applied wherever a smooth-scroll target can land — see the
     `main > section[id], .article h2, .article h3` rule further down.
     145px clears the measured worst case: the header wraps to two rows
     between ~768–900px (129px tall) plus a small buffer; it's harmless
     extra whitespace above the target at widths where the header is a
     single row (~69px). If .site-header's max height changes, update
     this one value and every anchor target stays correct. */
  --scroll-offset: 145px;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: rgba(10, 10, 12, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text);
}
.brand__dot { color: var(--accent); }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--accent); }

.nav-list {
  list-style: none;
  margin: 0;
  padding: var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-2) 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}
.nav-list a:hover, .nav-list a:focus-visible { color: var(--text); }

.lang-switch {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.lang-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-decoration: none;
}
.lang-switch a:hover { color: var(--text); border-color: var(--text-muted); }
.lang-switch a[aria-current="true"] {
  color: var(--text);
  border-color: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.btn--primary {
  background: var(--cta);
  color: #FFFFFF;
}
.btn--primary:hover, .btn--primary:focus-visible {
  filter: brightness(1.1);
  text-decoration: none;
}
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover, .btn--ghost:focus-visible {
  border-color: var(--text-muted);
  text-decoration: none;
}

/* ---------- Hero ---------- */
.hero__subtitle {
  color: var(--text-muted);
  max-width: 52ch;
}
.hero__banner {
  /* No border/shadow: asset corners (~RGB 10,10,10) already match --bg and
     blend seamlessly — a frame would only draw an unwanted seam. */
  position: relative;
  aspect-ratio: 16 / 10;
  width: 100%;
  max-width: var(--banner-max);
  border-radius: var(--radius-card);
  background: var(--bg); /* matches image edges, avoids flash before load */
  overflow: hidden;
}
.hero__banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Stats ---------- */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  text-align: center;
}
.stat__value {
  display: block;
  font-size: var(--fs-number);
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat__label {
  display: block;
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
}

/* ---------- Content card ---------- */
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-8);
}
.content-card__text { color: var(--text-muted); }

/* ---------- State cards (Sicher / Gefahr / loss) ---------- */
.state-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.state-card__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: fit-content;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
}
.state-card__text { color: var(--text-muted); }
.state-card__button {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-6);
  border-radius: var(--radius-pill);
  font-weight: 600;
}

/* Sicher — cash out available: green means "can take it", nothing else */
.state-card--safe { border-color: var(--safe); }
.state-card--safe .state-card__badge { background: rgba(90, 158, 74, 0.15); color: var(--safe); }
.state-card--safe .state-card__button { background: var(--success); color: #0A0A0C; }

/* Gefahr — cash out blocked: muted orange, never green, never "success" orange */
.state-card--danger { border-color: var(--danger); }
.state-card--danger .state-card__badge { background: rgba(199, 91, 42, 0.15); color: var(--danger); }
.state-card--danger .state-card__button { background: var(--locked); color: #0A0A0C; opacity: 0.85; cursor: not-allowed; }

/* Loss — round ended before cash out: neutral, not reusing safe/danger tokens */
.state-card--loss { border-color: var(--border); }
.state-card--loss .state-card__badge { background: var(--surface-2); color: var(--text-muted); }
.state-card--loss .state-card__button { background: var(--surface-2); color: var(--text-dim); }

/* ---------- Comparison table → cards on mobile (same <table>, no duplication) ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
}
.compare-table th, .compare-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
  /* long unbroken compound words (de/fi) must break inside a cell instead
     of forcing the table/card wider than the viewport */
  overflow-wrap: anywhere;
}
.compare-table thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  white-space: nowrap;
}
.compare-table tbody tr:last-child td { border-bottom: 0; }
.compare-table tbody tr:hover { background: var(--surface); }

/* Mobile card mode: thead visually hidden (not display:none, stays for a11y/SEO), rows become cards */
.compare-table--cards thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.compare-table--cards tr {
  display: block;
  margin: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-2) var(--space-4);
}
.compare-table--cards tbody tr:hover { background: none; }
.compare-table--cards td {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  border: 0;
  padding: var(--space-2) 0;
  text-align: right;
  min-width: 0;
}
.compare-table--cards td::before {
  content: attr(data-label);
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  flex-shrink: 0;
  overflow-wrap: anywhere;
  max-width: 45%;
}

/* ---------- Article body (rendered from markdown) ---------- */
/* Long unbroken compound words (de/fi especially — "Auszahlen-Strategie",
   "Satunnaislukugeneraattori") must be able to break inside prose and inside
   table cells, otherwise a single word overflows the container at 320px. */
.article {
  max-width: 100%;
}
.article :is(h2, h3, p, ul, ol, blockquote) {
  max-width: 80ch;
  overflow-wrap: anywhere;
}
.article h2, .article h3 {
  margin-top: var(--space-12);
}
.article h2:first-child, .article h3:first-child {
  margin-top: 0;
}

/* Anchor-scroll offset for the sticky header: applies to every top-level
   <section id="..."> in <main> (nav links to #calculator/#states/#article/
   #faq/#cta), to #main itself (the skip-to-content link in the body and
   the CTA button both link to "#main" — confirmed by measurement that
   native fragment navigation lands it flush under the header, same bug
   class as the sections), AND to in-article headings (markdown ships real
   #anchor links to h2/h3, e.g. "#corners-or-goals-choosing-your-trigger").
   Without this, position:sticky .site-header + html{scroll-behavior:smooth}
   lands the target underneath the header. Value: see --scroll-offset near
   the top of this file. */
main > section[id],
#main,
.article h2,
.article h3 {
  scroll-margin-top: var(--scroll-offset);
}
.article p, .article ul, .article ol {
  color: var(--text-muted);
}
.article ul, .article ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-6);
}
.article li {
  margin-bottom: var(--space-2);
}
.article li:last-child {
  margin-bottom: 0;
}
.article a {
  overflow-wrap: anywhere;
}
.article strong {
  color: var(--text);
}
.article hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-8) 0;
}
/* Tables inside the article reuse .table-wrap/.compare-table--cards
   (build.js applies the same classes), so the mobile card behaviour and the
   overflow-wrap safety net defined in the comparison-table rules above
   apply unchanged — this only adds article-specific vertical spacing. */
.article .table-wrap {
  margin: 0 0 var(--space-6);
}

/* ---------- FAQ (native <details>, no JS) ---------- */
.faq-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: var(--space-4) var(--space-6);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 44px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  flex-shrink: 0;
  color: var(--accent);
  font-size: 1.25rem;
  line-height: 1;
}
.faq-item[open] summary::after { content: '\2212'; }
.faq-item__body {
  padding: 0 var(--space-6) var(--space-4);
  color: var(--text-muted);
}

/* ---------- CTA block ---------- */
.cta-block {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-12) var(--space-6);
}
.cta-block__text {
  color: var(--text-muted);
  max-width: 60ch;
  margin-inline: auto;
}

/* ---------- Payout calculator (vanilla JS, no libraries) ---------- */
.calculator {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}
.calculator__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.calculator__field label {
  color: var(--text-muted);
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
}
.calculator__input {
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}
.calculator__input:focus-visible {
  outline: 2px solid var(--cta);
  outline-offset: 2px;
  border-color: var(--cta);
}
.calculator__result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.calculator__result-label {
  color: var(--text-muted);
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
}
.calculator__result-value {
  font-size: var(--fs-number);
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- Responsible gambling notice ---------- */
/* Regulatory content, not a warning — calm styling, not a red alert banner.
   Deliberately does NOT inherit .site-footer's --text-dim/0.875rem: this is
   not "small grey print", it has to read as its own block. */
.responsible-gambling {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-4);
  padding-block: var(--space-6);
  border-bottom: 1px solid var(--border);
}
.responsible-gambling__badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
}
.responsible-gambling__body {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.responsible-gambling__text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}
.responsible-gambling__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.responsible-gambling__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}
.responsible-gambling__link:hover,
.responsible-gambling__link:focus-visible {
  border-color: var(--accent);
  text-decoration: none;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-8);
  color: var(--text-dim);
  font-size: 0.875rem;
}
