:root {
    --bg: #f4efe4;
    --surface: rgba(255, 252, 247, 0.92);
    --surface-strong: #fffaf2;
    --ink: #1f2a2e;
    --muted: #5d6769;
    --line: rgba(31, 42, 46, 0.12);
    --brand: #0a7c86;
    --brand-strong: #045b63;
    --accent: #f28f3b;
    --danger: #b84035;
    --ok: #22764a;
    --shadow: 0 22px 60px rgba(22, 33, 39, 0.14);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 18px;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(242, 143, 59, 0.24), transparent 30%),
        radial-gradient(circle at top right, rgba(10, 124, 134, 0.18), transparent 28%),
        linear-gradient(180deg, #f8f1e4 0%, #f1ebde 52%, #ebe6db 100%);
}

body.slideshow-open {
    overflow: hidden;
}

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

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

.page-shell {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
    padding: 24px 0 56px;
}

.topbar,
.main-nav,
.panel,
.hero-card,
.photo-card,
.flash {
    backdrop-filter: blur(16px);
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.site-title,
h2,
h3 {
    margin: 0;
    line-height: 1.05;
}

.site-title {
    font-size: clamp(2rem, 3vw, 3.2rem);
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--brand-strong);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.user-panel,
.main-nav,
.section-header,
.photo-title-row,
.pager {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.user-panel {
    justify-content: flex-end;
}

.user-chip {
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    font-weight: 700;
}

.user-chip.warning {
    background: #fff0dd;
    color: #854f0b;
}

.main-nav {
    margin-top: 18px;
    padding: 14px;
    border-radius: var(--radius-lg);
    background: rgba(255, 250, 242, 0.88);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    justify-content: space-between;
}

.main-nav-side {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.main-nav-side.nav-right {
    justify-content: flex-end;
}

.nav-link,
.primary-button,
.favorite-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 12px 18px;
    border-radius: 16px;
    border: 1px solid transparent;
    font-weight: 800;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.nav-link {
    background: rgba(10, 124, 134, 0.08);
    border-color: rgba(10, 124, 134, 0.14);
}

.nav-link:hover,
.primary-button:hover,
.favorite-button:hover,
.drop-zone:hover {
    transform: translateY(-1px);
}

.nav-link.secondary {
    background: rgba(184, 64, 53, 0.08);
    border-color: rgba(184, 64, 53, 0.16);
}

.content {
    margin-top: 24px;
}

.flash-stack {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.flash {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.84);
    font-weight: 700;
}

.flash.success {
    border-color: rgba(34, 118, 74, 0.22);
    color: var(--ok);
}

.flash.error {
    border-color: rgba(184, 64, 53, 0.22);
    color: var(--danger);
}

.hero-card,
.section-header {
    display: grid;
    gap: 20px;
}

.hero-card {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: stretch;
}

.auth-card {
    margin-top: 24px;
}

.hero-copy,
.panel,
.photo-card {
    padding: 26px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.form-panel,
.upload-form {
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 10px;
    font-weight: 800;
}

.field input {
    width: 100%;
    min-height: 56px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 2px solid rgba(10, 124, 134, 0.16);
    background: #fffdf9;
    font-size: 1rem;
}

.field select {
    width: 100%;
    min-height: 56px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 2px solid rgba(10, 124, 134, 0.16);
    background: #fffdf9;
    font-size: 1rem;
}

.field input:focus,
.field select:focus,
.drop-zone:focus-within {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(10, 124, 134, 0.14);
}

.helper-note {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.primary-button {
    width: 100%;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
    color: white;
    border-color: rgba(4, 91, 99, 0.28);
    cursor: pointer;
    font-size: 1rem;
}

.inline-button {
    width: auto;
}

.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 12px 18px;
    border-radius: 16px;
    border: 1px solid rgba(184, 64, 53, 0.24);
    background: rgba(184, 64, 53, 0.1);
    color: var(--danger);
    font-weight: 800;
    cursor: pointer;
}

.danger-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.narrow-panel {
    max-width: 760px;
}

.search-hero,
.search-panel {
    margin-bottom: 18px;
}

.search-form,
.search-group {
    display: grid;
    gap: 18px;
}

.search-group h3 {
    font-size: 1.4rem;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.year-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.choice-card {
    position: relative;
    display: flex;
    min-height: 92px;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border-radius: 22px;
    border: 2px solid rgba(10, 124, 134, 0.16);
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.choice-card:hover {
    transform: translateY(-1px);
}

.choice-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-card.active,
.choice-card:has(input:checked) {
    border-color: rgba(10, 124, 134, 0.46);
    background: linear-gradient(135deg, rgba(10, 124, 134, 0.16), rgba(242, 143, 59, 0.14));
}

.search-actions-bar {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.large-action {
    min-height: 72px;
    padding: 18px 26px;
    font-size: 1.15rem;
}

.secondary-action {
    background: rgba(10, 124, 134, 0.08);
    border-color: rgba(10, 124, 134, 0.14);
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(300px, 420px) 1fr;
    gap: 18px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.photo-card {
    display: grid;
    gap: 16px;
}

.photo-frame {
    display: block;
}

.photo-frame {
    overflow: hidden;
    border-radius: 20px;
    background: #e3ddd3;
    aspect-ratio: 4 / 3;
}

.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-body {
    display: grid;
    gap: 10px;
}

.photo-body p {
    margin: 0;
    color: var(--muted);
}

.photo-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 4px;
}

.photo-actions .danger-button {
    width: auto;
}

.slideshow-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    background: rgba(0, 0, 0, 0.96);
}

.slideshow-overlay.open {
    display: block;
}

.slideshow-stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #000;
}

.slideshow-image-wrap {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
}

.slideshow-image {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
}

.slideshow-arrow,
.slideshow-favorite,
.slideshow-fullscreen,
.slideshow-exit,
.slideshow-control,
.slideshow-download {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    padding: 18px 24px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(20, 24, 27, 0.68);
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
    cursor: pointer;
    backdrop-filter: blur(12px);
}

.slideshow-arrow {
    top: 50%;
    width: 72px;
    min-height: 72px;
    padding: 0;
    transform: translateY(-50%);
    border-radius: 999px;
    font-size: 2rem;
}

.slideshow-arrow.left {
    left: 18px;
}

.slideshow-arrow.right {
    right: 18px;
}

.slideshow-favorite {
    top: 18px;
    left: 18px;
    min-width: 158px;
}

.slideshow-fullscreen {
    top: 18px;
    left: 50%;
    min-width: 190px;
    transform: translateX(-50%);
}

.slideshow-fullscreen.hidden {
    display: none;
}

.slideshow-favorite.active {
    background: rgba(168, 25, 71, 0.82);
    border-color: rgba(255, 184, 210, 0.42);
}

.slideshow-favorite:disabled {
    opacity: 0.7;
    cursor: wait;
}

.slideshow-exit {
    top: 18px;
    right: 18px;
    min-width: 150px;
}

.slideshow-toolbar {
    position: absolute;
    left: 24px;
    bottom: 24px;
    z-index: 2;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.slideshow-control,
.slideshow-download {
    position: static;
    min-height: 72px;
    min-width: 190px;
}

.slideshow-caption {
    position: absolute;
    right: 24px;
    bottom: 24px;
    z-index: 2;
    display: grid;
    gap: 8px;
    min-width: 260px;
    max-width: min(440px, calc(100vw - 48px));
    padding: 18px 20px;
    border-radius: 20px;
    background: rgba(20, 24, 27, 0.68);
    color: #fff;
    backdrop-filter: blur(12px);
}

.slideshow-caption p {
    margin: 0;
    line-height: 1.45;
}

.photo-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
}

.photo-viewer {
    display: grid;
    place-items: center;
    min-height: 70vh;
    padding: 18px;
    background: rgba(22, 33, 39, 0.92);
}

.photo-detail-image {
    width: 100%;
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
}

.photo-detail-meta {
    display: grid;
    gap: 16px;
    align-self: stretch;
}

.photo-detail-meta p {
    margin: 0;
    color: var(--ink);
    font-size: 1.02rem;
    line-height: 1.5;
}

.photo-title-row {
    justify-content: space-between;
    align-items: flex-start;
}

.photo-title-row h3 {
    font-size: 1.05rem;
}

.favorite-button {
    background: rgba(242, 143, 59, 0.12);
    border-color: rgba(242, 143, 59, 0.24);
    color: #8b4d0f;
    cursor: pointer;
}

.favorite-button.active {
    background: rgba(242, 143, 59, 0.22);
}

.pager {
    justify-content: center;
    margin-top: 24px;
}

.pager-current {
    padding: 12px 18px;
    font-weight: 800;
}

.empty-state {
    text-align: center;
}

.drop-zone {
    display: grid;
    gap: 10px;
    place-items: center;
    min-height: 240px;
    padding: 24px;
    border-radius: 24px;
    border: 3px dashed rgba(10, 124, 134, 0.3);
    background:
        linear-gradient(180deg, rgba(10, 124, 134, 0.08), rgba(255, 255, 255, 0.72)),
        var(--surface-strong);
    text-align: center;
    cursor: pointer;
}

.drop-zone.dragover {
    border-color: var(--accent);
    background:
        linear-gradient(180deg, rgba(242, 143, 59, 0.12), rgba(255, 255, 255, 0.8)),
        var(--surface-strong);
}

.drop-zone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.drop-icon {
    font-size: 3.4rem;
}

.file-list {
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    font-weight: 700;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
}

.check-row input {
    width: 24px;
    height: 24px;
}

.user-admin-list {
    display: grid;
    gap: 16px;
}

.user-admin-card {
    display: grid;
    gap: 12px;
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
}

.user-admin-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.user-admin-login {
    margin: 6px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.user-role-stack {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 800;
    border: 1px solid transparent;
}

.badge.brand {
    color: var(--brand-strong);
    background: rgba(10, 124, 134, 0.1);
    border-color: rgba(10, 124, 134, 0.16);
}

.badge.warning {
    color: #8b4d0f;
    background: rgba(242, 143, 59, 0.14);
    border-color: rgba(242, 143, 59, 0.22);
}

.badge.ok {
    color: var(--ok);
    background: rgba(34, 118, 74, 0.1);
    border-color: rgba(34, 118, 74, 0.18);
}

@media (max-width: 840px) {
    .page-shell {
        width: min(100% - 16px, 100%);
        padding-top: 12px;
    }

    .topbar,
    .hero-card {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 22px;
    }

    .site-title {
        font-size: 2.3rem;
    }

    .main-nav {
        justify-content: flex-start;
    }

    .main-nav-side {
        width: 100%;
    }

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

    .photo-detail-layout {
        grid-template-columns: 1fr;
    }

    .slideshow-image-wrap {
        padding: 0;
    }

    .slideshow-arrow {
        width: 60px;
        min-height: 60px;
        font-size: 1.5rem;
    }

    .slideshow-arrow.left {
        left: 10px;
    }

    .slideshow-arrow.right {
        right: 10px;
    }

    .slideshow-toolbar {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .slideshow-exit,
    .slideshow-control,
    .slideshow-favorite,
    .slideshow-fullscreen {
        min-width: 0;
        width: auto;
        min-height: 64px;
        font-size: 1.05rem;
        padding: 16px 20px;
    }

    .slideshow-caption {
        left: 16px;
        right: 16px;
        bottom: 88px;
        min-width: 0;
        max-width: none;
    }

    html {
        font-size: 17px;
    }
}
