/* ============================================================
   ORÁCULO AZUL — styles.css
   Autores: D. Doryan & S. Breysse
   Estética: Noche mística — azul abismal y oro lunar
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --azul-abismo:    #03060f;
    --azul-profundo:  #060d1e;
    --azul-noche:     #0a1535;
    --azul-medio:     #0f2060;
    --azul-claro:     #1a3a9e;
    --azul-brillo:    #2d5be3;
    --azul-glow:      #4a7fff;
    --azul-niebla:    rgba(30, 80, 200, 0.12);

    --oro-lunar:      #d4a843;
    --oro-suave:      #c8952a;
    --oro-palido:     #e8c97a;
    --oro-glow:       rgba(212, 168, 67, 0.4);

    --blanco-perla:   #f0eaff;
    --blanco-luna:    rgba(240, 234, 255, 0.85);
    --texto-suave:    rgba(200, 190, 230, 0.7);

    --radio-carta:    16px;
    --sombra-carta:   0 30px 80px rgba(0, 10, 40, 0.9), 0 0 60px rgba(74, 127, 255, 0.15);
    --flip-duration:  1.1s;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    background: var(--azul-abismo);
    color: var(--blanco-perla);
    font-family: 'Cormorant Garamond', Georgia, serif;
    min-height: 100vh;
    position: relative;
    cursor: default;
}

/* ── Canvas de partículas ───────────────────────────────────── */
#particles-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ── Nebulosas de fondo ─────────────────────────────────────── */
.nebula {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    animation: nebulaFloat 20s ease-in-out infinite alternate;
}

.nebula-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(15, 32, 96, 0.5) 0%, transparent 70%);
    top: -200px; left: -100px;
    animation-duration: 25s;
}

.nebula-2 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(45, 91, 227, 0.2) 0%, transparent 70%);
    top: 30%; right: -150px;
    animation-duration: 18s;
    animation-delay: -8s;
}

.nebula-3 {
    width: 700px; height: 400px;
    background: radial-gradient(ellipse, rgba(10, 21, 53, 0.6) 0%, transparent 70%);
    bottom: -100px; left: 20%;
    animation-duration: 22s;
    animation-delay: -12s;
}

@keyframes nebulaFloat {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(30px, -20px) scale(1.08); }
}

/* ── Wrapper principal ──────────────────────────────────────── */
.oracle-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px 30px;
}

/* ── Header ─────────────────────────────────────────────────── */
.oracle-header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 1.2s ease forwards;
}

.header-ornament {
    font-size: 0.75rem;
    letter-spacing: 0.8em;
    color: var(--oro-lunar);
    margin: 8px 0;
    opacity: 0.7;
}

.oracle-title {
    font-family: 'Cinzel Decorative', serif;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--oro-palido) 0%, var(--oro-lunar) 40%, var(--oro-suave) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    letter-spacing: 0.05em;
    line-height: 1.1;
    position: relative;
    filter: drop-shadow(0 0 20px var(--oro-glow));
    margin: 10px 0 6px;
}

.oracle-subtitle {
    font-family: 'Cinzel', serif;
    font-size: clamp(0.85rem, 2.5vw, 1.1rem);
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--azul-glow);
    opacity: 0.9;
    margin-bottom: 6px;
}

.oracle-autores {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--texto-suave);
    letter-spacing: 0.1em;
    margin-top: 4px;
}

/* ── Main ───────────────────────────────────────────────────── */
.oracle-main {
    width: 100%;
    max-width: 520px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ── Screens ────────────────────────────────────────────────── */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    animation: fadeIn 0.6s ease forwards;
}

.screen-active {
    display: flex;
}

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

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Pantalla Inicio ────────────────────────────────────────── */
.oracle-question {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-style: italic;
    font-weight: 300;
    color: var(--blanco-luna);
    text-align: center;
    line-height: 1.5;
    margin-bottom: 30px;
    letter-spacing: 0.03em;
}

.question-divider {
    margin: 0 auto 36px;
    display: flex;
    align-items: center;
    gap: 16px;
    width: 200px;
}

.question-divider::before,
.question-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--oro-lunar));
}

.question-divider::after {
    background: linear-gradient(to left, transparent, var(--oro-lunar));
}

.divider-gem {
    color: var(--oro-lunar);
    font-size: 0.7rem;
}

