/* ==========================================================================
   AÜ Content Kalender v2 — styles.css
   Corporate-Design Akademie Überlingen (Frontify Styleguide, Sept. 2025)
   Quelle: .claude/rules/corporate-design-au.md
   ========================================================================== */

/* ---------- @font-face (selbst-gehostet, kein Google-CDN — DSGVO + CSP) --- */

@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/pt-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/pt-sans-700.woff2") format("woff2");
}
@font-face {
  font-family: "Merriweather";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/merriweather-400.woff2") format("woff2");
}
@font-face {
  font-family: "Merriweather";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/merriweather-700.woff2") format("woff2");
}

/* ---------- Tokens ------------------------------------------------------- */

:root {
  /* Farben — AÜ-CD */
  --au-rot: #e20613;
  --au-rot-dunkel: #9a1d28;
  --au-beige: #faf6e5;
  --au-dunkelgrau: #666b6e;
  --au-hellgrau: #f4f4f4;
  --au-link: #4a90e2;
  --au-success: #557555;
  --au-error: #e3140d;
  --au-warning: #d08c24;

  /* Branchenfarben (Branchen-Icons + Kategorie-Badges) */
  --branche-gala: #436c59;
  --branche-holz: #c97c45;
  --branche-orientierung: #ffc378;
  --branche-frauen: #bdb5da;
  --branche-kueche: #80a190;
  --branche-gesundheit: #5189ac;
  --branche-logistik: #92c4cf;
  --branche-kaufmaennisch: #174476;
  --branche-sprachen: #52abb0;
  --branche-integration: #ee7766;
  --branche-fluechtlinge: #f5a04c;
  --branche-metall: #666b6e;
  --branche-multimedia: #914056;
  --branche-it: #605690;

  /* Semantische Rollen — Light */
  --bg-app: var(--au-hellgrau);
  --bg-surface: #ffffff;
  --bg-surface-warm: var(--au-beige);
  --bg-elevated: #ffffff;
  --bg-sunken: #eceef1;

  --text-heading: #000000;
  --text-body: #323437;
  --text-muted: var(--au-dunkelgrau);
  --text-inverse: #ffffff;

  --border-subtle: #d9dbdf;
  --border-strong: #a9adb3;
  --border-focus: var(--au-link);

  /* Typography */
  --font-heading: "Merriweather", Georgia, serif;
  --font-body: "PT Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;

  /* Größen (Vorlage Frontify Styleguide) */
  --fs-hero: 3.125rem;    /* 50 px */
  --fs-h1: 1.875rem;      /* 30 px */
  --fs-h2: 1.375rem;      /* 22 px */
  --fs-h3: 1.125rem;      /* 18 px */
  --fs-h4: 1rem;          /* 16 px */
  --fs-body: 0.9375rem;   /* 15 px */
  --fs-small: 0.84375rem; /* 13.5 px */
  --fs-button: 0.8125rem; /* 13 px */

  --lh-tight: 1.2;
  --lh-base: 1.4;
  --lh-relaxed: 1.55;

  /* Abstände (8-Grid) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 26px;

  /* Schatten */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.14);

  /* Z-Layer */
  --z-header: 100;
  --z-modal: 1000;
  --z-toast: 1100;
  --z-boot: 9999;

  /* Fokus */
  --focus-ring: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--border-focus);
}

[data-theme="dark"] {
  --bg-app: #0f0f10;
  --bg-surface: #17181b;
  --bg-surface-warm: #1e1a13;
  --bg-elevated: #1f2024;
  --bg-sunken: #0b0b0c;

  --text-heading: #f5f5f5;
  --text-body: #d9dbdf;
  --text-muted: #9fa3a9;
  --text-inverse: #17181b;

  --border-subtle: #2a2c31;
  --border-strong: #3e4148;
  --border-focus: #7fb0ec;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.65);
}

/* ---------- Reset / Base ------------------------------------------------- */

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

html {
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  color: var(--text-body);
  background: var(--bg-app);
  min-height: 100dvh;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  color: var(--text-heading);
  line-height: var(--lh-tight);
}
h1 { font-family: var(--font-heading); font-size: var(--fs-h1); font-weight: 400; }
h2 { font-size: var(--fs-h2); font-weight: 700; }
h3 { font-size: var(--fs-h3); font-weight: 700; }
h4 { font-size: var(--fs-h4); font-weight: 700; }

