*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0d0d0f;
    --surface: #131316;
    --surface2: #18181d;
    --border: #222228;
    --muted: #919191;
    --dim: #6b6b7a;
    --text: #c9c9d4;
    --bright: #eeeef5;
    --accent: #c084fc;
    --danger: #f87171;
    --ok: #86efac;
    --radius: 4px;
    --mono: "DM Mono", monospace;
    --serif: "Bricolage Grotesque", "DM Serif Display", serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ── Header ───────────────────────────────────────────────────── */
header {
    padding: 3rem 2rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-title {
    font-family: var(--serif);
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--bright);
    letter-spacing: -0.02em;
    line-height: 1;
}

.site-title span {
    color: var(--accent);
}

.site-meta {
    color: var(--dim);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 0.5em;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
}

.post-count {
    color: var(--dim);
    font-size: 11px;
    letter-spacing: 0.05em;
}

.admin-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    letter-spacing: 0.05em;
    transition: color 0.2s;
}
.admin-link:hover {
    color: var(--accent);
}

/* ── Feed ─────────────────────────────────────────────────────── */
.feed {
    max-width: 680px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Post card ────────────────────────────────────────────────── */
.post {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border);
    animation: fadeUp 0.4s ease both;
}

.post:last-child {
    border-bottom: none;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post:nth-child(1) {
    animation-delay: 0.05s;
}
.post:nth-child(2) {
    animation-delay: 0.1s;
}
.post:nth-child(3) {
    animation-delay: 0.15s;
}
.post:nth-child(4) {
    animation-delay: 0.2s;
}
.post:nth-child(5) {
    animation-delay: 0.25s;
}
.post:nth-child(6) {
    animation-delay: 0.3s;
}

.post-timestamp {
    font-size: 11px;
    color: var(--dim);
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
}

.post-photo {
    display: block;
    width: 100%;
    cursor: zoom-in;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform 0.2s;
    background: var(--surface);
}

.post-photo:hover {
    transform: scale(1.03);
}

.post-caption {
    margin-top: 0.9rem;
    color: var(--text);
    font-size: 13px;
    line-height: 1.65;
    white-space: pre-wrap;
}

.post-caption:empty {
    display: none;
}
.post-caption a {
    color: var(--accent);
    text-decoration: none;
}
.post-caption a:hover {
    text-decoration: underline;
}

/* ── Lightbox ─────────────────────────────────────────────────── */
#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    cursor: zoom-out;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    backdrop-filter: blur(4px);
}

#lightbox.open {
    display: flex;
    animation: lbIn 0.2s ease;
}

@keyframes lbIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#lightbox img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.8);
    cursor: default;
    animation: lbImgIn 0.25s ease;
}

@keyframes lbImgIn {
    from {
        transform: scale(0.94);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

#lightbox-caption {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(13, 13, 15, 0.9);
    color: var(--text);
    font-family: var(--mono);
    font-size: 12px;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 600px;
    text-align: center;
    white-space: pre-wrap;
}

#lightbox-caption:empty {
    display: none;
}

/* ── Pagination ───────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 2rem 0 1rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-decoration: none;
    color: var(--dim);
    transition:
        color 0.15s,
        border-color 0.15s;
}

.pagination a:hover {
    color: var(--bright);
    border-color: var(--muted);
}

.pagination .current {
    color: var(--accent);
    border-color: var(--accent);
}

/* ── Empty state ──────────────────────────────────────────────── */
.empty {
    text-align: center;
    padding: 6rem 2rem;
    color: var(--dim);
}

.empty strong {
    display: block;
    font-family: var(--serif);
    font-size: 1.8rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.empty-link {
    color: var(--accent);
    text-decoration: none;
}

/* ── Footer ───────────────────────────────────────────────────── */
footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-align: center;
}

/* ── Login ────────────────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-box {
    width: 100%;
    max-width: 320px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    background: var(--surface);
}

.login-title {
    font-family: var(--serif);
    font-size: 1.8rem;
    color: var(--bright);
    margin-bottom: 1.5rem;
}

.login-title span {
    color: var(--accent);
}

/* ── Layout ───────────────────────────────────────────────────── */
.admin-wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-title {
    font-family: var(--serif);
    font-size: 1.8rem;
    color: var(--bright);
}

.admin-title span {
    color: var(--accent);
}

