/* Öffentliche Projekt-Bibliothek („Dark Atelier"). Gilt für home/effect/show;
   die alte Werkstatt-Oberfläche (index.html) bringt ihr CSS weiterhin selbst mit. */

:root {
  color-scheme: dark;
  --bg:        oklch(0.155 0.010 265);
  --bg-deep:   oklch(0.105 0.008 265);   /* Vollbild-Ansicht, dunkler als die Liste */
  --surface:   oklch(0.185 0.012 265);
  --surface-2: oklch(0.205 0.012 265);
  --field:     oklch(0.145 0.010 265);
  --line:      oklch(0.30 0.014 265);
  --line-soft: oklch(0.24 0.012 265);
  --ink:       oklch(0.93 0.006 265);
  --muted:     oklch(0.62 0.010 265);
  --dim:       oklch(0.50 0.010 265);
  --brass:     oklch(0.78 0.095 82);
  --brass-line: oklch(0.42 0.030 82);
  --serif: Marcellus, Georgia, "Times New Roman", serif;
  --sans: Jost, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

/* Wer im System "Bewegung reduzieren" gesetzt hat, bekommt hier gar keine.
   Gilt für alles Folgende – die FLIP-Bewegung im JS prüft dieselbe Abfrage. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Muss sein: das UA-Stylesheet setzt für [hidden] nur `display: none`, und jede
   eigene display-Regel (`.card { display: flex }`, `.block { display: flex }`)
   ist spezifischer und gewinnt. Ohne das hier blieben gefilterte Kacheln und
   leere Dialogblöcke sichtbar, obwohl das Attribut korrekt gesetzt ist. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brass); text-decoration: none; }
a:hover { color: oklch(0.86 0.085 82); }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor;
        stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon--heart { fill: none; stroke-width: 1.5; }
.icon--heart.on { fill: var(--brass); stroke: var(--brass); }

/* --- Kopfleiste ---------------------------------------------------------- */

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 18px 40px; border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--serif); font-size: 20px; letter-spacing: 0.15em;
  color: var(--brass); white-space: nowrap;
}
.topbar__search {
  flex: 1 1 auto; max-width: 520px;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 0 14px; min-height: 44px;
}
.topbar__search input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: var(--ink); font: inherit; font-size: 14px;
}
.topbar__search input::placeholder { color: oklch(0.55 0.010 265); }
.topbar__search svg { color: var(--muted); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 20px;
                 font-size: 14px; }
.btn-brass {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--brass); color: var(--bg); border-radius: 6px;
  padding: 0 20px; min-height: 44px; font-size: 14px; font-weight: 500;
}
.btn-brass:hover { background: oklch(0.84 0.09 82); color: var(--bg); }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid var(--line); color: var(--ink); border-radius: 6px;
  padding: 0 20px; min-height: 44px; font-size: 14px;
}
.btn-ghost:hover { border-color: var(--brass-line); color: var(--ink); }
.btn-brass[disabled], .btn-brass:disabled {
  background: oklch(0.34 0.020 82); color: var(--muted); cursor: not-allowed;
}

/* --- Seitenkopf ---------------------------------------------------------- */

.pagehead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 48px; padding: 40px 40px 32px; border-bottom: 1px solid var(--line);
}
.eyebrow { font-size: 10px; letter-spacing: 0.26em; text-transform: uppercase;
           color: var(--brass); }
.pagehead h1 { font-family: var(--serif); font-size: 42px; line-height: 1.1; }
.pagehead h1 span { color: var(--brass); }
.pagehead p { font-size: 15px; line-height: 1.65; color: oklch(0.70 0.010 265);
              max-width: 640px; }
