/* ==========================================================================
   Referenzumgebung II – Stylesheet
   Ein einziges Stylesheet für alle Seiten. Keine externen Ressourcen.
   Farben stehen als Variablen oben; der dunkle Modus überschreibt nur diese.
   Gestaltung: sachlicher Behördenauftritt – Anthrazit, Weiß, Grau, dunkles Rot als Akzent.
   ========================================================================== */

/* ---------- Farben und Maße ---------- */
:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-alt: #f2f2f2;
  --surface: #ffffff;
  --text: #1f1f1f;
  --muted: #555555;
  --border: #d0d0d0;
  --accent: #a6192e;          /* dunkles Rot: Links, Schaltflächen, Markierungen */
  --accent-strong: #7a1020;
  --accent-soft: #f6e7e9;
  --on-accent: #ffffff;
  --button-bg: #a6192e;       /* Schaltflächen; Schrift immer weiß */
  --button-hover: #7a1020;
  --focus: #1f1f1f;
  --rule: #c8102e;            /* rote Linie unter der Absenderzeile (nur Schmuck) */
  --topbar-bg: #262626;
  --topbar-text: #f2f2f2;
  --notice-bg: #fff6e5;
  --notice-border: #a6580b;

  --radius: 2px;
  --gap: 1.5rem;
  --content: 46rem;           /* Lesebreite für Fließtext */
  --wide: 72rem;              /* Breite für Kopf, Navigation, Footer */
  /* Hausschrift: Liegt eine lizenzierte Schriftdatei vor, hier per @font-face einbinden
     (Datei unter assets/fonts/) und den Namen vorn in --font eintragen. */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Dunkel – Fall 1: Systemeinstellung, solange über den Schalter nicht „Hell“ gewählt ist.
   Die Werte stehen unten ein zweites Mal (Fall 2). Bei Änderungen beide Blöcke anpassen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --bg-alt: #1c1c1c;
    --surface: #1f1f1f;
    --text: #ececec;
    --muted: #b3b3b3;
    --border: #3a3a3a;
    --accent: #ff9090;
    --accent-strong: #ffb8b8;
    --accent-soft: #3a2023;
    --on-accent: #121212;
    --button-bg: #b3203a;
    --button-hover: #cc2f4a;
    --focus: #ececec;
    --rule: #c8102e;
    --topbar-bg: #000000;
    --topbar-text: #e0e0e0;
    --notice-bg: #2a2214;
    --notice-border: #e0a24a;
  }
}

/* Dunkel – Fall 2: über den Schalter gewählt (assets/js/theme.js setzt data-theme) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212;
  --bg-alt: #1c1c1c;
  --surface: #1f1f1f;
  --text: #ececec;
  --muted: #b3b3b3;
  --border: #3a3a3a;
  --accent: #ff9090;
  --accent-strong: #ffb8b8;
  --accent-soft: #3a2023;
  --on-accent: #121212;
  --button-bg: #b3203a;
  --button-hover: #cc2f4a;
  --focus: #ececec;
  --rule: #c8102e;
  --topbar-bg: #000000;
  --topbar-text: #e0e0e0;
  --notice-bg: #2a2214;
  --notice-border: #e0a24a;
}

/* Hell über den Schalter gewählt: Formularelemente und Scrollbalken ebenfalls hell */
:root[data-theme="light"] {
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
}

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

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
  font-weight: 700;
}

h1 { font-size: clamp(1.7rem, 1.4rem + 1.4vw, 2.3rem); }
h2 { font-size: clamp(1.3rem, 1.15rem + 0.6vw, 1.55rem); margin-top: 2.5rem; }
h3 { font-size: 1.15rem; margin-top: 1.75rem; }

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--accent-strong);
  text-decoration-thickness: 2px;
}

/* Sichtbarer Fokus für Tastaturbedienung */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--bg-alt);
  padding: 0.1em 0.35em;
  overflow-wrap: anywhere;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Skip-Link ---------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--button-bg);
  color: #ffffff;
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
  color: #ffffff;
}

