/* ============================================================
   base.css – Layout, Utilities, Top-Nav, Footer
   Baut auf tokens.css auf. Design-Bundle-Prinzipien:
   harte Kanten auf Inhaltsflächen, minimaler Schmuck,
   Typografie trägt die Hierarchie.
   ============================================================ */

:root {
  /* Editorial-Serif aus dem Spiel genommen – Pull-Quotes/Testimonials laufen
     jetzt in Open Sans mit. Variable bleibt fuer Bestands-Deklarationen. */
  --font-serif-editorial: 'Open Sans', Arial, Helvetica, sans-serif;
  --container-narrow: 960px;
  --container-wide: 1200px;
  --nav-height: 64px;
}

/* `clip` statt `hidden`: hidden macht html/body zum Scroll-Container und
   neutralisiert damit `position: sticky` bei ALLEN Nachfahren (Top-Nav,
   Anchor-Nav, Aside-Kästen) – clip schneidet nur ab, ohne Scroll-Kontext.
   `hidden` bleibt als Fallback für Browser ohne clip-Support (Safari <16)
   in der Zeile davor stehen. */
html, body { max-width: 100vw; overflow-x: hidden; overflow-x: clip; }

/* ---------- Layout primitives ----------
   Eine Leitkante: Nav-Inner, Breadcrumb-Inner, Hero-Inner und Section-Container
   teilen dieselbe max-width + padding. So liegt das Logo, die Hero-Headline und
   der darunter beginnende Content auf derselben linken X-Linie. Reading-
   Linienlänge wird INNERHALB über `.prose` begrenzt, nicht durch eine engere
   Container-Breite. */
.container {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container--wide { max-width: var(--container-wide); }
.container--narrow {
  max-width: 720px;
  margin: 0;
  padding: 0;
}

.section {
  padding: 3rem 0;
}
.section--tight { padding: 1.75rem 0; }
.section--wide .container { max-width: var(--container-wide); }

.section--tint {
  background: var(--surface-tint);
}
.section--dark {
  background: var(--uni-blau);
  color: white;
  /* Re-define color tokens innerhalb dieser Section, damit alle Kinder
     (p, .text-light, .muted) korrekt auf hellem Text landen, statt durch
     `p { color: var(--text); }` aus tokens.css wieder dunkel zu werden. */
  --text: white;
  --text-light: rgba(255,255,255,0.88);
  --muted: rgba(255,255,255,0.72);
}
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 {
  color: white;
}
.section--dark p, .section--dark strong, .section--dark em { color: inherit; }
.section--dark a { color: white; text-decoration: underline; text-underline-offset: 3px; }

/* Section headings with kicker */
.section-kicker {
  font-family: var(--font-sans);
  font-size: var(--eyebrow-size);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: var(--eyebrow-weight);
  margin-bottom: 0.4rem;
  display: block;
}
.section-title {
  font-size: var(--fs-h2);
  text-wrap: balance;
  margin-bottom: 0.5rem;
}
.section-lead {
  font-size: var(--fs-lead);
  color: var(--text-light);
  max-width: 680px;
  /* Zeilenhoehe an den Fliesstext/Kartentext (1.6) angeglichen – 1.7 wirkte
     neben dem Kartentext deutlich luftiger (Mobile-QA /master/). */
  line-height: 1.6;
  /* Keine automatische Silbentrennung in Lead-Absätzen – erzeugte auf dem
     Desktop unschöne Trennungen wie „eige-nen" (ZKOM-Review #2395). Auf schmalen
     Viewports ist der Lead dagegen so eng, dass ohne Trennung lange Woerter als
     ragged Restzeilen stehenbleiben (Mobile-Politur Befund 8) – dort auto. */
  -webkit-hyphens: manual;
  hyphens: manual;
}
@media (max-width: 640px) {
  .section-lead { -webkit-hyphens: auto; hyphens: auto; }
}
/* Sehr kurze Leads (einzeiliger Hinweis) duerfen die volle Spaltenbreite
   nutzen – der 680px-Deckel liesse sie sonst als unschoenen Zweizeiler
   umbrechen, obwohl sie einzeilig passen. Nur punktuell setzen; der
   Default-Deckel fuer laengere Leads bleibt. */
.section-lead--wide { max-width: none; }

/* ---------- Top nav ---------- */
/* Smart-Sticky: Die Nav klebt oben, wird aber beim Runterscrollen
   weggeschoben und erst beim Zurückscrollen wieder eingeblendet
   (Scroll-Richtungs-Erkennung in nav.js setzt `nav-hidden` auf <html>).
   Am Seitenanfang steht sie in ihrer natürlichen Position. */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--uni-blau);
  box-shadow: var(--shadow);
  transition: transform 0.22s ease;
}
html.nav-hidden .nav { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) {
  .nav, .anchor-nav { transition: none; }
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: white;
  text-decoration: none;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  line-height: 1.15;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-logo-img {
  width: 35px;
  height: 35px;
  flex-shrink: 0;
  margin-top: 3px;
}
.nav-logo-sub {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  opacity: 0.85;
  display: block;
  margin-top: 1px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.45rem 0.65rem;
  border-radius: 4px;
  transition: background var(--transition);
  white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,0.12); text-decoration: none; }
