/* =========================================================
   IVP - Institut fuer Verfahrenstechnik Papier e.V.
   Stylesheet (statische Variante, kirby-tauglich strukturiert)
   Farben: Rot + Grautoene. Signalrot nur sparsam.
   ========================================================= */

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-400.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-700.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Farbpaletten ---------- */
:root {
  /* Hell (Standard) */
  --bg: #f6f5f3;
  --surface: #ffffff;
  --surface-2: #ecebe8;
  --text: #202326;
  --text-muted: #5b6168;
  --border: #d6d4d0;
  --brand: #a1282f;          /* gedaempftes Rot (Hauptfarbe) */
  --brand-strong: #7f1d23;
  --brand-soft: #f4e3e4;
  --signal: #e30613;         /* Signalrot: nur Akzente, Fokus, Akzentlinien */
  --footer-bg: #2a2d31;
  --footer-text: #e9e9e7;
  --footer-muted: #b9bec5;
  --ink: #202326;
  --btn-text: #ffffff;
  --shadow: 0 10px 30px rgba(20, 22, 24, 0.10);
  --overlay: linear-gradient(90deg, rgba(20,22,24,.88) 0%, rgba(20,22,24,.62) 55%, rgba(20,22,24,.35) 100%);

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Montserrat", var(--font-body);

  --radius: 14px;
  --container: min(1200px, 100% - 2 * clamp(1rem, 4vw, 2.5rem));
  --header-h: 4.5rem;
  color-scheme: light;
}

/* Dunkel: folgt dem System, solange keine manuelle Wahl gespeichert ist */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a;
    --surface: #1e2126;
    --surface-2: #272b31;
    --text: #eceded;
    --text-muted: #a9afb7;
    --border: #353a41;
    --brand: #e0656b;
    --brand-strong: #f08a8f;
    --brand-soft: #3a2327;
    --signal: #ff2d36;
    --footer-bg: #0d0f11;
    --footer-text: #eceded;
    --footer-muted: #a9afb7;
    --ink: #eceded;
    --btn-text: #15171a;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --overlay: linear-gradient(90deg, rgba(10,11,13,.92) 0%, rgba(10,11,13,.68) 55%, rgba(10,11,13,.4) 100%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a;
  --surface: #1e2126;
  --surface-2: #272b31;
  --text: #eceded;
  --text-muted: #a9afb7;
  --border: #353a41;
  --brand: #e0656b;
  --brand-strong: #f08a8f;
  --brand-soft: #3a2327;
  --signal: #ff2d36;
  --footer-bg: #0d0f11;
  --footer-text: #eceded;
  --footer-muted: #a9afb7;
  --ink: #eceded;
  --btn-text: #15171a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --overlay: linear-gradient(90deg, rgba(10,11,13,.92) 0%, rgba(10,11,13,.68) 55%, rgba(10,11,13,.4) 100%);
  color-scheme: dark;
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-wrap: break-word;
  hyphens: manual;
}
main { flex: 1 0 auto; outline: none; }
img, picture, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--brand-strong); text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.18; margin: 0 0 0.6em; color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2.05rem); margin-top: 1.6em; }
h3 { font-size: clamp(1.15rem, 1rem + 0.5vw, 1.4rem); margin-top: 1.4em; }
h4 { font-size: 1.05rem; margin-top: 1.2em; }
p { margin: 0 0 1em; }
ul { padding-left: 1.25em; margin: 0 0 1.2em; }
li { margin: 0.25em 0; }
li::marker { color: var(--brand); }
strong { font-weight: 700; color: var(--ink); }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; border-radius: 4px; }

.container { width: var(--container); margin-inline: auto; }
.section { padding-block: clamp(2.5rem, 2rem + 3vw, 5rem); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 0.6rem 1rem; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- Prosa (Markdown-Inhalte) ---------- */
.prose { max-width: 68ch; }
.prose > :first-child { margin-top: 0; }
.prose > p:first-of-type { font-size: 1.08em; color: var(--text); }
.prose ul { list-style: square; }
.prose a { word-break: break-word; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header.is-scrolled { box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.header-inner {
  display: flex; align-items: center; gap: 1rem;
  min-height: var(--header-h);
  width: var(--container); margin-inline: auto;
}
.header-accent { height: 3px; background: var(--signal); }

.brand { display: inline-flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--ink); flex: 0 0 auto; }
.brand:hover { color: var(--ink); }
.logo { height: 3.25rem; width: auto; }
.logo--dark { display: none; }
:root[data-theme="dark"] .logo--light { display: none; }
:root[data-theme="dark"] .logo--dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo--light { display: none; }
  :root:not([data-theme="light"]) .logo--dark { display: block; }
}
.brand-text { display: none; line-height: 1.2; }
.brand-name { display: block; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.02em; }
.brand-sub { display: block; font-size: 0.8rem; color: var(--text-muted); max-width: 22ch; }
@media (min-width: 640px) { .brand-text { display: block; } }

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; position: relative; }