/* ---------- Layout-Container ---------- */
.container {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 1rem;
}

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

/* ---------- Kopf: Absenderzeile ---------- */
.topbar {
  background: var(--topbar-bg);
  color: var(--topbar-text);
  border-bottom: 4px solid var(--rule);
  font-size: 0.85rem;
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.5rem;
}

.topbar-sender {
  margin: 0;
  letter-spacing: 0.03em;
}

/* ---------- Kopf: Angebotsname ---------- */
.masthead .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.brand:hover {
  color: var(--text);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  margin-top: 0.2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Reserviert für das Landeslogo Niedersachsen (nur offizielle Datei verwenden) */
.brand-land {
  display: block;
  height: 56px;
  width: auto;
  padding-right: 1rem;
  border-right: 1px solid var(--border);
}

/* eJuNi-Bildmarke rechts im Kopf */
.brand-mark {
  display: block;
  width: 133px;
  height: 48px;
  flex: none;
}

/* ---------- Kopf: Navigation ---------- */
.site-nav {
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 0.8rem 1.1rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.site-nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--border);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Erster Menüpunkt bündig mit dem Inhalt – erst wenn links genug Rand ist */
@media (min-width: 75rem) {
  .site-nav ul {
    margin-left: -1.1rem;
  }
}

/* ---------- Schalter Hell/Dunkel (in der Absenderzeile) ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.45);   /* ≥ 3:1 auf Hell- und Dunkel-Absenderzeile */
  border-radius: var(--radius);
  background: transparent;
  color: var(--topbar-text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.theme-toggle:hover {
  border-color: var(--topbar-text);
}

.theme-toggle svg[hidden] {
  display: none;
}

.theme-toggle:focus-visible {
  outline-color: var(--topbar-text);
}

/* ---------- Kopf auf schmalen Bildschirmen ---------- */
@media (max-width: 40rem) {
  .topbar-sender {
    font-size: 0.8rem;
  }

  .masthead .container {
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
  }

  .brand-title {
    font-size: 1.3rem;
  }

  .brand-sub {
    display: none;
  }

  .brand-mark {
    width: 100px;
    height: 36px;
  }

  .site-nav ul {
    justify-content: space-between;
  }

  .site-nav a {
    padding: 0.7rem 0.5rem;
  }

  .theme-toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* ---------- Hauptinhalt ---------- */
main {
  display: block;
  padding: 0 0 3.5rem;
}

main:focus {
  outline: none;
}

.lead {
  font-size: 1.15rem;
  color: var(--muted);
}

/* Seitenkopf: grauer Streifen mit Brotkrumen und Seitentitel (auch Hero der Startseite) */
.page-head {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0 2rem;
  margin-bottom: 2.5rem;
}

.page-head h1 {
  margin: 0.75rem 0 0.5rem;
}

.page-head .lead {
  max-width: var(--content);
  margin-bottom: 0;
}

.hero {
  padding-top: 2.5rem;
  border-left: 0;
}

.hero h1 {
  margin-top: 0;
}

/* Bild des Länderverbunds: unter dem Text, ab 48rem rechts daneben.
   Das Bild hat einen weißen Hintergrund und steht deshalb auch im dunklen Modus auf Weiß. */
.hero-figure {
  margin: 1.5rem 0 0;
  max-width: 26rem;
}

.hero-figure img {
  display: block;
  background: #ffffff;
  border: 1px solid var(--border);
}

@media (min-width: 48rem) {
  .hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(16rem, 34vw, 26rem);
    gap: 2.5rem;
    align-items: center;
  }

  .hero-figure {
    margin: 0;
  }
}

/* Schmale Bildschirme: Seitenkopf kompakter */
@media (max-width: 40rem) {
  .page-head {
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
  }

  .hero {
    padding-top: 1.5rem;
  }

  .tile {
    padding: 1.25rem;
  }
}

/* Brotkrumen */
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--muted);
}

.breadcrumb li + li::before {
  content: "\203A";
  padding: 0 0.5rem;
  color: var(--muted);
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--accent);
}

