/* altersvorsorgedepot-rechner-2027.de – „Die Förderstufen“
   Bricolage Grotesque (warm, eigenwillig) für Überschriften und große Zahlen, Source Sans 3 für Text und Tabellen.
   Bordeaux = Ihr eigenes Geld, Messing = Geld vom Staat, Petrol = Erträge. Ein Merkmal: der Stufenbalken der Grundzulage
   (50 Cent je Euro bis 360 €, 25 Cent bis 1.800 €), der sich bis zu Ihrem Beitrag füllt. */

@font-face {
  font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage-var.woff2") format("woff2");
  font-weight: 200 800; font-display: swap;
}
@font-face {
  font-family: "Source Sans 3"; src: url("/fonts/source-sans-var.woff2") format("woff2");
  font-weight: 200 900; font-display: swap;
}
@font-face {
  font-family: "Source Sans Fallback"; src: local("Arial"), local("Helvetica Neue"), local("Liberation Sans");
  size-adjust: 94%; ascent-override: 104%; descent-override: 29%; line-gap-override: 0%;
}

:root {
  --tinte-l: #2a2f3a;   --tinte-d: #ecebf0;
  --leise-l: #5d6371;   --leise-d: #a9aab6;
  --papier-l: #f3f4f7;  --papier-d: #16161b;
  --flaeche-l: #ffffff; --flaeche-d: #1f1f26;
  --linie-l: #dcdee5;   --linie-d: #33333d;
  --wein-l: #7c2a43;    --wein-d: #d77a94;
  --messing-l: #c9952e; --messing-d: #e2b257;
  --messing-text-l: #855e0f; --messing-text-d: #ecc274;
  --petrol-l: #3f7480;  --petrol-d: #86c0cb;
  --link-l: #7c2a43;    --link-d: #f0a3b8;
  --minus-l: #b42318;   --minus-d: #ff9d92;
  --fehler-bg-l: #fcebea; --fehler-bg-d: #3a1f22;

  --tinte: var(--tinte-l); --leise: var(--leise-l); --papier: var(--papier-l); --flaeche: var(--flaeche-l);
  --linie: var(--linie-l); --wein: var(--wein-l); --messing: var(--messing-l); --messing-text: var(--messing-text-l);
  --petrol: var(--petrol-l); --link: var(--link-l); --minus: var(--minus-l); --fehler-bg: var(--fehler-bg-l);
  --logo-bg: #7c2a43; --logo-fg: #ffffff; --logo-flame: #e0ad46;

  @media (prefers-color-scheme: dark) {
    --tinte: var(--tinte-d); --leise: var(--leise-d); --papier: var(--papier-d); --flaeche: var(--flaeche-d);
    --linie: var(--linie-d); --wein: var(--wein-d); --messing: var(--messing-d); --messing-text: var(--messing-text-d);
    --petrol: var(--petrol-d); --link: var(--link-d); --minus: var(--minus-d); --fehler-bg: var(--fehler-bg-d);
    --logo-bg: #e2b257; --logo-fg: #2a1d22; --logo-flame: #7c2a43;
  }

  --s-0: 1.125rem;
  --s-1: 1.375rem;
  --s-2: clamp(1.75rem, 1.5rem + 1vw, 2.15rem);
  --s-3: clamp(2rem, 1.45rem + 2.6vw, 3.4rem);
  --mass: 68ch;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --display: "Bricolage Grotesque", "Source Sans 3", system-ui, sans-serif;

  color-scheme: light dark;
  accent-color: var(--wein);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Source Sans 3", "Source Sans Fallback", system-ui, sans-serif;
  font-size: var(--s-0);
  line-height: 1.6;
  color: var(--tinte);
  background: var(--papier);
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: .07em; transition: color 150ms ease; }
@media (hover: hover) and (pointer: fine) { a:hover { color: var(--tinte); } }
a, button, summary, select, label { touch-action: manipulation; }
h1, h2, h3, .brand, nav.main, th, .betrag { hyphens: manual; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--flaeche); padding: .5rem 1rem; z-index: 10; }

.wrap { max-width: 74rem; margin: 0 auto; padding: 0 1.5rem; }

