/* ==========================================================================
   Reiber Holding GmbH – Stylesheet
   Eigenständig, ohne Framework. Ausgelegt auf WCAG 2.1/2.2 Level AA
   (EN 301 549 / BITV 2.0).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design-Tokens
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Markenfarben aus dem Logo */
  --brand-blue: #003f87;
  --brand-cyan: #1ca2db;

  /* Flächen und Text */
  --bg: #f2f5f9;
  --bg-alt: #e7edf5;
  --surface: #ffffff;
  --surface-sunken: #f7f9fc;
  --border: #ccd6e2;
  --border-strong: #9aabc0;

  --text: #131c27;
  --text-muted: #4c5a6b;

  --primary: #003f87;
  --primary-hover: #002a5c;
  --on-primary: #ffffff;

  --accent-line: var(--brand-cyan);
  --focus: #003f87;
  --focus-inner: #ffffff;

  /* Warnhinweis */
  --warn-bg: #fff7e6;
  --warn-line: #b45309;
  --warn-text: #8a3d0b;

  --shadow-sm: 0 1px 2px rgba(19, 28, 39, .08), 0 1px 3px rgba(19, 28, 39, .06);
  --shadow-md: 0 4px 12px rgba(19, 28, 39, .09), 0 2px 4px rgba(19, 28, 39, .06);
  --shadow-lg: 0 18px 48px rgba(19, 28, 39, .22);

  --radius: 10px;
  --radius-sm: 6px;

  /* Mindestgröße interaktiver Elemente (WCAG 2.5.8 / 2.5.5) */
  --tap: 44px;

  --measure: 68ch;
  --page-max: 1180px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;

  --transition: 160ms ease;
}

/* --------------------------------------------------------------------------
   2. Grundlagen
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* Kein festes px-Font-Size: die Browsereinstellung des Nutzers gilt. */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  /* Umbruch langer Zeichenketten – hält den Reflow bei 320 px intakt. */
  overflow-wrap: break-word;
}

/* Scroll-Sperre, solange ein Dialog offen ist */
html.is-modal-open,
html.is-modal-open body {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 .5em;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
  text-wrap: balance;
}

h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p {
  margin: 0 0 1em;
}

a {
  color: var(--primary);
  text-decoration-thickness: max(1px, .06em);
  text-underline-offset: .18em;
}

a:hover {
  color: var(--primary-hover);
  text-decoration-thickness: max(2px, .12em);
}

img {
  max-width: 100%;
  height: auto;
}

hr {
  height: 1px;
  border: 0;
  margin: 2rem 0;
  background: var(--border);
}

:target {
  scroll-margin-top: 6rem;
}

/* --------------------------------------------------------------------------
   3. Fokus – WCAG 2.4.7 / 2.4.13
   Doppelring: bleibt auch auf farbigen Flächen sichtbar.
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Auf farbigen Flächen zusätzlich ein heller Innenring */
.btn-primary:focus-visible,
.legal-close:focus-visible {
  outline-color: var(--focus);
  box-shadow: 0 0 0 2px var(--focus-inner);
}

/* Browser ohne :focus-visible-Unterstützung nicht abhängen */
:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   4. Hilfsklassen
   -------------------------------------------------------------------------- */

/* Nur für Screenreader – nicht display:none, damit es vorgelesen wird. */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  /* fixed statt absolute: der Link muss auch dann sichtbar werden, wenn
     die Seite bereits gescrollt ist. */
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  transform: translateY(-120%);
  padding: .85rem 1.25rem;
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  border: 2px solid var(--primary);
  border-radius: 0 0 var(--radius-sm) 0;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition);
}

.skip-link:focus {
  transform: translateY(0);
}

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

/* Hält Ergänzungsbindestriche am Wort ("-vermietung") */
.nowrap {
  white-space: nowrap;
}

/* Listen ohne Punkte behalten ihre Semantik (Safari/VoiceOver) */
.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --------------------------------------------------------------------------
   5. Kopfbereich
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
  padding-block: .5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: .25rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.brand img {
  display: block;
  width: auto;
  height: 44px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: .6rem 1.15rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition),
    border-color var(--transition);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--on-primary);
}

.btn-primary .icon {
  flex: none;
}

/* --------------------------------------------------------------------------
   6. Hauptbereich – Vorstellung der Holding
   -------------------------------------------------------------------------- */

main {
  display: block;
}

