/*
 * Nachweischeck visual system: quiet editorial.
 * Borders exist on exactly three things: the selected choice card, the open
 * insight pane, and text inputs. Everything else separates by whitespace.
 * No webfonts, no CDN, no imagery.
 */

:root {
  --paper: #f7f4ef;
  --ink: #1c1b19;
  --muted: #5a574f;
  --accent: #2c3a4a;
  --line: #d9d3c8;
  --card: #fff;
  --wash: #eceef1;
  --meta: 0.765rem;
  --body-sm: 0.94rem;
}

@supports (background: color-mix(in srgb, red 8%, white)) {
  :root {
    --wash: color-mix(in srgb, var(--accent) 8%, #fff);
  }
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--paper);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0 auto;
  max-width: 46rem;
  padding: 1.5rem 1.25rem 3rem;
  overflow-x: hidden;
}

@media (max-width: 34rem) {
  body {
    padding: 1.25rem 0.9rem 2.5rem;
  }
}

/* The insight split needs room; the reading beats do not. */
body:has(#main[data-phase="insight"]) {
  max-width: 76rem;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--card);
  padding: 0.5rem;
  z-index: 10;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
}

[hidden] {
  display: none !important;
}

/* ---------- chrome ---------- */

.site-header {
  margin-bottom: 1.35rem;
}

.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  text-decoration: none;
}

.brand-home:hover .brand,
.brand-home:focus-visible .brand {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.brand-home-icon {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

.brand {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--accent);
}

.tagline {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: var(--meta);
}

.skin-logo {
  display: block;
  max-height: 2.25rem;
  max-width: 12rem;
  margin-bottom: 0.6rem;
}

.banner {
  background: var(--card);
  border-left: 3px solid var(--accent);
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  font-size: var(--body-sm);
}

/* ---------- beats ---------- */

.canvas {
  width: 100%;
}

.beat {
  margin: 0 0 3.15rem;
}

#main[data-phase="start"].canvas,
#main[data-phase="start"] #gate-form {
  padding-bottom: 0;
}

#main[data-phase="start"] .beat {
  margin-bottom: 0;
}

.beat[data-open="false"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
  margin: 0;
}

/* Opening a beat fades it in once; re-renders reuse the same attribute value.
 * No fill mode on purpose: outside the 200ms the beat must sit at its natural
 * opacity, otherwise a print or paint before the animation runs stays blank. */
.beat[data-open="true"] {
  animation: beat-in 200ms ease;
}

@keyframes beat-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.75rem, 1.5rem + 1vw, 2rem);
  margin: 0 0 1.75rem;
  max-width: 24em;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 0.7rem;
}

h3 {
  font-size: 1rem;
  margin: 1rem 0 0.4rem;
}

/* ---------- Q1 choice cards ---------- */

.choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  margin: 0 0 0.5rem;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 33.99rem) {
  .choice-grid,
  .choice-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 34rem) {
  .choice-grid,
  .choice-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  width: 100%;
  text-align: left;
  /* Transparent by default so selecting cannot shift the layout. */
  border: 1px solid transparent;
  background: var(--card);
  padding: 0.85rem 1rem;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: border-color 150ms ease;
}

.choice:hover .choice-title,
.choice:focus-visible .choice-title {
  color: var(--accent);
}

.choice[aria-pressed="true"],
.choice.is-selected {
  border-color: var(--accent);
}

.choice-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.choice-sub {
  color: var(--muted);
  font-size: var(--body-sm);
  line-height: 1.4;
}

.buy-split {
  margin-top: 0.5rem;
}

.text-back {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: var(--body-sm);
  padding: 0.4rem 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Q2 answers ---------- */

.role-badge {
  margin: 0 0 1rem;
  font-size: var(--meta);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.chip-block {
  margin: 0 0 1.05rem;
}

.chip-label {
  margin: 0 0 0.5rem;
  font-size: var(--meta);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.4rem 0.7rem;
  border: 1px solid transparent;
  background: var(--card);
  font-size: var(--body-sm);
  cursor: pointer;
}

/* Selected chip: accent text on a light wash. One hairline, never a box in a box. */
.chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--wash);
  color: var(--accent);
  font-weight: 600;
}

.chip input {
  margin: 0;
  accent-color: var(--accent);
}

.field {
  margin: 0 0 1.05rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 34rem) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: var(--body-sm);
}

input[type="number"] {
  width: 100%;
  max-width: 13rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

input[type="number"]:focus {
  border-color: var(--accent);
}

input:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hint {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: var(--body-sm);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.5rem;
}

.preset {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: var(--meta);
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Q3 insight ---------- */

#q3-insight[data-open="true"] {
  border: 1px solid var(--line);
  background: var(--card);
  padding: 1.6rem 1.7rem;
}

@media (max-width: 34rem) {
  #q3-insight[data-open="true"] {
    padding: 1.25rem 1.1rem;
  }
}

.lagebild h2,
.lesson h2 {
  margin-bottom: 0.9rem;
}

.lagebild p,
.lesson p {
  margin: 0 0 0.95rem;
  max-width: 36em;
}

.lagebild ul,
.lesson ul {
  margin: 0 0 0.9rem;
  padding-left: 1.15rem;
  max-width: 36em;
}

.lagebild li,
.lesson li {
  margin: 0 0 0.3rem;
}

