@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&family=Lato:wght@300;400&display=swap');

body { 
    margin: 0; height: 850vh; background: #000; overflow-x: hidden; color: white; 
    -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; user-select: none; overscroll-behavior: none;
}
canvas { position: fixed; top: 0; left: 0; outline: none; z-index: 1; pointer-events: none; }

/* --- PANTALLA DE CARGA --- */
#loading-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 1.5s ease-out; /* Transición más lenta y suave */
}
.loader-content { text-align: center; width: 280px; }
.loader-title {
    font-family: 'Cinzel', serif; font-size: 1.5rem; letter-spacing: 5px; color: #d4af37; margin-bottom: 20px;
}
.loader-bar-container {
    width: 100%; height: 2px; background: rgba(255,255,255,0.1); position: relative; overflow: hidden;
}
#loader-bar {
    width: 0%; height: 100%; background: #d4af37; transition: width 0.2s ease;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}
#loader-text {
    font-family: 'Lato', sans-serif; font-size: 0.7rem; color: rgba(255,255,255,0.4); 
    letter-spacing: 2px; margin-top: 10px;
}

/* EFECTO DE APARICIÓN SUAVE DE LA WEB */
/* Ocultamos elementos principales al inicio */
body > header, body > section {
    opacity: 0;
    transition: opacity 2s ease; /* Aparición muy lenta y elegante */
}
/* Cuando se añade la clase 'loaded', se muestran */
body.loaded > header, body.loaded > section {
    opacity: 1;
}

/* HEADER DINÁMICO */
header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 100;
    transition: all 0.4s ease; padding-top: 50px;
    display: flex; flex-direction: column; align-items: center;
}

header.scrolled {
    padding-top: 20px;
    background: transparent;
}

#menu-toggle {
    font-family: 'Cinzel', serif; font-size: 0.85rem; font-weight: 600; color: #d4af37;
    text-transform: uppercase; letter-spacing: 3px; cursor: pointer;
    border: 1px solid rgba(212, 175, 55, 0.5); padding: 10px 20px; border-radius: 30px;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    display: none; 
    transition: all 0.3s ease; pointer-events: auto;
}
#menu-toggle:hover { background: rgba(212, 175, 55, 0.1); border-color: #fff; color: #fff; }

#nav-container {
    display: flex; justify-content: center; gap: 80px;
    font-family: 'Cinzel', serif; font-size: 0.85rem; font-weight: 600; color: rgba(255,255,255,0.7);
    text-transform: uppercase; letter-spacing: 3px; pointer-events: none;
    transition: all 0.4s ease;
}

header.scrolled #nav-container {
    opacity: 0; pointer-events: none; transform: translateY(-20px); position: absolute;
}
header.scrolled #menu-toggle { display: block; }

header.menu-open #nav-container {
    opacity: 1; pointer-events: auto; transform: translateY(0); position: relative;
    flex-direction: column; background: rgba(10, 10, 10, 0.95); backdrop-filter: blur(15px);
    width: 100vw; height: 100vh; position: fixed; top: 0; left: 0;
    justify-content: center; align-items: center; gap: 40px;
}
header.menu-open #menu-toggle {
    z-index: 101; border-color: #fff; color: #fff;
    position: fixed; top: 30px;
}

