/* renteneintritt-rechner.de – „Der Zeitstrahl“
   Figtree (freundlich, gut lesbar, normale Null), Pflaume, Bernstein für den besten Termin.
   Ein Merkmal: der Zeitstrahl von 60 bis 68 mit allen Rentenarten. Alles andere ruhig. */

@font-face { font-family: "Figtree"; src: url("/fonts/figtree-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Figtree"; src: url("/fonts/figtree-600.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Figtree"; src: url("/fonts/figtree-800.woff2") format("woff2"); font-weight: 800; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  --ink-light: #1f1a2b;      --ink-dark: #ece8f3;
  --muted-light: #5e5770;    --muted-dark: #b0a8c2;
  --paper-light: #ffffff;    --paper-dark: #16121c;
  --surface-light: #f5f3f8;  --surface-dark: #201a29;
  --rule-light: #e2dcea;     --rule-dark: #352d42;
  --plum-light: #4a2873;     --plum-dark: #c6a8f0;    /* ohne Abschlag, Links, Knöpfe */
  --plum-strong-light: #331a52; --plum-strong-dark: #e0cff9;
  --on-plum-light: #ffffff;  --on-plum-dark: #1f1030;
  --early-light: #b9a3d6;    --early-dark: #6a5590;   /* mit Abschlag (schraffiert) */
  --amber-light: #b77905;    --amber-dark: #f3b33d;   /* bester Termin */
  --error-light: #a32a2a;    --error-dark: #f4a3a3;
  --error-bg-light: #fbecec; --error-bg-dark: #3a1f22;

  --ink: var(--ink-light); --muted: var(--muted-light); --paper: var(--paper-light); --surface: var(--surface-light);
  --rule: var(--rule-light); --plum: var(--plum-light); --plum-strong: var(--plum-strong-light); --on-plum: var(--on-plum-light);
  --early: var(--early-light); --amber: var(--amber-light); --error: var(--error-light); --error-bg: var(--error-bg-light);
  --logo-bg: #3b1f5c; --logo-fg: #ffffff; --logo-flame: #f3b33d;

  @media (prefers-color-scheme: dark) {
    --ink: var(--ink-dark); --muted: var(--muted-dark); --paper: var(--paper-dark); --surface: var(--surface-dark);
    --rule: var(--rule-dark); --plum: var(--plum-dark); --plum-strong: var(--plum-strong-dark); --on-plum: var(--on-plum-dark);
    --early: var(--early-dark); --amber: var(--amber-dark); --error: var(--error-dark); --error-bg: var(--error-bg-dark);
    --logo-bg: #ece6f5; --logo-fg: #3b1f5c; --logo-flame: #b07a10;
  }

  /* Typografie: Grundgröße 19 px, Skala 1.25 */
  --step-0: 1.1875rem;
  --step-1: 1.4844rem;
  --step-2: 1.8555rem;
  --step-3: clamp(2.2rem, 1.6rem + 2.4vw, 3.1rem);
  --measure: 66ch;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

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

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--step-0);
  font-size-adjust: from-font;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--plum); text-underline-offset: .18em; text-decoration-thickness: .08em; transition: color 150ms ease; }
a:hover { color: var(--plum-strong); }
a, button, summary, select, label { touch-action: manipulation; }
h1, h2, h3, .brand, nav.main, th { hyphens: manual; }
:focus-visible { outline: 3px solid var(--plum); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: .5rem 1rem; z-index: 10; }

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

header.site { border-bottom: 1px solid var(--rule); }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 2rem; padding-block: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.15rem; color: var(--ink); 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.4rem; font-size: 1.05rem; }
nav.main a { color: var(--ink); text-decoration: none; text-underline-offset: .4em; text-decoration-thickness: 2px; }
nav.main a:hover { color: var(--plum); }
nav.main a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--plum); font-weight: 600; }