.pagehead__text { display: flex; flex-direction: column; gap: 14px; }
.stats { display: flex; gap: 40px; padding-bottom: 4px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat b { font-family: var(--serif); font-size: 34px; line-height: 1;
          font-weight: 400; color: var(--brass); }
.stat span { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
             color: var(--muted); }

/* --- Zweispalter: Filterleiste + Raster ---------------------------------- */

.layout { display: flex; align-items: flex-start; }
.rail {
  width: 272px; flex: none; padding: 28px; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 30px;
}
.rail__group { display: flex; flex-direction: column; gap: 12px; }
.rail__title {
  font-family: var(--serif); font-size: 12px; letter-spacing: 0.20em;
  text-transform: uppercase; color: var(--brass);
}
.check { display: flex; align-items: center; gap: 11px; cursor: pointer;
         min-height: 30px; font-size: 14px; color: oklch(0.82 0.008 265); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box {
  width: 15px; height: 15px; flex: none; border: 1px solid oklch(0.38 0.014 265);
  border-radius: 3px; display: flex; align-items: center; justify-content: center;
}
.check__box { transition: background .16s ease, border-color .16s ease; }
.check__box svg { width: 11px; height: 11px; stroke: var(--bg); stroke-width: 3;
                  opacity: 0; transform: scale(.5);
                  transition: opacity .16s ease, transform .16s cubic-bezier(.2,.8,.3,1.2); }
.check input:checked + .check__box { background: var(--brass); border-color: var(--brass); }
.check input:checked + .check__box svg { opacity: 1; transform: none; }
.check__n { margin-left: auto; font-size: 12px; color: var(--muted); }
.check:hover { color: var(--ink); }

.digits { display: flex; gap: 8px; }
.digits label { flex: 1; }
.digits input { position: absolute; opacity: 0; pointer-events: none; }
.digits span {
  display: block; text-align: center; font-size: 14px; padding: 9px 0;
  border: 1px solid oklch(0.32 0.014 265); border-radius: 6px;
  color: oklch(0.80 0.008 265); cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.digits input:checked + span {
  background: var(--brass); border-color: var(--brass); color: var(--bg);
  font-weight: 500;
}

.rail__more { font-size: 13px; color: var(--brass); background: none;
              text-align: left; padding: 0; }

.main { flex: 1 1 auto; min-width: 0; padding: 28px 40px 64px;
        display: flex; flex-direction: column; gap: 22px; }
.main__head {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  border-bottom: 1px solid var(--line); padding-bottom: 14px;
}
.main__head h2 { font-family: var(--serif); font-size: 20px; letter-spacing: 0.06em; }
.count { font-size: 13px; color: var(--muted); }
.main__tools { display: flex; align-items: center; gap: 18px; }
.sortpick { display: flex; align-items: center; gap: 8px; font-size: 13px;
            color: var(--muted); }
.sortpick select {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px;
  cursor: pointer;
}
.sortpick select:hover { border-color: var(--brass-line); }
.sortpick select:focus { outline: none; border-color: var(--brass); }

/* --- Kachelraster -------------------------------------------------------- */

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.card {
  border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; overflow: hidden;
  /* Bewusst KEIN transform im Hover: die FLIP-Bewegung beim Filtern animiert
     genau diese Eigenschaft, beides zusammen würde sich ins Gehege kommen. */
  transition: border-color .18s ease, box-shadow .22s ease;
}
.card:hover {
  border-color: var(--brass-line);
  box-shadow: 0 14px 30px oklch(0.08 0.008 265 / 0.55);
}
.card__shot { position: relative; overflow: hidden; }
.card__shot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
                  background: var(--field);
                  transition: transform .45s cubic-bezier(.2,.7,.3,1); }
.card:hover .card__shot img { transform: scale(1.035); }
.card__over {
  position: absolute; inset: 0; background: oklch(0.14 0.010 265 / 0.66);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; opacity: 0; transition: opacity .14s ease;
}
.card:hover .card__over, .card__over:focus-within { opacity: 1; }
.card__over .btn-brass { min-height: 40px; padding: 0 18px; font-size: 13.5px; }
.card__over a.details { font-size: 12.5px; color: oklch(0.88 0.008 265);
                        border-bottom: 1px solid var(--muted); padding-bottom: 1px; }
.card__body { padding: 14px 16px 15px; display: flex; flex-direction: column; gap: 8px; }
.card__body h3 { font-family: var(--serif); font-size: 18px; line-height: 1.2;
                 overflow-wrap: anywhere; }
.card__by { font-size: 12px; color: var(--muted); }
.card__by.none { font-style: italic; color: var(--dim); }
.card__foot { display: flex; align-items: center; gap: 6px; padding-top: 2px; }
.chip {
  font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase;
  border: 1px solid oklch(0.32 0.014 265); border-radius: 4px; padding: 3px 8px;
  color: oklch(0.70 0.010 265); white-space: nowrap;
}
.chip--brass { border-color: var(--brass-line); color: var(--brass); }
/* PRO ist eine Produkteigenschaft, kein technisches Merkmal – deshalb gefüllt
   statt nur umrandet, damit es sich von den übrigen Chips abhebt. */
.chip--pro { background: var(--brass); border-color: var(--brass); color: var(--bg);
             font-weight: 600; }
.card__acts { margin-left: auto; display: flex; gap: 4px; }
.iconbtn {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 5px; color: var(--muted);
}
.iconbtn:hover { color: var(--brass); border-color: var(--brass-line); }

.empty { padding: 60px 0; text-align: center; color: var(--muted); font-size: 15px; }

/* --- Bewegung: Auftritt, Filtern, Dialog --------------------------------- */

/* Erster Seitenaufbau: die Kacheln kommen ZEILENWEISE herein, nicht einzeln –
   bei 127 Stück wäre ein Versatz pro Kachel eine endlose Welle. Das JS gruppiert
   nach offsetTop und setzt --row; animiert werden nur die Zeilen, die beim Laden
   überhaupt im Bild sind. */
@keyframes rowIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.grid.intro .card[data-row] {
  animation: rowIn .5s cubic-bezier(.2,.7,.3,1) both;
  animation-delay: calc(var(--row) * 90ms);
}

/* Kachel verlässt die Auswahl: erst wegblenden, dann fällt sie aus dem Fluss –
   sonst würden die übrigen springen, bevor man das Verschwinden gesehen hat. */
.card.leaving { transition: opacity .13s ease, transform .13s ease;
                opacity: 0; transform: scale(.96); pointer-events: none; }

/* --- Dialog: Code-Eingabe ------------------------------------------------ */

dialog.sheet {
  padding: 0; border: 1px solid var(--brass-line); background: var(--surface);
  color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: 92vh;
  overflow: auto; box-shadow: 0 40px 90px oklch(0.06 0.008 265 / 0.85);
}
dialog.sheet {
  opacity: 0; transform: translateY(10px) scale(.985);
  transition: opacity .2s ease, transform .22s cubic-bezier(.2,.7,.3,1),
              overlay .22s allow-discrete, display .22s allow-discrete;
}
dialog.sheet[open] { opacity: 1; transform: none; }
/* @starting-style gibt dem Dialog einen Startzustand, sonst gäbe es beim
   Einblenden nichts zu interpolieren (display wechselt ja gleichzeitig).
   Browser ohne Unterstützung zeigen ihn einfach sofort – kein Schaden. */
@starting-style {
  dialog.sheet[open] { opacity: 0; transform: translateY(10px) scale(.985); }
}
dialog.sheet::backdrop {
  background: oklch(0.10 0.008 265 / 0.82); opacity: 0;
  transition: opacity .2s ease, overlay .2s allow-discrete, display .2s allow-discrete;
}
dialog.sheet[open]::backdrop { opacity: 1; }
@starting-style { dialog.sheet[open]::backdrop { opacity: 0; } }
.sheet__shot { position: relative; }
.sheet__shot img { width: 100%; height: 190px; object-fit: cover; background: var(--field); }
.sheet__close {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: oklch(0.12 0.008 265 / 0.75); border: 1px solid oklch(0.36 0.014 265);
  border-radius: 6px; color: var(--ink);
}
.sheet__body { padding: 26px 30px 30px; display: flex; flex-direction: column; gap: 20px; }
.sheet__title { font-family: var(--serif); font-size: 28px; line-height: 1.1; }
.sheet__meta { font-size: 13px; color: var(--muted); }
.sheet__label { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
                color: var(--brass); }
.block { display: flex; flex-direction: column; gap: 11px; }
.block + .block { border-top: 1px solid oklch(0.28 0.014 265); padding-top: 20px; }

.cells { display: flex; gap: 10px; }
.cells input {
  flex: 1; min-width: 0; height: 76px; text-align: center;
  font-family: var(--serif); font-size: 30px;
  background: var(--field); color: var(--ink);
  border: 1px solid oklch(0.34 0.014 265); border-radius: 0; outline: none;
  -moz-appearance: textfield;
}
.cells input::-webkit-outer-spin-button,
.cells input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cells input { transition: border-color .15s ease, box-shadow .15s ease; }
.cells input:focus { border-color: var(--brass); box-shadow: 0 0 0 3px oklch(0.78 0.095 82 / 0.20); }
@keyframes cellPop { from { transform: scale(.88); } to { transform: none; } }
.cells input.hit { animation: cellPop .16s cubic-bezier(.2,.8,.3,1.3); }
/* Code vollständig: die Reihe pulst einmal in Messing, während im Hintergrund
   schon generiert wird – das erklärt die kurze Pause vor dem Seitenwechsel. */
@keyframes cellsDone {
  0%   { box-shadow: 0 0 0 0 oklch(0.78 0.095 82 / 0.45); }
  100% { box-shadow: 0 0 0 12px oklch(0.78 0.095 82 / 0); }
}
.cells.done input { border-color: var(--brass); animation: cellsDone .5s ease-out; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: oklch(0.66 0.010 265); }
.field input {
  min-height: 50px; padding: 0 14px; font-size: 15.5px;
  background: var(--field); color: var(--ink);
  border: 1px solid oklch(0.34 0.014 265); outline: none;
}
.field input:focus { border-color: var(--brass); box-shadow: 0 0 0 3px oklch(0.78 0.095 82 / 0.14); }
.sheet__hint { display: flex; align-items: center; justify-content: space-between;
               gap: 16px; border-top: 1px solid oklch(0.28 0.014 265);
               padding-top: 14px; font-size: 12.5px; color: var(--muted); }
.sheet__body .btn-brass { min-height: 54px; font-size: 16px; }

/* --- Detailseite --------------------------------------------------------- */

.detail { padding: 24px 40px 64px; display: flex; flex-direction: column; gap: 22px; }
.back { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px;
        color: oklch(0.72 0.010 265); align-self: flex-start; }
.back:hover { color: var(--ink); }
.detail__cols { display: flex; align-items: flex-start; gap: 44px; }
.detail__shot { width: min(720px, 55%); flex: none; display: flex;
                flex-direction: column; gap: 10px; }
.detail__shot img { width: 100%; border: 1px solid var(--line); background: var(--field); }
.detail__shot figcaption { font-size: 12px; color: var(--dim); }
.detail__side { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
                gap: 26px; }
.detail__side h1 { font-family: var(--serif); font-size: 42px; line-height: 1.05; }
.detail__acts { display: flex; gap: 12px; flex-wrap: wrap; }
.detail__acts > * { flex: 1 1 200px; min-height: 54px; }
.dl-note { font-size: 12.5px; color: var(--dim); margin-top: -16px; }
.sec { display: flex; flex-direction: column; gap: 12px;
       border-top: 1px solid oklch(0.28 0.014 265); padding-top: 20px; }
.sec__title { font-family: var(--serif); font-size: 12px; letter-spacing: 0.20em;
              text-transform: uppercase; color: var(--brass); }
.kv { display: flex; justify-content: space-between; gap: 20px; font-size: 14px;
      border-bottom: 1px solid var(--line-soft); padding-bottom: 10px; }
.kv:last-child { border-bottom: 0; padding-bottom: 0; }
.kv > span:first-child { color: var(--muted); }
.kv .none { color: var(--dim); }
.place { display: flex; align-items: flex-start; gap: 12px; }
.place svg { color: var(--muted); margin-top: 3px; }
.place b { font-weight: 400; font-size: 15px; }
.place span { font-size: 13px; line-height: 1.5; color: var(--muted); }

/* --- Vollbild-Ergebnis --------------------------------------------------- */

body.show { background: var(--bg-deep); height: 100vh; display: flex;
            flex-direction: column; overflow: hidden; }
.show__bar { flex: none; display: flex; align-items: center; gap: 20px;
             padding: 16px 24px; flex-wrap: wrap; }
.show__bar h1 { font-family: var(--serif); font-size: 24px; }
.show__code { display: flex; gap: 6px; }
.show__code span {
  width: 32px; height: 38px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--brass-line); background: var(--field);
  font-size: 16px; color: var(--brass);
}
.show__acts { margin-left: auto; display: flex; gap: 10px; }
.show__stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center;
               justify-content: center; padding: 4px 32px 12px; }
