/* ─── Die Werkbank — was der Besitzer sieht ──────────────────────────────────

   Ein Werkzeug, kein Geschenk. Dicht, dunkel, viel Information auf einmal.
   Der Gegenentwurf zur Uhr, und das mit Absicht: hier wird gearbeitet, dort
   wird geschaut.

   Struktur statt Dekoration — die Trennlinien und Beschriftungen tragen
   Information (wem gehoert die Uhr, wie viele Geraete haengen dran, laeuft
   sie noch), sie sind nicht da, um die Flaeche zu gliedern. */

body {
    background: var(--vortex);
    color: var(--bone);
}

.rahmen {
    max-width: 74rem;
    margin: 0 auto;
    padding: 0 1.5rem 5rem;
}

/* ─── Kopf ───────────────────────────────────────────────────────────────── */

.kopfleiste {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 1.5rem 0 1.25rem;
    border-bottom: 1px solid var(--vortex-kante);
    margin-bottom: 2.5rem;
}

.marke {
    font-family: var(--schrift-display);
    font-size: 1.35rem;
    color: var(--brass);
}

.kopfleiste .wer {
    color: #7A8B96;
    font-size: 0.9rem;
}

/* ─── Knöpfe ─────────────────────────────────────────────────────────────── */

.knopf {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.3rem;
    border-radius: var(--rund);
    background: var(--brass);
    color: var(--vortex);
    font-weight: 500;
    letter-spacing: var(--spur);
    transition: background 0.15s ease;
}

.knopf:hover { background: var(--brass-hell); }
.knopf[disabled] { opacity: 0.45; cursor: default; }

.knopf.leise {
    background: transparent;
    color: var(--bone);
    border: 1px solid var(--vortex-kante);
}

.knopf.leise:hover { border-color: var(--brass); }

.knopf.gefahr {
    background: transparent;
    color: var(--ember);
    border: 1px solid color-mix(in srgb, var(--ember) 45%, transparent);
}

.knopf.gefahr:hover { background: color-mix(in srgb, var(--ember) 12%, transparent); }

/* ─── Abschnitte ─────────────────────────────────────────────────────────── */

.abschnitt { margin-bottom: 3.5rem; }

/* ⚠️ flex-wrap ist hier Pflicht. Ohne das schiebt die Werkzeugleiste den
   Kopf auf schmalen Displays ueber den Rand hinaus, sobald ein Foto
   ausgewaehlt ist und die beiden Knoepfe erscheinen -- die Seite scrollt
   dann seitwaerts und der rechte Knopf ist nicht mehr erreichbar. */
.abschnitt-kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.6rem 1rem;
    margin-bottom: 1.25rem;
}

.abschnitt-kopf h2 { font-size: 1.4rem; }

.abschnitt-kopf .zahl {
    color: #6C7C88;
    font-size: 0.9rem;
}

.abschnitt-kopf .werkzeuge {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* Auf schmalen Displays bekommt die Werkzeugleiste eine eigene Zeile und
   fuellt sie aus, statt sich neben die Ueberschrift zu quetschen. */
@media (max-width: 640px) {
    .abschnitt-kopf .werkzeuge {
        margin-left: 0;
        width: 100%;
    }
    .abschnitt-kopf .werkzeuge > * { flex: 1 1 auto; justify-content: center; }
}

/* ─── Bestand ────────────────────────────────────────────────────────────── */

.bestand {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
    gap: 0.6rem;
}

.kachel {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--rund);
    background: var(--vortex-hoch);
    border: 1px solid var(--vortex-kante);
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    display: block;
    transition: border-color 0.15s ease;
}

.kachel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Datum und Format liegen als Band unten auf dem Bild -- lesbar, ohne das
   Motiv zu verdecken. */
.kachel .zeile {
    position: absolute;
    inset: auto 0 0 0;
    padding: 0.3rem 0.45rem;
    background: linear-gradient(transparent, rgba(14, 20, 24, 0.85));
    color: var(--bone);
    font-size: 0.7rem;
    text-align: left;
    pointer-events: none;
}

.kachel:hover { border-color: #3A4B57; }

.kachel[aria-pressed="true"] {
    border-color: var(--brass);
    box-shadow: inset 0 0 0 2px var(--brass);
}

.kachel .haken {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--brass);
    color: var(--vortex);
    display: none;
    place-items: center;
    font-size: 0.8rem;
}

.kachel[aria-pressed="true"] .haken { display: grid; }

.leer {
    border: 1px dashed var(--vortex-kante);
    border-radius: var(--rund);
    padding: 3rem 1.5rem;
    text-align: center;
    color: #6C7C88;
}

.leer p { margin: 0 0 1.25rem; text-wrap: pretty; }

/* ─── Uhren ──────────────────────────────────────────────────────────────── */

.uhren { display: flex; flex-direction: column; gap: 0.75rem; }