/* "International (EN)" / "Deutsch (DE)" – Verschmelzung aus Inhalts-Link
   und Sprach-Toggle. Die kleine Pille hinter dem Wort signalisiert den
   Sprachsprung, ohne einen eigenen Nav-Slot zu verbrauchen. */
.nav-link--intl {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-lang-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.4rem;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1;
}
.nav-link--intl:hover .nav-lang-pill {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Vertikale 1px-Trenner zwischen den vier Topnav-Gruppen. Bewusst
   sichtbar (nicht subtil) – sie tragen die Gruppen-Hierarchie und
   sollen die Navigation lesbar machen. */
.nav-sep {
  width: 1px;
  height: 1.5rem;
  background: rgba(255, 255, 255, 0.45);
  margin: 0 0.35rem;
  flex-shrink: 0;
  display: block;
}

/* Sketchbook-Anker: zaehler-dezente Floating-Pille unten rechts. Rendert
   global aus base.html, nur fuer Nicht-Design-Demo-Seiten und nur auf
   Desktop (Mobile-Cut bei 1100px deckt sich mit dem Nav-Toggle-Breakpoint).
   Bewusst dunkel-auf-hell, damit es Inhalte nicht ueberschreit; greift
   den Mono-Duktus der bestehenden Edit-/Debug-Affordances auf. */
.dx-mini-link-floating {
  position: fixed;
  /* Auf einer Linie mit dem Edit-Mode-Toggle (siehe _edit-mode.css:
     bottom 0.6rem / right 0.6rem, ca. 2rem breit), nur links davon
     gesetzt, damit beide Affordances nebeneinander stehen ohne sich
     zu ueberlappen. */
  bottom: 0.7rem;
  right: 3.2rem;
  z-index: 40;
  display: inline-block;
  padding: 0.3rem 0.55rem 0.32rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  text-decoration: none;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.dx-mini-link-floating:hover {
  color: white;
  background: rgba(0, 0, 0, 0.78);
  border-color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
}
@media (max-width: 1100px) {
  .dx-mini-link-floating { display: none; }
}

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: white;
  border: 1px solid var(--border);
  padding: 0.6rem;
  min-width: 220px;
  display: none;
  box-shadow: var(--shadow-lg);
}
.nav-dropdown:hover .nav-dropdown-panel,
.nav-dropdown.is-open .nav-dropdown-panel,
.nav-dropdown:focus-within .nav-dropdown-panel { display: block; }
.nav-dropdown-panel a {
  display: block;
  padding: 0.5rem 0.7rem;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
}
.nav-dropdown-panel a:hover { background: var(--surface-tint); color: var(--uni-blau); }

/* Mobile nav toggle.
   `margin-left: auto` schiebt den Toggle ans rechte Container-Ende – sonst
   landet er durch das `justify-content: space-between` des Nav-Inner zwischen
   Logo und der (auf Mobile leeren, weil absolut positionierten) `<nav>`-Huelle
   und sieht aus wie verloren in der Mitte. */
.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  margin-left: auto;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  transition: var(--transition);
}