.header-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* ── Form ─────────────────────────────────────────────────────── */
.post-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2.5rem;
}

.form-title {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dim);
    margin-bottom: 1.2rem;
}

.drop-zone {
    border: 1px dashed var(--muted);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition:
        border-color 0.2s,
        background 0.2s;
    color: var(--dim);
    margin-bottom: 1rem;
    position: relative;
    font-size: 12px;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(192, 132, 252, 0.04);
    color: var(--text);
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.drop-zone .preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius);
    margin-top: 0.75rem;
    display: none;
}

.drop-zone.has-file .preview {
    display: block;
}
.drop-zone.has-file .drop-hint {
    display: none;
}

textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    padding: 0.75rem;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 1rem;
}

textarea:focus {
    border-color: var(--muted);
}
textarea::placeholder {
    color: var(--muted);
}

/* ── Buttons & links ──────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    cursor: pointer;
    text-decoration: none;
    transition:
        opacity 0.15s,
        background 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #0d0d0f;
    border-color: var(--accent);
    font-weight: 500;
}

.btn-primary:hover {
    opacity: 0.85;
}

.btn-ghost {
    background: transparent;
    color: var(--dim);
    border-color: var(--border);
}

.btn-ghost:hover {
    color: var(--bright);
    border-color: var(--muted);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: transparent;
    padding: 0;
    font-size: 11px;
    letter-spacing: 0.05em;
}

.btn-danger:hover {
    text-decoration: underline;
}

.btn-full {
    width: 100%;
}

/* ── Password input ───────────────────────────────────────────── */
input[type="password"] {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    padding: 0.65rem 0.75rem;
    outline: none;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

input[type="password"]:focus {
    border-color: var(--muted);
}

/* ── Message ──────────────────────────────────────────────────── */
.msg {
    font-size: 12px;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid;
}

.msg-ok {
    color: var(--ok);
    border-color: rgba(134, 239, 172, 0.3);
    background: rgba(134, 239, 172, 0.05);
}
.msg-err {
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.05);
}

/* ── Post list ────────────────────────────────────────────────── */
.section-title {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dim);
    margin-bottom: 1rem;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.post-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}

.post-row:hover {
    border-color: var(--muted);
}

.post-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: var(--radius);
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--surface2);
}

.post-thumb-placeholder {
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 18px;
}

.post-info {
    flex: 1;
    min-width: 0;
}