/* ---------- Startseite: Zugänge und Support nebeneinander ---------- */
/* Ab 64rem stehen die Zugänge links als Zeilen und der Support rechts daneben,
   damit beides ohne Scrollen sichtbar ist. */
@media (min-width: 64rem) {
  .home-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
  }

  .home-grid > section > h2:first-child {
    margin-top: 0;
  }

  .home-grid .support {
    margin-top: 0;
  }

  .home-grid .tiles {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Zugang als Zeile: Symbol | Titel und Text | Schaltfläche und FAQ-Link */
  .home-grid .tile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "icon title links"
      "icon text  links";
    column-gap: 1.5rem;
    align-items: start;
    padding: 1.25rem 1.5rem;
  }

  .home-grid .tile-icon { grid-area: icon; margin: 0.1rem 0 0; }
  .home-grid .tile h3 { grid-area: title; margin-bottom: 0.35rem; }
  .home-grid .tile > p { grid-area: text; margin: 0; }

  .home-grid .tile-links {
    grid-area: links;
    text-align: right;
  }

  .home-grid .tile .tile-action { margin: 0 0 0.6rem; }
  .home-grid .button { white-space: nowrap; }
  .home-grid .tile .tile-more { max-width: 15rem; margin-left: auto; }

  /* In der schmalen Support-Spalte: Kontakt und Zeiten untereinander, Begriff über Wert */
  .home-grid .support {
    padding: 1.5rem;
  }

  .home-grid .support-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .home-grid .facts {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 0;
  }

  .home-grid .facts dd {
    margin-bottom: 0.6rem;
  }
}

/* ---------- Startseite: Zugänge ---------- */
.section-intro {
  max-width: var(--content);
  color: var(--muted);
}

