/* Eclipta academy — Design-System.
   Verbindlich: dunkel-editorial, ein roter Akzent SPARSAM, scharfe Kanten (0px),
   keine Gradients/Glow/Blur, keine Emojis. Ein Viewport, kein Scrollen (100dvh).
   Fonts: Newsreader (Serif, Headlines) + Hanken Grotesk (UI) — lokal, kein CDN. */
@import url("/static/fonts/fonts.css");

:root {
  color-scheme: dark;

  /* Flächen */
  --page-bg:    #000000;  /* hinterste Ebene (Seite/Starfield): reines Schwarz */
  --bg:         #0d0d0d;  /* Standardflächen (Inputs, Zeilen) — NICHT die Seite */
  --surface:    #111111;  /* Cards */
  --surface-2:  #161616;  /* Header / nested */

  /* Akzent (eigene Rottöne, sparsam) */
  --oxblood:    #9e2b1e;
  --signal:     #d8412f;

  /* Text-Opazität (Weiß) */
  --text:       rgba(255, 255, 255, 1);     /* Headlines */
  --text-body:  rgba(255, 255, 255, 0.70);  /* Body / Serif */
  --text-meta:  rgba(255, 255, 255, 0.40);  /* Subheads / Meta */
  --hairline:   rgba(255, 255, 255, 0.12);  /* Borders */
  --hairline-soft: rgba(255, 255, 255, 0.08);

  /* Interaktive Zustände (hover/focus/active) + Info-Ergebnisboxen: dezentes
     Weiß statt Rot — Rot bleibt Marke/Warnung vorbehalten, nicht „du bist hier". */
  --interactive: rgba(255, 255, 255, 0.90);

  /* Typo */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Hanken Grotesk", system-ui, -apple-system, sans-serif;

  /* Typo-Skala */
  --fs-wordmark: 15px;
  --fs-h1:       clamp(32px, 4.4vw, 44px);
  --fs-h2:       clamp(22px, 2.6vw, 28px);
  --fs-card:     clamp(18px, 2vw, 24px);
  --fs-body:     15px;
  --fs-label:    11px;

  --space-edge:  clamp(24px, 4vw, 64px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;                 /* Ein Viewport, kein Scrollen */
  background: var(--page-bg);
  color: var(--text-body);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Sternenhimmel: fixed hinter allem */
#starfield {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* App-Rahmen: 100dvh Grid, oben Wortmarke, darunter Content */
.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: var(--space-edge);
  gap: clamp(16px, 3vh, 40px);
}

/* Wortmarke „eclipta." — klein oben links, roter Punkt non-negotiable */
.wordmark {
  font-family: var(--sans);
  font-weight: 700;
  font-size: var(--fs-wordmark);
  letter-spacing: 0.01em;
  color: var(--text-body);
  text-decoration: none;
  user-select: none;
}
.wordmark .dot { color: var(--signal); }

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

/* Kopf-Nav / Sprach- & Logout-Zeile */
.topbar nav {
  display: flex;
  align-items: baseline;
  gap: 20px;
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-meta);
}
.topbar nav a { color: var(--text-meta); text-decoration: none; }
.topbar nav a:hover { color: var(--text-body); }

/* Logout-Button: Eclipta-Design statt Browser-Default (Safari-blau/rund) */
.logout-form { margin: 0; display: inline-flex; }
.linklike {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 1px solid var(--signal);
  border-radius: 0;                 /* scharfe Kanten */
  color: var(--signal);
  font-family: var(--sans);
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color 150ms linear, color 150ms linear, border-color 150ms linear;
}
.linklike:hover {
  background: var(--oxblood);        /* dunkleres Rot, kein Glow */
  border-color: var(--oxblood);
  color: var(--text);
}

/* Eyebrow-Label: Small caps, kein Punkt / Mittelpunkt */
.eyebrow {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-meta);
  margin: 0 0 12px;
}

/* Headlines: Serif, Hierarchie über Größe/Gewicht */
h1, h2, h3 { font-family: var(--serif); color: var(--text); font-weight: 500; margin: 0; }
h1 { font-size: var(--fs-h1); line-height: 1.05; }
h2 { font-size: var(--fs-h2); line-height: 1.1; }

.content {
  min-height: 0;                    /* erlaubt Kind-Overflow-Handling ohne Body-Scroll */
  display: flex;
  flex-direction: column;
}

/* ---- Home: genau 4 Modul-Karten im Viewport ---- */
.module-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1px;                         /* 1px-Border-Gap, keine Rundungen */
  background: var(--hairline-soft); /* Gap zeigt Haarlinie durch */
  border: 1px solid var(--hairline-soft);
}