/* Auf kleinen Displays: Burger links, Logo direkt daneben; Desktop-Reihenfolge bleibt Logo zuerst. */
@media (max-width: 1199px) {
  .menu-toggle { order: -2; }
  .brand { order: -1; }
  .header-tools { order: 1; }
}

.icon-btn {
  display: inline-grid; place-items: center;
  width: 2.75rem; height: 2.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.icon-btn:hover { border-color: var(--text-muted); }
.icon-btn svg { width: 1.3rem; height: 1.3rem; }
.icon-btn[aria-expanded="true"] { background: var(--surface-2); }

/* Hauptnavigation: mobil/Tablet als Drawer, ab 1200px inline */
.main-nav {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  display: none;
}
.main-nav.is-open { display: block; }
.main-nav ul { list-style: none; margin: 0; padding: 0.5rem clamp(1rem, 4vw, 2.5rem) 1rem; display: grid; grid-template-columns: 1fr; }
.main-nav li { margin: 0; border-bottom: 1px solid var(--border); }
.main-nav li:last-child { border-bottom: 0; }
.main-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  min-height: 3rem; padding: 0.6rem 0.25rem;
  color: var(--ink); text-decoration: none; font-weight: 500;
  position: relative;
}
.main-nav a:hover { color: var(--brand); }
.main-nav a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.main-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0.25rem; right: 0.25rem; bottom: 0.2rem; height: 2px; background: var(--signal);
}
.ext-icon { width: 0.85em; height: 0.85em; flex: 0 0 auto; opacity: .75; }
.main-nav a > svg { width: 1em; height: 1em; flex: 0 0 1em; opacity: .75; }

@media (min-width: 1200px) {
  .menu-toggle { display: none; }
  .main-nav {
    position: static; display: block; background: none; border: 0; box-shadow: none; max-height: none; overflow: visible;
    margin-left: auto;
  }
  .main-nav ul { display: flex; gap: 0.1rem; padding: 0; flex-wrap: nowrap; }
  .main-nav li { border: 0; }
  .main-nav a { min-height: 2.5rem; padding: 0.45rem 0.6rem; font-size: 0.93rem; white-space: nowrap; border-radius: 8px; }
  .main-nav a[aria-current="page"]::after { bottom: 0.1rem; }
  .main-nav a:hover { background: var(--surface-2); }
  .header-tools { margin-left: 0.5rem; }
}
.menu-toggle { display: inline-grid; }
@media (min-width: 1200px) { .menu-toggle { display: none; } }

/* Einstellungen (Zahnrad) */
.settings-panel {
  position: absolute; right: 0; top: calc(100% + 0.6rem);
  width: min(21rem, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  z-index: 60;
}
.settings-panel[hidden] { display: none; }
.settings-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: 0 0 0.6rem; font-weight: 700; }
.settings-label + .theme-switch { margin-bottom: 1.2rem; }
.theme-switch {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem;
  padding: 0.3rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
}
.theme-switch button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem;
  min-height: 3.6rem; padding: 0.4rem; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-muted); font: inherit; font-size: 0.82rem; cursor: pointer;
}
.theme-switch button svg { width: 1.3rem; height: 1.3rem; }
.theme-switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 700; }
.theme-switch button:hover:not([aria-pressed="true"]) { color: var(--text); }

.lang-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.lang-list a {
  display: block; text-align: center; padding: 0.6rem; border-radius: 9px;
  border: 1px solid var(--border); color: var(--ink); text-decoration: none; font-weight: 500;
}
.lang-list a:hover { border-color: var(--brand); color: var(--brand); }
.lang-list a[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 700; }