.modell-caption {
  margin: 0 0 1.1rem !important;
  font-size: var(--meta);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.posture {
  margin-top: 1.35rem !important;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.posture strong {
  color: var(--accent);
}

.note {
  color: var(--muted);
}

.meta {
  font-size: var(--meta);
  color: var(--muted);
  margin-bottom: 0.4rem !important;
}

/* ---------- expanders ---------- */

.rechenbeispiele,
.gutachter-details,
.zahlen-details,
.rechtslage-box {
  margin: 1.35rem 0 0;
}

.rechenbeispiele > summary,
.gutachter-details > summary,
.zahlen-details > summary,
.rechtslage-box > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: var(--body-sm);
  font-weight: 600;
  padding: 0.35rem 0;
  list-style-position: outside;
}

.rechtslage-box > summary {
  font-weight: 400;
}

.gutachter-list {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: var(--body-sm);
}

.gutachter-list li {
  margin: 0 0 0.3rem;
}

.zahlen-body {
  margin-top: 1rem;
  max-width: 30rem;
}

table.scenarios {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 0.5rem;
  font-size: var(--body-sm);
  font-variant-numeric: tabular-nums;
}

table.scenarios th {
  font-size: var(--meta);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

table.scenarios th,
table.scenarios td {
  text-align: left;
  padding: 0.45rem 0.6rem 0.45rem 0;
  vertical-align: top;
}

table.scenarios tbody tr + tr td {
  border-top: 1px solid var(--line);
}

.euro {
  white-space: nowrap;
}

/* ---------- labeled affiliate exits ---------- */

.cta {
  margin-top: 1.35rem;
}

.cta-werbung {
  margin: 0 0 0.3rem;
  font-size: var(--meta);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.cta-vertrag {
  margin: 0 0 0.7rem;
  font-size: var(--meta);
  color: var(--muted);
  max-width: 34em;
}

.cta-link {
  color: var(--accent);
}

.cta-button .cta-link {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--accent);
  background: var(--card);
  text-decoration: none;
  font-size: var(--body-sm);
  font-weight: 600;
}

.cta-button .cta-link:hover {
  background: var(--wash);
}

.cta-text .cta-link {
  font-size: var(--body-sm);
  text-underline-offset: 2px;
}

.cta-print-only {
  display: none;
}

/* ---------- glossary ---------- */

.term-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  margin-left: 0.15rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--wash);
  color: var(--accent);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  vertical-align: 0.1em;
}

.term-popover {
  position: absolute;
  z-index: 40;
  max-width: 19rem;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 0.7rem 0.85rem;
  font-size: var(--body-sm);
  color: var(--ink);
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 2rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-size: var(--meta);
  line-height: 1.5;
  color: var(--muted);
}

body:has(#main[data-phase="start"]) .site-footer {
  margin-top: 1rem;
  padding-top: 0.9rem;
}

.site-footer p {
  margin: 0 0 0.55rem;
  max-width: 44em;
}

.legal-links {
  margin-top: 0.9rem !important;
}

.legal-links a,
.kanzlei-line {
  color: var(--accent);
}

.legal-block {
  margin-top: 1.55rem;
}

.legal-block h2 {
  font-size: var(--body-sm);
  margin-bottom: 0.5rem;
}

/* ---------- insight split ---------- */

@media (min-width: 960px) {
  #main[data-phase="insight"] #gate-form {
    display: grid;
    grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 3.5rem;
    align-items: start;
  }

  #main[data-phase="insight"] #q2-context {
    grid-column: 1;
    grid-row: 1 / -1;
    position: sticky;
    top: 1.5rem;
    margin-bottom: 0;
    padding-right: 0.75rem;
  }

  #main[data-phase="insight"] #q3-insight {
    grid-column: 2;
    grid-row: 1;
  }

  #main[data-phase="insight"] #q4-zahlen {
    grid-column: 2;
    grid-row: 2;
  }

  #main[data-phase="insight"] #q4-next {
    grid-column: 2;
    grid-row: 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .beat[data-open="true"] {
    animation: none;
  }

  .choice {
    transition: none;
  }
}

/* ---------- print: a Gesprächsnotiz, not a web page ---------- */

@media print {
  @page {
    margin: 18mm;
  }

  /* The page canvas comes from html, not body: without this the paper tint
   * would print as a full-bleed background. */
  html {
    font-size: 11pt;
    background: #fff;
  }

  body,
  body:has(#main[data-phase="insight"]) {
    max-width: none;
    padding: 0;
    color: #000;
    background: #fff;
  }

  .skip,
  .banner,
  #role-grid,
  .buy-split,
  .presets,
  .term-help,
  .term-popover,
  .text-back,
  .legal-links,
  #impressum,
  #datenschutz,
  .cta-link {
    display: none !important;
  }

  /* Open beats print; the ones the reader never opened stay out. */
  #main[data-phase="insight"] #gate-form {
    display: block;
  }

  /* No break-inside on the beats: the insight pane is taller than a page and
   * avoiding breaks would push it onto a fresh sheet and waste the first one. */
  .beat {
    margin-bottom: 1.25rem;
  }

  .lagebild p,
  .posture,
  table.scenarios,
  .cta {
    break-inside: avoid;
  }

  .beat[data-open="true"] {
    animation: none;
    opacity: 1;
    transform: none;
  }

  #q3-insight[data-open="true"] {
    border: 0;
    padding: 0;
    background: #fff;
  }

  #main[data-phase="insight"] #q2-context {
    position: static;
  }

  details {
    margin-top: 0.9rem;
  }

  details > summary {
    color: #000;
  }

  .cta-print-only {
    display: block;
    font-size: var(--meta);
    color: #000;
  }

  .site-footer {
    margin-top: 1.5rem;
    color: #000;
    break-inside: avoid;
  }

  a {
    color: #000;
    text-decoration: none;
  }
}
