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

html { scroll-behavior:smooth; }

body {
    font-family: 'Cairo', sans-serif;
    background: #1a0e07;
    color: #FAF0DC;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(212,168,67,.3); }

::-webkit-scrollbar { width:6px; }
::-webkit-scrollbar-track { background: #1a0e07; }
::-webkit-scrollbar-thumb { background: #5c3a22; border-radius:3px; }

/* === Header === */
.header {
    display: flex;
    justify-content: center;
    padding: 48px 24px 16px;
}

.logo {
    height: 72px;
    width: auto;
    filter: drop-shadow(0 4px 20px rgba(212,168,67,.25));
    animation: fadeIn .8s ease-out;
}

/* === Gallery Grid === */
.gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 24px auto 48px;
    padding: 0 24px;
}

/* === Card === */
.card {
    background: linear-gradient(145deg, rgba(44,24,16,.9), rgba(26,14,7,.95));
    border: 1px solid rgba(212,168,67,.1);
    border-radius: 20px;
    overflow: hidden;
    transition: transform .4s ease, border-color .4s ease, box-shadow .4s ease;
    opacity: 0;
    animation: cardIn .6s ease-out forwards;
}
.card:nth-child(1) { animation-delay: .1s; }
.card:nth-child(2) { animation-delay: .2s; }
.card:nth-child(3) { animation-delay: .3s; }
.card:nth-child(4) { animation-delay: .4s; }

.card:hover {
    transform: translateY(-6px);
    border-color: rgba(212,168,67,.25);
    box-shadow: 0 12px 48px rgba(212,168,67,.1);
}

/* === 3D Viewer === */
.viewer {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    cursor: grab;
    background: #1a0e07;
}
.viewer:active { cursor: grabbing; }

.viewer canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    outline: none;
}

/* === Label === */
.label {
    display: block;
    text-align: center;
    padding: 14px;
    font-size: .95rem;
    font-weight: 700;
    color: rgba(212,168,67,.7);
    letter-spacing: .08em;
    border-top: 1px solid rgba(212,168,67,.08);
}

/* === Loader === */
.loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(26,14,7,.85);
    backdrop-filter: blur(8px);
    z-index: 10;
    transition: opacity .4s ease;
    color: #D4A843;
    font-size: .8rem;
    font-weight: 700;
}
.loader.hidden { opacity:0; pointer-events:none; }

.spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(212,168,67,.15);
    border-top-color: #D4A843;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

/* === Controls === */
.controls {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 5;
}

.controls button {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(212,168,67,.12);
    background: rgba(26,14,7,.7);
    backdrop-filter: blur(8px);
    color: #D4A843;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, border-color .2s;
}
.controls button:hover {
    background: rgba(212,168,67,.18);
    border-color: rgba(212,168,67,.3);
}
.controls button.active {
    background: rgba(212,168,67,.22);
    border-color: #D4A843;
}

/* === Fullscreen Overlay === */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,6,3,.97);
    z-index: 9999;
    display: none;
}
.overlay.open { display: block; }

.overlay canvas {
    width: 100%;
    height: 100%;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(212,168,67,.25);
    background: rgba(212,168,67,.12);
    color: #D4A843;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10000;
    transition: background .2s, transform .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.close-btn:hover {
    background: rgba(212,168,67,.3);
    transform: rotate(90deg);
}

/* === Animations === */
@keyframes fadeIn {
    from { opacity:0; transform:translateY(-12px); }
    to { opacity:1; transform:translateY(0); }
}

@keyframes cardIn {
    from { opacity:0; transform:translateY(30px); }
    to { opacity:1; transform:translateY(0); }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === Responsive === */
@media (max-width: 768px) {
    .gallery {
        grid-template-columns: 1fr;
        max-width: 560px;
    }
    .logo { height: 56px; }
    .header { padding: 32px 24px 12px; }
}