/* ── Botón Oracle ───────────────────────────────────────────── */
.btn-oracle {
    position: relative;
    background: transparent;
    border: 1px solid var(--oro-suave);
    color: var(--oro-palido);
    font-family: 'Cinzel', serif;
    font-size: clamp(0.8rem, 2.5vw, 0.95rem);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    padding: 16px 40px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s ease;
    outline: none;
    border-radius: 2px;
}

.btn-oracle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(212, 168, 67, 0.06) 0%, rgba(74, 127, 255, 0.06) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.btn-glow {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 0; height: 0;
    background: radial-gradient(circle, rgba(212, 168, 67, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    transition: width 0.6s ease, height 0.6s ease;
    pointer-events: none;
}

.btn-oracle:hover {
    border-color: var(--oro-lunar);
    color: #fff;
    box-shadow: 0 0 30px rgba(212, 168, 67, 0.25), inset 0 0 20px rgba(212, 168, 67, 0.05);
}

.btn-oracle:hover::before { opacity: 1; }

.btn-oracle:hover .btn-glow {
    width: 300px;
    height: 300px;
}

.btn-oracle:active {
    transform: scale(0.98);
}

.btn-text {
    position: relative;
    z-index: 1;
}

.btn-nueva {
    margin-top: 32px;
    border-color: rgba(74, 127, 255, 0.5);
    color: var(--azul-glow);
}

.btn-nueva:hover {
    border-color: var(--azul-glow);
    box-shadow: 0 0 30px rgba(74, 127, 255, 0.2);
    color: #fff;
}

/* ── Loading / Orbe ─────────────────────────────────────────── */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.loading-orb {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid transparent;
}

.orb-ring-1 {
    width: 120px; height: 120px;
    border-top-color: var(--oro-lunar);
    border-right-color: rgba(212, 168, 67, 0.3);
    animation: orbSpin 2s linear infinite;
}

.orb-ring-2 {
    width: 88px; height: 88px;
    border-bottom-color: var(--azul-brillo);
    border-left-color: rgba(45, 91, 227, 0.3);
    animation: orbSpin 1.4s linear infinite reverse;
}

.orb-ring-3 {
    width: 56px; height: 56px;
    border-top-color: var(--oro-palido);
    border-right-color: rgba(232, 201, 122, 0.3);
    animation: orbSpin 1s linear infinite;
}

.orb-core {
    font-size: 1.4rem;
    color: var(--oro-lunar);
    animation: orbPulse 2s ease-in-out infinite;
    z-index: 1;
    filter: drop-shadow(0 0 8px var(--oro-lunar));
}

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

@keyframes orbPulse {
    0%, 100% { opacity: 0.6; transform: scale(0.9); }
    50%       { opacity: 1;   transform: scale(1.1); }
}

.loading-text {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.1rem;
    color: var(--texto-suave);
    letter-spacing: 0.1em;
    animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1; }
}

/* ── Carta (flip) ───────────────────────────────────────────── */
.card-scene {
    width: 300px;
    height: 400px;
    perspective: 1200px;
    cursor: pointer;
    margin-bottom: 0;
}

.card-flipper {
    width: 100%; height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform var(--flip-duration) cubic-bezier(0.4, 0.0, 0.2, 1);
}

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

.card-face {
    position: absolute;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radio-carta);
    overflow: hidden;
}

/* ── Reverso de carta ───────────────────────────────────────── */
.card-back {
    background: var(--azul-noche);
    border: 1px solid rgba(212, 168, 67, 0.3);
    box-shadow: var(--sombra-carta);
}

