/* ============================================================
   BB Photo Delivery — gallery.css
   Vista pública del cliente
   ============================================================ */

:root {
    --clr-night:        #0a161f;
    --clr-stone:        #b2aea3;
    --clr-navy:         #093145;
    --clr-copper:       #663106;
    --clr-copper-hover: #4e2404;
    --clr-white:        #ffffff;
    --clr-bg:           #142331;
    --clr-bg-end:       #070b0f;
    --clr-surface:      #0f1c27;
    --clr-surface-2:    #1a2d3e;
    --clr-border:       rgba(178,174,163,0.12);
    --clr-text:         #b2aea3;
    --clr-text-2:       rgba(178,174,163,0.78);
    --clr-text-muted:   rgba(178,174,163,0.45);

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body:    'Outfit', system-ui, sans-serif;

    --nav-height: 60px;
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --shadow-lg: 0 16px 64px rgba(0,0,0,.7);
    --transition: 0.2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font-body);
    background: linear-gradient(160deg, var(--clr-bg) 0%, var(--clr-bg-end) 100%);
    background-attachment: fixed;
    color: var(--clr-text);
    min-height: 100vh;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ── Header ── */
.gallery-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-height);
    background: rgba(9,49,69,0.90);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--clr-border);
}
.gallery-header-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.header-brand { display: flex; align-items: center; }
.header-logo  { height: 24px; width: auto; }
.header-info  { display: flex; align-items: center; }
.header-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--clr-text-2);
    font-style: italic;
}

/* ── Main ── */
.gallery-main { min-height: calc(100vh - var(--nav-height)); }

/* ── Expiry banner ── */
.expiry-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: rgba(9,49,69,0.6);
    border-bottom: 1px solid var(--clr-border);
    font-size: 0.83rem;
    color: var(--clr-text-2);
    text-align: center;
    justify-content: center;
}
.expiry-urgent {
    background: rgba(122,92,26,0.20);
    border-color: rgba(122,92,26,0.40);
    color: #d4a845;
}
.expiry-icon { font-size: 1rem; flex-shrink: 0; }

/* ── Gallery hero ── */
.gallery-hero {
    max-width: 760px;
    margin: 60px auto 40px;
    padding: 0 24px;
    text-align: center;
}
.gallery-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 600;
    color: var(--clr-white);
    line-height: 1.15;
    margin-bottom: 16px;
}
.gallery-description {
    font-size: 1rem;
    color: var(--clr-text-2);
    line-height: 1.7;
    margin-bottom: 20px;
}
.gallery-stats {
    font-size: 0.8rem;
    color: var(--clr-text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── Photo grid ── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 4px;
    padding: 0 4px 80px;
    max-width: 1600px;
    margin: 0 auto;
}
.grid-item {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    cursor: zoom-in;
    background: var(--clr-surface);
}
.grid-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, filter 0.3s ease;
    display: block;
}
.grid-item:hover .grid-img {
    transform: scale(1.04);
    filter: brightness(0.85);
}
.grid-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
}
.grid-item:hover .grid-overlay { opacity: 1; }
.overlay-expand {
    font-size: 1.8rem;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 2px 8px rgba(0,0,0,.5);
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(5,10,15,0.97);
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.open { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-close {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 10;
    background: rgba(178,174,163,0.12);
    border: 1px solid var(--clr-border);
    color: var(--clr-stone);
    font-size: 1.1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: rgba(178,174,163,0.22); color: var(--clr-white); }

.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(178,174,163,0.10);
    border: 1px solid var(--clr-border);
    color: var(--clr-stone);
    font-size: 2rem;
    width: 48px;
    height: 80px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.modal-nav:hover { background: rgba(178,174,163,0.20); color: var(--clr-white); }
.modal-prev { left: 12px; }
.modal-next { right: 12px; }

.modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    max-width: calc(100vw - 140px);
    max-height: 100vh;
}

.modal-img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}
.modal-img {
    max-width:  calc(100vw - 140px);
    max-height: calc(100vh - 80px);
    object-fit: contain;
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-lg);
    transition: opacity 0.18s ease;
}
.modal-img.loading { opacity: 0; }