header.site { background: var(--flaeche); border-bottom: 1px solid var(--linie); }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 2rem; padding-block: .9rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 700; font-size: 1.3rem; letter-spacing: -.01em; color: var(--tinte); text-decoration: none; }
.brand .logo { inline-size: 2.1rem; block-size: 2.1rem; flex: none; }
nav.main ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.3rem; font-size: 1.05rem; }
nav.main a { color: var(--tinte); text-decoration: none; text-underline-offset: .45em; text-decoration-thickness: 2px; }
@media (hover: hover) and (pointer: fine) { nav.main a:hover { color: var(--link); } }
nav.main a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--messing); font-weight: 650; }

main { padding: 1.5rem 0 4rem; }
main .wrap > * { max-width: var(--mass); }
main .wrap > :is(.rechner, .breit) { max-width: none; }
main .wrap > .table-wrapper { max-width: 62rem; }
h1 { font-family: var(--display); font-size: var(--s-3); line-height: 1.02; font-weight: 750; letter-spacing: -.02em; margin: .6rem 0 .8rem; text-wrap: balance; }
h2 { font-family: var(--display); font-size: var(--s-2); line-height: 1.12; font-weight: 700; letter-spacing: -.01em; margin: 2.8rem 0 .7rem; text-wrap: balance; }
h3 { font-size: var(--s-1); line-height: 1.3; font-weight: 650; margin: 2rem 0 .4rem; }
p, li { text-wrap: pretty; }
.lead { font-size: var(--s-1); line-height: 1.45; color: var(--leise); margin-top: 0; hyphens: manual; }
.breadcrumb { font-size: .98rem; color: var(--leise); margin-top: .5rem; }
.breadcrumb ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; }
.breadcrumb li + li::before { content: "›"; margin: 0 .5rem; }
.stand { font-size: .98rem; color: var(--leise); margin-top: 3rem; }
.note { border-left: 3px solid var(--messing); padding: .1rem 0 .1rem 1.1rem; margin: 2rem 0; }
.note p { margin: .4rem 0; }
.sources li { margin: .4rem 0; }

/* ── Rechner: Formular links, Ergebnis rechts ── */
.rechner { display: grid; gap: 2rem; align-items: start; margin-block: 1.2rem 2.5rem; }
@media (width >= 60rem) {
  .rechner { grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); gap: 3rem; }
  .rechner #result { position: sticky; top: 1.5rem; }
}
form.calc { background: var(--flaeche); border: 1px solid var(--linie); padding: 1.3rem 1.4rem 1.5rem; border-radius: .75rem; }
form.calc .feld, form.calc fieldset, form.calc .check { margin-top: 1.05rem; }
form.calc > .feld:first-of-type { margin-top: 0; }
form.calc label, form.calc legend { font-weight: 600; }
form.calc .feld > label { display: block; }
form.calc .hint { display: block; color: var(--leise); font-size: .95rem; line-height: 1.4; margin: 0; }
form.calc fieldset { border: 0; padding: 0; margin-inline: 0; min-inline-size: 0; }
form.calc legend { padding: 0; margin-bottom: .2rem; }
.eingabe { position: relative; display: block; margin-top: .3rem; }
.eingabe input { font: inherit; font-weight: 600; inline-size: 100%; padding: .55rem 2.2rem .55rem .7rem;
  border: 2px solid var(--linie); border-radius: .45rem; background: var(--flaeche); color: var(--tinte); }
.eingabe .einheit { position: absolute; inset-inline-end: .8rem; inset-block: 0; display: grid; place-items: center; color: var(--leise); pointer-events: none; }
#beitrag { font-family: var(--display); font-weight: 700; font-size: 1.5rem; }
form.calc select { font: inherit; inline-size: 100%; margin-top: .3rem; padding: .5rem .6rem; border: 2px solid var(--linie);
  border-radius: .45rem; background: var(--flaeche); color: var(--tinte); }
form.calc :is(input, select):focus-visible { border-color: var(--link); outline-offset: 1px; }

/* Kinder: vier kleine Felder nebeneinander */
.kinder-felder { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .8rem; }
.kinder-felder .feld { margin-top: .5rem !important; }
.kinder-felder label { font-weight: 500 !important; font-size: .95rem; }
.kinder > .feld:last-child { margin-top: .8rem; }