/* Breakpoint: bei 8 Top-Level-Items + EN/Designs reicht eine 820px-Schwelle
   nicht; ab ~1100 px beginnt „International Students" zu brechen, deshalb hier
   umklappen. Wer das spaeter feiner zonen will, kann ueber Container-Queries
   gehen – aktuell bewusst harter Cut. */
@media (max-width: 1100px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    /* Sonst zieht das Desktop-`align-items: center` die Eintraege im
       umgeklappten Mobile-Menue zur Mitte. */
    align-items: stretch;
    background: var(--uni-blau);
    border-top: 1px solid rgba(255,255,255,0.12);
    padding: 1rem 1.5rem;
    gap: 0.1rem;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links > li { width: 100%; }
  .nav-link { display: block; width: 100%; padding: 0.7rem 0.75rem; }
  .nav-link--lang {
    padding-left: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.15);
    margin-top: 0.5rem;
    padding-top: 0.9rem;
  }
  /* Im aufgeklappten Mobile-Menue ist der vertikale 1px-Strich nicht sinnvoll –
     stattdessen eine duenne horizontale Trennlinie zwischen den Gruppen. */
  .nav-sep {
    width: auto;
    height: 1px;
    background: rgba(255, 255, 255, 0.14);
    margin: 0.45rem 0;
  }
  .nav-dropdown-panel {
    position: static;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding-left: 1rem;
    display: block;
  }
  .nav-dropdown-panel a { color: white; padding: 0.4rem 0.5rem; }
  .nav-dropdown-panel a:hover { background: rgba(255,255,255,0.08); color: white; }
}

/* ---------- Footer ---------- */
.footer {
  background: var(--uni-blau);
  color: rgba(255,255,255,0.82);
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}
/* Der 4rem-Abstand ueber dem Footer ist Luft nach WEISS endenden Seiten.
   Endet die Seite dagegen mit einer vollflaechig getoenten/dunklen Sektion
   (Kontakt-Tint, Cluster-Diff-Band, Programm-Kontaktfuss …), erzeugte der
   Abstand einen weissen Streifen zwischen Farbflaeche und dunkelblauem Footer
   (Mobile-QA). Dann Abstand auf 0, damit die Farbflaeche buendig anschliesst.
   Die `+ .edit-cms-link:last-child`-Varianten fangen den dev-only Edit-Link
   ab, der im End-User-/Launch-Build nicht existiert. */
main:has(> .section--tint:last-child) + .footer,
main:has(> .section--dark:last-child) + .footer,
main:has(> .section--parallax:last-child) + .footer,
main:has(> .cluster-diff-band:last-child) + .footer,
main:has(> .program-foot:last-child) + .footer,
main:has(> .program-related:last-child) + .footer,
main:has(> .section--tint + .edit-cms-link:last-child) + .footer,
main:has(> .section--dark + .edit-cms-link:last-child) + .footer,
main:has(> .section--parallax + .edit-cms-link:last-child) + .footer,
main:has(> .cluster-diff-band + .edit-cms-link:last-child) + .footer,
main:has(> .program-foot + .edit-cms-link:last-child) + .footer,
main:has(> .program-related + .edit-cms-link:last-child) + .footer {
  margin-top: 0;
}
/* Folgt der Footer direkt auf eine DUNKLE Sektion (Parallax-Overlay, dunkle
   Section), verschmelzen mobil beide Blauflaechen zu einem Block. Eine dezente
   Hairline (wie die Footer-Trennlinien) setzt die Kante sichtbar ab. Nur bei
   dunklen Vorlaeufern – getoente/helle Sektionen haben ohnehin Kontrast zum
   Footer. Das Cluster-Diff-Band ist hier NICHT mehr aufgefuehrt: es ist seit
   2026-07 ein eingefasstes Panel mit hellem Grundabstand ringsum (siehe
   components.css), die Hairline waere doppelt. */
