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

/* ── Variables ───────────────────────────────────────────────────────────── */
:root {
    --bg-dark:    #0a0c12;
    --bg-card:    #161920;
    --accent:     #c8a96e;      /* dorado cálido */
    --accent-dim: rgba(200,169,110,.15);
    --text-main:  #f0ece4;
    --text-muted: #7a7670;
    --border:     rgba(255,255,255,.07);
    --radius-lg:  20px;
    --radius-sm:  10px;
    --transition: .35s cubic-bezier(.4,0,.2,1);
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html, body { height: 100%; }
[hidden] {
    display: none !important;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px 20px;
}

/* ── Start Screen ────────────────────────────────────────────────────────── */
.start-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.brand-tag {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 5px 12px;
    border-radius: 50px;
    margin-bottom: 24px;
    display: inline-block;
}

.start-content h1 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(2.4rem, 8vw, 3.2rem);
    line-height: 1.1;
    color: var(--text-main);
    margin-bottom: 18px;
}

.start-content h1 em {
    font-style: italic;
    color: var(--accent);
}

.start-content > p {
    font-size: .95rem;
    line-height: 1.65;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.instructions-box {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 32px;
}

.instr-title {
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
}

.instructions-box ol {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.instructions-box li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .9rem;
    color: var(--text-muted);
}

.step-num {
    font-family: 'DM Serif Display', serif;
    font-size: 1.1rem;
    color: var(--accent);
    min-width: 28px;
}

.primary-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--accent);
    color: #0d0f14;
    border: none;
    padding: 14px 24px;
    border-radius: 50px;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 24px rgba(200,169,110,.3);
}

.primary-btn svg { width: 18px; height: 18px; }

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(200,169,110,.4);
}

.note {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: 16px;
}

/* ── Model Screen ────────────────────────────────────────────────────────── */
#model-screen {
    justify-content: flex-start;
    padding-top: 0;
    gap: 0;
    overflow: hidden;
}

.carousel-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 4px 12px;
    flex-shrink: 0;
}

.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--border); }

.carousel-counter {
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: .06em;
}

/* ── Carousel ────────────────────────────────────────────────────────────── */
.carousel-wrapper {
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.carousel-track {
    display: flex;
    transition: transform .45s cubic-bezier(.4,0,.2,1);
    will-change: transform;
}

.carousel-slide {
    width: 100%;
    flex-shrink: 0;
}

.carousel-slide model-viewer,
.model-viewer-instance {
    width: 100%;
    height: 46vh;
    min-height: 260px;
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
}

/* ── Model Info Panel ────────────────────────────────────────────────────── */
.model-info-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px 0 24px;
    flex-shrink: 0;
}

.model-text { min-height: 72px; }

#model-name {
    font-family: 'DM Serif Display', serif;
    font-size: 1.6rem;
    color: var(--text-main);
    margin-bottom: 6px;
    transition: opacity .25s ease;
}

#model-desc {
    font-size: .88rem;
    color: var(--text-muted);
    line-height: 1.6;
    transition: opacity .25s ease;
}

/* ── Carousel Nav ────────────────────────────────────────────────────────── */
.carousel-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.nav-btn svg { width: 18px; height: 18px; }
.nav-btn:hover:not(:disabled) {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}
.nav-btn:disabled {
    opacity: .25;
    cursor: not-allowed;
}

.dots {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}
.dot.active {
    background: var(--accent);
    transform: scale(1.3);
    width: 20px;
    border-radius: 4px;
}

/* ── AR Button ───────────────────────────────────────────────────────────── */
.ar-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: var(--accent);
    color: #0d0f14;
    border: none;
    padding: 15px 24px;
    border-radius: 50px;
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 24px rgba(200,169,110,.25);
}
.ar-button svg { width: 18px; height: 18px; }
.ar-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(200,169,110,.4);
}

/* ── AR Container ────────────────────────────────────────────────────────── */
#ar-container {
    position: fixed;
    inset: 0;
    max-width: 100%;
    z-index: 100;
    padding: 0;
}

.ar-content {
    width: 100%;
    height: 100%;
    position: relative;
}

#ar-model {
    width: 100%;
    height: 100%;
    display: block;
}

.ar-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(13,15,20,.85);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 12px 22px;
    border-radius: 50px;
    font-family: 'DM Sans', sans-serif;
    font-size: .95rem;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: var(--transition);
}
.control-btn svg { width: 16px; height: 16px; }
.control-btn:hover { background: rgba(13,15,20,.95); }

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-bar {
    display: block;
    width: 33%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
}
.progress-bar.hide { display: none; }
.update-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width .3s ease;
}

/* ── AR WebXR ────────────────────────────────────────────────────────────── */
#ar-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #000;
}

#ar-screen canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

#ar-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

#ar-gesture-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: auto;
    touch-action: none;
}

#ar-tutorial,
.ar-counter,
#ar-exit-btn {
    position: relative;
    z-index: 1;
}

#ar-tutorial,
.ar-counter,
#ar-exit-btn {
    background: rgba(13, 15, 20, .78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#ar-tutorial {
    position: relative;
    z-index: 1;
    align-self: center;
    max-width: 300px;
    padding: 10px 18px;
    border: 1px solid rgba(200, 169, 110, .3);
    border-radius: 14px;
    color: var(--text-main);
    font-size: .8125rem;
    font-weight: 600;
    text-align: center;
}

#ar-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: #ff8f7a;
}

#ar-status-dot.locked { background: #5ee6c8; }

.ar-counter {
    position: absolute;
    top: max(20px, env(safe-area-inset-top));
    right: 16px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: .75rem;
    font-weight: 600;
    z-index: 1;
}

#ar-exit-btn {
    align-self: center;
    pointer-events: auto;
    padding: 12px 24px;
    border: 1px solid rgba(240, 236, 228, .25);
    border-radius: 50px;
    color: var(--text-main);
    cursor: pointer;
    font: 600 .8125rem 'DM Sans', sans-serif;
    position: relative;
    z-index: 1;
}

button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}