.nav-item { pointer-events: auto; cursor: pointer; transition: color 0.3s ease; position: relative; }
.nav-item::after { content: ''; position: absolute; width: 0; height: 1px; bottom: -5px; left: 50%; background-color: #d4af37; transition: all 0.3s ease; transform: translateX(-50%); }
.nav-item:hover { color: #ffffff; text-shadow: 0 0 10px rgba(255,255,255,0.5); }
.nav-item:hover::after { width: 100%; }

/* SECCIONES */
#about-section {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 80%; max-width: 650px; text-align: center; z-index: 5;
    font-family: 'Lato', sans-serif; font-weight: 300; pointer-events: none; opacity: 0; filter: blur(20px);
}
#about-section h2 { font-family: 'Cinzel', serif; font-size: 2rem; margin-bottom: 30px; letter-spacing: 4px; color: #fff; }
#about-section p { font-size: 1.05rem; line-height: 1.9; margin-bottom: 20px; color: rgba(255,255,255,0.85); }
.brand-highlight { color: #fff; font-weight: 400; border-bottom: 1px solid rgba(255,255,255,0.3); padding-bottom: 2px; }
.highlight-quote {
    font-family: 'Cinzel', serif; font-size: 1.2rem; color: #d4af37; margin: 35px 0; line-height: 1.5; letter-spacing: 2px;
    border-top: 1px solid rgba(212, 175, 55, 0.3); border-bottom: 1px solid rgba(212, 175, 55, 0.3); padding: 20px 0; text-shadow: 0 0 10px rgba(0,0,0,0.5);
}
#about-section .signature { font-family: 'Cinzel', serif; font-size: 0.8rem; opacity: 0.6; margin-top: 40px; letter-spacing: 4px; display: inline-block; }

#custom-section {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 6; 
    display: flex; justify-content: center; align-items: center; perspective: 1500px; opacity: 0;
    pointer-events: none; touch-action: pan-y;
}
#custom-section.active-interaction { pointer-events: auto; }
#custom-section.grabbing { cursor: grabbing; }

#config-ui {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10;
    display: flex; flex-direction: column; justify-content: space-between; padding: 120px 0 60px 0; box-sizing: border-box;
    opacity: 0; transition: opacity 0.5s ease;
}
#selection-display {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-family: 'Cinzel', serif; font-size: 1.5rem; color: rgba(255,255,255,0.9);
    letter-spacing: 5px; text-transform: uppercase; text-shadow: 0 0 20px rgba(0,0,0,0.8);
    pointer-events: none; opacity: 0; transition: opacity 0.5s; white-space: nowrap;
}
#selection-display.visible { opacity: 1; }