.module-card {
  background: var(--surface);
  border: 0;
  padding: clamp(18px, 3vh, 32px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: var(--text-body);
  transition: background-color 150ms linear, border-color 150ms linear,
              box-shadow 800ms ease;
  min-height: 0;
  overflow: hidden;
}
.module-card:hover { background: var(--surface-2); }

/* Rand-Aufleuchten beim Hover (Ersatz für den entfernten Zoom): die 1px-Kante
   der Karte wird kurz hell-weiß und bekommt einen dezenten weichen Schein.
   Als box-shadow umgesetzt (keine Größenänderung → kein Layout-Shift), für ALLE
   vier Karten identisch — mit wie ohne Render, unabhängig vom Grid-Modus. Nur
   auf echten Hover-Zeigern, Touch bleibt unverändert. position/z-index heben
   die leuchtende Kante über die Nachbarn im 1px-Gap. Die zweite Regel matcht
   die Spezifität der Render-Karten-Grundlinie (`:has(.has-render)`), damit die
   leuchtende Kante deren 0.045-Haarlinie im Hover sicher überschreibt. */
@media (hover: hover) {
  .module-grid .module-card:hover {
    position: relative;
    z-index: 2;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.42),
                0 0 10px rgba(255, 255, 255, 0.08);
  }
  .module-grid:has(.module-card.has-render) .module-card:hover {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.42),
                0 0 10px rgba(255, 255, 255, 0.08);
  }
}

.module-card .index {
  font-family: var(--serif);
  font-size: var(--fs-label);
  color: var(--signal);
  letter-spacing: 0.04em;
}
.module-card .title {
  font-family: var(--serif);
  font-size: var(--fs-card);
  color: var(--text);
  line-height: 1.1;
  margin: 8px 0 6px;
}
.module-card .desc {
  font-size: var(--fs-body);
  color: var(--text-meta);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Optional Modul-Bild: füllt die KOMPLETTE Karte als Hintergrund, scharfe
   Kanten. Text liegt an gleicher Stelle darüber; die Kartenhöhe (2x2-Grid im
   Viewport) bleibt unverändert, da das Bild absolut positioniert ist. */
.module-card.has-image {
  position: relative;
}
.module-card .module-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  display: block;
  border: 0;
  border-radius: 0;
}
.module-card.has-image .index,
.module-card.has-image > span {
  position: relative;
  z-index: 1;
}

/* Prozedural gerenderte Karte (fundamentals): <canvas class="module-render">
   statt <img>, gezeichnet von eclipse-render.js. Die Kartenfläche ist
   TRANSPARENT, damit das Seiten-Starfield durch die Karte scheint. */
.module-card.has-render {
  position: relative;
  background: transparent;
}
/* Kein 8%-Weiß-Schleier hinter der transparenten Karte: enthält das Grid eine
   Render-Karte, verliert es seinen Gap-Hintergrund (der sonst als grauer Film
   über dem schwarzen Sternenhimmel läge). Die 1px-Haarlinien in den Gaps
   kommen stattdessen als box-shadow der Karten zurück — zwei Nachbarn
   überlappen sich im Gap auf ≈ die alte Helligkeit (0.045 doppelt ≈ 0.08).
   Browser ohne :has() behalten schlicht den bisherigen dezenten Schleier. */
.module-grid:has(.module-card.has-render) {
  background: transparent;
}
.module-grid:has(.module-card.has-render) .module-card {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.045);
}
.module-card.has-render:hover {
  background: transparent;
}
.module-card .module-render {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}
.module-card.has-render .index,
.module-card.has-render > span {
  position: relative;
  z-index: 1;
}

/* ---- Login ---- */
.login-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
}
.login-card {
  width: min(360px, 100%);
  background: var(--surface);
  border: 1px solid var(--hairline);
  padding: clamp(28px, 5vh, 44px);
}
.login-card h1 { font-size: var(--fs-h2); margin-bottom: 20px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-meta);
}
.field input {
  background: var(--bg);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-body);
  padding: 10px 12px;
  border-radius: 0;
}
.field input:focus { outline: none; border-color: var(--interactive); }

.btn {
  display: inline-block;
  background: var(--signal);
  color: #0d0d0d;
  border: 0;
  border-radius: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--fs-body);
  letter-spacing: 0.02em;
  padding: 11px 18px;
  cursor: pointer;
  transition: background-color 150ms linear;
}
.btn:hover { background: var(--oxblood); color: var(--text); }
.btn--ghost {
  background: transparent;
  color: var(--text-body);
  border: 1px solid var(--hairline);
}
.btn--ghost:hover { background: transparent; border-color: var(--interactive); color: var(--text); }

.form-error {
  color: var(--signal);
  font-size: var(--fs-body);
  margin: 0 0 16px;
}