.hero {
  padding-block: clamp(2rem, 6vw, 4rem);
  background:
    linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.hero__card {
  max-width: 760px;
  margin-inline: auto;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.hero__logo {
  width: auto;
  max-height: 130px;
  margin-bottom: 1.5rem;
}

.hero__tagline {
  margin: 0 auto 1.75rem;
  max-width: 54ch;
  font-size: clamp(1.05rem, 1rem + .5vw, 1.3rem);
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-muted);
}

.badge-band {
  display: inline-block;
  margin-bottom: 1.5rem;
}

.badge-band img {
  display: block;
  width: 230px;
  max-width: 100%;
  height: auto;
}

/* Registerdaten */
.facts {
  margin: 0;
  font-size: .9375rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.facts__former {
  margin-top: .35rem;
}

.facts__label {
  font-weight: 600;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   7. Unternehmen – operative Gesellschaften
   -------------------------------------------------------------------------- */

.section {
  padding-block: clamp(2.5rem, 7vw, 4.5rem);
}

/* Aufeinanderfolgende Abschnitte brauchen zwischen sich nur einen
   Abstand, nicht zwei. */
.section + .section {
  padding-top: 0;
}

.section-head {
  max-width: var(--measure);
  margin-bottom: 2rem;
}

.section-head p {
  margin-bottom: 0;
  color: var(--text-muted);
}

.section-head::after {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  margin-top: 1.25rem;
  background: var(--accent-line);
  border-radius: 2px;
}

.card-grid {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  grid-template-columns: 1fr;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 620px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Ab drei Spalten: obere Reihe drei, untere Reihe zwei – wie gehabt. */
@media (min-width: 940px) {
  .card-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .card-grid > li {
    grid-column: span 2;
  }

  .card-grid > li:nth-last-child(-n + 2) {
    grid-column: span 3;
  }
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition),
    border-color var(--transition);
}

.card:hover,
.card:focus-within {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card__body {
  flex: 1 1 auto;
  padding: 1.75rem 1.5rem 1.5rem;
  text-align: center;
}

/* Feste Höhe hält die Logos auf einer gemeinsamen Grundlinie, obwohl
   die Fremdlogos sehr unterschiedliche Proportionen mitbringen. */
.card__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  margin-bottom: 1.25rem;
}

.card__logo img {
  width: auto;
  max-height: 40px;
}

.card__name {
  margin-bottom: .35rem;
}

.card__purpose {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-muted);
}

.card__facts {
  margin: 0;
  font-size: .875rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.share {
  display: inline-block;
  margin-bottom: .85rem;
  padding: .25rem .7rem;
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text);
}

.card__footer {
  margin: 0;
  border-top: 1px solid var(--border);
}

/* Der Link nimmt den ganzen Fuß ein: große Klickfläche, und die
   Ausrichtung folgt dem zentrierten Karteninhalt. */
.card__link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: var(--tap);
  padding: .8rem 1rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  transition: background-color var(--transition),
    text-decoration-color var(--transition);
}

.card__link:hover {
  background: var(--surface-sunken);
  text-decoration-color: currentColor;
}

/* Die Karte kappt Überstehendes (overflow: hidden), deshalb muss der
   Fokusring nach innen gezeichnet werden. */
.card__link:focus-visible {
  outline-offset: -3px;
  border-radius: 0;
}

.icon {
  flex: none;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   8. Beteiligungen
   Der Abschnittskopf ist der gleiche wie bei den Unternehmen; nur die
   Einträge selbst treten zurück – ohne Karten und ohne Logos.
   -------------------------------------------------------------------------- */

/* Schlichte Liste statt Karten: die Beteiligungen sollen gegenüber den
   operativen Gesellschaften zurücktreten. */
.invest-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.invest {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .1rem 1.5rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
}

.invest__name {
  grid-column: 1;
  margin: 0;
  font-size: 1.0625rem;
}

.invest__desc {
  grid-column: 1;
  margin: 0;
  font-size: .9375rem;
  color: var(--text-muted);
}

.invest__link {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  justify-self: end;
}

.invest__link a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: .25rem .35rem;
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  font-weight: 600;
}

/* Kennzeichnung als Wort, nicht über Farbe allein */
.tag {
  display: inline-block;
  margin-left: .35rem;
  padding: .1rem .5rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  vertical-align: .1em;
}

/* Unter 560 px stapeln die Angaben untereinander */
@media (max-width: 560px) {
  .invest {
    grid-template-columns: 1fr;
    gap: .1rem;
  }

  .invest__link {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
    margin-top: .25rem;
  }
}

/* --------------------------------------------------------------------------
   9. RIPE LIR – Fließtext, Verweis und Warnhinweis
   -------------------------------------------------------------------------- */

.prose {
  max-width: var(--measure);
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose h3 {
  margin-top: 2rem;
}

/* Verweis nach außen, als eigenständige Zeile gesetzt */
.link-out {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: var(--tap);
  padding: .35rem 0;
  font-weight: 600;
}

.link-out .icon {
  flex: none;
}

.note {
  display: flex;
  gap: .85rem;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-left-width: 4px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.note__icon {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: .15rem;
  fill: none;
  stroke: var(--warn-text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.note__body > :last-child {
  margin-bottom: 0;
}

.note p {
  margin-bottom: .6rem;
  font-size: .9375rem;
}

/* Das Signalwort trägt die Warnung mit, nicht die Farbe allein. */
.note strong {
  color: var(--warn-text);
}

/* --------------------------------------------------------------------------
   10. Fußbereich
   -------------------------------------------------------------------------- */

.site-footer {
  padding-block: 2rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .5rem 1.5rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: var(--text-muted);
  font-size: .9375rem;
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .25rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: .25rem .5rem;
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   11. Rechtstexte als Dialog
   Ohne JavaScript stehen die Texte als normale Abschnitte am Seitenende
   (das <dialog> ist dann mit open ausgeliefert). Erst JavaScript macht
   daraus ein modales Fenster.
   -------------------------------------------------------------------------- */

.legal {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Darstellung ohne JavaScript: schlichter Abschnitt im Seitenfluss */
html:not(.js) .legal {
  display: block;
  margin-block: 2rem;
}

html:not(.js) .legal-close {
  display: none;
}

/* Mit JavaScript: echtes Overlay */
html.js .legal {
  max-width: min(880px, 100% - 2rem);
  max-height: min(86dvh, 100% - 2rem);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

html.js .legal:not([open]) {
  display: none;
}

html.js .legal[open] {
  display: flex;
  flex-direction: column;
}

.legal::backdrop {
  background: rgba(9, 15, 23, .7);
}

.legal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1rem, 3vw, 1.75rem);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.legal__title {
  margin: 0;
  font-size: clamp(1.3rem, 1.15rem + .7vw, 1.65rem);
}

.legal__title:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.legal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}

.legal-close:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.legal-close .icon {
  width: 20px;
  height: 20px;
  stroke-width: 2.25;
}

.legal__body {
  padding: clamp(1.25rem, 3vw, 1.75rem);
  overflow-y: auto;
  /* Scrollbereich muss per Tastatur bedienbar sein (WCAG 2.1.1) */
  overscroll-behavior: contain;
}

.legal__body:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.legal__body > :first-child {
  margin-top: 0;
}

.legal__body > :last-child {
  margin-bottom: 0;
}

.legal__body h3 {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 1.2rem;
  color: var(--text);
}

.legal__body h4 {
  margin-top: 1.6rem;
  font-size: 1.02rem;
}

.legal__body p,
.legal__body li {
  max-width: var(--measure);
  font-size: .9375rem;
}

.legal__body ul,
.legal__body ol {
  margin: 0 0 1em;
  padding-left: 1.5rem;
}

.legal__body li {
  margin-bottom: .5rem;
}

.legal__body a {
  /* Lange URLs dürfen den Reflow nicht sprengen */
  overflow-wrap: anywhere;
}

.legal__body address,
.legal__body .stand {
  font-style: normal;
  color: var(--text-muted);
}

.legal__body .stand {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .875rem;
}

.legal__note {
  margin-bottom: 1.5rem;
  padding: .9rem 1.1rem;
  background: var(--surface-sunken);
  border-left: 4px solid var(--accent-line);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .9375rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   12. Nutzerpräferenzen und Ausgabemedien
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }

  .card:hover,
  .card:focus-within {
    transform: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: #4a5a6d;
    --border-strong: #24303f;
    --text-muted: #303b49;
  }

  .card,
  .hero__card,
  .legal {
    border-width: 2px;
  }
}

/* Windows-Kontrastmodus: Rahmen und Icons müssen sichtbar bleiben. */
@media (forced-colors: active) {
  .card,
  .hero__card,
  .legal,
  .legal-close,
  .share {
    border: 1px solid CanvasText;
  }

  .card__footer {
    border-top: 1px solid CanvasText;
  }

  .note {
    border: 1px solid CanvasText;
    border-left-width: 4px;
  }

  .invest {
    border-bottom: 1px solid CanvasText;
  }

  .tag {
    border: 1px solid CanvasText;
  }

  .note__icon {
    stroke: CanvasText;
  }

  .btn-primary {
    border: 2px solid ButtonText;
  }

  .icon {
    stroke: currentColor;
  }

  :focus-visible {
    outline: 3px solid Highlight;
  }

  .section-head::after {
    forced-color-adjust: none;
    background: CanvasText;
  }
}

@media print {
  .site-header,
  .skip-link,
  .legal-close,
  .card__footer {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .legal {
    display: block !important;
    max-width: none;
    max-height: none;
    border: 0;
    box-shadow: none;
    page-break-before: always;
  }

  .card,
  .hero__card {
    box-shadow: none;
    break-inside: avoid;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: .8em;
    word-break: break-all;
  }
}