main { padding: 1.5rem 0 4rem; }
main .wrap > * { max-width: var(--measure); }
main .wrap > :is(.calc-layout) { max-width: none; }
h1 { font-size: var(--step-3); line-height: 1.1; font-weight: 800; letter-spacing: -.02em; margin: .6rem 0 .8rem; text-wrap: balance; }
h2 { font-size: var(--step-2); line-height: 1.2; font-weight: 800; letter-spacing: -.01em; margin: 2.8rem 0 .7rem; text-wrap: balance; }
h3 { font-size: var(--step-1); line-height: 1.3; font-weight: 600; margin: 2rem 0 .4rem; }
p, li { text-wrap: pretty; }
.lead { font-size: var(--step-1); line-height: 1.45; color: var(--muted); }
.breadcrumb { font-size: 1rem; color: var(--muted); margin-top: .75rem; }
.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: 1rem; color: var(--muted); margin-top: 3rem; }
.note { border-left: 3px solid var(--amber); padding: .1rem 0 .1rem 1.1rem; margin: 2rem 0; }
.note p { margin: .4rem 0; }
.sources li { margin: .4rem 0; }

/* ── Der Zeitstrahl ── */
.timeline { margin: 0; }
.timeline figcaption { font-size: 1rem; color: var(--muted); margin-bottom: .6rem; }
.timeline .summary { font-size: var(--step-1); line-height: 1.3; margin: 0 0 .3rem; }
.timeline .summary strong { font-weight: 800; color: var(--plum); }
.timeline .summary span { color: var(--muted); font-size: 1rem; }
.timeline .summary-early { margin: 0 0 1.2rem; color: var(--muted); font-size: 1rem; }
.timeline .countdown { margin: -.8rem 0 1.2rem; font-weight: 600; }
.timeline ol { list-style: none; margin: 0; padding: 0; }
.timeline .opt { display: grid; gap: .05rem; padding: .8rem 0 .9rem; border-top: 1px solid var(--rule); }
.timeline .opt-name { font-weight: 800; }
.timeline .badge {
  display: inline-block; margin-inline-start: .5rem; padding: .05rem .45rem; border-radius: .3rem;
  font-size: .8rem; font-weight: 600; vertical-align: .15em; background: var(--amber); color: #1f1a2b;
}
.timeline .opt-date { font-weight: 600; }
.timeline .opt-early, .timeline .opt-note { font-size: 1rem; color: var(--muted); }
.timeline .opt-note { color: var(--amber); }
.timeline .track { position: relative; display: block; block-size: .9rem; margin-top: .5rem; background: var(--surface); border-radius: 2px; }
.timeline .seg { position: absolute; inset-block: 0; inset-inline-start: calc(var(--start, 0) * 1%); inline-size: calc(var(--w, 0) * 1%); }
.timeline .seg.free { background: var(--plum); border-radius: 0 2px 2px 0; }
.timeline .seg.early { background: repeating-linear-gradient(135deg, var(--early) 0 5px, transparent 5px 9px); }
.timeline .axis { display: flex; justify-content: space-between; font-size: .9rem; color: var(--muted); border-top: 2px solid var(--ink); padding-top: .3rem; }
.timeline .axis span { inline-size: 0; display: flex; justify-content: center; }
.timeline .axis span:first-child { justify-content: flex-start; }
.timeline .axis span:last-child { justify-content: flex-end; }
.timeline .legend { font-size: .95rem; color: var(--muted); margin-top: .9rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.timeline .key { display: inline-block; inline-size: 1.6rem; block-size: .7rem; margin-inline-start: .4rem; }
.timeline .key:first-child { margin-inline-start: 0; }
.timeline .key.free { background: var(--plum); }
.timeline .key.early { background: repeating-linear-gradient(135deg, var(--early) 0 5px, transparent 5px 9px); outline: 1px solid var(--early); }
html:not(.js) .timeline :is(.track, .axis, .legend) { display: none; }

/* ── Tabellen (modern-web-guidance: responsive-table) ── */
table { border-collapse: collapse; width: 100%; font-size: 1.05rem; }
th, td { text-align: left; vertical-align: top; padding: .55rem .8rem .55rem 0; border-bottom: 1px solid var(--rule); }
thead th { font-weight: 800; border-bottom: 2px solid var(--ink); }
caption { text-align: left; caption-side: bottom; padding-top: .6rem; font-size: 1rem; color: var(--muted); }
.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(--paper); position: sticky; inset-inline-start: 0; }
.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 tr { padding: .5rem 0; border-bottom: 1px solid var(--rule); }
  .table-wrapper th, .table-wrapper td { border: 0; padding: .1rem 0; }
  .table-wrapper tbody th { position: static; }
  .table-wrapper td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
}

