/* ================================================
   Kairi Uibo — Portfolio
   Clean, minimal, editorial design
   ================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --color-bg:      #e8e8e8;
    --color-surface: #f2f2f2;
    --color-text:    #1a1a1a;
    --color-muted:   #6b6b6b;
    --color-border:  #d0d0d0;
    --color-accent:  #1a1a1a;
    --font-sans:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif:    'Playfair Display', Georgia, serif;
    --max-width:     1200px;
    --nav-height:    84px;
    --transition:    0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    position: relative;
    min-height: 100vh;
}

/* ---------- Animated Background ---------- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 600px 600px at 20% 30%, rgba(180, 160, 180, 0.25), transparent),
        radial-gradient(ellipse 500px 500px at 75% 70%, rgba(160, 175, 200, 0.2), transparent),
        radial-gradient(ellipse 400px 400px at 50% 50%, rgba(170, 155, 170, 0.15), transparent);
    animation: bgDrift 20s ease-in-out infinite alternate;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 550px 550px at 80% 20%, rgba(160, 180, 180, 0.2), transparent),
        radial-gradient(ellipse 450px 450px at 30% 80%, rgba(190, 160, 165, 0.18), transparent);
    animation: bgDrift2 25s ease-in-out infinite alternate;
}

@keyframes bgDrift {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(30px, -20px) scale(1.05); }
    66%  { transform: translate(-20px, 15px) scale(0.97); }
    100% { transform: translate(15px, -10px) scale(1.02); }
}

@keyframes bgDrift2 {
    0%   { transform: translate(0, 0) scale(1.02); }
    50%  { transform: translate(-25px, 20px) scale(0.98); }
    100% { transform: translate(20px, -15px) scale(1.04); }
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ---------- Navbar ---------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
    padding: 0 clamp(1.25rem, 4vw, 3rem);
    background: rgba(242, 242, 242, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
}

.navbar__name {
    font-family: var(--font-serif);
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.navbar__vita-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1.5px solid var(--color-accent);
    border-radius: 2px;
    transition: background var(--transition), color var(--transition);
}

.navbar__vita-btn:hover,
.navbar__vita-btn:focus-visible {
    background: var(--color-accent);
    color: var(--color-surface);
}

/* ---------- Artist Statement ---------- */
.statement {
    padding: clamp(3rem, 8vw, 6rem) clamp(1.25rem, 4vw, 3rem);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.statement__inner {
    max-width: 740px;
    margin: 0 auto;
}

.statement__text {
    font-family: var(--font-serif);
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    font-weight: 400;
    font-style: italic;
    line-height: 1.75;
    color: var(--color-muted);
    text-align: center;
}

/* ---------- Categories ---------- */
.categories {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 4rem) clamp(1.25rem, 4vw, 3rem);
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 3vw, 2.5rem);
}

/* Single category */
.category {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.category:hover {
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
}

/* Category header (button) */
.category__header {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2vw, 1.75rem);
    width: 100%;
    padding: clamp(0.75rem, 1.5vw, 1.25rem);
    text-align: left;
    transition: background var(--transition);
}

.category__header:hover {
    background: rgba(0,0,0,0.02);
}

.category__cover-wrap {
    flex-shrink: 0;
    width: clamp(80px, 12vw, 140px);
    border-radius: 3px;
    overflow: hidden;
}

.category__cover {
    width: 100%;
    height: auto;
    display: block;
    transition: transform var(--transition);
}

.category__header:hover .category__cover {
    transform: scale(1.04);
}

.category__info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
}

.category__title {
    font-family: var(--font-sans);
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* Toggle icon */
.category__toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--color-muted);
    transition: color var(--transition), background var(--transition);
}

.category__header:hover .category__toggle {
    color: var(--color-text);
    background: rgba(0,0,0,0.05);
}

.category__toggle .toggle-v {
    transition: transform var(--transition), opacity var(--transition);
    transform-origin: center;
}

.category__header[aria-expanded="true"] .toggle-v {
    transform: rotate(90deg);
    opacity: 0;
}

/* Category panel (collapsible) */
.category__panel {
    overflow: hidden;
}

.category__panel[hidden] {
    display: none;
}

.category__panel:not([hidden]) {
    animation: panelOpen 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes panelOpen {
    from { opacity: 0; max-height: 0; }
    to   { opacity: 1; max-height: 2000px; }
}

/* ---------- Gallery ---------- */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: clamp(1rem, 2vw, 1.5rem);
    padding: 0 clamp(0.75rem, 1.5vw, 1.25rem) clamp(1.25rem, 2vw, 1.75rem);
}

.gallery__item {
    cursor: pointer;
    border-radius: 3px;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}

.gallery__item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.gallery__img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform var(--transition);
}

.gallery__item:hover .gallery__img {
    transform: scale(1.03);
}

.gallery__caption {
    padding: 0.6rem 0.75rem;
    font-size: 0.825rem;
    color: var(--color-muted);
    letter-spacing: 0.01em;
    background: var(--color-surface);
}

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox[hidden] {
    display: none;
}

.lightbox:not([hidden]) {
    animation: lbFadeIn 0.3s ease forwards;
}

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

.lightbox__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.lightbox__container {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 1.5rem);
    max-width: 92vw;
    max-height: 92vh;
    z-index: 1;
}

.lightbox__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 80vw;
    max-height: 85vh;
}

.lightbox__img {
    max-width: 80vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 2px;
    animation: lbImgIn 0.3s ease forwards;
}

@keyframes lbImgIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}

.lightbox__caption {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.75);
    letter-spacing: 0.02em;
    text-align: center;
}

/* Lightbox buttons */
.lightbox__close,
.lightbox__prev,
.lightbox__next {
    color: rgba(255,255,255,0.7);
    transition: color var(--transition), transform var(--transition);
}

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
    color: #fff;
}

.lightbox__close {
    position: absolute;
    top: -40px;
    right: 0;
    z-index: 2;
}

.lightbox__prev,
.lightbox__next {
    flex-shrink: 0;
}

.lightbox__prev:hover { transform: translateX(-3px); }
.lightbox__next:hover { transform: translateX(3px); }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
    .category__cover-wrap {
        width: 64px;
    }

    .lightbox__container {
        max-width: 100vw;
        padding: 0 0.5rem;
    }

    .lightbox__content {
        max-width: 95vw;
    }

    .lightbox__img {
        max-width: 95vw;
        max-height: 70vh;
    }

    .lightbox__prev,
    .lightbox__next {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 3;
        background: rgba(0,0,0,0.4);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .lightbox__prev { left: 0.5rem; }
    .lightbox__next { right: 0.5rem; }

    .lightbox__prev:hover,
    .lightbox__next:hover {
        transform: translateY(-50%);
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
    }
}

/* Focus-visible for accessibility */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Scrollbar subtle styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
