/* =============================================================================
   Ehrhardt Photos – eigenes Design-System (ergänzt TailwindCSS)
   ============================================================================= */

:root {
    --bg: #fafafb;
    --bg-elev: #ffffff;
    --bg-soft: #f2f3f5;
    --text: #1a1c22;
    --text-muted: #6b7280;
    --border: #e8eaee;
    --brand: #59b1c5;
    --brand-2: #59b1c5;
    --accent: #59b1c5;
    --shadow: 0 1px 3px rgba(20, 23, 31, 0.06);
    --shadow-lg: 0 4px 16px -6px rgba(20, 23, 31, 0.1);
    --radius: 16px;
}

html.dark {
    --bg: #0c0e12;
    --bg-elev: #14171d;
    --bg-soft: #1b1f27;
    --text: #eceef2;
    --text-muted: #8a92a1;
    --border: #232830;
    --brand: #59b1c5;
    --brand-2: #59b1c5;
    --accent: #59b1c5;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 30px -12px rgba(0, 0, 0, 0.6);
}

* {
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    scroll-behavior: smooth;
}

body {
    min-height: 100dvh;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Sanfte, animierte Verlaufsflächen ------------------------------------------ */
.aurora {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.aurora::before,
.aurora::after {
    content: '';
    position: absolute;
    width: 55vmax;
    height: 55vmax;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.06;
    background: radial-gradient(circle at 30% 30%, var(--brand), transparent 60%);
    animation: drift 40s ease-in-out infinite;
}

.aurora::after {
    right: -10vmax;
    bottom: -10vmax;
    background: radial-gradient(circle at 70% 70%, var(--brand-2), transparent 60%);
    animation-duration: 48s;
    animation-direction: reverse;
}

html.dark .aurora::before,
html.dark .aurora::after {
    opacity: 0.08;
}

@keyframes drift {
    0%, 100% { transform: translate(-8vmax, -6vmax) scale(1); }
    50% { transform: translate(6vmax, 8vmax) scale(1.15); }
}

/* Glas-Karten ---------------------------------------------------------------- */
.card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
    .aurora::before, .aurora::after { animation: none; }
}

.glass {
    background: color-mix(in srgb, var(--bg-elev) 78%, transparent);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

/* Buttons -------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.62rem 1.1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.92rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.12s ease, background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s;
    user-select: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000 12%); }

html.dark .btn-primary { color: #14171d; }
html.dark .btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #fff 12%); }

.btn-ghost {
    background: var(--bg-soft);
    color: var(--text);
    border-color: var(--border);
}

.btn-ghost:hover { background: color-mix(in srgb, var(--bg-soft) 70%, var(--brand) 10%); }

.btn-danger {
    background: color-mix(in srgb, #ef4444 16%, var(--bg-soft));
    color: #ef4444;
    border-color: color-mix(in srgb, #ef4444 30%, transparent);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
}

/* Formularelemente ----------------------------------------------------------- */
.field {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.field:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
}

label.lbl {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.35rem;
}

/* =============================================================================
   Masonry-Layout (per CSS-Spalten) – Spaltenanzahl via --cols steuerbar
   ============================================================================= */
.masonry {
    column-count: var(--cols, 3);
    column-gap: var(--gap, 14px);
    transition: column-count 0.15s ease;
}

.masonry .tile {
    break-inside: avoid;
    margin-bottom: var(--gap, 14px);
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-soft);
    cursor: zoom-in;
    opacity: 0;
    transform: translateY(14px);
    animation: tile-in 0.5s ease forwards;
}

@keyframes tile-in {
    to { opacity: 1; transform: none; }
}

.masonry .tile img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.masonry .tile:hover img { transform: scale(1.03); }

.masonry .tile::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.18), transparent 45%);
    opacity: 0;
    transition: opacity 0.3s;
}

.masonry .tile:hover::after { opacity: 1; }

/* Bereichs-Kacheln (Cover-Übersicht) ---------------------------------------- */
.section-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    cursor: pointer;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    transition: transform 0.35s ease;
}

.section-card:hover { transform: translateY(-3px); }

.section-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.section-card:hover img { transform: scale(1.05); }

.section-card .overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.1rem 1.2rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0.02) 62%);
    color: #fff;
}

/* =============================================================================
   Album-Hero (modernes Heading mit Coverbild)
   ============================================================================= */
.hero {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    isolation: isolate;
}

.hero.has-cover {
    min-height: 240px;
    display: flex;
    align-items: flex-end;
}

@media (min-width: 640px) {
    .hero.has-cover { min-height: 320px; }
}

.hero .hero-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    transform: scale(1.02);
}

.hero.has-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.28) 45%, rgba(0, 0, 0, 0.08) 100%);
}

.hero .hero-inner {
    padding: 1.5rem 1.5rem 1.6rem;
    width: 100%;
}

