:root {
    --bg: #f7ecdb;
    --panel: rgba(251, 241, 226, 0.8);
    --panel-strong: #fff7ec;
    --text: #211815;
    --muted: #6e5a4e;
    --accent: #d15b2f;
    --accent-dark: #a74222;
    --accent-soft: #f0a24d;
    --border: rgba(52, 33, 20, 0.11);
    --shadow: 0 24px 70px rgba(71, 37, 8, 0.15);
    --radius: 28px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 24%),
        radial-gradient(circle at 85% 12%, rgba(240, 162, 77, 0.18), transparent 18%),
        linear-gradient(180deg, #f4e9d8 0%, #edd8ba 36%, #dfbf92 100%);
    color: var(--text);
    min-height: 100vh;
}

body.modal-open {
    overflow: hidden;
}

body.public-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(transparent 92%, rgba(96, 63, 35, 0.05) 92%),
        radial-gradient(circle at bottom, rgba(116, 61, 19, 0.12), transparent 34%);
    background-size: 100% 36px, auto;
    opacity: 0.65;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    padding: 0.82rem 1.15rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

button:hover,
button:focus-visible {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

.slideshow-card,
.admin-card {
    background: var(--panel);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.public-page .slideshow-card {
    position: relative;
    overflow: hidden;
    padding: 2rem;
    background:
        linear-gradient(160deg, rgba(255, 247, 236, 0.86), rgba(249, 233, 205, 0.76)),
        var(--panel);
}

.public-page .slideshow-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 10px;
    background: linear-gradient(90deg, #cc4a2d, #f0a24d, #e9d7b4, #6f8d72);
}

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

.slideshow-header h1 {
    margin: 0.2rem 0 0;
    font-size: clamp(1.8rem, 4vw, 3rem);
}

.hero-header {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
    gap: 1.5rem;
    align-items: end;
    margin-bottom: 1.75rem;
}

.hero-copy h1 {
    margin: 0.25rem 0 0.7rem;
    font-size: clamp(2.5rem, 5vw, 4.9rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
    max-width: 10ch;
}

.hero-text {
    margin: 0;
    max-width: 50rem;
    font-size: 1.08rem;
    line-height: 1.65;
    color: rgba(33, 24, 21, 0.82);
}

.journey-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1.2rem;
}

.journey-tags span,
.topline-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    padding: 0.48rem 0.85rem;
    background: rgba(255, 250, 243, 0.72);
    border: 1px solid rgba(82, 55, 26, 0.12);
    color: #6a4f3f;
    font-size: 0.88rem;
    letter-spacing: 0.02em;
}

.trip-panel {
    background:
        linear-gradient(160deg, rgba(53, 31, 24, 0.96), rgba(86, 45, 31, 0.94));
    color: #fff4e8;
    border-radius: 24px;
    padding: 1.2rem 1.25rem;
    box-shadow: 0 22px 46px rgba(74, 40, 17, 0.18);
}

.trip-kicker,
.trip-note,
.slideshow-footer p {
    margin: 0;
}

.trip-kicker {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    color: rgba(255, 232, 212, 0.72);
}

.trip-count {
    margin: 0.55rem 0 0.3rem;
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    font-weight: 700;
}

.trip-note {
    color: rgba(255, 232, 212, 0.8);
    line-height: 1.5;
}

.eyebrow,
.image-count,
.help-text,
.viewer-meta,
.admin-filename,
.secondary-link {
    color: var(--muted);
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.78rem;
    color: #8b5232;
    font-weight: 700;
}

.image-count {
    margin: 0;
}

.viewer {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    background:
        linear-gradient(160deg, rgba(209, 91, 47, 0.18), rgba(255, 255, 255, 0.04)),
        linear-gradient(180deg, #2c1a13, #150e0d);
    min-height: 52vh;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.slide-image {
    width: 100%;
    height: min(72vh, 820px);
    object-fit: contain;
    display: none;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.slide-image.is-active {
    display: block;
}

.slide-image.is-fading,
.slide-image.is-loading {
    opacity: 0.2;
}

.slide-video {
    background: #000;
}

.viewer-overlay {
    position: absolute;
    inset: auto 0 0;
    padding: 1.2rem 1.25rem 1.2rem;
    background: linear-gradient(to top, rgba(18, 12, 9, 0.9), rgba(18, 12, 9, 0.18), rgba(18, 12, 9, 0));
    color: #fff;
}

.viewer-caption,
.viewer-meta {
    margin: 0;
}

.viewer-caption {
    font-size: 1.1rem;
    font-weight: 700;
    min-height: 1.4em;
}

.viewer-meta {
    margin-top: 0.35rem;
    color: rgba(255, 235, 217, 0.72);
    letter-spacing: 0.03em;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.15rem;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.public-page .controls button:first-child,
.public-page .controls button:nth-child(2) {
    background: #b54a29;
}

.public-page .controls button:nth-child(3) {
    background: #2f6e61;
}

.public-page .controls button:nth-child(4) {
    background: #8f5c44;
}

.public-page .controls button:nth-child(3):hover,
.public-page .controls button:nth-child(3):focus-visible {
    background: #24584f;
}

.public-page .controls button:nth-child(4):hover,
.public-page .controls button:nth-child(4):focus-visible {
    background: #754832;
}

.icon-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 3;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    position: absolute;
    width: 46px;
    height: 46px;
    border: 4px solid rgba(255, 255, 255, 0.28);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.slideshow:fullscreen,
.slideshow:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    background: #120d0a;
    padding: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.slideshow:fullscreen .viewer,
.slideshow:-webkit-full-screen .viewer {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
}

.slideshow:fullscreen .slide-image,
.slideshow:-webkit-full-screen .slide-image {
    height: 100vh;
    max-height: none;
}

.slideshow:fullscreen .controls,
.slideshow:-webkit-full-screen .controls {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 1.5rem);
    z-index: 5;
    width: min(100%, 760px);
    justify-content: center;
    padding: 2.5rem 1rem 1.2rem;
    margin-top: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
    opacity: 0;
    pointer-events: none;
}

.slideshow:fullscreen:hover .controls,
.slideshow:fullscreen:focus-within .controls,
.slideshow:fullscreen.is-controls-visible .controls,
.slideshow:-webkit-full-screen:hover .controls,
.slideshow:-webkit-full-screen:focus-within .controls,
.slideshow:-webkit-full-screen.is-controls-visible .controls {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.slideshow:fullscreen .controls button,
.slideshow:-webkit-full-screen .controls button {
    background: rgba(196, 91, 60, 0.94);
}

.spinner.is-visible {
    opacity: 1;
}

.empty-state {
    border: 2px dashed rgba(111, 100, 87, 0.25);
    border-radius: 18px;
    padding: 2rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.45);
}

.admin-header {
    align-items: flex-start;
}

.secondary-link {
    text-decoration: none;
    font-weight: 600;
}

.admin-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.login-card {
    max-width: 460px;
    margin: 8vh auto 0;
}

.login-form {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.upload-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.file-picker {
    display: inline-flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-picker input[type="file"] {
    max-width: 100%;
}

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

.status-message {
    min-height: 1.5rem;
    margin: 1rem 0;
    font-weight: 600;
}

.status-message.is-error {
    color: #8d2417;
}

.status-message.is-success {
    color: #1d6f3d;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.admin-item {
    position: relative;
    background: var(--panel-strong);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    cursor: grab;
}

.admin-item.is-dragging {
    opacity: 0.55;
}

.drag-handle {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    background: rgba(31, 28, 24, 0.65);
    color: #fff;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}

.admin-item-body {
    padding: 1rem;
}

.admin-filename {
    margin: 0 0 0.75rem;
    word-break: break-word;
}

.caption-field {
    display: block;
}

.caption-field span {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.caption-input {
    width: 100%;
    border: 1px solid rgba(31, 28, 24, 0.14);
    border-radius: 12px;
    padding: 0.75rem;
    background: #fff;
}

.secondary-button {
    margin-bottom: 0.8rem;
    width: 100%;
    background: #d7c0a5;
    color: #3d2c20;
}

.secondary-button:hover,
.secondary-button:focus-visible {
    background: #c9ad8d;
}

.danger-button {
    margin-top: 0.8rem;
    width: 100%;
    background: #aa3227;
}

.danger-button:hover,
.danger-button:focus-visible {
    background: #812119;
}

.media-modal[hidden] {
    display: none;
}

.media-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.media-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 12, 9, 0.82);
    backdrop-filter: blur(6px);
}

.media-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(1100px, 100%);
    max-height: calc(100vh - 2rem);
    background: rgba(28, 18, 15, 0.96);
    border-radius: 22px;
    padding: 1rem 1rem 1.15rem;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

.media-modal-close {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    width: 2.9rem;
    height: 2.9rem;
    padding: 0;
    border-radius: 999px;
    font-size: 1.5rem;
    line-height: 1;
}

.media-modal-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.media-modal-image,
.media-modal-video {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 9rem);
    object-fit: contain;
    border-radius: 16px;
    background: #000;
}

.media-modal-title {
    margin: 0.9rem 0 0;
    color: rgba(255, 236, 220, 0.88);
    text-align: center;
    font-size: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 700px) {
    .page-shell {
        width: min(100% - 1rem, 1100px);
        padding-top: 1rem;
    }

    .slideshow-card,
    .admin-card {
        padding: 1rem;
        border-radius: 20px;
    }

    .hero-header {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .hero-copy h1 {
        max-width: 12ch;
        font-size: clamp(2.2rem, 10vw, 3.35rem);
    }

    .viewer {
        min-height: 42vh;
    }

    .slide-image {
        height: min(56vh, 520px);
    }

    .controls button,
    .upload-form button,
    .admin-actions button {
        width: 100%;
    }

    .journey-tags {
        gap: 0.55rem;
    }
}