.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; font-weight: 500 !important; line-height: 1.4; }
.check input { inline-size: 1.2rem; block-size: 1.2rem; margin: .15rem 0 0; flex: none; }
.nur-verheiratet { display: none; }
form:has(input[name="verheiratet"]:checked) .nur-verheiratet { display: block; }

details.weitere { margin-top: 1.2rem; border-top: 1px solid var(--linie); padding-top: .8rem; }
details.weitere > summary { font-size: 1.05rem; font-weight: 650; }
.weitere-inhalt { padding-bottom: .2rem; }

form.calc button {
  font: inherit; font-weight: 700; inline-size: 100%; margin-top: 1.4rem; padding: .8rem 1.3rem; border: 0;
  border-radius: .5rem; background: var(--wein); color: #fff; cursor: pointer; transition: background-color 150ms ease;
}
@media (prefers-color-scheme: dark) { form.calc button { color: #2a1d22; } }
@media (hover: hover) and (pointer: fine) { form.calc button:hover { background: color-mix(in srgb, var(--wein) 85%, black); } }
@media (prefers-reduced-motion: no-preference) {
  form.calc button { transition: transform 160ms var(--ease-out), background-color 150ms ease; }
  form.calc button:active { transform: scale(0.97); }
}
form.calc .error-msg { display: none; color: var(--minus); font-size: .93rem; margin-top: .25rem; }
form.calc input:user-invalid { border-color: var(--minus); background-color: var(--fehler-bg); }
form.calc .feld:has(input:user-invalid) .error-msg { display: block; }
form.calc .user-invalid-fallback { border-color: var(--minus); background-color: var(--fehler-bg); }
form.calc .feld:has(.user-invalid-fallback) .error-msg { display: block; }

/* ── Ergebnis: die Förderstufen ── */
#result { container-type: inline-size; }
#result:focus-visible { outline-offset: 6px; }
.ergebnis { background: var(--flaeche); border: 1px solid var(--linie); border-radius: .75rem; padding: 1.4rem 1.5rem 1.3rem; }
.ergebnis .kopf { margin: 0 0 .3rem; font-weight: 650; color: var(--leise); }
.ergebnis .kopf.zwei { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--linie); }
.ergebnis .summe { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .8rem; margin: 0 0 1rem; }
.ergebnis .summe .betrag { font-family: var(--display); font-weight: 800; font-size: clamp(2.8rem, 2rem + 4vw, 4.2rem); line-height: 1; letter-spacing: -.03em; color: var(--messing-text); }
.ergebnis .summe.klein .betrag { font-size: clamp(2.2rem, 1.7rem + 2.5vw, 3rem); color: var(--tinte); }
.ergebnis .summe .dazu { color: var(--leise); font-size: 1.02rem; }

.stufen-box { margin: 0 0 1.1rem; }
.stufen { display: block; inline-size: 100%; block-size: 3.2rem; }
.stufen-grund { fill: color-mix(in srgb, var(--messing) 20%, transparent); }
.stufen-fuell { fill: var(--messing); }
.stufen-box figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; margin-top: .45rem; font-size: .93rem; color: var(--leise); }
.stufen-box figcaption span::before { content: ""; display: inline-block; inline-size: .7rem; margin-inline-end: .35rem; background: var(--messing); vertical-align: -.05em; }
.stufen-box .st1::before { block-size: .95em; }
.stufen-box .st2::before { block-size: .5em; }

dl.werte { margin: 0; }
dl.werte > div { display: flex; justify-content: space-between; gap: 1rem; padding: .42rem 0; border-bottom: 1px solid var(--linie); }
dl.werte dt { color: var(--tinte); }
dl.werte dd { margin: 0; text-align: right; white-space: nowrap; font-weight: 600; }
dl.werte > div.gesamt { border-bottom: 0; border-top: 2px solid var(--tinte); font-weight: 700; font-size: 1.08rem; }
dl.werte > div.gesamt dd { color: var(--messing-text); font-weight: 800; }
dl.werte.legende { margin-top: .6rem; }
.punkt { display: inline-block; inline-size: .7rem; block-size: .7rem; border-radius: 50%; margin-inline-end: .45rem; }
.p-beitrag { background: var(--wein); }
.p-zulage { background: var(--messing); }
.p-ertrag { background: var(--petrol); }
.anteile { display: block; inline-size: 100%; block-size: 1.1rem; border-radius: .25rem; overflow: hidden; }
.a-beitrag { fill: var(--wein); }
.a-zulage { fill: var(--messing); }
.a-ertrag { fill: var(--petrol); }
.ergebnis .auszahlung { margin: 1rem 0 0; font-size: 1.05rem; line-height: 1.5; }
.ergebnis .auszahlung strong { font-weight: 700; white-space: nowrap; }
.ergebnis .hinweis { font-size: .95rem; color: var(--leise); margin: .8rem 0 0; line-height: 1.45; }

