:root {
    color-scheme: dark;
    font-family: Arial, Helvetica, sans-serif;
    background: #090909;
    color: #f2f2f2;
    line-height: 1.5;
}

* {
    box-sizing: border-box;
}

html {
    background: #090909;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #090909;
}

.background-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 15% 15%, rgba(255,255,255,0.05), transparent 26rem),
        radial-gradient(circle at 80% 25%, rgba(255,255,255,0.035), transparent 24rem),
        linear-gradient(180deg, #111111 0%, #070707 100%);
}

a {
    color: inherit;
    text-underline-offset: 0.25rem;
}

button,
input,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    min-height: 4.8rem;
    padding: 0 4vw;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    background: rgba(8,8,8,0.82);
    backdrop-filter: blur(18px);
}

.site-header nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.1rem;
}

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: 0.75rem;
    width: max-content;
    text-decoration: none;
}

.brand strong {
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand span,
.header-tagline,
.site-footer,
.card-meta,
.admin-count {
    color: #8d8d8d;
    font-size: 0.78rem;
}

.header-tagline {
    margin: 0;
    letter-spacing: 0.04em;
}

.inline-form {
    display: inline;
}

.text-button,
.danger-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.25rem;
    cursor: pointer;
}

.danger-button {
    color: #d9a9a9;
}

.page-shell {
    width: min(1320px, 92vw);
    margin: 0 auto;
    padding: 5.5rem 0;
}

.intro {
    max-width: 900px;
    margin: 0 auto 3.5rem;
    text-align: center;
}

.intro h1,
.admin-heading h1,
.form-panel h1 {
    margin: 0 0 0.8rem;
    font-size: clamp(3rem, 9vw, 7.4rem);
    line-height: 0.92;
    letter-spacing: -0.065em;
}

.intro > p:last-child {
    margin: 0 auto;
    color: #b5b5b5;
    font-size: 1rem;
    letter-spacing: 0.04em;
}

.eyebrow,
.card-category {
    margin: 0 0 0.6rem;
    color: #8c8c8c;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.55rem;
    margin-bottom: 2.25rem;
}

.filter {
    padding: 0.52rem 0.8rem;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 999px;
    color: #a7a7a7;
    background: rgba(255,255,255,0.025);
    text-decoration: none;
}

.filter span {
    margin-left: 0.35rem;
    color: #6f6f6f;
}

.filter:hover,
.filter.active {
    border-color: #f2f2f2;
    color: #f2f2f2;
}

.gallery {
    columns: 3 300px;
    column-gap: 0.9rem;
}

.card {
    display: inline-block;
    width: 100%;
    margin: 0 0 0.9rem;
    overflow: hidden;
    break-inside: avoid;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 0.65rem;
    background: rgba(18,18,18,0.82);
    box-shadow: 0 16px 50px rgba(0,0,0,0.22);
}

.post-images {
    display: grid;
    gap: 2px;
    background: #050505;
}

.post-images.image-count-2,
.post-images.image-count-3,
.post-images.image-count-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-images.image-count-3 .media-button:first-child {
    grid-row: span 2;
}

.media-button {
    display: block;
    width: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: #050505;
    cursor: zoom-in;
}

.media-button img {
    display: block;
    width: 100%;
    min-height: 190px;
    max-height: 620px;
    object-fit: cover;
    transition: transform 180ms ease, opacity 180ms ease;
}

.image-count-1 .media-button img {
    height: auto;
    min-height: 220px;
    object-fit: contain;
}

.image-count-2 .media-button img,
.image-count-3 .media-button img,
.image-count-4 .media-button img {
    height: 240px;
}

.media-button:hover img {
    transform: scale(1.012);
    opacity: 0.94;
}

