/* =========================================================================
   Athena – die Dokumentenablage der Schule

   Farbtoken aus dem Praktikums-Modul, damit beide Module erkennbar
   zusammengehören: dieselben Flächen, dieselbe Marke (#3f6fa8), dieselben
   Abstände. Wer das Praktikum bedienen kann, findet sich hier ohne Umlernen
   zurecht.

   Für das iPad ausgelegt. Vier Dinge, die dabei zählen und nicht offen-
   sichtlich sind:

   1. **Eingabefelder tragen 16 px.** Ist die Schrift kleiner, zoomt Safari
      beim Antippen automatisch in das Feld hinein – die Seite springt, und
      man muss von Hand zurückzoomen. Deshalb 16 px, nicht 15.
   2. **Berührungsziele sind mindestens 44 px hoch** (--tap). Alles darunter
      trifft man mit dem Finger nicht zuverlässig.
   3. **`:hover` nur, wo es Zeigegeräte gibt.** Auf Touch bleibt ein
      Hover-Zustand nach dem Tippen „kleben", bis man woanders hintippt.
   4. **`dvh` statt `vh`.** Bei `100vh` schiebt die ein- und ausfahrende
      Adressleiste den Inhalt; `dvh` rechnet mit der tatsächlichen Höhe.
   ========================================================================= */

:root {
  /* Flächen */
  --bg: #f0ece3;
  --surface: #fffdf9;
  --surface-2: #f6f1e8;
  --surface-inset: #f3eee4;

  /* Text */
  --ink: #211f1a;
  --ink-soft: #453f37;
  --muted: #7a736a;
  --faint: #9c968c;

  /* Linien */
  --line: #e7e0d3;
  --line-strong: #dbd2c1;

  /* Marke */
  --brand: #3f6fa8;
  --brand-strong: #33598a;
  --brand-soft: #dde7f3;
  --brand-tint: #eef3f9;
  --brand-ink: #24405f;

  /* Statusfarben */
  --ok: #3c8a5f;
  --ok-soft: #e2efe6;
  --info: #3f6fa8;
  --info-soft: #e3ebf5;
  --warn: #b07420;
  --warn-soft: #f4e9d5;
  --danger: #a8452f;
  --danger-soft: #f3e0d8;
  --neutral: #7c756c;
  --neutral-soft: #ece6da;

  /* Form */
  --r-xl: 20px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(60, 45, 25, 0.05);
  --shadow: 0 10px 30px rgba(70, 50, 25, 0.07);
  --shadow-pop: 0 18px 44px rgba(50, 35, 18, 0.16);

  --sidebar-w: 236px;
  --tap: 44px;
  --gap: clamp(0.9rem, 2vw, 1.3rem);
}

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

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 12% -8%, rgba(255, 255, 255, 0.85), transparent 60%),
    radial-gradient(900px 500px at 108% 4%, rgba(63, 111, 168, 0.07), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(63, 111, 168, 0.12);
}

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

