/* mieterhoehung-rechner.de – „Der Prüfbericht“
   Public Sans (sachlich, gut lesbar), Indigo, klare Prüfzeichen.
   Ein Merkmal: die Fristen-Leiste mit den drei Daten des Schreibens. Alles andere ruhig. */

@font-face { font-family: "Public Sans"; src: url("/fonts/public-sans-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: "Public Sans"; src: url("/fonts/public-sans-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: "Public Sans"; src: url("/fonts/public-sans-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: #1d2433;      --ink-dark: #e8eaf2;
  --muted-light: #59607a;    --muted-dark: #aab0c4;
  --paper-light: #ffffff;    --paper-dark: #12151d;
  --surface-light: #f2f3f8;  --surface-dark: #1c2030;
  --rule-light: #dcdfea;     --rule-dark: #2f3447;
  --indigo-light: #2b2f8f;   --indigo-dark: #a9adf5;
  --indigo-strong-light: #1d2070; --indigo-strong-dark: #cfd1fb;
  --on-indigo-light: #ffffff; --on-indigo-dark: #14163d;
  --ok-light: #1e7a4c;       --ok-dark: #7fd6a6;
  --no-light: #b3261e;       --no-dark: #ff9b92;
  --open-light: #8a5a00;     --open-dark: #f0c060;
  --error-light: #b3261e;    --error-dark: #ff9b92;
  --error-bg-light: #fcebea; --error-bg-dark: #3a1f22;

  --ink: var(--ink-light); --muted: var(--muted-light); --paper: var(--paper-light); --surface: var(--surface-light);
  --rule: var(--rule-light); --indigo: var(--indigo-light); --indigo-strong: var(--indigo-strong-light); --on-indigo: var(--on-indigo-light);
  --ok: var(--ok-light); --no: var(--no-light); --open: var(--open-light); --error: var(--error-light); --error-bg: var(--error-bg-light);
  --logo-bg: #2b2f8f; --logo-fg: #ffffff; --logo-flame: #ffc94a;

  @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); --indigo: var(--indigo-dark); --indigo-strong: var(--indigo-strong-dark); --on-indigo: var(--on-indigo-dark);
    --ok: var(--ok-dark); --no: var(--no-dark); --open: var(--open-dark); --error: var(--error-dark); --error-bg: var(--error-bg-dark);
    --logo-bg: #e6e7f6; --logo-fg: #2b2f8f; --logo-flame: #9a6a00;
  }

  --step-0: 1.1875rem;
  --step-1: 1.4844rem;
  --step-2: 1.8555rem;
  --step-3: clamp(2.1rem, 1.6rem + 2.2vw, 2.9rem);
  --measure: 66ch;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

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

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Public Sans", 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(--indigo); text-underline-offset: .18em; text-decoration-thickness: .08em; transition: color 150ms ease; }
a:hover { color: var(--indigo-strong); }
a, button, summary, select, label { touch-action: manipulation; }
h1, h2, h3, .brand, nav.main, th { hyphens: manual; }
:focus-visible { outline: 3px solid var(--indigo); 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(--indigo); }
nav.main a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--indigo); 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.12; 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(--indigo); padding: .1rem 0 .1rem 1.1rem; margin: 2rem 0; }
.note p { margin: .4rem 0; }
.sources li { margin: .4rem 0; }