/* Mitlaufende Ergebniszeile auf schmalen Bildschirmen */
.netto-leiste { display: none; }
@media (width < 60rem) {
  .netto-leiste {
    display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; position: sticky; bottom: .75rem; z-index: 2;
    margin-block: -1rem -.5rem; padding: .65rem 1rem; border-radius: .6rem; background: var(--wein); color: #fff;
    text-decoration: none; box-shadow: 0 6px 20px -6px rgb(60 15 30 / .45);
  }
  .netto-leiste .leiste-text { font-size: .95rem; font-weight: 600; }
  .netto-leiste b { font-family: var(--display); font-weight: 800; font-size: 1.6rem; white-space: nowrap; }
}
@media (width < 60rem) and (prefers-color-scheme: dark) { .netto-leiste { color: #2a1d22; } }

/* ── Tabellen (modern-web-guidance: responsive-table) ── */
table { border-collapse: collapse; width: 100%; font-size: 1.02rem; }
th, td { text-align: left; vertical-align: top; padding: .5rem .8rem .5rem 0; border-bottom: 1px solid var(--linie); }
thead th { font-weight: 700; border-bottom: 2px solid var(--tinte); }
caption { text-align: left; caption-side: bottom; padding-top: .6rem; font-size: .95rem; color: var(--leise); }
.table-wrapper { overflow: auto; max-inline-size: 100%; container-type: inline-size; margin: 1.2rem 0; }
.table-wrapper table { margin: 0; border-collapse: separate; border-spacing: 0; }
.table-wrapper tbody th { font-weight: 600; background: var(--papier); position: sticky; inset-inline-start: 0; }
.table-wrapper td.zahl, .table-wrapper th.zahl { text-align: right; white-space: nowrap; }
.table-wrapper .betont { font-weight: 700; color: var(--messing-text); }
.table-wrapper:focus-visible { outline-offset: 4px; }
@container (width < 30rem) {
  .table-wrapper table, .table-wrapper tbody, .table-wrapper tr, .table-wrapper th, .table-wrapper td { display: block; }
  .table-wrapper thead { display: none; }
  .table-wrapper caption { display: block; padding: .6rem 0 0; }
  .table-wrapper tr { padding: .5rem 0; border-bottom: 1px solid var(--linie); }
  .table-wrapper th, .table-wrapper td { border: 0; padding: .1rem 0; }
  .table-wrapper td.zahl { text-align: left; }
  .table-wrapper tbody th { position: static; }
  .table-wrapper td[data-label]:not([data-label=""])::before { content: attr(data-label) ": "; color: var(--leise); }
  .table-wrapper tbody th[data-label]:not([data-label=""])::before { content: attr(data-label) ": "; color: var(--leise); font-weight: 400; }
}

/* ── Häufige Fragen (modern-web-guidance: accordion) ── */
details { border-bottom: 1px solid var(--linie); padding: .9rem 0; }
.faq details:first-of-type { border-top: 1px solid var(--linie); }
details.weitere { border-bottom: 0; padding-bottom: 0; }
summary { list-style: none; display: flex; align-items: baseline; gap: .6ch; cursor: pointer; font-weight: 700; font-size: 1.2rem; line-height: 1.35; }
summary::-webkit-details-marker { display: none; }
summary::before {
  content: ""; inline-size: .6em; block-size: .6em; flex-shrink: 0; background-color: var(--link); translate: 0 .05em;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 8l8 8 8-8' fill='none' stroke='black' stroke-width='3.5'/%3E%3C/svg%3E") no-repeat center / contain;
  rotate: -90deg;
}
details[open] > summary::before { rotate: 0deg; }
details > p { margin: .7rem 0 .2rem; }
details::details-content { interpolate-size: allow-keywords; overflow: clip; contain: layout; }
details:not([open])::details-content { block-size: 0; opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  summary::before { transition: rotate 200ms var(--ease-out); }
  details::details-content {
    transition: block-size 220ms var(--ease-out), opacity 220ms var(--ease-out), content-visibility 220ms;
    transition-behavior: allow-discrete;
  }
}
@media (prefers-reduced-motion: reduce) {
  details::details-content { transition: opacity 150ms var(--ease-out), content-visibility 150ms; transition-behavior: allow-discrete; }
}

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important; clip-path: inset(50%) !important; overflow: hidden !important;
  width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important;
  border: 0 !important; white-space: nowrap !important;
}

footer.site { background: var(--flaeche); border-top: 1px solid var(--linie); font-size: .98rem; color: var(--leise); padding: 2rem 0 2.5rem; }
footer.site p { max-width: var(--mass); margin: 0; }
footer.site ul { list-style: none; padding: 0; margin: .7rem 0 0; display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; }

/* ── Bewegung: ein Moment ──
   Nach einer Eingabe füllt sich der Stufenbalken von links bis zu Ihrem Beitrag. Nur als Antwort auf eine Aktion.
   Bei reduzierter Bewegung: nur Einblenden. */
@keyframes fuellen { from { transform: scaleX(0); } }
@keyframes einblenden { from { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .ergebnis.animate .stufen-fuell { animation: fuellen 650ms var(--ease-out) both; transform-box: fill-box; transform-origin: left center; }
  .ergebnis.animate .summe .betrag { animation: einblenden 260ms var(--ease-out) both; }
}
@media (prefers-reduced-motion: reduce) {
  .ergebnis.animate { animation: einblenden 200ms ease both; }
}

/* Navigation auf schmalen Bildschirmen: eine Zeile, seitlich scrollbar, weiche Ränder nur dort, wo mehr kommt
   (modern-web-guidance: scrollability-affordance-hints) */
@property --fade-start { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --fade-end { syntax: "<length>"; inherits: false; initial-value: 0px; }
@keyframes reveal-fade-start { to { --fade-start: var(--fade-size); } }
@keyframes hide-fade-end { from { --fade-end: var(--fade-size); } }
@media (width < 52rem) {
  header.site .wrap { row-gap: .3rem; }
  nav.main {
    inline-size: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin;
    padding-block: .45rem .55rem; scroll-padding-inline: 2rem;
    --fade-size: 2rem;
    mask:
      linear-gradient(black, black) no-clip subtract,
      linear-gradient(to right, black, transparent) 0 0 / var(--fade-start) 100% no-repeat no-clip,
      linear-gradient(to right, transparent, black) 100% 0 / var(--fade-end) 100% no-repeat no-clip;
    animation: reveal-fade-start linear both, hide-fade-end linear both;
    animation-timeline: scroll(self inline);
    animation-range: 0 var(--fade-size), calc(100% - var(--fade-size)) 100%;
  }
  nav.main ul { flex-wrap: nowrap; }
  nav.main li { flex: none; white-space: nowrap; }
}
@media (width < 30rem) {
  .wrap { padding: 0 1rem; }
  form.calc, .ergebnis { padding-inline: 1rem; }
}

/* Vergleich nach Steuern: Altersvorsorgedepot gegen ETF-Sparplan */
dl.vergleich > div { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem 6.5rem; gap: .2rem .8rem; }
dl.vergleich > div > dd { text-align: right; }
dl.vergleich > div.spalten { border-bottom: 2px solid var(--tinte); padding-bottom: .3rem; }
dl.vergleich > div.spalten dd { font-weight: 650; white-space: normal; hyphens: manual; color: var(--leise); font-size: .95rem; line-height: 1.25; }
dl.vergleich > div.gesamt dd:first-of-type { color: var(--messing-text); }
dl.vergleich > div.gesamt dd:last-of-type { color: var(--tinte); }
.ergebnis .fazit { margin: .9rem 0 0; font-size: 1.05rem; line-height: 1.5; }
@container (width < 26rem) { dl.vergleich > div { grid-template-columns: minmax(0, 1fr) 5.6rem 5.6rem; gap: .2rem .5rem; } }
