/* Fonts */
@font-face {
    font-family: 'BrittanySignature';
    src: url('./assets/BrittanySignature.ttf') format('truetype');
}
@font-face {
    font-family: 'Ovo';
    src: url('./assets/Ovo-Regular.ttf') format('truetype');
}

:root {
    --bg: #0a0a0a;
    --surface: #141414;
    --surface-2: #1e1e1e;
    --surface-3: #2a2a2a;
    --border: rgba(255,255,255,0.08);
    --text: #f0ece4;
    --text-secondary: rgba(240,236,228,0.5);
    --accent: #c9a96e;
    --accent-dim: rgba(201,169,110,0.15);
    --accent-glow: rgba(201,169,110,0.3);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --radius-lg: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html { background: var(--bg); }

body {
    font-family: -apple-system, 'Ovo', serif;
    background: var(--bg);
    color: var(--text);
    overscroll-behavior-y: none;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
}

/* ─── NAVBAR ─── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: calc(64px + var(--safe-top));
    padding: calc(var(--safe-top) + 12px) 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10,10,10,0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-title-small {
    font-family: 'BrittanySignature', cursive;
    font-size: 1.9rem;
    color: var(--accent);
    font-weight: normal;
    letter-spacing: 0.02em;
}

.btn-secondary {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: -apple-system, sans-serif;
    font-size: 0.82rem;
    padding: 8px 14px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-secondary:active {
    transform: scale(0.94);
    background: var(--surface-3);
}

/* ─── SELECTION BAR ─── */
.selection-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 101;
    height: calc(64px + var(--safe-top));
    padding: calc(var(--safe-top) + 12px) 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(20,14,8,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(201,169,110,0.2);
    transform: translateY(-110%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}
.selection-bar.active { transform: translateY(0); }

#selectionCount {
    font-size: 0.92rem;
    color: var(--accent);
    font-weight: 600;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.88rem;
    cursor: pointer;
    padding: 6px 2px;
}
.btn-icon:active { color: var(--text); }

.btn-primary-small {
    background: var(--accent);
    color: #0a0a0a;
    border: none;
    font-family: -apple-system, sans-serif;
    font-size: 0.84rem;
    font-weight: 700;
    padding: 9px 18px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-primary-small:active {
    transform: scale(0.93);
    background: var(--accent-dim);
    color: var(--accent);
}
.btn-primary-small:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ─── GALLERY CONTAINER ─── */
.gallery-container {
    padding-top: calc(80px + var(--safe-top));
    padding-bottom: calc(40px + var(--safe-bottom));
    min-height: 100dvh;
}
.loading-text {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ─── PHOTO LIST (FEED VIEW) ─── */
.photo-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 550px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ─── IMAGE WRAPPER ─── */
.img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; 
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: var(--surface);
    cursor: pointer;
    -webkit-touch-callout: none;
    user-select: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.img-wrapper::before {
    content: '';
    position: absolute;
    inset: -10px; 
    background: inherit;
    background-size: cover;
    background-position: center;
    filter: blur(5px);
    z-index: 1;
}

.img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 2;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease-in-out;
    opacity: 0;
}
.img-wrapper.loaded img { opacity: 1; }

.selection-mode .img-wrapper {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(0.95);
}
.selection-mode .img-wrapper.selected {
    transform: scale(0.9);
}

/* ─── INDIVIDUAL DOWNLOAD BUTTON ─── */
.item-download-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 10;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-family: -apple-system, sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.item-download-btn:active {
    transform: scale(0.9);
    background: var(--accent);
    color: #000;
}
/* Hide individual download button when selecting multiple */
.selection-mode .item-download-btn {
    display: none;
}

/* ─── CHECKBOX OVERLAY ─── */
.checkbox-overlay {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.7);
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    z-index: 10;
}
.selection-mode .checkbox-overlay { display: flex; }
.img-wrapper.selected .checkbox-overlay {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.1);
}
.img-wrapper.selected .checkbox-overlay::after {
    content: '';
    display: block;
    width: 6px;
    height: 12px;
    border: 2px solid #0a0a0a;
    border-top: none;
    border-left: none;
    transform: rotate(42deg) translateY(-2px);
}
.img-wrapper.selected::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(201,169,110,0.18);
    pointer-events: none;
    z-index: 5;
}

.scroll-trigger {
    height: 1px;
    width: 100%;
}