h1, h2, h3 {
  font-family: "Bricolage Grotesque", "Hanken Grotesk", system-ui, sans-serif;
  line-height: 1.18;
  margin: 0 0 .4em;
  font-weight: 600;
  letter-spacing: -0.011em;
}
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); }
h2 { font-size: clamp(1.14rem, 1.05rem + 0.5vw, 1.35rem); }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
a { color: var(--brand-strong); text-underline-offset: 2px; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.tiny  { font-size: .78rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: .75rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row.tight { gap: .35rem; }
.grow { flex: 1 1 auto; }

/* Dateinamen aus dem Sekretariat sind lang und haben keine Trennstellen –
   sie dürfen nie aus ihrem Kasten laufen. */
.card, td, li, .doc__name { overflow-wrap: anywhere; }

/* --------------------------------------------------------------- Layout */

.wrap {
  max-width: 1220px;
  margin: 0 auto;
  padding: var(--gap) clamp(0.9rem, 3vw, 1.6rem) 4rem;
  padding-left: max(clamp(0.9rem, 3vw, 1.6rem), env(safe-area-inset-left));
  padding-right: max(clamp(0.9rem, 3vw, 1.6rem), env(safe-area-inset-right));
}
.wrap.narrow { max-width: 760px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  padding: .75rem clamp(0.9rem, 3vw, 1.6rem);
  padding-top: max(.75rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.88);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.topbar__brand { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.topbar__brand strong {
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 1.05rem; letter-spacing: -0.01em;
}
.topbar__brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__spacer { flex: 1 1 auto; }

.hero {
  border-radius: var(--r-xl);
  padding: clamp(1.2rem, 3vw, 1.9rem);
  background:
    linear-gradient(135deg, var(--brand-tint), var(--surface) 62%),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap);
  overflow: hidden;
}
.hero h1 { margin-bottom: .18em; }
.hero p:last-child { margin-bottom: 0; }

/* Begrüßungsbild: Bild oben, Text darunter – ein Textblock auf dem Bild wäre
 * nicht lesbar.
 *
 * **Das Bild wird VOLLSTÄNDIG gezeigt**, nicht auf einen Streifen beschnitten.
 * Es hat deshalb weder `aspect-ratio` noch `object-fit`: Beides zusammen hieße
 * „nimm dir aus dem Bild, was in diese Form passt" – und genau dabei fiel der
 * Kopf der abgebildeten Person heraus. Stattdessen behält das Bild sein
 * eigenes Seitenverhältnis; für schmale Geräte liegt ein anderer Zuschnitt
 * bereit (siehe `<picture>` in index.html).
 *
 * `height: auto` ist dabei Pflicht, nicht Geschmack: Ohne die Zeile gewinnt
 * das `height`-Attribut aus dem Markup, und das Bild wird starr so hoch, wie
 * die Datei Pixel hat.
 */
.hero--bild { padding: 0; }
.hero__bild {
  display: block;
  width: 100%;
  height: auto;
  background: var(--brand-tint);
}
.hero__text { padding: clamp(1.1rem, 3vw, 1.7rem); }
.hero__text > :last-child { margin-bottom: 0; }

.card--bild { overflow: hidden; }
.card__bild {
  display: block;
  width: 100%;
  height: auto;
  background: var(--brand-tint);
  border-bottom: 1px solid var(--line);
}

.panel {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}
@media (max-width: 900px) { .panel { grid-template-columns: minmax(0, 1fr); } }

/* Bereichswahl: seitlich am Schreibtisch, als Reiterleiste auf dem Tablet. */
.sidenav {
  display: flex; flex-direction: column; gap: .12rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: .45rem;
  position: sticky; top: calc(3.6rem + env(safe-area-inset-top));
  box-shadow: var(--shadow-sm);
}
.sidenav button {
  display: flex; align-items: center;
  min-height: var(--tap);
  text-align: left; border: 0; background: transparent; cursor: pointer;
  padding: .5rem .7rem; border-radius: var(--r-sm); color: var(--ink-soft);
  font-weight: 500;
  transition: background-color .12s ease, color .12s ease;
}
@media (hover: hover) { .sidenav button:hover { background: var(--surface-2); } }
.sidenav button[aria-current="true"] {
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 650;
}
@media (max-width: 900px) {
  .sidenav {
    position: sticky; top: calc(3.4rem + env(safe-area-inset-top));
    flex-direction: row; flex-wrap: nowrap;
    overflow-x: auto; scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .sidenav::-webkit-scrollbar { display: none; }
  .sidenav button { flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap; }
}

/* ----------------------------------------------------------------- Karten */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap);
  overflow: hidden;
}
.card__head {
  padding: .85rem 1.05rem;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  background: linear-gradient(var(--surface-2), var(--surface-2));
}
.card__head h2, .card__head h3 { margin: 0; }
.card__body { padding: clamp(.9rem, 2.2vw, 1.2rem); }
.card__body > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ------------------------------------------------------------- Formulare */

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .85rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.field .hint, .hint { font-size: .8rem; color: var(--muted); line-height: 1.45; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="time"], input[type="search"], input[type="number"], input[type="file"],
select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: .55rem .7rem;
  /* 16 px – alles darunter lässt Safari beim Antippen hineinzoomen. */
  font-size: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}
textarea { min-height: 5rem; resize: vertical; line-height: 1.5; }
fieldset {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1rem 1.05rem .35rem; margin: 0 0 1.1rem;
  background: var(--surface);
}
legend {
  padding: .15rem .55rem; font-weight: 650; font-size: .82rem;
  color: var(--brand-ink); background: var(--brand-tint);
  border-radius: 999px; letter-spacing: .01em;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap);
  padding: .55rem 1.05rem;
  border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  font-weight: 600; text-decoration: none; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(36, 64, 95, .18);
  transition: background-color .12s ease, border-color .12s ease, transform .06s ease;
}
@media (hover: hover) {
  .btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
  .btn.secondary:hover { background: var(--surface-2); }
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.secondary {
  background: var(--surface); color: var(--ink-soft);
  border-color: var(--line-strong); box-shadow: none;
}
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 36px; padding: .3rem .7rem; font-size: .86rem; font-weight: 550; }
.btn.link {
  min-height: 32px; background: none; border: 0; color: var(--brand-strong);
  text-decoration: underline; padding: .15rem 0; box-shadow: none;
  font-weight: 500; white-space: normal; text-align: left;
  justify-content: flex-start;
}
/* Auf Touch-Geräten reicht ein 23 px hoher Textlink nicht – man trifft ihn
   nicht zuverlässig und erwischt stattdessen die Zeile darunter. */
