/* ============================================================
   U·R·SHOOTING — Galerie Steilshoop
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --gold:        #d4af37;
    --gold-dark:   #b8860b;
    --gold-light:  #f4e5c3;
    --ink:         #1a1a1a;
    --ink-soft:    #4a4a4a;
    --muted:       #8a8a8a;
    --line:        #ece8df;
    --bg:          #fafaf7;
    --bg-card:     #ffffff;
    --shadow-sm:   0 1px 3px rgba(0,0,0,.06);
    --shadow-md:   0 8px 24px rgba(0,0,0,.08);
    --radius:      12px;
    --max:         1280px;
}

html, body { min-height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    padding-bottom: env(safe-area-inset-bottom);
    display: flex; flex-direction: column;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: transparent; }
input { font: inherit; }

/* ===== Brand-Bar (oben) ===== */
.brand-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top);
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.brand-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 12px 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.wordmark {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: .15em;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    padding: 4px 0;
}
.topnav { display: flex; gap: 4px; }
.ghost {
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--ink-soft);
    font-size: .9rem; font-weight: 500;
    min-height: 36px;
    display: inline-flex; align-items: center;
}
.ghost:active { background: var(--line); }

@media (min-width: 640px) {
    .wordmark { font-size: 1.3rem; letter-spacing: .2em; }
}

/* ===== Footer (Powered by) ===== */
.poweredby {
    margin-top: auto;
    padding: 18px 16px max(18px, env(safe-area-inset-bottom));
    text-align: center;
    font-size: .75rem;
    color: var(--muted);
    letter-spacing: .04em;
}
.poweredby a {
    display: inline-flex; gap: 6px; align-items: center;
}
.wordmark-mini {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700; letter-spacing: .12em;
}

/* ===== Login ===== */
.page-login { background: linear-gradient(180deg, var(--bg) 0%, var(--bg-card) 80%); }
.login-wrap {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 24px 16px;
}
.login-card {
    width: 100%; max-width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 32px 24px;
    text-align: center;
}
.login-title {
    font-size: 1.6rem; font-weight: 700; letter-spacing: -.3px;
    color: var(--ink);
}
.login-sub {
    margin-top: 6px;
    color: var(--ink-soft);
    font-size: .95rem;
}
.login-card form { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.login-card input[type=password] {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    font-size: 16px;
    background: var(--bg);
    color: var(--ink);
    outline: none;
    text-align: center;
}
.login-card input[type=password]:focus { border-color: var(--gold); background: var(--bg-card); }

.btn-primary {
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #fff;
    padding: 13px 22px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    min-height: 48px;
    width: 100%;
    transition: transform .15s ease, box-shadow .2s ease;
}
.btn-primary:active { transform: scale(.98); }
.btn-primary:hover { box-shadow: 0 6px 18px rgba(212,175,55,.35); }

.vis-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* ===== Hero (Galerie) ===== */
.hero {
    max-width: var(--max);
    margin: 0 auto;
    padding: 28px 16px 16px;
    text-align: center;
}
.hero h1 {
    font-size: 1.7rem; font-weight: 700; letter-spacing: -.4px;
    color: var(--ink);
}
.hero p { margin-top: 6px; color: var(--ink-soft); font-size: .95rem; }
@media (min-width: 768px) {
    .hero { padding: 48px 16px 24px; }
    .hero h1 { font-size: 2.4rem; }
    .hero p { font-size: 1.05rem; }
}

/* ===== Galerie-Grid (Thumbnails, square) ===== */
.gallery-wrap { max-width: var(--max); margin: 0 auto; padding: 0 8px 28px; width: 100%; }
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);    /* Mobile: 3 Thumbs nebeneinander */
    gap: 4px;
}
@media (min-width: 420px)  { .gallery-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; } }
@media (min-width: 640px)  { .gallery-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; } }
@media (min-width: 900px)  { .gallery-grid { grid-template-columns: repeat(6, 1fr); gap: 10px; } }
@media (min-width: 1200px) { .gallery-grid { grid-template-columns: repeat(7, 1fr); gap: 12px; } }

.g-item {
    position: relative;
    overflow: hidden;
    background: var(--line);
    border-radius: 6px;
    display: block;
    cursor: zoom-in;
    box-shadow: var(--shadow-sm);
    aspect-ratio: 1 / 1 !important;     /* square thumbnails, override inline */
}
.g-item img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform .4s ease, opacity .25s ease;
}
.g-item:hover img { transform: scale(1.04); }
.g-cap {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 14px 8px 6px;
    background: linear-gradient(0deg, rgba(0,0,0,.65) 0%, transparent 100%);
    color: #fff; font-size: .7rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@keyframes flash-anim {
    0%, 100% { box-shadow: var(--shadow-sm); }
    50% { box-shadow: 0 0 0 4px var(--gold); }
}
.g-item.flash { animation: flash-anim .9s ease; }

.empty {
    text-align: center; padding: 60px 20px; color: var(--ink-soft);
}