/* ---------- Hero (Startseite) ---------- */
.hero--home { padding-block: clamp(2.5rem, 2rem + 3vw, 5rem) clamp(2rem, 1.5rem + 2vw, 3.5rem); }
.hero-grid { display: grid; gap: clamp(2rem, 1.5rem + 2vw, 3.5rem); align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-size: 0.82rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand); margin: 0 0 1rem;
}
.eyebrow::before { content: ""; width: 2.2rem; height: 3px; background: var(--signal); border-radius: 2px; }
.hero-media {
  margin: 0; border-radius: 22px; overflow: hidden; aspect-ratio: 3 / 4; box-shadow: var(--shadow);
}
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.1fr 0.9fr; }
  .hero-media { aspect-ratio: 3 / 4; }
}

/* ---------- Seiten-Banner ---------- */
.page-hero {
  position: relative; isolation: isolate; color: #fff;
  min-height: clamp(220px, 32vw, 400px);
  display: flex; align-items: flex-end;
  background: #1a1c1f;
  overflow: hidden;
}
.page-hero__media, .page-hero__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.page-hero__overlay { position: absolute; inset: 0; background: var(--overlay); z-index: -1; }
.page-hero__inner { padding-block: clamp(2rem, 1.5rem + 3vw, 4rem); }
.page-hero h1 { color: #fff; margin: 0; max-width: 22ch; }
.page-hero h1::before {
  content: ""; display: block; width: 3.2rem; height: 4px; background: var(--signal); margin-bottom: 1rem; border-radius: 2px;
}

/* ---------- Schnellzugriff ---------- */
.quicklinks h2 { margin-top: 0; font-size: clamp(1.2rem, 1rem + 0.8vw, 1.6rem); }
.quick-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.quick-grid li { margin: 0; }
.quick-card {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  min-height: 4.2rem; padding: 1rem 1.1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--ink); text-decoration: none; font-weight: 600;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.quick-card svg { width: 1.1rem; height: 1.1rem; color: var(--brand); flex: 0 0 auto; }
.quick-card:hover { color: var(--ink); border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }

/* ---------- Arbeitsgruppe ---------- */
.team-intro { margin-bottom: 2rem; }
.team-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: clamp(1rem, 0.8rem + 1vw, 1.75rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
}
.team-card { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.team-card figure { margin: 0; aspect-ratio: 4 / 5; background: var(--surface-2); overflow: hidden; }
.team-card img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.7); transition: filter .35s ease, transform .35s ease; }
@media (hover: hover) { .team-card:hover img { filter: grayscale(0); transform: scale(1.03); } }
.team-card__body { padding: 0.9rem 1rem 1.1rem; }
.team-card__prefix { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.team-card__name { font-size: 1.08rem; margin: 0.1rem 0 0.2rem; line-height: 1.25; }
.team-card__position { margin: 0; font-size: 0.9rem; font-weight: 700; color: var(--brand); }

/* ---------- 404 ---------- */
.notfound { text-align: left; padding-block: 4rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.6rem 1.1rem;
  border-radius: 999px; background: var(--brand); color: var(--btn-text); text-decoration: none; font-weight: 700;
}
.btn:hover { background: var(--brand-strong); color: var(--btn-text); }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer-bg); color: var(--footer-text); margin-top: 3rem; }
.site-footer a { color: var(--footer-text); text-underline-offset: 0.25em; }
.site-footer strong { color: var(--footer-text); }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; gap: 2rem; padding-block: clamp(2.25rem, 2rem + 2vw, 3.5rem); }
.footer-grid h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--footer-muted); margin: 0 0 0.8rem; font-family: var(--font-body); }
.footer-grid p { margin: 0 0 0.4rem; font-size: 0.95rem; color: var(--footer-text); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin: 0.35rem 0; }
.footer-meta { font-size: 0.85rem; color: var(--footer-muted); }
.text-menu { display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; align-items: center; }
.text-menu li { margin: 0; }
.text-menu li + li::before { content: "·"; margin-right: 0.6rem; color: var(--footer-muted); }
.text-menu a[aria-current="true"] { font-weight: 700; text-decoration: underline; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.3fr 1fr 1fr; } }

/* ---------- Layout-Breakpoints ---------- */
@media (min-width: 900px) {
  .prose { font-size: 1.02em; }
}

/* ---------- Reduzierte Bewegung ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .skip-link, .settings-panel { display: none !important; }
  body { background: #fff; color: #000; }
}