main:has(> .section--dark:last-child) + .footer,
main:has(> .section--parallax:last-child) + .footer,
main:has(> .section--dark + .edit-cms-link:last-child) + .footer,
main:has(> .section--parallax + .edit-cms-link:last-child) + .footer {
  border-top: 1px solid rgba(255,255,255,0.15);
}
.footer a { color: white; text-decoration: none; }
.footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-col h2 {
  color: white;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 0.8rem;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 0.4rem; font-size: 1rem; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 1.5rem;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
}
.footer-disclaimer {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.55;
  margin-top: 1.5rem;
  -webkit-hyphens: manual;
  hyphens: manual;
}

/* ---------- Utility classes ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
/* Skip-Link: visuell versteckt, aber bei Tastatur-Fokus sichtbar (WCAG 2.4.1). */
.skip-link {
  position: absolute; left: 0.5rem; top: -3rem; z-index: 1000;
  padding: 0.6rem 1rem; background: var(--uni-blau); color: #fff;
  border-radius: 0 0 6px 6px; text-decoration: none; font-weight: 600;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }
@media (prefers-reduced-motion: reduce) { .skip-link { transition: none; } }
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}
.grid-auto--tight {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
}
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 2rem; }
.flex-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.center { text-align: center; }

/* Fade-in-on-scroll helper (used with observeStaggeredReveal in JS) */
.reveal { opacity: 0; transform: translateY(16px); }
.reveal.visible {
  opacity: 1; transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Lists in body copy */
.prose { max-width: 680px; }
.prose.prose--wide { max-width: none; }
.prose.prose--center { margin-left: auto; margin-right: auto; }
.prose ul { padding-left: 1.3rem; max-width: 680px; }
.prose li { margin-bottom: 0.4rem; }
.prose p { max-width: 680px; }
.prose p.wide { max-width: none; }

/* Em-dash separators */
.sep-em { color: var(--border); }

/* --- Legal pages (Impressum, Datenschutz) – übernommen aus dem WIAI-Studienportal --- */
.legal-page { max-width: 720px; margin: 0 auto; padding: 4rem 1.5rem 3rem; }
.legal-page h1 { font-family: var(--font-serif); font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 600; color: var(--uni-blau); margin-bottom: 0.5rem; }
.legal-page .legal-subtitle { font-size: 1rem; color: var(--muted); margin-bottom: 3rem; line-height: 1.6; }
.legal-page h2 { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-top: 2.5rem; margin-bottom: 0.75rem; }
.legal-page h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-top: 1.5rem; margin-bottom: 0.5rem; }
.legal-page p { font-size: 0.95rem; color: var(--text-light); line-height: 1.75; margin-bottom: 1rem; }
.legal-page ul { padding-left: 1.25rem; margin-bottom: 1rem; }
.legal-page li { font-size: 0.95rem; color: var(--text-light); line-height: 1.75; margin-bottom: 0.3rem; }
.legal-page a { color: var(--accent); }

/* WCAG 1.4.1 (link-in-text-block): Inline-Links im Fliesstext sind nicht nur
   ueber die Farbe erkennbar, sondern im Ruhezustand unterstrichen. Bewusst
   eng auf Prosa-/Lauftext-Container gescoped – Karten, Buttons, Nav, CTAs und
   Pills tragen ihre eigene Affordanz und bleiben unterstreichungsfrei. */
