:root {
    --background: #f6f7f8;
    --surface: #ffffff;
    --ink: #171717;
    --muted: #68707a;
    --line: #dfe4e8;
    --accent: #1f5f53;
    --accent-strong: #15473d;
    --danger: #b33535;
    --shadow: 0 18px 48px rgba(27, 27, 25, 0.11);
    --tile-size: 300px;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--background);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

body.has-lightbox {
    overflow: hidden;
}

body.is-loading {
    overflow: hidden;
}

button,
input,
textarea {
    font: inherit;
    letter-spacing: 0;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

.loading-curtain {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: #fff;
    opacity: 1;
    visibility: visible;
    transition: opacity 420ms ease, visibility 420ms ease;
}

.loading-curtain.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-banner {
    width: min(520px, 78vw);
    height: auto;
    max-height: 42vh;
    object-fit: contain;
}

.site-shell {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 24px;
}

.brand {
    font-size: clamp(24px, 6vw, 42px);
    font-weight: 700;
    line-height: 1;
}

.gallery-stage {
    position: relative;
    width: 100%;
    min-height: calc(var(--tile-size) + 44px);
    margin-top: 0;
}

.gallery-stage.is-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--tile-size), var(--tile-size)));
    justify-content: center;
    align-items: center;
    gap: 24px;
}

.picture-tile {
    width: var(--tile-size);
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    cursor: zoom-in;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    align-self: center;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.picture-tile:hover,
.picture-tile:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 24px 60px rgba(27, 27, 25, 0.18);
    outline: none;
}

.picture-tile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.site-footer {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 18px 0 32px;
    display: flex;
    justify-content: center;
    gap: 22px;
    color: var(--muted);
    font-size: 14px;
}

.site-footer a:hover,
.site-footer a:focus-visible {
    color: var(--ink);
}

.legal-page {
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    padding: 44px 0 64px;
    line-height: 1.7;
}

.legal-page h1 {
    margin: 22px 0 24px;
    font-size: clamp(32px, 8vw, 54px);
    line-height: 1;
}

.legal-page h2 {
    margin: 28px 0 8px;
    font-size: 20px;
}

.legal-page p {
    margin: 0;
    color: var(--muted);
}

.back-link {
    color: var(--muted);
    font-size: 14px;
}

.empty-state {
    min-height: 54vh;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 18px;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(246, 247, 248, 0.88);
    backdrop-filter: blur(12px);
}

.lightbox[aria-hidden="false"] {
    display: flex;
}

.lightbox-dialog {
    max-width: min(960px, 100%);
    max-height: 92vh;
}

.lightbox-dialog img {
    width: auto;
    max-width: 100%;
    max-height: 76vh;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
    object-fit: contain;
}

.lightbox-copy {
    width: min(760px, 100%);
    margin: 18px auto 0;
    text-align: center;
}

.lightbox-copy h1 {
    margin: 0 0 6px;
    font-size: clamp(22px, 4vw, 34px);
    line-height: 1.1;
}

.lightbox-copy p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.lightbox-close {
    position: fixed;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.admin-page {
    background: #f6f7f8;
}

.admin-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 54px;
}

.admin-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.admin-header p {
    margin: 8px 0 0;
    color: var(--muted);
}

.admin-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-panel {
    margin: 22px 0;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.admin-panel.compact {
    width: min(420px, 100%);
}

.admin-panel h1 {
    margin: 0 0 18px;
    font-size: 24px;
}

label {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 14px;
}

.form-hint {
    grid-column: 1 / -1;
    margin: -6px 0 16px;
    color: var(--muted);
    font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 11px 12px;
}

textarea {
    resize: vertical;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font-weight: 650;
}

.button.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.button.primary:hover {
    background: var(--accent-strong);
}

.button.ghost {
    background: transparent;
}

.button.danger {
    border-color: var(--danger);
    color: #fff;
    background: var(--danger);
}

.button.small {
    min-height: 36px;
    padding: 0 12px;
    font-size: 14px;
}

.full-button {
    width: 100%;
    margin-top: 10px;
}

.notice {
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 600;
}

.notice.success {
    background: #dfeee7;
    color: #1f5f3e;
}

.notice.error {
    background: #f4dfdf;
    color: #8f2727;
}

.muted {
    color: var(--muted);
}

.upload-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
}

.upload-form label:nth-child(4),
.upload-form label:nth-child(5),
.upload-form .button {
    grid-column: 1 / -1;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.image-admin-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfd;
}

.image-admin-item > img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 14px;
}

.item-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

@media (max-width: 980px) {
    .site-shell,
    .admin-shell {
        width: min(100% - 24px, 920px);
    }

}

@media (max-width: 720px) {
    .admin-header,
    .upload-form {
        display: block;
    }

    .admin-header .button {
        margin-top: 16px;
    }

    .admin-panel {
        padding: 18px;
    }
}

@media (max-width: 420px) {
    .site-shell,
    .admin-shell {
        width: calc(100% - 18px);
    }

    .gallery-stage.is-grid {
        gap: 16px;
    }

    .lightbox {
        padding: 14px;
    }
}