@media (pointer: coarse) {
  .btn.link { min-height: var(--tap); padding-block: .55rem; }
}

input[type="checkbox"] {
  width: 1.15rem; height: 1.15rem; min-height: 0;
  accent-color: var(--brand); flex: 0 0 auto;
}
label.row { min-height: var(--tap); cursor: pointer; }

/* ------------------------------------------------------------- Tabellen */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  position: sticky; top: 0; z-index: 1;
  font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
tbody tr { transition: background-color .1s ease; }
@media (hover: hover) { tbody tr:hover { background: var(--surface-2); } }
tbody tr:last-child td { border-bottom: 0; }
td select, td input { min-height: 38px; padding: .3rem .5rem; font-size: 15px; }

/* --------------------------------------------------------------- Marken */

.badge {
  display: inline-block; padding: .16rem .55rem; border-radius: 999px;
  font-size: .76rem; font-weight: 650; letter-spacing: .01em;
  background: var(--neutral-soft); color: var(--ink-soft);
  white-space: nowrap;
}
.badge.ok      { background: var(--ok-soft); color: var(--ok); }
.badge.info    { background: var(--info-soft); color: var(--info); }
.badge.warn    { background: var(--warn-soft); color: var(--warn); }
.badge.danger  { background: var(--danger-soft); color: var(--danger); }

