/* iWantToRead — Gestaltung
 *
 * Eine Datei, keine Abhängigkeit, kein Build. Farben liegen als Variablen
 * vor, damit der Dunkelmodus nur die Werte tauscht und nicht die Regeln.
 */

:root {
  color-scheme: light dark;

  --grund:        #f6f4ef;
  --flaeche:      #ffffff;
  --flaeche-tief: #eceae4;
  --rand:         #d9d5cc;
  --text:         #232a3d;
  --text-leise:   #656d81;
  --akzent:       #2b3a67;
  --akzent-text:  #ffffff;
  /* Der Kopf hat eigene Werte: Im Dunkelmodus wird der Akzent hell, und ein
     hell leuchtender Balken über einer dunklen Seite ist genau das, was ein
     Dunkelmodus vermeiden soll. */
  --kopf:         #2b3a67;
  --kopf-text:    #ffffff;
  --band:         #d96f3b;
  --warnung:      #fbeee3;
  --warnung-text: #7a4318;
  --fehler:       #fae6e6;
  --fehler-text:  #7a2020;

  --radius: 12px;
  --schatten: 0 1px 3px rgb(35 42 61 / 12%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund:        #171a24;
    --flaeche:      #212736;
    --flaeche-tief: #2b3143;
    --rand:         #39405a;
    --text:         #eceff7;
    --text-leise:   #a2aac0;
    --akzent:       #7d94d8;
    --akzent-text:  #131722;
    --kopf:         #1b2130;
    --kopf-text:    #eceff7;
    --band:         #e08a5c;
    --warnung:      #4a3520;
    --warnung-text: #f3d4b5;
    --fehler:       #4a2424;
    --fehler-text:  #f0c4c4;
    --schatten: 0 1px 3px rgb(0 0 0 / 40%);
  }
}

* { box-sizing: border-box; }

/* Muss über allem stehen: Eine display-Regel mit ID- oder Klassen-Selektor
   schlägt sonst das hidden-Attribut. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--grund);
  color: var(--text);
  /* Auf iOS im Standalone-Modus reicht die Seite sonst unter die Home-Leiste. */
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---- Kopf --------------------------------------------------------------- */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: var(--kopf);
  color: var(--kopf-text);
}

header h1 { font-size: 1.1rem; margin: 0; font-weight: 600; }

.kennzeichen {
  font-size: .7rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--band);
  color: #fff;
}

.version { font-size: .7rem; opacity: .7; }
header .rechts { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
header .nutzer { font-size: .85rem; opacity: .85; overflow: hidden; text-overflow: ellipsis; }
header button {
  padding: 5px 10px;
  font-size: .8rem;
  background: rgb(255 255 255 / 15%);
  color: var(--kopf-text);
  border: 0;
  border-radius: var(--radius);
  white-space: nowrap;
}
header button:hover { background: rgb(255 255 255 / 25%); }

/* ---- Reiter ------------------------------------------------------------- */

nav {
  display: flex;
  overflow-x: auto;
  gap: 2px;
  background: var(--flaeche-tief);
  border-bottom: 1px solid var(--rand);
}

nav button {
  flex: 1 0 auto;
  padding: 11px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
  font: inherit;
  font-size: .9rem;
  color: var(--text-leise);
  cursor: pointer;
}

/* aria-current statt role="tab": Die Ansicht wird neu aufgebaut, es gibt
   kein tabpanel, das bestehen bliebe. Ein Reiter, der nur so aussieht, aber
   keins hat, meldet dem Screenreader mehr, als die App einlöst. */
nav button[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--band);
  font-weight: 600;
}

/* ---- Stand -------------------------------------------------------------- */

/* Commit und Zeit des Deploys. Bleibt oben (CLAUDE.md: „Der Stand im Kopf der
   Seite"), aber leise — gebraucht wird er bei der Fehlersuche, nicht beim
   Lesen. */
.stand {
  margin: 0;
  padding: 5px 14px;
  font-size: .72rem;
  color: var(--text-leise);
  background: var(--flaeche-tief);
  border-bottom: 1px solid var(--rand);
}

main { padding: 14px; max-width: 780px; margin: 0 auto; }
h2 { font-size: 1rem; margin: 22px 0 10px; }
main > h2:first-child { margin-top: 0; }
.gedaempft { color: var(--text-leise); font-size: .9rem; }

/* ---- Meldungen ---------------------------------------------------------- */

.meldung {
  padding: 9px 12px;
  border-radius: var(--radius);
  margin: 12px 0;
  font-size: .88rem;
}
.meldung.fehler, .meldung.absturz { background: var(--fehler); color: var(--fehler-text); }
.meldung.hinweis { background: var(--flaeche-tief); color: var(--text); }
.meldung.absturz { margin: 12px 14px; }

/* ---- Buchkarten --------------------------------------------------------- */

.buecher { display: grid; gap: 12px; margin: 12px 0; }