.uhr-zeile {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem 1.5rem;
    align-items: start;
    padding: 1.1rem 1.25rem;
    background: var(--vortex-hoch);
    border: 1px solid var(--vortex-kante);
    border-left: 3px solid var(--patina);
    border-radius: 0 var(--rund) var(--rund) 0;
}

/* Auf schmalen Displays untereinander. Nebeneinander blieben fuer den Text
   nur ~65px von 375px uebrig -- "wartet auf das erste Oeffnen" brach dann
   auf sechs Zeilen um, waehrend die Knoepfe daneben zwei Drittel der Breite
   belegten. */
@media (max-width: 640px) {
    .uhr-zeile { grid-template-columns: 1fr; }
    .uhr-zeile .taten .knopf { flex: 1 1 auto; justify-content: center; }
}

/* Die linke Kante traegt den Zustand: gruen laeuft, messing wartet auf das
   erste Oeffnen, rot ist versiegelt. */
.uhr-zeile.wartet { border-left-color: var(--brass); }
.uhr-zeile.versiegelt { border-left-color: var(--ember); opacity: 0.6; }

.uhr-zeile h3 { font-size: 1.05rem; font-weight: 500; margin-bottom: 0.2rem; }

.uhr-zeile .fakten {
    color: #7A8B96;
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.1rem;
}

.uhr-zeile .taten { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.uhr-zeile .taten .knopf { padding: 0.4rem 0.9rem; font-size: 0.85rem; }

/* ─── Link-Ausgabe ───────────────────────────────────────────────────────── */

.linkfeld {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.7rem 0.85rem;
    background: var(--vortex);
    border: 1px solid var(--brass);
    border-radius: var(--rund);
}

.linkfeld input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    color: var(--bone);
    font-family: var(--schrift-ui);
    font-size: 0.85rem;
}

.linkfeld input:focus { outline: none; }

/* ─── Formular ───────────────────────────────────────────────────────────── */

dialog {
    background: var(--vortex-hoch);
    color: var(--bone);
    border: 1px solid var(--vortex-kante);
    border-radius: var(--rund);
    padding: 0;
    max-width: 30rem;
    width: calc(100% - 2rem);
}

dialog::backdrop { background: rgba(6, 10, 12, 0.75); }

.dialog-inhalt { padding: 1.75rem; }
.dialog-inhalt h2 { margin-bottom: 0.4rem; }
.dialog-inhalt .lead { color: #7A8B96; font-size: 0.9rem; margin: 0 0 1.5rem; }

label { display: block; margin-bottom: 1.1rem; font-size: 0.9rem; }
label span { display: block; margin-bottom: 0.35rem; color: #9BAAB4; }

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--vortex);
    border: 1px solid var(--vortex-kante);
    border-radius: var(--rund);
    color: var(--bone);
    font: inherit;
}

input[type="text"]:focus, select:focus { border-color: var(--brass); outline: none; }

.zeile-zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }

.schalter {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin-bottom: 1.1rem;
    font-size: 0.9rem;
}

.schalter input { margin-top: 0.25rem; flex: none; }
.schalter .erklaerung { color: #6C7C88; font-size: 0.82rem; display: block; }

.dialog-fuss {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 1rem 1.75rem 1.75rem;
}

/* ─── Meldungen ──────────────────────────────────────────────────────────── */

.meldung {
    padding: 0.85rem 1.1rem;
    border-radius: var(--rund);
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
    border-left: 3px solid var(--patina);
    background: var(--vortex-hoch);
}

.meldung.schlecht { border-left-color: var(--ember); }

.anmelden { display: grid; place-items: center; min-height: 70vh; text-align: center; }
.anmelden h1 { font-size: 2.4rem; margin-bottom: 0.5rem; }
.anmelden p { color: #7A8B96; margin: 0 0 2rem; max-width: 26rem; text-wrap: pretty; }


/* ─── Uhr-Detail ─────────────────────────────────────────────────────────── */

.uhr-zeile h3 { cursor: pointer; }
.uhr-zeile h3:hover { color: var(--brass); }

dialog.breit { max-width: 46rem; }

.detail-bilder {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.6rem;
    margin: 1rem 0 1.5rem;
}

.detail-bild {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--rund);
    overflow: hidden;
    border: 1px solid var(--vortex-kante);
}

.detail-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }

.detail-bild .weg {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(14, 20, 24, 0.8);
    color: var(--bone);
    display: grid;
    place-items: center;
    font-size: 1rem;
    line-height: 1;
}

.detail-bild .weg:hover { background: var(--ember); }

/* Version in der Kopfleiste. Vorher lag sie fixiert unten rechts und legte
   sich dort ueber die letzte Reihe der Vorschaubilder -- in der Kopfzeile
   ist sie genauso auffindbar und stoert nichts.
   Beim Melden eines Fehlers ist die erste Frage immer, welcher Stand lief. */
.kopfleiste .version {
    margin-left: auto;
    color: #4A5761;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}