/* ---- Modul-Detailseite ---- */
.module-head { border-bottom: 1px solid var(--hairline); padding-bottom: 16px; margin-bottom: 20px; }

.module-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;                 /* Content-Liste scrollt innerhalb, nie der Body */
  padding-right: 8px;
}

.markdown-body { color: var(--text-body); max-width: 68ch; }
.markdown-body h2 { margin: 20px 0 8px; }
.markdown-body p { margin: 0 0 12px; }

/* ---- Modul-Übersicht: kompakte Eintragsliste (Titel + Teaser, klickbar) ---- */
.entry-index { display: flex; flex-direction: column; }
.entry-row {
  display: block;
  padding: 14px 12px;
  border-bottom: 1px solid var(--hairline-soft);
  text-decoration: none;
  color: var(--text-body);
  transition: background-color 150ms linear;
}
.entry-row:hover { background: var(--surface); }
.entry-row-title {
  display: block;
  font-family: var(--serif);
  font-size: var(--fs-card);
  line-height: 1.15;
  color: var(--text);
}
.entry-row:hover .entry-row-title { color: var(--interactive); }
.entry-row-teaser {
  display: block;
  margin-top: 4px;
  font-size: var(--fs-body);
  color: var(--text-meta);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Persönliche Einträge: Akzentkante links, sparsam. */
.entry-row--custom { border-left: 2px solid var(--signal); }

/* ---- Eintrag-Detailseite ---- */
.back-link {
  color: var(--text-meta);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.back-link:hover { color: var(--text-body); }
.detail-title { color: var(--signal); }

/* Text-Block: dunkelgraue Fläche, deutlich vom #0d0d0d abgesetzt, scharfe
   Kanten; weiße Schrift, Zwischenüberschriften im Akzentrot. */
.detail-text {
  background: #1a1a1a;
  border: 1px solid var(--hairline-soft);
  border-radius: 0;
  padding: clamp(20px, 3vh, 32px);
  margin: 0 0 24px;
  color: var(--text);
  max-width: 76ch;
}
.detail-text h1, .detail-text h2, .detail-text h3,
.detail-text h4, .detail-text h5, .detail-text h6 { color: var(--signal); }
.detail-text h1 { font-size: var(--fs-h2); margin: 20px 0 8px; }
.detail-text h1:first-child, .detail-text h2:first-child,
.detail-text h3:first-child { margin-top: 0; }
.detail-text a { color: var(--signal); }

/* Inline-Dateien: Bilder + PDFs werden angezeigt, Download bleibt sekundär. */
.detail-media {
  margin: 0 0 24px;
  max-width: 900px;
  border: 1px solid var(--hairline);
  background: #1a1a1a;
}
.detail-media img { display: block; width: 100%; height: auto; }
.detail-media--pdf iframe {
  display: block;
  width: 100%;
  height: min(70vh, 720px);
  border: 0;
  background: #1a1a1a;
}
.detail-media figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-top: 1px solid var(--hairline-soft);
  font-size: var(--fs-body);
}
/* "Custom"-Auszeichnung für persönliche Einträge: kleine Uppercase-Outline im
   Akzentrot, scharfe Kanten, kein Glow, sparsam. */
.badge-custom {
  display: inline-block;
  vertical-align: middle;
  margin-left: 10px;
  font-size: var(--fs-label);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--signal);
  border: 1px solid var(--signal);
  border-radius: 0;
  padding: 3px 7px;
}
.entry-video {
  margin: 0 0 16px;
  max-width: 900px;
  background: #000;
  border: 1px solid var(--hairline);
}
.entry-video video { display: block; width: 100%; height: auto; }
.entry-video--embed {
  position: relative;
  aspect-ratio: 16 / 9;
}
.entry-video--embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.content-list { list-style: none; margin: 16px 0 0; padding: 0; }
.content-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline-soft);
}
.content-list .c-title { color: var(--text); }
.content-list .c-meta { font-size: var(--fs-label); color: var(--text-meta); text-transform: uppercase; letter-spacing: 0.06em; }
.content-list a.c-download { color: var(--signal); text-decoration: none; font-size: var(--fs-label); text-transform: uppercase; letter-spacing: 0.08em; }
.content-list a.c-download:hover { color: var(--text); }

/* ---- Admin-Tabellen-Basics ---- */
.admin-table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline-soft);
}
.admin-table th {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-meta);
  font-weight: 500;
  border-bottom: 1px solid var(--hairline);
}
.admin-table tr:hover td { background: var(--surface); }

.muted { color: var(--text-meta); }
.serif-italic { font-family: var(--serif); font-style: italic; color: var(--text-body); }