.buch {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 12px;
  padding: 12px;
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
}

.buch .cover {
  width: 68px;
  /* Buchcover sind hochkant. Ohne festes Verhältnis springt das Raster, bis
     das letzte Bild geladen ist. */
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 4px;
  background: var(--flaeche-tief);
}

.buch .titel { font-weight: 600; margin: 0 0 2px; }
.buch .autor { color: var(--text-leise); font-size: .88rem; margin: 0 0 6px; }
.buch .begruendung { font-size: .9rem; margin: 0 0 8px; }
/* pre-line, weil Verlagstexte Absätze haben. Ohne das läuft der ganze
   Klappentext zu einem Block zusammen. */
.buch .beschreibung { font-size: .85rem; color: var(--text-leise); margin: 0 0 8px;
                      white-space: pre-line; }
/* Gekürzt und damit anklickbar: Der Zeiger ist der einzige Hinweis darauf,
   neben dem „…" am Ende. Ein eigener Knopf dafür war größer als der Gewinn. */
.buch .beschreibung.aufklappbar { cursor: pointer; }
/* Nur wo es einen Zeiger gibt: Auf dem Telefon bleibt :hover nach dem Tippen
   hängen, und der aufgeklappte Text sähe dauerhaft anders aus als der Rest. */
@media (hover: hover) {
  .buch .beschreibung.aufklappbar:hover { color: var(--text); }
}

.buch .ungeprueft { font-size: .78rem; color: var(--band); margin: 0 0 8px; }

.aktionen { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }

.aktionen button {
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  padding: 7px 11px;
  border: 1px solid var(--rand);
  border-radius: 999px;
  background: var(--flaeche);
  color: var(--text);
  cursor: pointer;
}
.aktionen button:hover:not(:disabled) { background: var(--flaeche-tief); }
.aktionen button[aria-pressed="true"] { border-color: var(--akzent); background: var(--flaeche-tief); }

/* Entfernen steht abgesetzt und ohne aria-pressed: Es ist kein Zustand, den
   man umschaltet, sondern eine einmalige, nicht umkehrbare Handlung. */
.aktionen button.weg { margin-left: auto; opacity: .65; }
.aktionen button.weg:hover:not(:disabled) { opacity: 1; border-color: var(--fehler-text); }

.skoobe {
  font-size: .82rem;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--rand);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.skoobe:hover { background: var(--flaeche-tief); }

/* ---- Bedienelemente ----------------------------------------------------- */

button {
  font: inherit;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--akzent);
  color: var(--akzent-text);
  cursor: pointer;
  font-weight: 600;
}
button.leise {
  background: var(--flaeche-tief);
  color: var(--text);
  border: 1px solid var(--rand);
  font-weight: 400;
}
button.leise:hover:not([disabled]) { background: var(--flaeche); }
button[disabled] { opacity: .45; cursor: not-allowed; }

.reihe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
/* Eine Reihe in einer Reihe (Beschriftung samt Auswahlfeld) bringt keine
   eigenen Ränder mit — sonst rutscht sie gegen ihre Nachbarn. */
.reihe .reihe { margin: 0; }

input, select {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  background: var(--flaeche);
  color: var(--text);
  min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 1px;
}
input[type="checkbox"] { accent-color: var(--akzent); }

/* Beschriftung über dem Feld: Auf einem Telefon ist daneben kein Platz. */
label { display: block; margin: 12px 0; font-size: .85rem; color: var(--text-leise); }
label input { display: block; width: 100%; margin-top: 4px; }
label .gedaempft { display: block; margin-top: 3px; font-size: .78rem; }
/* Eine Beschriftung, die selbst eine Reihe ist (Kontrollkästchen), bleibt
   einzeilig — sonst steht das Häkchen über dem Wort. */
label.reihe { display: flex; }
label.reihe input { display: inline-block; width: auto; margin-top: 0; }

/* Eigene Zeile: Neben Knopf und Auswahlfeld blieb vom Platzhalter nur ein
   angeschnittenes Wortfragment übrig. */
.volle-zeile { flex: 1 1 100%; }
.volle-zeile input { display: block; width: 100%; margin-top: 4px; }

/* ---- Anmeldung ---------------------------------------------------------- */

/* Kein Overlay: Die Anmeldung ist die Ansicht, solange kein Token da ist. */
form.anmeldung {
  width: min(360px, 100%);
  margin: 8vh auto 0;
  padding: 22px;
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
}
form.anmeldung h2 { margin: 0 0 6px; font-size: 1.15rem; }
form.anmeldung button[type="submit"] { width: 100%; margin-top: 6px; }

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

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; vertical-align: top; padding: 8px 6px; border-bottom: 1px solid var(--rand); }
th { color: var(--text-leise); font-weight: 600; }
td .reihe { margin: 0; gap: 6px; }
td button { padding: 5px 9px; font-size: .8rem; }

code {
  background: var(--flaeche-tief);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .85rem;
}