.modal-loader {
    position: absolute;
    width: 32px;
    height: 32px;
    border: 2px solid var(--clr-border);
    border-top-color: var(--clr-stone);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}
.modal-loader.active { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(9,20,30,0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--clr-border);
    gap: 16px;
}
.modal-counter {
    font-size: 0.78rem;
    color: var(--clr-text-muted);
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.78rem;
    font-family: var(--font-body);
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--clr-stone);
    background: rgba(178,174,163,0.08);
    border: 1px solid var(--clr-border);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}
.modal-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.modal-btn:hover { background: rgba(178,174,163,0.16); color: var(--clr-white); }

/* ── Share toast ── */
.share-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--clr-navy);
    color: var(--clr-stone);
    padding: 10px 20px;
    border-radius: var(--r-md);
    font-size: 0.82rem;
    border: 1px solid var(--clr-border);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 2000;
    white-space: nowrap;
}
.share-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Client login ── */
.login-outer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--nav-height));
    padding: 40px 24px;
}
.client-login-card {
    width: 100%;
    max-width: 420px;
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--r-lg);
    padding: 48px 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.login-logo-img  { height: 32px; width: auto; margin: 0 auto 20px; }
.login-gallery-title {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--clr-white);
    margin-bottom: 6px;
    line-height: 1.2;
}
.login-gallery-sub {
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--clr-text-muted);
    margin-bottom: 32px;
}
.client-alert {
    padding: 10px 14px;
    background: rgba(139,34,34,0.15);
    border: 1px solid rgba(139,34,34,0.4);
    border-radius: var(--r-sm);
    font-size: 0.85rem;
    color: #e88;
    margin-bottom: 20px;
}
.client-login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.code-input {
    width: 100%;
    padding: 14px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: var(--clr-white);
    background: var(--clr-surface-2);
    border: 1px solid var(--clr-border);
    border-radius: var(--r-md);
    outline: none;
    transition: border-color var(--transition);
    font-family: var(--font-display);
}
.code-input:focus { border-color: rgba(178,174,163,0.35); }
.btn-enter {
    width: 100%;
    padding: 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--clr-stone);
    background: var(--clr-copper);
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--transition);
    font-family: var(--font-body);
}
.btn-enter:hover { background: var(--clr-copper-hover); color: var(--clr-white); }

.expired-notice {
    padding: 24px;
    background: rgba(139,34,34,0.1);
    border: 1px solid rgba(139,34,34,0.25);
    border-radius: var(--r-md);
    color: #e88;
    font-size: 0.9rem;
}
.expired-icon { display: block; font-size: 2rem; margin-bottom: 10px; }

/* ── Home page ── */
.home-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.home-wrap { width: 100%; padding: 40px 24px; display: flex; align-items: center; justify-content: center; }
.home-content { text-align: center; max-width: 420px; }
.home-logo { height: 40px; width: auto; margin: 0 auto 24px; }
.home-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    color: var(--clr-white);
    margin-bottom: 16px;
    font-style: italic;
}
.home-text { font-size: 0.9rem; color: var(--clr-text-2); line-height: 1.7; }

/* ── Footer ── */
.gallery-footer {
    padding: 24px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--clr-text-muted);
    border-top: 1px solid var(--clr-border);
}
.gallery-footer a { color: var(--clr-text-muted); text-decoration: underline; transition: color var(--transition); }
.gallery-footer a:hover { color: var(--clr-stone); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .modal-content { max-width: 100vw; }
    .modal-img {
        max-width: 100vw;
        max-height: calc(100vh - 100px);
    }
    .modal-prev { left: 4px; }
    .modal-next { right: 4px; }
    .modal-nav { width: 38px; height: 64px; font-size: 1.5rem; }
    .modal-btn span, .modal-btn { font-size: 0; padding: 0.5rem; }
    .modal-btn svg { width: 18px; height: 18px; margin: 0; }
    .client-login-card { padding: 36px 24px; }
}
@media (max-width: 480px) {
    .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 2px; padding: 0 2px 60px; }
    .gallery-hero { margin: 36px auto 28px; }
}