/* ── Häufige Fragen (modern-web-guidance: accordion) ── */
details { border-bottom: 1px solid var(--rule); padding: .9rem 0; }
details:first-of-type { border-top: 1px solid var(--rule); }
summary { list-style: none; display: flex; align-items: baseline; gap: .6ch; cursor: pointer; font-weight: 800; font-size: 1.3rem; 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(--plum); 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 200ms var(--ease-out), opacity 200ms var(--ease-out), content-visibility 200ms;
    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; }
}

/* ── Rechner (modern-web-guidance: validate-input-after-interaction, accessible-error-announcement) ── */
.calc-layout { display: grid; gap: 2.5rem; align-items: start; margin-block: 1.5rem 2rem; }
@media (width >= 58rem) { .calc-layout { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 4rem; } }
form.calc { background: var(--surface); padding: 1.3rem 1.4rem 1.5rem; border-radius: .6rem; }
form.calc > label, form.calc legend { display: block; font-weight: 600; margin-top: 1rem; }
form.calc > label:first-child { margin-top: 0; }
form.calc .hint { display: block; color: var(--muted); font-size: .95rem; }
form.calc fieldset { border: 0; margin: 0; padding: 0; }
form.calc fieldset label, form.calc .check { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin-top: .35rem; cursor: pointer; }
form.calc :is(input[type="radio"], input[type="checkbox"]) { inline-size: 1.15rem; block-size: 1.15rem; margin: 0; flex: none; }
form.calc input[type="date"] {
  font: inherit; padding: .5rem .65rem; margin-top: .3rem; width: 100%;
  border: 2px solid var(--rule); border-radius: .4rem; background: var(--paper); color: var(--ink);
}
form.calc input:focus-visible { border-color: var(--plum); outline-offset: 1px; }
form.calc button {
  font: inherit; font-weight: 600; margin-top: 1.4rem; padding: .7rem 1.3rem; border: 0; border-radius: .4rem;
  background: var(--plum); color: var(--on-plum); cursor: pointer; transition: background-color 150ms ease;
}
@media (hover: hover) and (pointer: fine) { form.calc button:hover { background: var(--plum-strong); } }
@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(--error); font-size: .95rem; margin-top: .25rem; }
form.calc input:user-invalid { border-color: var(--error); background-color: var(--error-bg); }
form.calc input:user-invalid ~ .error-msg { display: block; }
form.calc .user-invalid-fallback { border-color: var(--error); background-color: var(--error-bg); }
form.calc .user-invalid-fallback ~ .error-msg { display: block; }
#result:focus-visible { outline-offset: 6px; }

.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 { border-top: 1px solid var(--rule); font-size: 1rem; color: var(--muted); padding: 2rem 0 2.5rem; }
footer.site p { max-width: var(--measure); 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 jeder Berechnung schieben sich die Abschnitte auf dem Zeitstrahl von links an ihren Platz
   (reagiert auf die Eingabe). Bei reduzierter Bewegung: nur Einblenden. */
@keyframes grow { from { scale: 0 1; } }
@keyframes fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .timeline.animate .seg { transform-origin: left center; animation: grow 450ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
  .timeline.animate .opt:nth-child(2) { --d: 60ms; }
  .timeline.animate .opt:nth-child(3) { --d: 105ms; }
  .timeline.animate .opt:nth-child(4) { --d: 140ms; }
  /* Kürzer werdende Abstände; feste Werte oben als Rückfall */
  @supports (animation-delay: calc(sibling-index() * 1ms)) {
    .timeline.animate .opt:nth-child(n) { --d: calc(60ms * sqrt(sibling-index() - 1)); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .timeline.animate .seg { animation: fade-in 200ms ease both; }
}