/* ===== Lightbox ===== */
.lightbox {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.96);
    z-index: 200;
}
.lightbox.open { display: flex; }
.lb-stage {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    padding-top: max(56px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: 16px; padding-right: 16px;
    gap: 12px;
    align-items: center;
}
.lb-imgwrap {
    flex: 1;
    width: 100%;
    min-height: 0;             /* WICHTIG: erlaubt dem Bild zu shrinken */
    display: flex; align-items: center; justify-content: center;
}
.lb-imgwrap img {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-drag: none;
}
.lb-meta {
    flex-shrink: 0;
    display: flex; flex-direction: column;
    align-items: center; gap: 10px;
    width: 100%; max-width: 640px;
}
.lb-caption {
    color: rgba(255,255,255,.78);
    font-size: .85rem;
    text-align: center;
    padding: 0 8px;
}
.lb-caption:empty { display: none; }
.lb-dlbtn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 11px 22px;
    background: linear-gradient(135deg, #d4af37, #b8860b);
    color: #fff;
    font-weight: 600; font-size: .9rem;
    border-radius: 999px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(212,175,55,.4);
    min-height: 44px;
    letter-spacing: .02em;
}
.lb-dlbtn:hover { box-shadow: 0 6px 18px rgba(212,175,55,.6); }
.lb-dlbtn:active { transform: scale(.97); }

.lb-close, .lb-nav {
    position: absolute;
    color: #fff;
    background: rgba(255,255,255,.12);
    border-radius: 50%;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; line-height: 1;
    user-select: none;
    z-index: 5;
    border: none; cursor: pointer;
}
.lb-close { top: max(12px, env(safe-area-inset-top)); right: 12px; }
.lb-nav { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }

@media (min-width: 720px) {
    .lb-close, .lb-nav { width: 52px; height: 52px; font-size: 30px; }
    .lb-prev { left: 20px; }
    .lb-next { right: 20px; }
    .lb-dlbtn { padding: 12px 26px; font-size: 1rem; }
}

/* ===== Lightbox-Strip (Thumbnails unten) ===== */
.lb-strip {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    display: flex; gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 4px 0;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.lb-strip::-webkit-scrollbar { height: 4px; }
.lb-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }
.lb-strip-item {
    flex-shrink: 0;
    width: 64px; height: 64px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255,255,255,.06);
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s ease, opacity .2s ease;
    opacity: .55;
    padding: 0;
}
.lb-strip-item img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.lb-strip-item:hover { opacity: .85; }
.lb-strip-item.active {
    border-color: var(--gold);
    opacity: 1;
}
@media (min-width: 720px) {
    .lb-strip-item { width: 76px; height: 76px; }
    .lb-strip { gap: 8px; }
}

/* ===== Admin ===== */
.admin-wrap {
    max-width: 1080px; margin: 0 auto;
    padding: 16px;
    display: flex; flex-direction: column; gap: 14px;
}
.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}
.card h2 {
    font-size: 1.05rem; font-weight: 700; color: var(--ink);
    margin-bottom: 12px;
}
.hint { font-size: .8rem; color: var(--ink-soft); margin-bottom: 12px; }
.empty-mini { color: var(--muted); font-size: .9rem; padding: 12px 0; text-align: center; }

.settings-form {
    display: flex; flex-direction: column; gap: 12px;
}
.settings-form label { display: flex; flex-direction: column; gap: 4px; }
.settings-form label > span { font-size: .8rem; color: var(--ink-soft); font-weight: 500; }
.settings-form input {
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    font-size: 16px;
    background: var(--bg);
    outline: none;
}
.settings-form input:focus { border-color: var(--gold); background: var(--bg-card); }
.settings-form .btn-primary { width: auto; align-self: flex-start; min-width: 160px; }

/* Upload */
.upload-zone {
    border: 2px dashed var(--line);
    border-radius: 12px;
    padding: 28px 16px;
    text-align: center;
    background: var(--bg);
    transition: border-color .2s ease, background .2s ease;
}
.upload-zone.over { border-color: var(--gold); background: var(--gold-light); }
.up-hint { font-size: 1rem; color: var(--ink); margin-bottom: 6px; }
.up-sub { font-size: .75rem; color: var(--muted); }
.link-btn {
    color: var(--gold-dark);
    text-decoration: underline; padding: 0; min-height: 0;
    font-weight: 600;
}
.upload-progress {
    margin-top: 12px;
    display: flex; flex-direction: column; gap: 6px;
}
.up-row {
    display: flex; gap: 10px; align-items: center;
    font-size: .82rem; padding: 6px 10px;
    background: var(--bg); border-radius: 8px;
}
.up-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-row .status { color: var(--muted); }
.up-row.ok .status { color: #066a3c; }
.up-row.err .status { color: #b03a2e; }

/* Admin-Grid */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media (min-width: 540px) { .admin-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px) { .admin-grid { grid-template-columns: repeat(4, 1fr); } }
.a-item {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    display: flex; flex-direction: column;
}
.a-item.dragging { opacity: .4; }
.a-item.drop-target { outline: 2px solid var(--gold); }
.a-thumb {
    aspect-ratio: 1 / 1;
    background: var(--line);
    overflow: hidden;
}
.a-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.a-cap {
    padding: 8px 10px;
    font-size: .78rem;
    border: none; outline: none;
    background: transparent;
    border-top: 1px solid var(--line);
    color: var(--ink);
}
.a-cap:focus { background: var(--bg-card); }
.a-meta {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 10px;
    font-size: .7rem; color: var(--muted);
    border-top: 1px solid var(--line);
}
.a-del {
    color: #b03a2e;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 6px;
}
.a-del:active { background: rgba(176,58,46,.12); }

/* ===== Toast ===== */
.toast-stack {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    z-index: 300; display: flex; flex-direction: column; gap: 8px;
    width: calc(100% - 32px); max-width: 400px;
}
.toast {
    padding: 12px 16px; background: var(--bg-card);
    border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow-md); font-size: .9rem;
    text-align: center;
}
.toast-ok { border-left: 4px solid #4ade80; }
.toast-error { border-left: 4px solid #f87171; }
