/* ============================================================
   nazly.com — Dark minimal photography portfolio
   ============================================================ */

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
    --c-bg:        #0a0a0a;
    --c-sidebar:   #0e0e0e;
    --c-border:    #1a1a1a;
    --c-text:      #d8d8d8;
    --c-muted:     #a0a0a0;
    --c-dim:       #787878;
    --c-active:    #ffffff;
    --c-hover:     #cccccc;

    --sidebar-w:   460px;
    --font:        'Roboto', system-ui, sans-serif;

    --transition:  0.2s ease;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; }
body {
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font);
    font-weight: 300;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
img  { display: block; max-width: 100%; height: auto; }
a    { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
ul, ol { list-style: none; }

/* ── Layout: sidebar + content ───────────────────────────────────────────── */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--c-sidebar);
    border-right: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    padding: 3rem 3rem 2.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
    /* Thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--c-border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--c-border); }

/* Profile photo — circle */
.sidebar-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
    background: var(--c-border);
}
.sidebar-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Name, tagline, bio */
.sidebar-identity {
    margin-bottom: 2.25rem;
}

.sidebar-name {
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    color: var(--c-active);
    margin-bottom: 0.4rem;
}

.sidebar-tagline {
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--c-muted);
    margin-bottom: 1rem;
}

.sidebar-bio {
    font-size: 0.94rem;
    font-weight: 300;
    color: var(--c-dim);
    line-height: 1.7;
    overflow-wrap: break-word;
}

/* Gallery navigation */
.gallery-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.gallery-link {
    display: block;
    padding: 0.6rem 0;
    font-size: 0.92rem;
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-muted);
    text-align: left;
    transition: color var(--transition);
    position: relative;
}

.gallery-link::before {
    content: '';
    position: absolute;
    left: -1.75rem;    /* aligns to sidebar left edge */
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 0;
    background: var(--c-active);
    transition: height 0.2s ease;
}

.gallery-link:hover { color: var(--c-hover); }

.gallery-link.active {
    color: var(--c-active);
    font-weight: 400;
}

.gallery-link.active::before {
    height: 14px;
}

/* Spacer pushes socials to bottom */
.sidebar-spacer { flex: 1; min-height: 2rem; }

/* Social icons */
.social-links {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--c-muted);
    transition: color var(--transition);
}
.social-link:hover { color: var(--c-active); }
.social-link svg { width: 22px; height: 22px; }

/* Copyright */
.sidebar-copy {
    font-size: 0.82rem;
    color: var(--c-dim);
    letter-spacing: 0.05em;
}

/* ── Mobile: hamburger toggle ────────────────────────────────────────────── */
.menu-toggle {
    display: none;      /* hidden on desktop */
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 200;
    width: 36px;
    height: 36px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(14, 14, 14, 0.9);
    border: 1px solid var(--c-border);
    padding: 0;
    transition: background var(--transition);
}
.menu-toggle:hover { background: var(--c-border); }

.menu-toggle-bar {
    display: block;
    width: 18px;
    height: 1px;
    background: var(--c-text);
    transition: opacity var(--transition), transform 0.25s ease;
    transform-origin: center;
}

/* Animate to X when open */
.menu-toggle.open .menu-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle.open .menu-toggle-bar:nth-child(2) { opacity: 0; }
.menu-toggle.open .menu-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.65);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-backdrop.visible {
    display: block;
    opacity: 1;
}

/* ── Content area ────────────────────────────────────────────────────────── */
.content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    position: relative;
}

/* ── Gallery grid (Masonry.js — left-to-right photo ordering) ───────────── */
.gallery-grid {
    padding: 6px;
    position: relative;       /* Required by Masonry absolute positioning */
    transition: opacity 0.25s ease;
}

.gallery-grid.fading {
    opacity: 0;
    pointer-events: none;
}

/* Invisible sizer element — Masonry reads its width to calculate columns.
   3 columns with 6px gutters: (100% - 2×6px) ÷ 3 = 33.333% - 4px          */
.grid-sizer          { width: calc(33.333% - 4px); }

/* Each photo link */
.grid-item {
    width: calc(33.333% - 4px);
    display: block;
    margin-bottom: 6px;
    position: relative;
    overflow: hidden;
    background: #111;
    cursor: zoom-in;
}

.grid-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.35s ease;
    /* Subtle initial filter — lifted on hover */
    filter: brightness(0.92);
}

.grid-item:hover img {
    opacity: 0.82;
    filter: brightness(1);
}

/* Caption — slides up on hover */
.grid-item-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 0.75rem 0.6rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    font-size: 0.7rem;
    font-weight: 300;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.8);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.28s ease, transform 0.28s ease;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-item:hover .grid-item-caption {
    opacity: 1;
    transform: translateY(0);
}

/* Empty state */
.gallery-empty {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--c-muted);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
}

/* ── Loading dots (AJAX state) ───────────────────────────────────────────── */
.gallery-loading {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    gap: 6px;
    z-index: 30;
    align-items: center;
}

.gallery-loading.active {
    display: flex;
}

.loading-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--c-muted);
    animation: dot-pulse 1.2s ease-in-out infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ── PhotoSwipe overrides ────────────────────────────────────────────────── */
.pswp {
    --pswp-bg:                   #060606;
    --pswp-placeholder-color:    #111;
    --pswp-icon-color:           #888;
    --pswp-icon-color-secondary: #444;
    --pswp-icon-stroke-color:    #888;
    --pswp-icon-stroke-width:    1.5px;
}

/* Caption in lightbox */
.pswp__caption-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem 1.5rem 1.25rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: rgba(255,255,255,0.7);
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.07em;
    text-align: center;
    pointer-events: none;
}

/* ── Keyboard focus ring ─────────────────────────────────────────────────── */
:focus-visible {
    outline: 1px solid #555;
    outline-offset: 2px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

/* Mobile: sidebar off-canvas, hamburger visible */
@media (max-width: 1100px) {
    .menu-toggle  { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        box-shadow: none;
        /* Prevent sidebar overflowing the viewport on narrow screens */
        max-width: 88vw;
        padding-left: 1.75rem;
        padding-right: 1.75rem;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 6px 0 24px rgba(0,0,0,0.6);
    }

    .content {
        margin-left: 0;
    }

    /* Sidebar off-canvas — tighten grid gaps slightly */
    .gallery-grid { padding: 4px; }
    .grid-item    { margin-bottom: 4px; }
}

/* Narrow phones: switch to 2 columns.
   2 columns with 6px gutter: (100% - 1×6px) ÷ 2 = 50% - 3px              */
@media (max-width: 600px) {
    .grid-sizer,
    .grid-item    { width: calc(50% - 3px); }
    .gallery-grid { padding: 3px; }
    .grid-item    { margin-bottom: 3px; }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .gallery-grid       { transition: none; }
    .grid-item img      { transition: none; }
    .grid-item-caption  { transition: none; }
    .loading-dot        { animation: none; }
    .sidebar            { transition: none; }
}