.post-ts {
    font-size: 11px;
    color: var(--dim);
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.post-cap {
    color: var(--text);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-cap:empty::after {
    content: "(no caption)";
    color: var(--muted);
    font-style: italic;
}

.post-actions {
    flex-shrink: 0;
    padding-top: 2px;
}

.empty-list {
    color: var(--dim);
    font-size: 12px;
    padding: 2rem;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.form-center {
    margin-top: 1rem;
    text-align: center;
}

.form-inline {
    display: inline;
}

.drop-hint-small {
    font-size: 11px;
    color: var(--muted);
}

/* ── Wall ─────────────────────────────────────────────────────── */
.wall-header {
    padding: 2rem 2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.wall-title-group {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.wall-title {
    font-family: var(--serif);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--bright);
    letter-spacing: -0.02em;
    line-height: 1;
}

.wall-title span {
    color: var(--accent);
}

.wall-count {
    color: var(--dim);
    font-size: 11px;
    letter-spacing: 0.06em;
}

.wall-nav {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Photo grid ───────────────────────────────────────────────── */
.wall-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 3px;
    padding: 3px;
}

@media (max-width: 480px) {
    .wall-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 2px;
        padding: 2px;
    }
}

@media (min-width: 900px) {
    .wall-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (min-width: 1400px) {
    .wall-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

.wall-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--surface);
    cursor: zoom-in;
    animation: cellIn 0.35s ease both;
}

.wall-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition:
        transform 0.3s ease,
        opacity 0.3s ease;
    opacity: 0;
}

.wall-item img.loaded {
    opacity: 1;
}

.wall-item:hover img {
    transform: scale(1.06);
}

.wall-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(192, 132, 252, 0);
    transition: background 0.2s ease;
    pointer-events: none;
}

.wall-item:hover::after {
    background: rgba(192, 132, 252, 0.08);
}

@keyframes cellIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Staggered animation delays for first 30 items */
.wall-item:nth-child(1) {
    animation-delay: 0.018s;
}
.wall-item:nth-child(2) {
    animation-delay: 0.036s;
}
.wall-item:nth-child(3) {
    animation-delay: 0.054s;
}
.wall-item:nth-child(4) {
    animation-delay: 0.072s;
}
.wall-item:nth-child(5) {
    animation-delay: 0.09s;
}
.wall-item:nth-child(6) {
    animation-delay: 0.108s;
}
.wall-item:nth-child(7) {
    animation-delay: 0.126s;
}
.wall-item:nth-child(8) {
    animation-delay: 0.144s;
}
.wall-item:nth-child(9) {
    animation-delay: 0.162s;
}
.wall-item:nth-child(10) {
    animation-delay: 0.18s;
}
.wall-item:nth-child(11) {
    animation-delay: 0.198s;
}
.wall-item:nth-child(12) {
    animation-delay: 0.216s;
}
.wall-item:nth-child(13) {
    animation-delay: 0.234s;
}
.wall-item:nth-child(14) {
    animation-delay: 0.252s;
}
.wall-item:nth-child(15) {
    animation-delay: 0.27s;
}
.wall-item:nth-child(16) {
    animation-delay: 0.288s;
}
.wall-item:nth-child(17) {
    animation-delay: 0.306s;
}
.wall-item:nth-child(18) {
    animation-delay: 0.324s;
}
.wall-item:nth-child(19) {
    animation-delay: 0.342s;
}
.wall-item:nth-child(20) {
    animation-delay: 0.36s;
}
.wall-item:nth-child(21) {
    animation-delay: 0.378s;
}
.wall-item:nth-child(22) {
    animation-delay: 0.396s;
}
.wall-item:nth-child(23) {
    animation-delay: 0.414s;
}
.wall-item:nth-child(24) {
    animation-delay: 0.432s;
}
.wall-item:nth-child(25) {
    animation-delay: 0.45s;
}
.wall-item:nth-child(26) {
    animation-delay: 0.468s;
}
.wall-item:nth-child(27) {
    animation-delay: 0.486s;
}
.wall-item:nth-child(28) {
    animation-delay: 0.504s;
}
.wall-item:nth-child(29) {
    animation-delay: 0.522s;
}
.wall-item:nth-child(30) {
    animation-delay: 0.54s;
}

/* ── Wall empty state ─────────────────────────────────────────── */
.wall-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: 0.75rem;
    color: var(--dim);
}

.wall-empty strong {
    font-family: var(--serif);
    font-size: 1.8rem;
    color: var(--muted);
}

/* ── Wall lightbox ────────────────────────────────────────────── */
#wall-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 7, 0.96);
    z-index: 1000;
    cursor: zoom-out;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2rem;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

#wall-lightbox.open {
    display: flex;
    animation: lbIn 0.18s ease;
}

@keyframes lbIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#wall-lb-img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.9);
    cursor: default;
    animation: lbImgIn 0.22s ease;
    object-fit: contain;
}

@keyframes lbImgIn {
    from {
        transform: scale(0.93);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

#wall-lb-meta {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    pointer-events: none;
}

#wall-lb-caption {
    color: var(--text);
    font-family: var(--mono);
    font-size: 12px;
    text-align: center;
    max-width: 560px;
    line-height: 1.6;
    white-space: pre-wrap;
}

#wall-lb-caption:empty {
    display: none;
}

#wall-lb-ts {
    color: var(--dim);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.06em;
}

.lb-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(20, 20, 24, 0.7);
    border: 1px solid var(--border);
    color: var(--dim);
    font-size: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        color 0.15s,
        border-color 0.15s,
        background 0.15s;
    z-index: 1001;
    user-select: none;
}

.lb-arrow:hover {
    color: var(--bright);
    border-color: var(--muted);
    background: rgba(30, 30, 36, 0.9);
}

#lb-prev {
    left: 1rem;
}
#lb-next {
    right: 1rem;
}

.lb-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(20, 20, 24, 0.7);
    border: 1px solid var(--border);
    color: var(--dim);
    font-size: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition:
        color 0.15s,
        border-color 0.15s;
}

.lb-close:hover {
    color: var(--bright);
    border-color: var(--muted);
}

#wall-lb-counter {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--dim);
    font-family: var(--mono);
    z-index: 1001;
}
