/* ARC B2B Factoring – Gestaltung nach dem B2B-Rechnungsbriefbogen (siehe DESIGN.md).
   Maße der Keile relativ zur Seitenbreite, abgenommen am Briefbogen (1190 px breit). */
:root {
  --red: #ab0033;          /* Rot aus dem Logo („A“, „B2B“) */
  --red-dark: #8a0029;
  --slate: #5c6771;        /* Schiefergrau der Briefbogen-Keile und von „RC“, „Factoring“ */
  --slate-dark: #3d464e;
  --ink: #262c32;
  --text-soft: #49525a;
  --line: #d9dde1;
  --paper: #fff;
  --slip: #fbf2f4;         /* Überweisungsträger: zartes Rosé mit weißen Feldern */
  --slip-line: #e7c8d0;
  --strip: clamp(6px, 1vw, 14px);                 /* durchgehender Rand links: 12/1190 */
  --wedge-top-w: clamp(30px, 4.3vw, 62px);        /* Keil oben links: 51 × 222 */
  --wedge-top-h: clamp(130px, 18.7vw, 270px);
  --wedge-foot-w: clamp(28px, 5.1vw, 74px);       /* Keil unten links: 61 × 564 */
  --wedge-foot-h: clamp(240px, 47vw, 680px);
  --wedge-right-w: clamp(26px, 4.7vw, 68px);      /* Keil unten rechts: 56 × 321 */
  --wedge-right-h: clamp(150px, 27vw, 390px);
  --gutter: calc(var(--strip) + clamp(1.5rem, 6vw, 5.5rem));
  color-scheme: light;
}
@media (prefers-contrast: more) {
  :root { --slate: #46505a; --line: #9aa3ab; --text-soft: var(--ink); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; position: relative; min-height: 100vh; overflow-x: hidden;
  background: var(--paper); color: var(--ink);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem; line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, p, dl, dd, ol { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
::selection { background: #f2d4dc; color: var(--ink); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.red { color: var(--red); }
.sheet { width: min(70rem, 100% - 2 * var(--gutter)); margin-inline: auto; }
.skip { position: absolute; z-index: 10; left: var(--gutter); top: -5rem; padding: .6rem 1rem; background: var(--red); color: #fff; }
.skip:focus { top: 1rem; }

/* ---------- Briefbogen: Rand links, Keile oben links, unten links und unten rechts ---------- */
body::before, .letterhead::before, .letterfoot::before, .letterfoot::after {
  content: ""; position: absolute; z-index: 1; background: var(--slate); pointer-events: none;
}
body::before { inset: 0 auto 0 0; width: var(--strip); }
.letterhead::before { left: 0; top: 0; width: var(--wedge-top-w); height: var(--wedge-top-h); clip-path: polygon(0 0, 100% 0, var(--strip) 100%, 0 100%); }
.letterfoot::before { left: 0; bottom: 0; width: var(--wedge-foot-w); height: var(--wedge-foot-h); clip-path: polygon(0 0, 100% 0, var(--strip) 100%, 0 100%); }
.letterfoot::after { right: 0; bottom: 0; width: var(--wedge-right-w); height: var(--wedge-right-h); clip-path: polygon(100% 0, 100% 100%, 0 100%); }

/* ---------- Briefkopf ---------- */
.letterhead { position: relative; padding-top: clamp(1.75rem, 4vw, 3.25rem); }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem 2.5rem; }
.brand { display: block; width: clamp(170px, 19vw, 250px); }
.brand img { width: 100%; }
.letterhead nav { display: flex; flex-wrap: wrap; padding-bottom: .3rem; font-size: .875rem; letter-spacing: .01em; }
.letterhead nav a { padding: .3rem .95rem; border-left: 1px solid var(--line); color: var(--slate); line-height: 1.2; text-decoration: none; transition: color .15s ease; }
.letterhead nav a:first-child { padding-left: 0; border-left: 0; }
.letterhead nav a:last-child { padding-right: 0; }
.letterhead nav a:hover { color: var(--red); }

/* ---------- Typografie und Bedienelemente ---------- */
h1 { font-size: clamp(2.25rem, 4.6vw, 3.9rem); font-weight: 300; line-height: 1.06; letter-spacing: -.025em; color: var(--slate-dark); }
h2 { font-size: clamp(1.85rem, 3.4vw, 2.85rem); font-weight: 300; line-height: 1.12; letter-spacing: -.02em; color: var(--slate-dark); }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.lead { max-width: 36em; margin-top: 1.5rem; font-size: clamp(1.125rem, 1.6vw, 1.3rem); line-height: 1.55; }
.label { margin-bottom: .9rem; color: var(--slate); font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.label i { margin-inline: .65em; color: #a9b0b6; font-style: normal; font-weight: 300; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem 1rem; margin-top: 2.25rem; }
.button {
  display: inline-flex; align-items: center; gap: .65rem; min-height: 2.875rem; padding: .7rem 1.35rem;
  border: 1px solid var(--red); border-radius: 2px; background: var(--red); color: #fff;
  font-size: .9375rem; font-weight: 500; letter-spacing: .01em; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.button span { transition: transform .15s ease; }
.button:hover { background: var(--red-dark); border-color: var(--red-dark); }
.button:hover span { transform: translateX(2px); }
.button.secondary { background: transparent; border-color: var(--slate); color: var(--slate-dark); }
.button.secondary:hover { border-color: var(--red); color: var(--red); }

/* ---------- Einstieg: Absenderzeile, Betreff, Infoblock ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(15rem, 1fr); gap: clamp(2.5rem, 6vw, 6rem); align-items: start; padding-block: clamp(3.5rem, 8vw, 6.5rem) clamp(3rem, 7vw, 5.5rem); }
.sender { display: inline-block; margin-bottom: clamp(1.5rem, 3vw, 2.25rem); padding-bottom: .2rem; border-bottom: 1px solid var(--slate); color: var(--slate); font-size: .75rem; letter-spacing: .02em; }
.infoblock { margin-top: clamp(2.6rem, 4.6vw, 3.6rem); border-top: 2px solid var(--slate); font-size: .875rem; }
.infoblock h2 { padding: .85rem 0 .5rem; color: var(--slate); font-size: .75rem; font-weight: 600; letter-spacing: .12em; line-height: 1.4; text-transform: uppercase; }
.infoblock dl > div { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.infoblock dt { color: var(--slate); }
.infoblock dd { font-weight: 500; text-align: right; }

/* ---------- Abschnitte ---------- */
.section { padding-block: clamp(3.5rem, 7vw, 6rem); border-top: 1px solid var(--line); }
.section-head { margin-bottom: clamp(2rem, 4vw, 3rem); }

/* Leistungen als Rechnungspositionen, mit doppelt unterstrichenem Ergebnis wie eine Rechnungssumme. */
.positions { width: 100%; border-collapse: collapse; font-size: 1rem; }
.positions th, .positions td { padding: 1.15rem 1.25rem 1.15rem 0; text-align: left; vertical-align: top; }
.positions thead th { padding-block: 0 .7rem; border-bottom: 1.5px solid var(--slate-dark); color: var(--slate); font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.positions tbody tr { border-bottom: 1px solid var(--line); }
.positions .pos { width: 4.5rem; color: var(--slate); font-variant-numeric: tabular-nums; }
.positions tbody th { width: 28%; font-weight: 600; }
.positions td:last-child { padding-right: 0; color: var(--text-soft); }
.positions tfoot th, .positions tfoot td { border-top: 1.5px solid var(--slate-dark); border-bottom: 4px double var(--slate-dark); }
.positions tfoot th { color: var(--slate); font-size: .8125rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.positions tfoot td:last-child { color: var(--red); font-size: 1.125rem; font-weight: 500; }

/* Ablauf: der rote Strich oben greift den Querbalken des „A“ auf. */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 4vw, 3.5rem); padding: 0; list-style: none; }
.steps li { position: relative; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.steps li::before { content: ""; position: absolute; left: 0; top: -2px; width: 2.5rem; height: 3px; background: var(--red); }
.step-num { display: block; margin-bottom: .6rem; color: var(--slate); font-size: .8125rem; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.steps h3 { margin-bottom: .5rem; }
.steps p { color: var(--text-soft); }

/* Für Rechnungsempfänger: Überweisungsträger mit Abtrennlinie, roten Feldbezeichnungen und weißen Feldern. */
.slip { position: relative; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(16rem, 1fr); gap: clamp(2rem, 5vw, 4.5rem); padding: clamp(1.75rem, 4vw, 3.25rem); border-top: 1px dashed #c9a3ae; background: var(--slip); }
.slip::before { content: "\2702\FE0E"; position: absolute; left: 1.25rem; top: -.8rem; padding-inline: .3rem; background: var(--paper); color: #b78795; font-size: 1rem; line-height: 1.5; }
.slip-copy h2 { font-size: clamp(1.6rem, 2.8vw, 2.3rem); }
.slip-copy p { max-width: 34em; margin-top: 1rem; color: var(--text-soft); }
.slip-copy h2 + p { margin-top: 1.25rem; }
.slip-fields { display: grid; gap: .6rem; align-content: start; }
.slip-fields > div { padding: .45rem .8rem .55rem; border: 1px solid var(--slip-line); background: var(--paper); }
.slip-fields dt { color: var(--red); font-size: .6875rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.slip-fields dd { font-family: "Cascadia Mono", Consolas, ui-monospace, "SF Mono", Menlo, monospace; font-size: .9375rem; letter-spacing: .01em; }
.slip-fields a { text-decoration: none; }
.slip-fields a:hover { color: var(--red); text-decoration: underline; }

/* Häufige Fragen der Rechnungsempfänger: aufklappbar ohne JavaScript. */
.faq { max-width: 52rem; margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.faq h3 { margin-bottom: .75rem; color: var(--slate-dark); font-size: 1.125rem; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; gap: 1.5rem; padding: .95rem 0; font-weight: 500; list-style: none; cursor: pointer; transition: color .15s ease; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; width: 1rem; color: var(--red); font-size: 1.25rem; font-weight: 300; line-height: 1.2; text-align: center; }
.faq details[open] summary::after { content: "\2212"; }
.faq summary:hover { color: var(--red); }
.faq details p { max-width: 44em; padding: 0 2.5rem 1.1rem 0; color: var(--text-soft); }
.faq details a { text-decoration-color: var(--line); text-underline-offset: .2em; }
.faq details a:hover { color: var(--red); text-decoration-color: currentColor; }

/* Kontakt */
.contact-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: clamp(2rem, 4vw, 3.5rem); align-items: start; }
.person { display: flex; align-items: center; gap: 1.25rem; }
.person img { flex: none; width: 6rem; height: 6rem; object-fit: cover; }
.person p { color: var(--slate); font-size: .9375rem; line-height: 1.45; }
.person strong { display: block; margin-bottom: .15rem; color: var(--ink); font-size: 1.125rem; font-weight: 600; }
.contact-lines { display: flex; flex-direction: column; gap: .35rem; }
.contact-lines a { text-decoration-color: var(--line); text-underline-offset: .2em; }
.contact-lines a:hover { color: var(--red); text-decoration-color: currentColor; }
.contact-phone { color: var(--red); font-size: clamp(1.5rem, 2.4vw, 1.9rem); font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -.01em; text-decoration: none; }
.addresses { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; color: var(--text-soft); font-size: .9375rem; }
.addresses strong { display: block; margin-bottom: .15rem; color: var(--ink); font-weight: 600; }

/* Rechtstexte */
.legal { padding-block: clamp(3rem, 7vw, 5.5rem) clamp(3rem, 6vw, 5rem); }
.legal h1 { font-size: clamp(2.25rem, 4.2vw, 3.4rem); }
.prose { max-width: 46rem; margin-top: clamp(2rem, 4vw, 3rem); color: var(--text-soft); overflow-wrap: anywhere; }
.prose h2 { margin-top: 2.25rem; color: var(--slate-dark); font-size: 1.1875rem; font-weight: 600; letter-spacing: 0; line-height: 1.35; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose ul { margin-top: .75rem; }
.prose ul { padding-left: 1.25rem; }
.prose ul + ul { margin-top: .3rem; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose em { font-style: normal; }
.prose a { color: var(--red); text-underline-offset: .2em; }

/* ---------- Fußzeile wie auf der Rechnung ---------- */
.letterfoot { position: relative; margin-top: clamp(2rem, 5vw, 4rem); padding-block: 2.5rem clamp(2.5rem, 5vw, 3.5rem); border-top: 1px solid var(--line); color: var(--slate); font-size: .75rem; line-height: 1.6; }
.foot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem 2rem; }
.foot-grid strong { color: var(--slate-dark); font-weight: 600; }
.letterfoot a { text-decoration: none; }
.letterfoot a:hover { color: var(--red); text-decoration: underline; }
.foot-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 1.5rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.foot-bottom nav { display: flex; gap: 1.25rem; }

.not-found { min-height: 44rem; padding-block: clamp(4rem, 10vw, 8rem); } /* kurze Seite: Keile oben und unten bleiben getrennt */
.not-found .lead { margin-bottom: 2rem; }

/* ---------- Kleinere Bildschirme ---------- */
@media (max-width: 62rem) {
  .hero, .slip { grid-template-columns: 1fr; }
  .infoblock { max-width: 30rem; margin-top: 0; }
  .contact-grid { grid-template-columns: 1fr 1fr; }
  .person { grid-column: 1 / -1; }
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .head-row { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .letterhead nav { gap: .2rem 1.25rem; }
  .letterhead nav a { padding: .3rem 0; border-left: 0; }
  .steps, .contact-grid, .foot-grid { grid-template-columns: 1fr; }
  .positions thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .positions tr { display: grid; grid-template-columns: 2.5rem 1fr; column-gap: .5rem; padding-block: 1rem; }
  .positions th, .positions td, .positions tbody th, .positions .pos, .positions tfoot th, .positions tfoot td { width: auto; padding: 0; border: 0; }
  .slip { padding: 1.75rem 1.25rem; }
  .positions tbody td:last-child, .positions tfoot td:last-child { grid-column: 2; margin-top: .35rem; }
  .positions tfoot tr { border-top: 1.5px solid var(--slate-dark); border-bottom: 4px double var(--slate-dark); }
}

@media print {
  .letterhead nav, .actions, .skip { display: none; }
  body::before, .letterhead::before, .letterfoot::before, .letterfoot::after { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .section, .slip { break-inside: avoid; }
}
