:root {
    --bg: #EDEFF1;
    --surface: #FFFFFF;
    --ink: #13171C;
    --muted: #5A6471;
    --line: #D3D8DE;
    --accent: #2A4BE8;
    --on-accent: #FFFFFF;
    --danger: #B3261E;
    --display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #101318;
        --surface: #181C22;
        --ink: #ECEFF3;
        --muted: #9AA4B1;
        --line: #2A3039;
        --accent: #8CA0FF;
        --on-accent: #0E1220;
        --danger: #FF8A80;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.55 "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
code { font-size: .9em; background: var(--line); padding: 1px 6px; border-radius: 4px; }

.wrap { max-width: 1480px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px); }

/* ---------- Header ---------- */
.top {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
    gap: 14px 40px; padding: 32px 0 24px;
}
.brand {
    font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 5vw, 3.1rem);
    letter-spacing: -.035em; line-height: 1; text-decoration: none;
}
.tagline { margin: 8px 0 0; color: var(--muted); max-width: 46ch; }
.albums { display: flex; flex-wrap: wrap; gap: 2px 24px; list-style: none; margin: 0; padding: 0; }
.albums a {
    display: inline-block; padding: 8px 0; text-decoration: none; color: var(--muted);
    border-bottom: 2px solid transparent; font-weight: 500;
}
.albums a:hover { color: var(--ink); }
.albums a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.albums .n { font-size: .78rem; margin-left: 6px; color: var(--muted); font-weight: 400; }

/* ---------- Photo wall ---------- */
.wall { column-width: 260px; column-gap: 14px; }
.photo {
    display: block; margin: 0 0 14px; break-inside: avoid;
    background: var(--line); border-radius: 3px; overflow: hidden; cursor: zoom-in;
}
.photo img { display: block; width: 100%; height: auto; }
.js .photo img { opacity: 0; transition: opacity .6s ease; }
.js .photo img.loaded { opacity: 1; }

.empty { padding: 80px 0; text-align: center; color: var(--muted); }
.foot {
    display: flex; justify-content: space-between; gap: 16px;
    padding: 40px 0 32px; color: var(--muted); font-size: .9rem;
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* ---------- Lightbox ---------- */
.lb {
    position: fixed; inset: 0; z-index: 50; background: rgba(9, 11, 15, .97); color: #EEF1F5;
}
.lb[hidden] { display: none; }
.lb-fig { margin: 0; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.lb-stage {
    min-height: 0; display: flex; align-items: center; justify-content: center;
    padding: 64px clamp(12px, 7vw, 96px) 8px;
}
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-cap {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 10px 24px 24px; text-align: center; min-height: 72px;
}
.lb-title { font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.lb-text { max-width: 60ch; color: #C3CAD4; }
.lb-meta { font-size: .85rem; color: #8E98A6; }
.lb-btn {
    position: absolute; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px;
    border: 0; border-radius: 50%; background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, .18); }
.lb-btn:focus-visible { outline-color: #fff; }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) {
    .lb-prev, .lb-next { top: auto; bottom: 18px; transform: none; }
    .lb-stage { padding: 64px 8px 8px; }
}

/* ---------- Auth & admin ---------- */
.narrow { max-width: 420px; margin: 0 auto; padding: 72px 0; }
.narrow h1, .admin h1, .admin h2 { font-family: var(--display); letter-spacing: -.02em; margin: 0 0 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.field { display: block; margin-bottom: 16px; font-weight: 500; font-size: .93rem; }
.field small { display: block; color: var(--muted); font-weight: 400; margin-top: 4px; }
input[type=text], input[type=password], input[type=file], textarea, select {
    display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit; color: var(--ink);
    background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
textarea { resize: vertical; }
.btn {
    display: inline-block; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer;
    background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); border-radius: 6px;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn.small { padding: 6px 12px; font-size: .88rem; }

.notice { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface); }
.notice.error { border-color: var(--danger); color: var(--danger); }
.notice.ok { border-color: var(--accent); }

.admin { padding-bottom: 48px; }
.admin-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px; padding: 24px 0;
}
.admin-bar .brand { font-size: 1.6rem; }
.admin-bar nav { display: flex; gap: 10px; align-items: center; }
.admin-bar form { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; margin-bottom: 32px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 0; }
.card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.card .body { padding: 14px; }
.card .field { margin-bottom: 10px; font-size: .85rem; }
.album-list { list-style: none; margin: 0; padding: 0; }
.album-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.album-list form { margin: 0; }

@media (prefers-reduced-motion: reduce) {
    .js .photo img { transition: none; }
}