.notice {
  border-radius: var(--r-md); padding: .75rem .95rem; margin-bottom: 1rem;
  border: 1px solid var(--line-strong); background: var(--surface-2);
  border-left-width: 4px;
}
.notice.ok     { background: var(--ok-soft); border-color: #bcd9c7; border-left-color: var(--ok); }
.notice.warn   { background: var(--warn-soft); border-color: #e2cfa6; border-left-color: var(--warn); }
.notice.error  { background: var(--danger-soft); border-color: #e2bcae; border-left-color: var(--danger); }

.empty { padding: 2.4rem 1rem; text-align: center; color: var(--muted); }

details > summary {
  cursor: pointer; min-height: var(--tap); display: flex; align-items: center;
  padding: .3rem 0;
}
details > summary::marker { color: var(--muted); }

/* ------------------------------------------------------------ Pfadleiste */

.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: .15rem;
  font-size: .9rem;
}
.crumbs .btn.link { min-height: 28px; text-decoration: none; font-weight: 600; }
@media (pointer: coarse) { .crumbs .btn.link { min-height: 36px; } }
.crumbs span[aria-hidden] { color: var(--faint); padding: 0 .1rem; }

/* --------------------------------------------------------- Ablageliste */

/*  Verzeichnisse und Dokumente stehen in EINER Liste, Verzeichnisse zuerst.
 *  Zwei getrennte Kästen sähen ordentlicher aus und wären beim Suchen mit
 *  den Augen langsamer: Man sucht einen Namen, nicht eine Gattung.
 */
.entries { list-style: none; margin: 0; padding: 0; }
.entry {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: .7rem;
  align-items: center;
  padding: .6rem .3rem;
  border-bottom: 1px solid var(--line);
  min-height: var(--tap);
}
.entry:last-child { border-bottom: 0; }
@media (hover: hover) { .entry:hover { background: var(--surface-2); } }
.entry__icon { font-size: 1.3rem; line-height: 1; text-align: center; }
.entry__main { min-width: 0; }
.entry__name {
  font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--ink); text-align: left; font-size: 1rem; line-height: 1.3;
  overflow-wrap: anywhere;
}
@media (hover: hover) { .entry__name:hover { color: var(--brand-strong); text-decoration: underline; } }
.entry__meta { font-size: .8rem; color: var(--muted); }
.entry__actions { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 620px) {
  .entry { grid-template-columns: 2rem minmax(0, 1fr); }
  .entry__actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Ein Verzeichnis, das man nur durchqueren darf: sichtbar, aber ohne Inhalt.
   Ohne diesen Zustand wäre eine Freigabe auf ein Unterverzeichnis wertlos –
   man sähe den Ordner nie, in dem es steckt. */
.entry--durch .entry__name { color: var(--muted); font-weight: 500; }
.entry--durch .entry__icon { opacity: .5; }

/* ------------------------------------------------------- Ablagefläche */

/*  Das Ziel für Drag & Drop.
 *
 *  ⚠️ Es muss auch OHNE Ziehen bedienbar sein: Auf dem iPad zieht niemand
 *  eine Datei aus einer anderen App in den Browser, und mit Tastatur geht es
 *  gar nicht. Deshalb liegt darin ein echter Knopf, der den Dateidialog
 *  öffnet – die Fläche ist die Abkürzung, nicht der einzige Weg.
 */
.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-inset);
  padding: 1.4rem 1rem;
  text-align: center;
  transition: border-color .12s ease, background-color .12s ease;
}
.dropzone.over {
  border-color: var(--brand);
  background: var(--brand-tint);
}
.dropzone__hint { color: var(--muted); font-size: .87rem; margin-top: .5rem; }

.upload-list { list-style: none; margin: .8rem 0 0; padding: 0; }
.upload-list li {
  display: flex; gap: .6rem; align-items: center;
  padding: .35rem 0; font-size: .88rem;
  border-bottom: 1px solid var(--line);
}
.upload-list li:last-child { border-bottom: 0; }
.upload-list .name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------- Platzanzeige */

.quota { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.quota__bar {
  flex: 1 1 180px; height: 8px; min-width: 120px;
  background: var(--surface-inset); border-radius: 999px; overflow: hidden;
  border: 1px solid var(--line);
}
.quota__fill { height: 100%; background: var(--brand); }
.quota__fill.warn { background: var(--warn); }
.quota__fill.full { background: var(--danger); }

/* ---------------------------------------------------------- Freigaben */

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--brand-tint); color: var(--brand-ink);
  border: 1px solid var(--brand-soft);
  border-radius: 999px; padding: .25rem .35rem .25rem .7rem;
  font-size: .85rem; font-weight: 550;
}
.chip button {
  border: 0; background: none; cursor: pointer; color: var(--brand-ink);
  font-size: 1rem; line-height: 1; padding: .2rem .35rem; border-radius: 999px;
}
@media (hover: hover) { .chip button:hover { background: var(--brand-soft); } }

/* ---------------------------------------------------------------- Druck */

@media print {
  :root { --gap: 0; }
  body { background: #fff; background-image: none; font-size: 10.5pt; }
  .topbar, .sidenav, .no-print, .btn, details, .notice,
  .hero__bild, .card__bild, .dropzone { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; margin: 0; }
  .card__head { background: none; border-bottom: 1px solid #999; }
  .entry { break-inside: avoid; page-break-inside: avoid; }
  @page { margin: 10mm; }
  a { text-decoration: none; color: #000; }
}