/* Drei Zugänge: untereinander, ab 56rem nebeneinander (nie 2 + 1) */
.tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 56rem) {
  .tiles {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tile {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
}

.tile-icon {
  width: 2rem;
  height: 2rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.tile h3 {
  margin-top: 0;
}

.tile p {
  color: var(--muted);
}

/* Schaltfläche und FAQ-Link stehen unten in der Kachel */
.tile-links {
  margin-top: auto;
}

.tile .tile-action {
  margin-bottom: 0.75rem;
}

.tile .tile-more {
  margin: 0;
  font-size: 0.95rem;
}

.button {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  background: var(--button-bg);
  color: #ffffff;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}

.button::after {
  content: " \2192";
}

.button:hover {
  background: var(--button-hover);
  color: #ffffff;
}

/* ---------- Support-Box ---------- */
.support {
  margin-top: 3rem;
  padding: 1.75rem 1.5rem;
  background: var(--bg-alt);
  border-left: 4px solid var(--accent);
}

.support h2 {
  margin-top: 0;
}

.support-grid {
  display: grid;
  gap: 1.5rem 3rem;
}

@media (min-width: 56rem) {
  .support-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.support h3 {
  margin-top: 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* Beschriftete Liste (Telefon, E-Mail, Zeiten) */
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 0 0 1rem;
}

.facts dt {
  font-weight: 600;
}

.facts dd {
  margin: 0;
}

/* Lange E-Mail-Adressen dürfen auf schmalen Bildschirmen umbrechen */
a[href^="mailto:"] {
  overflow-wrap: anywhere;
}

/* Telefonnummern nicht mitten in der Nummer umbrechen */
a[href^="tel:"] {
  white-space: nowrap;
}

@media (max-width: 30rem) {
  .facts {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .facts dd {
    margin-bottom: 0.6rem;
  }
}

/* Kontaktseite: Aufbau wie die Support-Box der Startseite, ab 56rem drei Spalten */
.support.contact {
  margin-top: 0;
}

.contact h2 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.contact .facts {
  grid-template-columns: 1fr;
  gap: 0;
}

.contact .facts dd {
  margin-bottom: 0.6rem;
}

@media (min-width: 56rem) {
  .contact .support-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.support .note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Startseite: Teaser ---------- */
.teasers {
  display: grid;
  gap: var(--gap);
  margin-top: 3rem;
}

@media (min-width: 48rem) {
  .teasers {
    grid-template-columns: 1fr 1fr;
  }
}

.teaser {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.teaser h2 {
  margin-top: 1rem;
}

/* ---------- Abbildungen ---------- */
figure {
  margin: 1.5rem 0;
}

figure img {
  display: block;
}

figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Grafiken mit eigenem weißem Hintergrund: im dunklen Modus eingerahmt */
.figure-light img {
  background: #ffffff;
  padding: 0.5rem;
}

.screenshot img {
  border: 1px solid var(--border);
  max-height: 28rem;   /* hochformatige Screenshots nicht bildschirmfüllend */
  width: auto;
}

.screenshot a,
.figure-light a {
  display: inline-block;
}

/* ---------- Abschnitte mit Anker ---------- */
section[id],
details[id] {
  scroll-margin-top: 1rem;
}

/* ---------- FAQ ---------- */
.faq {
  border-top: 2px solid var(--text);
}

.faq details {
  border-bottom: 1px solid var(--border);
}

.faq summary {
  position: relative;
  padding: 1rem 2.5rem 1rem 0;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

/* Plus/Minus als Zustandsanzeige */
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--accent);
}

.faq details[open] > summary::after {
  content: "\2212";
}

.faq summary:hover {
  color: var(--accent);
}

.faq details:target > summary {
  color: var(--accent);
}

.faq-body {
  max-width: var(--content);
  padding: 0 0 1.5rem;
}

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

.faq-body ol > li {
  margin-bottom: 1.25rem;
}

.faq-body li > ul,
.faq-body li > ol {
  margin: 0.25rem 0 0;
}

.step-title {
  font-weight: 600;
}

.notice {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  background: var(--notice-bg);
  border-left: 4px solid var(--notice-border);
}

/* ---------- Rechtstexte ---------- */
.legal h2 {
  font-size: 1.25rem;
}

.legal h3 {
  font-size: 1.05rem;
}

address {
  font-style: normal;
}

/* ---------- Abschnittsnavigation (Über uns) ---------- */
.toc ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.toc a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.toc a::before {
  content: "\2193\00a0";
  color: var(--accent);
}

.toc a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 4px solid var(--rule);
  background: var(--topbar-bg);
  color: var(--topbar-text);
  font-size: 0.95rem;
}

.site-footer a {
  color: var(--topbar-text);
}

.site-footer a:hover {
  color: #ffffff;
}

.site-footer a:focus-visible {
  outline-color: var(--topbar-text);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 1.5rem 2.5rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

/* Bis 48rem: Support über die volle Breite, die beiden Linklisten nebeneinander */
.footer-grid > :first-child {
  grid-column: 1 / -1;
}

/* Sehr schmale Bildschirme: alles untereinander */
@media (max-width: 22.5rem) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 48rem) {
  .footer-grid {
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 1.5rem 3rem;
  }

  .footer-grid > :first-child {
    grid-column: auto;
  }
}

.footer-title {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--topbar-text);
  opacity: 0.85;
}

.footer-grid p,
.footer-grid ul {
  margin: 0 0 0.5rem;
}

.footer-grid ul {
  padding: 0;
  list-style: none;
}

.footer-grid li {
  margin-bottom: 0.3rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-bottom .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 2rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
  font-size: 0.875rem;
}

.footer-bottom p {
  margin: 0;
  opacity: 0.85;
}

/* ---------- Fehlerseite ---------- */
.error-code {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}

/* ---------- Druck ---------- */
@media print {
  .skip-link,
  .site-nav,
  .theme-toggle,
  .tile-icon,
  .breadcrumb {
    display: none;
  }

  body {
    background: #ffffff;
    color: #000000;
  }

  .topbar,
  .site-footer {
    background: none;
    color: #000000;
  }

  .faq details {
    break-inside: avoid;
  }
}
