/* === Reset & Variables === */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #000;
    --fg: #fff;
    --muted: #cec4c4;
    --subtle: #7a6868;
    --card-bg: #0a0a0a;
    --card-border: #222;
    --desc: #888;
    --show-artist-name: 1; /* set to 0 to hide */
}

body.light {
    --bg: #f5f5f5;
    --fg: #111;
    --muted: #413a3a;
    --subtle: #ccc;
    --card-bg: #fff;
    --card-border: #ddd;
    --desc: #666;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--fg);
    transition: background 0.3s, color 0.3s;
}

/* === Accessibility === */

.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--fg);
    color: var(--bg);
    padding: 8px 16px;
    z-index: 200;
    font-size: 0.85rem;
    text-decoration: none;
    border-radius: 4px;
}

.skip-link:focus {
    top: 16px;
}

*:focus-visible {
    outline: 2px solid var(--fg);
    outline-offset: 2px;
}

/* === Category Navigation === */

#category-nav {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    align-items: center;
    z-index: 30;
}

#category-nav .divider {
    width: 1px;
    height: 12px;
    background: var(--subtle);
}

.cat-btn {
    padding: 6px 20px;
    font-size: 0.75rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.3s, opacity 0.3s;
    font-family: inherit;
    opacity: 0.6;
}

.cat-btn.active {
    color: var(--fg);
    opacity: 1;
}

.cat-btn:hover:not(.active) {
    opacity: 0.7;
}

/* === Gallery Layout === */

#page-container {
    position: relative;
    width: 100%;
    height: 100%;
}

#room-label {
    position: absolute;
    top: 56px;
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    letter-spacing: 8px;
    text-transform: uppercase;
    color: var(--muted);
    pointer-events: none;
    z-index: 2;
}

#gallery-wall {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 80px 80px;
    transition: opacity 0.5s;
    overflow: hidden;
    perspective: 1000px;
}

/* === Card / Flip === */

.card {
    position: relative;
    cursor: default;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.card-front {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--card-border);
    line-height: 0;
}

.card-front img {
    display: block;
    max-width: 70vw;
    max-height: calc(100vh - 200px);
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: pointer;
}

.click-zone {
    position: absolute;
    top: 0;
    width: 20%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
}

.click-left { left: 0; }
.click-right { right: 0; }

.click-zone:hover {
    background: rgba(255, 255, 255, 0.06);
}

.click-zone:active {
    background: rgba(255, 255, 255, 0.15);
}

body.light .click-zone:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light .click-zone:active {
    background: rgba(0, 0, 0, 0.1);
}

.card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    overflow: hidden;
    cursor: pointer;
}

.card-back h2 {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 2px;
    margin-bottom: 6px;
    color: var(--fg);
}

.card-back .medium {
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.card-back .desc {
    font-size: 0.8rem;
    color: var(--desc);
    line-height: 1.9;
    font-weight: 300;
}

.painting-label {
    position: absolute;
    bottom: -32px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.65rem;
    color: var(--muted);
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* === Navigation Dots === */

#nav-dots {
    position: absolute;
    bottom: 60px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    pointer-events: none;
    z-index: 3;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--subtle);
    transition: background 0.3s;
}

.dot.active {
    background: var(--fg);
}

/* === Artist Name === */

#artist-name {
    position: fixed;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    pointer-events: none;
    opacity: var(--show-artist-name);
}

#artist-name span {
    display: block;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 5.65rem;
    letter-spacing: 10px;
    text-transform: uppercase;
    color: var(--fg);
    opacity: 0.4;
    white-space: nowrap;
}

/* === About Overlay === */

.about-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s;
}

.about-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.about-content {
    max-width: 520px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 40px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
}

.about-close {
    position: absolute;
    top: 24px;
    right: 32px;
    font-size: 1.8rem;
    background: none;
    border: none;
    color: var(--fg);
    cursor: pointer;
    line-height: 1;
}

.about-section {
    margin-bottom: 28px;
}

.about-section:last-child {
    margin-bottom: 0;
}

.about-section h2 {
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--fg);
    margin-bottom: 12px;
}

.about-section p,
.about-section li {
    font-size: 0.82rem;
    color: var(--desc);
    line-height: 1.8;
    font-weight: 300;
}

.about-section ul {
    list-style: none;
    padding: 0;
}

.about-section ul li {
    margin-bottom: 6px;
}

.about-section a {
    color: var(--fg);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.about-section a:hover {
    opacity: 0.7;
}

/* === Responsive — large to small === */

@media (max-width: 1024px) {
    #gallery-wall {
        padding: 70px 60px 100px;
    }

    .card-front img {
        max-width: 75vw;
        max-height: calc(100vh - 220px);
    }

    #artist-name span {
        font-size: 4rem;
        letter-spacing: 8px;
    }
}

@media (max-width: 768px) {
    #gallery-wall {
        padding: 70px 20px 110px;
    }

    .card-front img {
        max-width: 85vw;
        max-height: calc(100vh - 200px);
    }

    .card-back {
        padding: 20px;
    }

    .card-back h2 {
        font-size: 0.95rem;
    }

    .card-back .desc {
        font-size: 0.75rem;
        line-height: 1.7;
    }

    .painting-label {
        font-size: 0.55rem;
        bottom: -24px;
    }

    .cat-btn {
        padding: 6px 12px;
        letter-spacing: 2px;
        font-size: 0.68rem;
    }

    /* Artist name moves to horizontal bottom bar */
    #artist-name {
        left: 0;
        top: auto;
        bottom: 0;
        width: 100%;
        height: auto;
        padding: 8px 0 12px;
        justify-content: center;
    }

    #artist-name span {
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 0.6rem;
        letter-spacing: 5px;
        opacity: 0.35;
    }

    #nav-dots {
        bottom: 42px;
    }
}

@media (max-width: 480px) {
    #gallery-wall {
        padding: 60px 12px 120px;
    }

    .card-front img {
        max-width: 92vw;
        max-height: calc(100vh - 220px);
    }

    .card-back {
        padding: 14px;
    }

    .card-back .desc {
        font-size: 0.7rem;
    }

    .cat-btn {
        padding: 5px 10px;
        letter-spacing: 1.5px;
        font-size: 0.62rem;
    }

    #nav-dots {
        bottom: 46px;
    }

    #artist-name span {
        font-size: 0.55rem;
        letter-spacing: 4px;
    }

    .painting-label {
        bottom: -20px;
    }
}

@media (max-width: 360px) {
    .cat-btn {
        padding: 4px 8px;
        font-size: 0.58rem;
        letter-spacing: 1px;
    }

    .card-back h2 {
        font-size: 0.85rem;
    }
}

/* === Empty Gallery === */

.empty-gallery {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
    opacity: 0.6;
}

/* === Reduced Motion === */

@media (prefers-reduced-motion: reduce) {
    .card,
    #gallery-wall {
        transition: none;
    }
}