/* ── Der Prüfbericht ── */
.report { margin: 0; }
.report figcaption { font-size: 1rem; color: var(--muted); margin-bottom: .4rem; }
.report .numbers { font-weight: 600; margin: 0 0 1.2rem; }
/* Fristen-Leiste: drei Daten auf einer Linie */
.deadlines { list-style: none; margin: 0 0 1.4rem; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); position: relative; }
.deadlines::before { content: ""; position: absolute; inset-inline: .55rem 33%; top: .55rem; block-size: 2px; background: var(--indigo); }
.deadlines li { position: relative; padding-top: 1.7rem; padding-inline-end: .6rem; }
.deadlines li::before {
  content: ""; position: absolute; top: .1rem; inset-inline-start: 0; inline-size: 1.1rem; block-size: 1.1rem;
  border-radius: 50%; background: var(--paper); border: 3px solid var(--indigo);
}
.deadlines li:last-child::before { background: var(--indigo); }
.deadlines .step-label { display: block; font-size: .95rem; color: var(--muted); }
.deadlines .step-date { display: block; font-weight: 800; font-size: 1.1rem; line-height: 1.3; }
@container (width < 28rem) {
  .deadlines { grid-template-columns: 1fr; }
  .deadlines::before { inset-inline: .5rem auto; inline-size: 2px; block-size: auto; inset-block: .6rem 1.2rem; }
  .deadlines li { padding: 0 0 .9rem 1.8rem; }
}
#result { container-type: inline-size; }
.verdict { padding: .7rem .9rem; border-radius: .4rem; margin: 0 0 1rem; }
.verdict.no { background: color-mix(in srgb, var(--no) 12%, transparent); }
.verdict.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; gap: .1rem; padding: .75rem 0; border-top: 1px solid var(--rule); }
.checks .check-head { display: flex; align-items: center; gap: .55rem; font-weight: 600; }
.checks .check-text { padding-inline-start: 1.85rem; color: var(--muted); font-size: 1.02rem; }
.checks .mark { inline-size: 1.3rem; block-size: 1.3rem; flex: none; border-radius: 50%; display: inline-grid; place-items: center; }
.checks .mark::before { content: ""; inline-size: .8rem; block-size: .8rem; background: #fff;
  mask: var(--icon) no-repeat center / contain; }
.checks .ok .mark   { background: var(--ok);   --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5l5 5L20 6.5' fill='none' stroke='black' stroke-width='4'/%3E%3C/svg%3E"); }
.checks .no .mark   { background: var(--no);   --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' fill='none' stroke='black' stroke-width='4'/%3E%3C/svg%3E"); }
.checks .open .mark { background: var(--open); --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 9a3 3 0 1 1 4 2.8c-.7.3-1 .9-1 1.7V15M12 19v.5' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) { .checks .mark::before { background: #12151d; } }
.checks strong { font-weight: 800; }
.checks .ok strong { color: var(--ok); }
.checks .no strong { color: var(--no); }
.checks .open strong { color: var(--open); }
.report .fine { font-size: .95rem; color: var(--muted); margin-top: 1rem; }

/* ── 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(--indigo); 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, 23rem) minmax(0, 1fr); gap: 4rem; } }
form.calc { background: var(--surface); padding: 1.3rem 1.4rem 1.5rem; border-radius: .5rem; }
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 { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin-top: .35rem; cursor: pointer; }
form.calc input[type="radio"] { inline-size: 1.15rem; block-size: 1.15rem; margin: 0; flex: none; }
form.calc :is(input[type="text"], 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(--indigo); outline-offset: 1px; }
form.calc .optional { margin-top: 1.4rem; padding-top: .6rem; border-top: 1px solid var(--rule); }
form.calc button {
  font: inherit; font-weight: 600; margin-top: 1.4rem; padding: .7rem 1.3rem; border: 0; border-radius: .4rem;
  background: var(--indigo); color: var(--on-indigo); cursor: pointer; transition: background-color 150ms ease;
}
@media (hover: hover) and (pointer: fine) { form.calc button:hover { background: var(--indigo-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 Prüfung erscheinen die Prüfpunkte nacheinander mit kürzer werdenden Abständen
   (reagiert auf die Eingabe). Bei reduzierter Bewegung: nur Einblenden. */
@keyframes rise { from { opacity: 0; translate: 0 6px; } }
@keyframes fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .report.animate .checks li { animation: rise 320ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
  .report.animate .checks li:nth-child(2) { --d: 60ms; }
  .report.animate .checks li:nth-child(3) { --d: 105ms; }
  .report.animate .checks li:nth-child(4) { --d: 140ms; }
  @supports (animation-delay: calc(sibling-index() * 1ms)) {
    .report.animate .checks li:nth-child(n) { --d: calc(60ms * sqrt(sibling-index() - 1)); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .report.animate .checks li { animation: fade-in 200ms ease both; }
}

/* Mustertext */
blockquote.template { margin: 1.2rem 0; padding: 1rem 1.2rem; background: var(--surface); border-left: 4px solid var(--indigo); border-radius: 0 .4rem .4rem 0; }
blockquote.template p { margin: .5rem 0; }

/* Navigation auf schmalen Bildschirmen: eine Zeile, seitlich scrollbar, weiche Ränder nur dort, wo mehr kommt
   (modern-web-guidance: scrollability-affordance-hints; Scrollbalken bleibt sichtbar) */
@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 < 48rem) {
  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; white-space: nowrap; }
}