.card-copy {
    padding: 1.1rem 1.15rem 1.2rem;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.card-meta p {
    margin-top: 0;
}

.card-copy h2 {
    margin: 0 0 0.55rem;
    font-size: 1.2rem;
    letter-spacing: -0.025em;
}

.post-body {
    margin: 0;
    color: #bcbcbc;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 3rem;
    color: #a5a5a5;
}

.empty-state {
    padding: 5rem 1rem;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 0.65rem;
    text-align: center;
}

.empty-state h2 {
    margin-top: 0;
    font-size: 2rem;
}

.messages {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.message {
    padding: 0.85rem 1rem;
    border: 1px solid #3a3a3a;
    border-radius: 0.5rem;
    background: #171717;
}

.message.error {
    border-color: #714040;
}

.message.success {
    border-color: #416f4d;
}

.form-panel,
.post-list-panel {
    padding: 2rem;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 0.7rem;
    background: rgba(15,15,15,0.88);
    backdrop-filter: blur(14px);
}

.form-panel.narrow {
    width: min(720px, 100%);
    margin: 0 auto;
}

.form-panel h1 {
    margin-bottom: 2rem;
    font-size: clamp(2.5rem, 7vw, 5rem);
}

.form-panel h2,
.post-list-panel h2 {
    margin-top: 0;
}

.form-panel form {
    display: grid;
    gap: 0.75rem;
}

.form-panel label {
    margin-top: 0.5rem;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    border: 1px solid #373737;
    border-radius: 0.45rem;
    outline: none;
    background: #080808;
    color: #f2f2f2;
}

input {
    min-height: 2.9rem;
    padding: 0 0.8rem;
}

textarea {
    min-height: 8rem;
    padding: 0.8rem;
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: #d8d8d8;
}

.upload-box {
    position: relative;
    display: grid;
    place-items: center;
    gap: 0.35rem;
    min-height: 155px;
    padding: 1.5rem;
    border: 1px dashed #555555;
    border-radius: 0.55rem;
    background: #0a0a0a;
    text-align: center;
    transition: border-color 150ms ease, background 150ms ease;
}

.upload-box.dragging {
    border-color: #f2f2f2;
    background: #151515;
}

.upload-box input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-box span {
    color: #8f8f8f;
    font-size: 0.84rem;
}

.upload-preview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
}

.upload-preview:empty {
    display: none;
}

.upload-preview > div {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #2d2d2d;
    border-radius: 0.45rem;
    background: #090909;
}

.upload-preview img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.upload-preview span {
    display: block;
    padding: 0.45rem;
    overflow: hidden;
    color: #999999;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.primary-button {
    min-height: 2.9rem;
    margin-top: 1rem;
    border: 1px solid #f2f2f2;
    border-radius: 0.45rem;
    background: #f2f2f2;
    color: #0c0c0c;
    font-weight: 700;
    cursor: pointer;
}

.primary-button:hover {
    background: #d8d8d8;
}

.primary-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.admin-heading {
    margin-bottom: 2rem;
}

.admin-heading h1 {
    font-size: clamp(2.8rem, 7vw, 5rem);
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 1.25rem;
    align-items: start;
}

.admin-post-list {
    display: grid;
    gap: 0.75rem;
}

.admin-post {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #292929;
    border-radius: 0.5rem;
    background: #0b0b0b;
}

.admin-post h3,
.admin-count {
    margin: 0;
}

.admin-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.existing-images {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    margin: 0.5rem 0 1rem;
}

.existing-image {
    display: grid;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid #2d2d2d;
    border-radius: 0.55rem;
    background: #090909;
}

.existing-image img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 0.35rem;
    object-fit: cover;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 400;
}

.checkbox-row input {
    width: auto;
    min-height: auto;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-actions .primary-button {
    flex: 1;
}

.image-viewer {
    width: min(1200px, 96vw);
    max-width: none;
    max-height: 95vh;
    padding: 0;
    overflow: hidden;
    border: 1px solid #343434;
    border-radius: 0.65rem;
    background: #050505;
    color: #f2f2f2;
}

.image-viewer::backdrop {
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(10px);
}

.viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #272727;
}

.viewer-toolbar button {
    border: 0;
    background: transparent;
    color: #f2f2f2;
    text-decoration: underline;
    text-underline-offset: 0.22rem;
    cursor: pointer;
}

.viewer-toolbar span {
    margin-right: auto;
    color: #8d8d8d;
    font-size: 0.82rem;
}

.viewer-stage {
    display: grid;
    place-items: center;
    min-height: 65vh;
    background: #030303;
}

.image-viewer img {
    display: block;
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
}

.viewer-caption {
    margin: 0;
    padding: 0.9rem 1rem;
    color: #b5b5b5;
    white-space: pre-wrap;
}

.site-footer {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.5rem 5vw;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.setup-state {
    max-width: 720px;
    margin: 8rem auto;
}

.setup-values {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.setup-values code {
    padding: 0.65rem 0.8rem;
    border: 1px solid currentColor;
    font-family: inherit;
}

@media (max-width: 900px) {
    .site-header {
        grid-template-columns: 1fr auto;
    }

    .header-tagline {
        display: none;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .site-header {
        min-height: 4.3rem;
        padding: 0 1rem;
    }

    .site-header nav {
        gap: 0.75rem;
        font-size: 0.88rem;
    }

    .brand span {
        display: none;
    }

    .page-shell {
        width: min(94vw, 1320px);
        padding: 3.5rem 0;
    }

    .intro {
        margin-bottom: 2.5rem;
    }

    .gallery {
        columns: 2 140px;
        column-gap: 0.55rem;
    }

    .card {
        margin-bottom: 0.55rem;
    }

    .post-images.image-count-2,
    .post-images.image-count-3,
    .post-images.image-count-4 {
        grid-template-columns: 1fr;
    }

    .post-images.image-count-3 .media-button:first-child {
        grid-row: auto;
    }

    .media-button img,
    .image-count-1 .media-button img,
    .image-count-2 .media-button img,
    .image-count-3 .media-button img,
    .image-count-4 .media-button img {
        min-height: 120px;
        height: auto;
        max-height: 360px;
    }

    .card-copy {
        padding: 0.8rem;
    }

    .card-copy h2 {
        font-size: 1rem;
    }

    .post-body {
        font-size: 0.86rem;
    }

    .form-panel,
    .post-list-panel {
        padding: 1.15rem;
    }

    .admin-post {
        align-items: flex-start;
        flex-direction: column;
    }

    .upload-preview,
    .existing-images {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .viewer-toolbar {
        gap: 0.65rem;
        font-size: 0.86rem;
    }
}
