:root {
    --bg: #151515;
    --panel: rgba(255, 255, 255, 0.06);
    --line: rgba(255, 255, 255, 0.12);
    --text: #f6f1e8;
    --muted: rgba(246, 241, 232, 0.68);
    --accent: #f39f12;
    --danger: #a63d2f;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Sofia Sans Extra Condensed", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(243, 159, 18, 0.18), transparent 26%),
        radial-gradient(circle at left center, rgba(243, 159, 18, 0.1), transparent 30%),
        linear-gradient(180deg, #0f0f0f 0%, var(--bg) 38%, #121212 100%);
}

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

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

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.gallery-only-shell,
.admin-shell {
    width: min(1320px, calc(100vw - 32px));
    margin: 0 auto;
}

.gallery-only-shell {
    min-height: 100vh;
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 24px 0;
}

.eyebrow,
.meta-index,
.photo-format,
.lightbox-format,
.admin-card-header p {
    margin: 0;
    color: var(--accent);
    font-size: 0.95rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.hero-text,
.photo-description,
.empty-gallery p,
.admin-empty,
.flash,
label span,
.admin-hint {
    color: var(--muted);
}

.gallery-app,
.admin-panel,
.admin-card {
    border: 1px solid var(--line);
    border-radius: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.gallery-app {
    display: grid;
    justify-items: center;
    gap: 0;
    width: min(100%, 900px);
    padding: 22px;
}

.gallery-stage {
    display: grid;
    grid-template-columns: 50px 360px 50px;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.main-photo-button,
.nav-arrow {
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(0, 0, 0, 0.22);
}

.main-photo-button {
    position: relative;
    width: 360px;
    height: 360px;
    overflow: hidden;
}

.main-photo-button::after {
    content: "Klick fuer Originalgroesse";
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 7px 11px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    font-size: 0.72rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.62);
    color: var(--text);
}

.main-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.05), transparent 30%),
        linear-gradient(180deg, #111 0%, #1a1a1a 100%);
}

.nav-arrow {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    color: #ffffff;
}

.nav-arrow span {
    color: #ffffff;
    font-size: 1.5rem;
    line-height: 1;
}

.photo-meta {
    width: 360px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px 0 0;
    text-align: center;
}

.photo-side-meta {
    display: grid;
    gap: 6px;
}

.photo-meta h3,
.admin-heading h1,
.admin-card h2,
.empty-gallery h3,
.lightbox-caption h3 {
    margin: 0;
    line-height: 0.95;
    letter-spacing: -0.03em;
}

.photo-meta h3 {
    margin-top: 6px;
    font-size: clamp(1.55rem, 2vw, 2.15rem);
}

.photo-format {
    font-size: 0.84rem;
}

.photo-description {
    margin: 0;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.35;
}

.thumbnail-strip {
    display: grid;
    width: min(100%, 760px);
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 10px;
    margin-top: 24px;
}

.thumbnail-button {
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.03);
    text-align: left;
    color: var(--muted);
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.thumbnail-button:hover,
.main-photo-button:hover,
.nav-arrow:hover,
.outline-button:hover,
.ghost-button:hover,
.danger-button:hover {
    transform: translateY(-2px);
}

.thumbnail-button img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 0;
}

.thumbnail-button span {
    font-size: 1.05rem;
    line-height: 1.1;
}

.thumbnail-button.is-active {
    border-color: rgba(243, 159, 18, 0.55);
    background: rgba(243, 159, 18, 0.1);
    color: var(--text);
}

.empty-gallery {
    display: grid;
    justify-items: center;
    gap: 14px;
    width: min(100%, 820px);
    padding: 54px 28px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.03);
    text-align: center;
}

.empty-gallery img {
    width: min(440px, 100%);
}

.empty-gallery h3 {
    font-size: clamp(2.2rem, 4vw, 3rem);
}

.empty-gallery p {
    margin: 0;
    font-size: clamp(1.2rem, 1.8vw, 1.5rem);
    line-height: 1.35;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    align-items: center;
    justify-items: center;
    padding: 8px;
    background: rgba(8, 8, 8, 0.94);
    backdrop-filter: blur(16px);
}

.lightbox[hidden] {
    display: none;
}

.lightbox-image {
    max-width: 100vw;
    max-height: 96vh;
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow);
}

.lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 56px;
    height: 56px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 2rem;
}

.lightbox-caption {
    width: min(96vw, 1600px);
    margin-top: 10px;
    padding: 0 12px 12px;
}

.lightbox-caption h3 {
    font-size: 2.2rem;
}