/* Bewusst hochskaliert statt in Originalgröße: manche Grundbilder sind nur
   640x480 (z.B. Hotel) und lägen sonst verloren in der Mitte eines großen
   Schirms. In diesem Moment zählt Größe mehr als Schärfe – und auf dem Handy,
   dem eigentlichen Vorführgerät, füllt es ohnehin. Kein Rahmen: das Foto soll
   randlos wirken, nicht wie ein Bild in einem Katalog. */
.show__stage img { width: 100%; height: 100%; object-fit: contain; }
/* Ladezustand, solange gerendert wird. Ohne das zeigt der Browser für ein
   <img> ohne src sein Kaputt-Bild-Symbol – genau das war vorher zu sehen.
   Metapher passend zum Rest: das Foto wird entwickelt. */
.show__loading {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  color: var(--muted);
}
.show__loading svg { width: 46px; height: 46px; animation: spin 1.1s linear infinite; }
.show__loading circle { fill: none; stroke: var(--line); stroke-width: 2; }
.show__loading path {
  fill: none; stroke: var(--brass); stroke-width: 2; stroke-linecap: round;
}
.show__loading span {
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  animation: breathe 1.8s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

@keyframes revealIn {
  from { opacity: 0; transform: scale(.99); }
  to   { opacity: 1; transform: none; }
}
/* Der eigentliche Moment: die Vorhersage kommt herein, statt hart zu erscheinen.
   Etwas länger als alles andere auf der Seite – das darf man sehen. */
.show__stage img.in { animation: revealIn .55s cubic-bezier(.2,.7,.3,1) both; }
.show__bar { transition: opacity .45s ease; }
.show__foot { flex: none; text-align: center; padding: 0 24px 18px;
              font-size: 12.5px; color: oklch(0.44 0.010 265); }
.warn { color: oklch(0.80 0.09 60); font-size: 12.5px; }

/* --- Schmal: Filter als Sheet, Raster enger ------------------------------ */

.rail-toggle { display: none; }

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .topbar { padding: 14px 18px; gap: 14px; flex-wrap: wrap; }
  .topbar__search { order: 3; flex-basis: 100%; max-width: none; }
  .pagehead { padding: 26px 18px 22px; flex-direction: column;
              align-items: flex-start; gap: 22px; }
  .pagehead h1 { font-size: 30px; }
  .stats { gap: 32px; }
  .stat b { font-size: 28px; }
  .layout { flex-direction: column; }
  .rail {
    width: 100%; border-right: 0; border-bottom: 1px solid var(--line);
    padding: 18px; gap: 22px;
  }
  .rail[hidden] { display: none; }
  .rail-toggle { display: inline-flex; margin: 14px 18px 0; }
  .main { padding: 18px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .card__body { padding: 12px 13px 13px; gap: 6px; }
  .card__body h3 { font-size: 16px; }
  /* Ohne Hover kein Overlay – auf Touch führt ein Tipp direkt zum Dialog. */
  .card__over { display: none; }
  .detail { padding: 18px; }
  .detail__cols { flex-direction: column; gap: 24px; }
  .detail__shot { width: 100%; }
  .detail__side h1 { font-size: 32px; }
  dialog.sheet {
    width: 100vw; max-width: none; max-height: 92vh;
    margin: auto 0 0; border-bottom: 0; border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  dialog.sheet[open] { transform: none; }
  @starting-style { dialog.sheet[open] { transform: translateY(100%); } }
  .sheet__shot img { height: 120px; }
  .sheet__body { padding: 20px 18px 26px; }
  .show__bar { padding: 12px 14px; gap: 12px; }
  .show__bar h1 { font-size: 20px; }
  .show__stage { padding: 4px 12px 10px; }
}