.hero.has-cover .hero-inner { color: #fff; }

.hero .hero-title {
    font-size: clamp(1.9rem, 5vw, 3.1rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.02;
}

.hero .hero-sub {
    font-size: clamp(0.98rem, 2vw, 1.15rem);
    margin-top: 0.5rem;
    opacity: 0.92;
}

.hero .hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1rem;
    margin-top: 0.9rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.hero .hero-meta .mi { display: inline-flex; align-items: center; gap: 0.4rem; }

.hero:not(.has-cover) .hero-inner { padding-left: 0; padding-right: 0; padding-top: 0.5rem; }
.hero:not(.has-cover) .hero-sub { color: var(--text-muted); }
.hero:not(.has-cover) .hero-meta { color: var(--text-muted); }

/* Breadcrumb-Navigation ------------------------------------------------------ */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.15rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumb .crumb {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.55rem;
    border-radius: 9px;
    cursor: pointer;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.breadcrumb .crumb:hover { background: var(--bg-soft); color: var(--text); }
.breadcrumb .crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.breadcrumb .crumb.current:hover { background: transparent; }
.breadcrumb .sep { opacity: 0.5; flex: none; }

/* Sortier-Steuerung ---------------------------------------------------------- */
.sort-control {
    position: relative;
    display: inline-flex;
}

.sort-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0.4rem 2rem 0.4rem 0.9rem;
    border-radius: 11px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.sort-select:focus { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }

.sort-control .chev {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
}

/* =============================================================================
   Lightbox / Einzelbild-Ansicht
   ============================================================================= */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(6, 8, 12, 0.94);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    touch-action: none;
    overscroll-behavior: contain;
}

.lightbox.open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
}

.lightbox-topbar,
.lightbox-bottombar {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    z-index: 2;
    color: #fff;
    transition: opacity 0.3s, transform 0.3s;
}

.lightbox-topbar { top: 0; justify-content: space-between; background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent); }
.lightbox-bottombar { bottom: 0; justify-content: center; background: linear-gradient(to top, rgba(0,0,0,0.5), transparent); }

.lightbox.chrome-hidden .lightbox-topbar { opacity: 0; transform: translateY(-100%); pointer-events: none; }
.lightbox.chrome-hidden .lightbox-bottombar { opacity: 0; transform: translateY(100%); pointer-events: none; }

.lb-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.12s, opacity 0.2s;
}

.lb-btn:hover { background: rgba(255, 255, 255, 0.16); }
.lb-btn:active { transform: scale(0.94); }

.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.05);
    opacity: 0.65;
}

.lb-nav:hover { background: rgba(255, 255, 255, 0.12); opacity: 1; }

.lb-nav.prev { left: 0.75rem; }
.lb-nav.next { right: 0.75rem; }

@media (max-width: 767px) {
    .lb-nav { display: none; } /* Auf Mobil per Wischgeste navigieren */
}

/* Info-Panel (hochwischen / Info-Button) ------------------------------------- */
.info-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    max-height: 72vh;
    overflow-y: auto;
    padding: 1.4rem 1.4rem 2rem;
    border-radius: 22px 22px 0 0;
    background: var(--bg-elev);
    color: var(--text);
    transform: translateY(101%);
    transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.2, 1);
    box-shadow: 0 -8px 30px -18px rgba(0, 0, 0, 0.4);
}

.info-panel.open { transform: translateY(0); }

.info-panel .grabber {
    width: 44px;
    height: 5px;
    border-radius: 99px;
    background: var(--border);
    margin: -0.4rem auto 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}

.meta-item:last-child { border-bottom: none; }

.meta-item .ic {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--brand) 15%, var(--bg-soft));
    color: var(--brand);
}

.meta-item .k { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.meta-item .v { font-size: 0.95rem; font-weight: 600; }

/* Toasts --------------------------------------------------------------------- */
.toast-wrap {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.toast {
    padding: 0.7rem 1.1rem;
    border-radius: 12px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 0.9rem;
    font-weight: 500;
    animation: toast-in 0.3s ease;
}

.toast.error { border-color: color-mix(in srgb, #ef4444 40%, var(--border)); color: #ef4444; }
.toast.success { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* Spinner -------------------------------------------------------------------- */
.spinner {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid color-mix(in srgb, currentColor 25%, transparent);
    border-top-color: currentColor;
    animation: spin 0.8s linear infinite;
}

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

/* Scrollbar ------------------------------------------------------------------ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* Segmentierte Umschalter ---------------------------------------------------- */
.segmented {
    display: inline-flex;
    padding: 5px;
    border-radius: 999px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    gap: 3px;
}

.segmented button {
    padding: 0.5rem 1.2rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}

.segmented button.active {
    background: var(--bg-elev);
    color: var(--text);
    box-shadow: var(--shadow);
}

/* Hilfsklassen --------------------------------------------------------------- */
.fade-in { animation: fade-in 0.5s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.hidden-important { display: none !important; }