.legal-page a,
.prose a,
.faq-a a,
.section-lead a,
.eligibility-fristen a,
.quiz-zsb-contact-alts a,
.argument-card p a,
/* Genereller Lauftext-Fall: Links, die DIREKTES Kind eines Absatzes in
   <main> sind. Karten/Buttons/CTAs/Pills sind nie direkte <p>-Kinder
   (sie liegen in Grids/divs), daher kein Over-Reach. */
main p > a {
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* Ausnahmen: separat gestylte Affordanz-Links, die in einem Prosa-Container
   sitzen koennen (Quelle-Chips/„weitere Fragen" unter FAQ-Antworten, Buttons). */
.faq-a .faq-evidence a,
.faq-a .faq-more a,
.prose .btn {
  text-decoration: none;
}

/* ---------- Fliesstext-Silbentrennung (Gegenstueck zum a/a*-Reset) ----------
   Der globale Reset in tokens.css stellt Links auf hyphens:manual, damit URLs
   und Steuer-Elemente (Buttons, Nav, Pills) nicht mitten im Wort brechen. Das
   zieht aber zwei Faelle mit, in denen wir sehr wohl trennen wollen:
   (1) ein verlinktes Wort MITTEN im Absatz — sonst bleibt „…die Einschrei-|bung"
       als Restzeile stehen, waehrend der umgebende Text sauber trennt;
   (2) die Body-Texte der als Link gebauten Karten (.qa-card, .pcard) — sie erben
       den a*-Reset, obwohl es normaler Fliesstext ist.
   Ueberschriften/Kartentitel bleiben manual (eigene Regeln, hoehere Spezifitaet).
   E-Mail-/Telefon-Links werden unten wieder ausgenommen (Adressen nicht trennen). */
.legal-page a,
.prose a,
.faq-a a,
.eligibility-fristen a,
.argument-card p a,
main p > a,
main li > a,
main dd > a,
.qa-card-body,
.pcard-lead {
  -webkit-hyphens: auto;
  hyphens: auto;
}
main p > a[href^="mailto:"], main p > a[href^="tel:"],
main li > a[href^="mailto:"], main li > a[href^="tel:"],
main dd > a[href^="mailto:"], main dd > a[href^="tel:"] {
  -webkit-hyphens: manual;
  hyphens: manual;
}

/* Ausgeglichener Flattersatz fuer Fliesstext: vermeidet einzelne kurze
   Restzeilen (Waisen) am Absatzende. Progressive Enhancement (Chrome 117+),
   degradiert sonst lautlos zu normalem Umbruch. Ueberschriften nutzen weiter
   text-wrap:balance (eigene Regeln mit hoeherer Spezifitaet). */
p, li, dd, .section-lead, .qa-card-body, .pcard-lead {
  text-wrap: pretty;
}
.legal-page .legal-contact { background: var(--uni-blau-lighter); border-radius: 10px; padding: 1.25rem 1.5rem; margin: 1rem 0 1.5rem; }
.legal-page .legal-contact p { margin-bottom: 0.25rem; color: var(--text); }
.legal-page .legal-contact strong { color: var(--uni-blau); }
.legal-page hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
@media (max-width: 768px) { .legal-page { padding: 2.5rem 1.25rem 2rem; } }

/* Placeholder marker (PRD §9) – Gelb-20-Pill, Schwarz-Text */
.placeholder-flag {
  display: inline-block;
  background: var(--uni-gelb-20);
  border: 1px dashed var(--uni-gelb);
  padding: 0.1rem 0.45rem;
  font-size: 0.85rem;
  color: #000000;
  font-family: var(--font-mono);
  margin-left: 0.3rem;
  vertical-align: middle;
}

/* Auto-generated marker – Felder aus extract_knowledge.py – Blau-Outline-Pill */
.auto-flag {
  display: inline-block;
  background: var(--uni-blau-20);
  border: 1px solid var(--uni-blau-40);
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
  color: var(--uni-blau);
  font-family: var(--font-mono);
  margin-left: 0.3rem;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

/* Focus rings */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