.ui-top { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: auto; }
.ui-bottom { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 25px; pointer-events: auto; padding-bottom: 20px; }
.metal-row { display: flex; gap: 30px; background: rgba(0,0,0,0.4); padding: 10px 25px; border-radius: 50px; border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(5px); }
.stone-group { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.stone-row { display: flex; gap: 20px; justify-content: center; }
.config-label { font-family: 'Cinzel', serif; font-size: 0.75rem; color: #d4af37; text-transform: uppercase; letter-spacing: 3px; text-shadow: 0 0 5px rgba(0,0,0,0.8); }

.config-dot {
    width: 44px; height: 44px; border-radius: 50%; cursor: pointer; position: relative; touch-action: manipulation;
    border: 1px solid rgba(255,255,255,0.3); box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    background-size: cover; background-position: center; background-repeat: no-repeat; background-color: #222; 
}
.config-dot.active { transform: scale(1.2); border-color: #ffffff; box-shadow: 0 0 0 3px rgba(0,0,0,0.9), 0 0 0 4px rgba(212, 175, 55, 0.9); z-index: 2; }
.config-dot:hover { transform: scale(1.1); border-color: #fff; }

.dot-gold { background-image: url('./texture-gold.png'); }
.dot-silver { background-image: url('./texture-silver.png'); }
.dot-diamond { background-image: url('./texture-diamond.png'); }
.dot-ruby { background-image: url('./texture-ruby.png'); }
.dot-sapphire { background-image: url('./texture-sapphire.png'); }
.dot-emerald { background-image: url('./texture-emerald.png'); }

.stack-wrapper { position: relative; width: 350px; height: 450px; transform-style: preserve-3d; transform: rotateX(55deg) rotateZ(35deg); pointer-events: none; }
.layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 2px; background-size: contain; background-repeat: no-repeat; background-position: center; background-color: transparent; box-shadow: -15px 15px 40px rgba(0,0,0,0.4); border: 1px solid rgba(255, 255, 255, 0.1); will-change: transform, opacity; }
#l4 { border: none !important; box-shadow: none !important; background: none !important; }
#l1 { background-image: url('./1.png'); z-index: 4; } 
#l2 { background-image: url('./2.png'); z-index: 3; }
#l3 { background-image: url('./3.png'); z-index: 2; }

#contact-section { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; display: flex; justify-content: center; align-items: center; pointer-events: none; opacity: 0; transition: opacity 1.5s ease; overflow: hidden; visibility: hidden; }
#contact-section.active { visibility: visible; }
.glass-card { width: 90%; max-width: 600px; background: rgba(15, 15, 15, 0.85); backdrop-filter: blur(20px); padding: 50px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.1); border-top: 1px solid rgba(255, 255, 255, 0.5); box-shadow: 0 40px 80px rgba(0, 0, 0, 0.9); text-align: center; transform: translateY(20px); transition: transform 0.8s ease; pointer-events: auto; }
#contact-section[style*="opacity: 1"] .glass-card { transform: translateY(0); }
.glass-card h2 { font-family: 'Cinzel', serif; font-size: 2rem; color: #fff; margin-bottom: 30px; letter-spacing: 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.3); padding-bottom: 15px; display: inline-block; }
.input-row { display: flex; gap: 30px; margin-bottom: 25px; }
.input-group { flex: 1; position: relative; text-align: left; margin-bottom: 25px; }
.styled-input, textarea { width: 100%; background: transparent; border: none; border-bottom: 1px solid rgba(255,255,255,0.3); color: white; font-family: 'Lato', sans-serif; padding: 12px 0; font-size: 1rem; transition: border-color 0.4s ease, background 0.4s; outline: none; box-sizing: border-box; border-radius: 0; }
.styled-input::placeholder, textarea::placeholder { color: rgba(255,255,255,0.3); font-weight: 300; }
.styled-input:focus, textarea:focus { border-bottom-color: #ffffff; background: linear-gradient(to bottom, transparent 95%, rgba(255,255,255,0.05) 100%); }
textarea { resize: none; height: 150px; margin-top: 0; line-height: 1.5; }
.file-upload-label { display: block; padding: 15px; margin-bottom: 10px; border: 1px dashed rgba(255,255,255,0.3); color: rgba(255,255,255,0.6); font-size: 0.8rem; cursor: pointer; transition: all 0.3s; letter-spacing: 2px; text-transform: uppercase; }
.file-upload-label:hover { border-color: #ffffff; color: #ffffff; background: rgba(255,255,255,0.05); }
input[type="file"] { display: none; }
#file-list { text-align: left; margin-bottom: 25px; font-family: 'Lato', sans-serif; font-size: 0.85rem; color: #ccc; }
.file-item { display: flex; align-items: center; justify-content: space-between; gap: 15px; background: rgba(255,255,255,0.05); padding: 10px; margin-top: 8px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.1); }
.file-remove { margin-left: auto; cursor: pointer; color: rgba(255,255,255,0.5); font-size: 1.2rem; padding: 0 10px; transition: color 0.3s ease; line-height: 1; }
.file-remove:hover { color: #ff4444; }
.file-preview-img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid #555; }
.file-icon { width: 40px; height: 40px; background: #222; color: #fff; font-weight: bold; font-size: 10px; display: flex; align-items: center; justify-content: center; border-radius: 4px; border: 1px solid #444; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.file-size { font-size: 0.7rem; color: #888; margin-left: 10px; }
.submit-btn { background: transparent; color: #d4af37; border: 1px solid #d4af37; padding: 18px 50px; font-family: 'Cinzel', serif; font-size: 0.9rem; letter-spacing: 4px; font-weight: 600; cursor: pointer; transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1); width: 100%; position: relative; overflow: hidden; text-transform: uppercase; -webkit-appearance: none; }
.submit-btn:hover { background: #d4af37; color: #000; box-shadow: 0 0 30px rgba(212, 175, 55, 0.3); }
.lil-gui { display: none !important; }

#success-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 100;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: opacity 0.5s;
    backdrop-filter: blur(10px);
}
#success-modal.visible { opacity: 1; pointer-events: auto; }
.success-content {
    font-family: 'Cinzel', serif; color: #d4af37; text-align: center;
    border: 1px solid #d4af37; padding: 40px; border-radius: 4px;
    background: rgba(20, 20, 20, 0.9);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.2);
    width: 80%; max-width: 500px;
}
.success-content h3 { font-size: 1.5rem; letter-spacing: 3px; margin-bottom: 20px; line-height: 1.4; }
.success-content p { font-family: 'Lato', sans-serif; font-size: 0.9rem; color: rgba(255,255,255,0.7); letter-spacing: 1px; }

/* FIX MENÚ MÓVIL: Reducimos espacio y fuente para que entren en una línea */
@media (max-width: 768px) { 
    .glass-card { width: 85%; padding: 30px; } 
    h2 { font-size: 1.5rem !important; } 
    header { top: 20px; }
    #config-ui { padding: 100px 20px 60px 20px; }
    
    /* MENÚ COMPACTO */
    #nav-container { 
        gap: 12px; /* Menos espacio entre palabras */
        width: 100%; 
        padding: 0 5px; 
        box-sizing: border-box; 
    }
    .nav-item { 
        font-size: 0.6rem; /* Letra un pelín más pequeña */
        letter-spacing: 1px; 
    }
    
    .config-dot { width: 44px; height: 44px; } 
    #selection-display { font-size: 1rem; top: 45%; }
}