.card-back-inner {
    width: 100%; height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-back-pattern {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(
            45deg,
            rgba(212, 168, 67, 0.03) 0px,
            rgba(212, 168, 67, 0.03) 1px,
            transparent 1px,
            transparent 12px
        ),
        repeating-linear-gradient(
            -45deg,
            rgba(74, 127, 255, 0.03) 0px,
            rgba(74, 127, 255, 0.03) 1px,
            transparent 1px,
            transparent 12px
        );
}

.card-back-border {
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(212, 168, 67, 0.2);
    border-radius: calc(var(--radio-carta) - 4px);
}

.card-back-border::before,
.card-back-border::after {
    content: '◆';
    position: absolute;
    color: var(--oro-lunar);
    font-size: 0.6rem;
    opacity: 0.6;
}

.card-back-border::before { top: -8px; left: 50%; transform: translateX(-50%); }
.card-back-border::after  { bottom: -8px; left: 50%; transform: translateX(-50%); }

.card-back-emblem {
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.emblem-circle {
    width: 90px; height: 90px;
    border-radius: 50%;
    border: 2px solid rgba(212, 168, 67, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(15, 32, 96, 0.8) 0%, transparent 100%);
    box-shadow: 0 0 30px rgba(212, 168, 67, 0.15), inset 0 0 20px rgba(74, 127, 255, 0.1);
    animation: emblemGlow 3s ease-in-out infinite alternate;
}

@keyframes emblemGlow {
    from { box-shadow: 0 0 20px rgba(212, 168, 67, 0.1), inset 0 0 15px rgba(74, 127, 255, 0.08); }
    to   { box-shadow: 0 0 40px rgba(212, 168, 67, 0.3), inset 0 0 25px rgba(74, 127, 255, 0.15); }
}

.emblem-symbol {
    font-size: 2.2rem;
    color: var(--oro-lunar);
    filter: drop-shadow(0 0 8px var(--oro-glow));
}

.card-back-hint {
    position: relative;
    z-index: 1;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--texto-suave);
    letter-spacing: 0.08em;
    text-align: center;
    padding: 0 30px;
    animation: hintPulse 2.5s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 0.9; }
}

/* ── Frente de carta ────────────────────────────────────────── */
.card-front {
    transform: rotateY(180deg);
    background: var(--azul-profundo);
    border: 1px solid rgba(212, 168, 67, 0.4);
    box-shadow: var(--sombra-carta), 0 0 40px rgba(74, 127, 255, 0.1);
}

.card-front-inner {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
}

.card-image-wrapper {
    position: relative;
    height: 280px;
    overflow: hidden;
    flex-shrink: 0;
}

.carta-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform 8s ease;
}

.card-flipper.flipped .carta-img {
    transform: scale(1.04);
}

.card-image-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 120px;
    background: linear-gradient(to top, var(--azul-profundo) 0%, transparent 100%);
}

.card-content {
    padding: 16px 22px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.carta-titulo {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.1rem, 3.5vw, 1.4rem);
    font-weight: 600;
    color: var(--oro-palido);
    text-align: center;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 8px var(--oro-glow));
}

.carta-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 80%;
    margin-bottom: 12px;
}

.carta-divider::before,
.carta-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(212, 168, 67, 0.4));
}

.carta-divider::after {
    background: linear-gradient(to left, transparent, rgba(212, 168, 67, 0.4));
}

.carta-divider span {
    font-size: 0.5rem;
    color: var(--oro-suave);
}

.carta-interpretacion {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    font-style: italic;
    font-weight: 300;
    color: var(--blanco-luna);
    text-align: center;
    line-height: 1.7;
    letter-spacing: 0.02em;
    margin: 0;
}

/* ── Panel de interpretación (fuera de la carta) ─────────── */
.panel-interpretacion {
    width: 300px;
    max-width: 100%;
    background: linear-gradient(135deg, rgba(10, 21, 53, 0.85) 0%, rgba(6, 13, 30, 0.9) 100%);
    border: 1px solid rgba(212, 168, 67, 0.25);
    border-top: none;
    border-radius: 0 0 var(--radio-carta) var(--radio-carta);
    padding: 20px 22px 22px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.7s ease 0.3s, transform 0.7s ease 0.3s;
    pointer-events: none;
}

.panel-interpretacion.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Footer ─────────────────────────────────────────────────── */
.oracle-footer {
    margin-top: 40px;
    padding: 16px;
    text-align: center;
}

.footer-line {
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    letter-spacing: 0.4em;
    color: rgba(212, 168, 67, 0.3);
    text-transform: uppercase;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 400px) {
    .card-scene {
        width: 260px;
        height: 350px;
    }

    .card-image-wrapper {
        height: 240px;
    }

    .panel-interpretacion {
        width: 260px;
    }

    .oracle-header {
        margin-bottom: 32px;
    }
}

@media (max-height: 700px) {
    .oracle-header {
        margin-bottom: 24px;
    }

    .card-scene {
        height: 340px;
    }

    .card-image-wrapper {
        height: 230px;
    }
}