.lightbox-format {
    margin-top: 10px;
    font-size: 1rem;
}

.lightbox-caption p:last-child {
    margin: 6px 0 0;
    font-size: 1.3rem;
    color: var(--muted);
}

.admin-page {
    background:
        radial-gradient(circle at top right, rgba(243, 159, 18, 0.16), transparent 22%),
        linear-gradient(180deg, #111 0%, #151515 100%);
}

.admin-shell {
    padding: 56px 0;
}

.admin-panel {
    padding: 34px;
}

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

.admin-toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 24px 0 18px;
}

.admin-toolbar-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 96px;
    width: 100%;
    flex-wrap: wrap;
}

.text-link,
.admin-toolbar-links .text-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-size: 1.2rem;
    color: var(--text);
}

.text-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, var(--accent), transparent);
    transform: scaleX(0.4);
    transform-origin: left center;
    transition: transform 180ms ease;
}

.text-Link:hover::after,
.text-link:hover::after {
    transform: scaleX(1);
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 22px;
}

.admin-card {
    padding: 24px;
}

.admin-card-full {
    width: 100%;
    margin-top: 20px;
}

.admin-card h2 {
    margin: 0 0 18px;
    font-size: clamp(2rem, 3vw, 2.8rem);
}

.admin-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.admin-form {
    display: grid;
    gap: 12px;
}

.admin-form label {
    display: grid;
    gap: 8px;
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="file"],
.admin-form textarea {
    width: 100%;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

.admin-form textarea {
    resize: vertical;
    min-height: 120px;
}

.admin-hint {
    margin: -4px 0 0;
    font-size: 1.1rem;
}

.outline-button,
.ghost-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 24px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 1.2rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.outline-button {
    background: linear-gradient(135deg, rgba(243, 159, 18, 0.16), rgba(255, 255, 255, 0.04));
}

.danger-button {
    border-color: rgba(166, 61, 47, 0.45);
    background: rgba(166, 61, 47, 0.14);
}

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

.admin-photo-item {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr) auto;
    gap: 20px;
    align-items: start;
    width: 100%;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.03);
}

.admin-photo-item img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 0;
}

.admin-photo-copy {
    min-width: 0;
}

.admin-sort-form {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.admin-sort-form label {
    display: grid;
    gap: 8px;
}

.admin-sort-controls {
    display: grid;
    grid-template-columns: 130px auto;
    gap: 10px;
    align-items: center;
}

.admin-sort-controls input[type="number"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

.admin-sort-button {
    width: 100%;
}

.admin-edit-form {
    gap: 10px;
}

.admin-edit-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(180px, 0.8fr);
    gap: 10px;
}

.admin-edit-form input[type="text"],
.admin-edit-form textarea {
    padding: 12px 14px;
}

.admin-edit-form textarea {
    min-height: 112px;
}

.admin-actions {
    display: flex;
    justify-content: flex-start;
}

.admin-delete-form {
    align-self: center;
}

.flash {
    margin-top: 20px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 0;
    font-size: 1.15rem;
}

.flash-success {
    border-color: rgba(78, 151, 83, 0.45);
    background: rgba(78, 151, 83, 0.14);
}

.flash-error {
    border-color: rgba(166, 61, 47, 0.45);
    background: rgba(166, 61, 47, 0.14);
}

@media (max-width: 980px) {
    .gallery-stage {
        grid-template-columns: 44px 300px 44px;
    }

    .main-photo-button,
    .photo-meta {
        width: 300px;
    }

    .main-photo-button {
        height: 300px;
    }

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

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

    .admin-toolbar-links {
        gap: 64px;
    }

    .admin-photo-item {
        grid-template-columns: 110px minmax(0, 1fr);
    }

    .admin-delete-form {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

@media (max-width: 720px) {
    .gallery-only-shell,
    .admin-shell {
        width: min(100vw - 20px, 1320px);
    }

    .gallery-app,
    .admin-panel {
        padding: 18px;
    }

    .gallery-stage {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .nav-arrow {
        width: 56px;
        height: 56px;
    }

    .nav-arrow-left {
        order: 2;
    }

    .main-photo-button {
        order: 1;
        width: min(100%, 280px);
        height: min(100vw - 80px, 280px);
    }

    .nav-arrow-right {
        order: 3;
    }

    .photo-meta {
        width: min(100%, 280px);
    }

    .thumbnail-strip {
        width: 100%;
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    }

    .admin-toolbar-links {
        gap: 40px;
    }

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

    .admin-photo-item img {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
    }

    .lightbox {
        padding: 4px;
    }

    .lightbox-image {
        max-height: 90vh;
    }
}