p { margin: 0 0 var(--space-4); }
a { color: var(--au-link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

img, svg { max-width: 100%; height: auto; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ---------- Skip-Link ---------------------------------------------------- */

.skip-link {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: calc(var(--z-boot) + 1);
  padding: var(--space-2) var(--space-4);
  background: var(--au-rot);
  color: var(--text-inverse);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  transform: translateY(-200%);
  transition: transform 120ms ease-out;
}
.skip-link:focus {
  transform: translateY(0);
}

/* ---------- App-Shell (Grid) -------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header header"
    "nav    main"
    "footer footer";
  min-height: 100dvh;
}
.app__header {
  grid-area: header;
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
}
.app__nav {
  grid-area: nav;
  padding: var(--space-4);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
}
.app__main {
  grid-area: main;
  padding: var(--space-6) var(--space-8);
  min-width: 0;
  outline: none; /* tabindex=-1 erlaubt Fokus, Ring stört hier nicht */
}
.app__aside {
  grid-area: main;
  justify-self: end;
  width: min(380px, 40vw);
  padding: var(--space-4);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  height: calc(100dvh - var(--space-12));
  overflow-y: auto;
}
.app__aside[hidden] { display: none; }
.app__footer {
  grid-area: footer;
  padding: var(--space-3) var(--space-6);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-small);
  color: var(--text-muted);
  display: flex;
  gap: var(--space-4);
  align-items: center;
  justify-content: space-between;
}

/* Mobile-Shell: Nav als Drawer (später via JS toggleable) */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main"
      "footer";
  }
  .app__nav {
    display: none; /* Drawer wird F5 realisiert */
  }
  .app__main { padding: var(--space-4); }
}

/* ---------- Boot-Screen ------------------------------------------------- */

#boot-screen {
  position: fixed; inset: 0;
  z-index: var(--z-boot);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: var(--bg-surface-warm);
  color: var(--text-heading);
  transition: opacity 300ms ease-out;
}
#boot-screen[aria-hidden="true"] {
  /* bleibt sichtbar bis main.js .boot-screen--fade-out setzt */
}
.boot-screen__logo {
  width: 88px; height: 88px;
  display: grid; place-items: center;
  background: var(--au-rot);
  color: var(--text-inverse);
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.boot-screen__text {
  margin: 0;
  font-size: var(--fs-body);
  color: var(--text-muted);
}
.boot-screen--fade-out {
  opacity: 0;
  pointer-events: none;
}

html[data-boot-state="ready"] #boot-screen {
  opacity: 0;
  pointer-events: none;
}

/* ---------- Toast-Stack ------------------------------------------------- */

.toast-stack {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(360px, 92vw);
  pointer-events: none;
}
.toast-stack > div {
  display: contents; /* Logische aria-Regionen, kein eigenes Layout */
}
.toast {
  pointer-events: auto;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  color: var(--text-body);
  border-left: 4px solid var(--au-link);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-small);
}
.toast--success { border-left-color: var(--au-success); }
.toast--warning { border-left-color: var(--au-warning); }
.toast--error   { border-left-color: var(--au-error); }
.toast__titel {
  margin: 0 0 var(--space-1);
  font-weight: 700;
  color: var(--text-heading);
}
.toast__text { margin: 0; }

/* ---------- Buttons ----------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem; /* 10/20 px */
  font-family: var(--font-body);
  font-size: var(--fs-button);
  font-weight: 700;
  line-height: 1;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-heading);
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.button--primary {
  background: var(--au-rot);
  border-color: #c90512;
  color: var(--text-inverse);
}
.button--primary:hover { background: #a7040f; border-color: #95030d; }
.button--secondary {
  background: #e6e6e6;
  color: #000000;
  border-color: #c4c4c4;
}
[data-theme="dark"] .button--secondary {
  background: #2a2c31;
  color: var(--text-heading);
  border-color: #3e4148;
}
.button--ghost { color: var(--au-rot); }
.button--ghost:hover { background: rgba(226, 6, 19, 0.08); }
.button[disabled], .button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- Forms ------------------------------------------------------- */

.field {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}
.field__label {
  font-weight: 700;
  font-size: var(--fs-small);
  color: var(--text-heading);
}
.field__hint { font-size: var(--fs-small); color: var(--text-muted); }
.field__error { font-size: var(--fs-small); color: var(--au-error); }

.input, .textarea, .select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: var(--bg-surface);
  color: var(--text-body);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--fs-body);
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-strong); }
.textarea { min-height: 6rem; resize: vertical; }
.search { border-radius: var(--radius-pill); padding-left: 1rem; }

/* ---------- Badges / Kategorien ---------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--bg-sunken);
  color: var(--text-muted);
}
.badge--baas           { background: color-mix(in oklab, var(--branche-kaufmaennisch) 14%, transparent); color: var(--branche-kaufmaennisch); }
.badge--umschulung     { background: color-mix(in oklab, var(--branche-it) 14%, transparent);           color: var(--branche-it); }
.badge--weiterbildung  { background: color-mix(in oklab, var(--branche-gesundheit) 14%, transparent);    color: var(--branche-gesundheit); }
.badge--reputation     { background: color-mix(in oklab, var(--au-rot) 12%, transparent);               color: var(--au-rot-dunkel); }
.badge--fachartikel    { background: color-mix(in oklab, var(--branche-sprachen) 14%, transparent);     color: var(--branche-sprachen); }

/* ---------- View-Placeholder (vor F-Phase) ----------------------------- */

.view-placeholder {
  max-width: 60ch;
  padding: var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  box-shadow: var(--shadow-xs);
}

/* ---------- Noscript-Banner -------------------------------------------- */

.noscript-banner {
  padding: var(--space-4);
  margin: var(--space-4);
  background: var(--au-rot);
  color: var(--text-inverse);
  border-radius: var(--radius-md);
  font-weight: 700;
}

/* ---------- Reduced Motion --------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .boot-screen--fade-out { opacity: 0; transition: none; }
}
