:root {
    color-scheme: dark;
    --bg: #0b0d11;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-strong: rgba(255, 255, 255, 0.1);
    --text: #f6f7fb;
    --muted: #b8bfd1;
    --accent: #f0b35a;
    --danger: #db6d6d;
    --border: rgba(255, 255, 255, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
    line-height: 1.5;
}

body.is-page-loading {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    width: 100%;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
    padding: 1rem 5vw;
    background: rgba(11, 13, 17, 0.72);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
}

body.is-page-loading .site-header,
body.is-page-loading main {
    pointer-events: none;
}

.page-loader {
    --page-loader-transition-duration: 240ms;
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background: rgba(11, 13, 17, 0.92);
    backdrop-filter: blur(14px);
    transition:
        opacity var(--page-loader-transition-duration) ease,
        visibility 0s linear var(--page-loader-transition-duration);
}

.page-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-loader__spinner {
    width: 3.5rem;
    height: 3.5rem;
    border: 0.3rem solid rgba(255, 255, 255, 0.16);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: pageLoaderSpin 0.9s linear infinite;
}

.page-loader__text {
    color: var(--muted);
    text-align: center;
}

.brand {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
    line-height: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.brand-logo {
    width: auto;
    max-width: 100%;
    height: clamp(2.75rem, 7vw, 3.75rem);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.site-nav a {
    color: var(--muted);
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: var(--text);
}

.hero {
    position: relative;
    min-height: calc(100vh - 76px);
    padding: 4rem 5vw;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    background: linear-gradient(135deg, #171b23, #090b10);
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(10, 12, 16, 0.35), rgba(10, 12, 16, 0.65));
}

.hero-media-stack {
    position: absolute;
    inset: 0;
}

.hero-media {
    position: absolute;
    inset: 0;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 900ms ease;
}

.hero-media.is-active {
    opacity: 1;
}

.hero-content,
.content-shell,
.dashboard {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 42rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2.8rem, 7vw, 5.4rem);
    line-height: 0.98;
    margin-bottom: 1rem;
}

.hero p,
.page-hero p,
.panel p,
.prose {
    color: var(--muted);
}

.hero-actions,
.inline-actions,
.two-columns {
    display: flex;
    gap: 1rem;
}

.hero-actions {
    margin-top: 2rem;
    flex-wrap: wrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.9rem 1.4rem;
    font-weight: 600;
    cursor: pointer;
}

.button.primary {
    background: var(--accent);
    color: #17110a;
}

.button.ghost {
    border-color: rgba(255, 255, 255, 0.28);
    color: var(--text);
}

.button.dark {
    background: transparent;
}

.button.danger {
    background: rgba(219, 109, 109, 0.16);
    color: #ffdada;
    border-color: rgba(219, 109, 109, 0.34);
}

.intro-grid,
.page-layout {
    width: min(1180px, calc(100% - 10vw));
    margin: 3rem auto;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.panel,
.notice,
.auth-panel,
.page-editor,
.admin-photo-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.panel,
.notice,
.auth-panel,
.page-editor {
    padding: 1.5rem;
}

.gallery-section {
    width: min(1180px, calc(100% - 10vw));
    margin: 4rem auto 5rem;
}

.section-heading {
    margin-bottom: 1.5rem;
}

.gallery-grid,
.admin-gallery {
    display: grid;
    gap: 1.2rem;
}

.gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.gallery-card {
    overflow: hidden;
    border-radius: 24px;
    background: #131823;
    border: 1px solid var(--border);
}

.gallery-card img {
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

.gallery-card figcaption,
.admin-photo-meta {
    padding: 1rem;
}

.gallery-card figcaption {
    display: grid;
    gap: 0.4rem;
}

.empty-state {
    padding: 2rem;
    background: var(--surface);
    border-radius: 24px;
    color: var(--muted);
}

.content-shell,
.dashboard {
    padding: 3rem 5vw 5rem;
}

.page-hero {
    margin-bottom: 2rem;
}

.sidebar-card {
    align-self: start;
}

.auth-body,
.admin-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgba(240, 179, 90, 0.16), transparent 30%),
        var(--bg);
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.auth-panel {
    width: min(520px, 100%);
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--muted);
}

.stacked-form,
.page-editor {
    display: grid;
    gap: 1rem;
}

label {
    display: grid;
    gap: 0.5rem;
    color: var(--muted);
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
}

textarea {
    resize: vertical;
}

.checkbox {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.checkbox input {
    width: 1.05rem;
    height: 1.05rem;
}

.notice {
    margin-bottom: 1.5rem;
}

.notice.success {
    border-color: rgba(130, 209, 163, 0.32);
}

.notice.error {
    border-color: rgba(219, 109, 109, 0.34);
}

.admin-header {
    position: static;
}

.admin-gallery,
.page-editor-list {
    margin-top: 1.5rem;
}

.admin-photo-card {
    overflow: hidden;
}

.admin-photo-card img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.status-pill {
    display: inline-flex;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
    margin-bottom: 1rem;
}

.status-pill.active {
    background: rgba(240, 179, 90, 0.2);
    color: #ffd59a;
}

.separator {
    height: 1px;
    margin: 2rem 0;
    background: var(--border);
}

.prose {
    font-size: 1.05rem;
}

pre {
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 780px) {
    .site-header,
    .hero-actions,
    .inline-actions,
    .two-columns {
        flex-direction: column;
    }

}

/* Hero content: initially hidden, flies in from the left on scroll */
@keyframes pageLoaderSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes heroSlideIn {
    from {
        opacity: 0;
        transform: translateX(-60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes heroSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-60px);
    }
}

.hero-content > * {
    opacity: 0;
    transform: translateX(-60px);
}

.hero-content > *.is-visible {
    animation: heroSlideIn 0.7s ease forwards;
}

.hero-content > *:nth-child(1).is-visible { animation-delay: 0s; }
.hero-content > *:nth-child(2).is-visible { animation-delay: 0.12s; }
.hero-content > *:nth-child(3).is-visible { animation-delay: 0.24s; }
.hero-content > *:nth-child(4).is-visible { animation-delay: 0.36s; }

.hero-content > *.is-hiding {
    animation: heroSlideOut 0.5s ease forwards;
}

.hero-content > *:nth-child(1).is-hiding { animation-delay: 0s; }
.hero-content > *:nth-child(2).is-hiding { animation-delay: 0.08s; }
.hero-content > *:nth-child(3).is-hiding { animation-delay: 0.16s; }
.hero-content > *:nth-child(4).is-hiding { animation-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
    .page-loader {
        transition: none;
    }

    .page-loader__spinner {
        animation: none;
    }

    .hero-media {
        transition: none;
    }

    .hero-content > * {
        opacity: 1;
        transform: none;
    }

    .hero-content > *.is-visible,
    .hero-content > *.is-hiding {
        animation: none;
    }
}

/* Gallery shuffle animation */
@keyframes cardShuffle {
    0% {
        opacity: 0;
        transform: translateY(48px) scale(0.88) rotate(var(--shuffle-angle, 0deg));
    }
    55% {
        opacity: 1;
        transform: translateY(-6px) scale(1.03) rotate(calc(var(--shuffle-angle, 0deg) * 0.2));
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

.gallery-card.will-shuffle {
    opacity: 0;
}

.gallery-card.is-shuffled {
    animation: cardShuffle 0.65s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card.will-shuffle {
        opacity: 1;
    }

    .gallery-card.is-shuffled {
        animation: none;
        opacity: 1;
        transform: none;
    }
}