/* ============================================================
   SPELL DISCOVERY PAGE — spell-discovery.css
   ============================================================ */

/* ============================================================
   PAGE BASE
   ============================================================ */
body.discovery-page {
    background: var(--charcoal);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    cursor: none;
}

/* Fixed ambient canvas */
#ambient-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* Sparkle canvas pops on top of everything during swipe-right */
#sparkle-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1100;
    opacity: 0;
    transition: opacity 200ms ease;
}

#sparkle-canvas.active {
    opacity: 1;
}

/* ============================================================
   NAV ACTIVE OVERRIDE
   ============================================================ */
.nav-link-active {
    color: var(--gold-light) !important;
}

.nav-link-active::after {
    transform: scaleX(1) !important;
}

/* ============================================================
   DISCOVERY HEADER
   ============================================================ */
.discovery-header {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 120px var(--section-h) 20px;
    pointer-events: none;
}

.discovery-eyebrow {
    font-size: 9px;
    letter-spacing: 0.52em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 14px;
    opacity: 0;
    animation: discoverFadeUp 0.9s var(--ease-out-expo) 0.2s forwards;
}

.discovery-heading {
    font-family: var(--font-serif);
    font-size: clamp(38px, 6vw, 72px);
    font-weight: 400;
    line-height: 1.06;
    color: var(--cream);
    letter-spacing: -0.01em;
    opacity: 0;
    animation: discoverFadeUp 1s var(--ease-out-expo) 0.35s forwards;
}

.discovery-heading em {
    font-style: italic;
    color: var(--gold-light);
}

.discovery-sub {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-on-dark-muted);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    opacity: 0;
    animation: discoverFadeUp 0.9s var(--ease-out-expo) 0.5s forwards;
}

@keyframes discoverFadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }

    from {
        opacity: 0;
        transform: translateY(16px);
    }
}

/* ============================================================
   STAGE
   ============================================================ */
.discovery-stage {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 56vh;
    padding: 20px 0;
}

/* ============================================================
   SWIPE HINT LABELS
   ============================================================ */
.swipe-hint {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 150ms ease;
}

.swipe-hint span {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    padding: 10px 18px;
    border-radius: 6px;
    border: 2px solid;
    display: block;
}

.swipe-hint--left {
    left: 40px;
}

.swipe-hint--left span {
    color: #e05c5c;
    border-color: #e05c5c;
    text-shadow: 0 0 12px rgba(224, 92, 92, 0.4);
    box-shadow: 0 0 18px rgba(224, 92, 92, 0.12);
}

.swipe-hint--right {
    right: 40px;
}

.swipe-hint--right span {
    color: var(--gold-light);
    border-color: var(--gold);
    text-shadow: 0 0 12px rgba(184, 150, 62, 0.5);
    box-shadow: 0 0 18px rgba(184, 150, 62, 0.18);
}

/* ============================================================
   CARD STACK
   ============================================================ */
.card-stack {
    position: relative;
    width: min(380px, 88vw);
    height: min(560px, 72vh);
    margin: 0 auto;
}

/* ============================================================
   INDIVIDUAL SPELL CARD
   ============================================================ */
.spell-scard {
    position: absolute;
    inset: 0;
    border-radius: 22px;
    overflow: hidden;
    cursor: none;
    user-select: none;
    will-change: transform;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(184, 150, 62, 0.12),
        inset 0 0 80px rgba(0, 0, 0, 0.2);
    transition: box-shadow 300ms ease;
    touch-action: none;
}

/* Stack visuals are fully managed by JS inline styles — no nth-child rules needed */

/* Active top card */
.spell-scard.is-top {
    z-index: 10;
    transform: scale(1) translateY(0);
    filter: none;
    transition:
        box-shadow 300ms ease,
        filter 300ms ease;
}

.spell-scard.is-top:hover {
    box-shadow:
        0 44px 100px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(184, 150, 62, 0.22),
        0 0 40px rgba(184, 150, 62, 0.08);
}

/* Background image */
.scard-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 8s ease;
}

.spell-scard.is-top .scard-bg {
    transform: scale(1.04);
}

/* Gradient overlay */
.scard-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(170deg,
            rgba(10, 8, 6, 0.05) 0%,
            rgba(10, 8, 6, 0.15) 30%,
            rgba(10, 8, 6, 0.72) 68%,
            rgba(10, 8, 6, 0.95) 100%);
    z-index: 1;
}

/* Magical shimmer border */
.scard-border-glow {
    position: absolute;
    inset: 0;
    border-radius: 22px;
    border: 1px solid transparent;
    background: linear-gradient(135deg, rgba(184, 150, 62, 0.45), transparent 40%, rgba(184, 150, 62, 0.15) 80%) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    z-index: 2;
    pointer-events: none;
}

/* Inner corner sparkles (CSS only) */
.scard-corner {
    position: absolute;
    width: 28px;
    height: 28px;
    z-index: 3;
    pointer-events: none;
    opacity: 0.5;
}

.scard-corner::before,
.scard-corner::after {
    content: '';
    position: absolute;
    background: var(--gold);
    border-radius: 1px;
}

.scard-corner--tl {
    top: 18px;
    left: 18px;
}

.scard-corner--tr {
    top: 18px;
    right: 18px;
    transform: scaleX(-1);
}

.scard-corner--tl::before,
.scard-corner--tr::before {
    width: 12px;
    height: 1px;
    top: 0;
    left: 0;
}

.scard-corner--tl::after,
.scard-corner--tr::after {
    width: 1px;
    height: 12px;
    top: 0;
    left: 0;
}

/* Content */
.scard-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 28px 28px 32px;
    z-index: 4;
}

.scard-spell-type {
    font-size: 8.5px;
    letter-spacing: 0.52em;
    text-transform: uppercase;
    color: var(--gold-light);
    margin-bottom: 10px;
    opacity: 0.9;
}

.scard-spell-name {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: clamp(26px, 6vw, 36px);
    font-weight: 400;
    color: var(--cream);
    line-height: 1.1;
    margin-bottom: 10px;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
}

.scard-description {
    font-size: 13px;
    font-weight: 300;
    color: rgba(245, 240, 232, 0.72);
    line-height: 1.6;
    letter-spacing: 0.02em;
    margin-bottom: 16px;
}

.scard-destination {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--text-on-dark-muted);
}

.scard-destination::before {
    content: '';
    width: 16px;
    height: 1px;
    background: var(--gold);
    flex-shrink: 0;
}

/* Tags row */
.scard-tags {
    display: flex;
    gap: 7px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.scard-tag {
    font-size: 9px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--gold-light);
    border: 1px solid rgba(184, 150, 62, 0.35);
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(184, 150, 62, 0.06);
    backdrop-filter: blur(6px);
}

/* ============================================================
   PROGRESS DOTS
   ============================================================ */
.progress-dots {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 22px;
}

.progress-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(245, 240, 232, 0.18);
    transition: background 350ms ease, transform 350ms var(--ease-spring), width 350ms var(--ease-spring);
    cursor: none;
}

.progress-dot.active {
    background: var(--gold);
    width: 18px;
    border-radius: 3px;
    transform: scaleY(1);
}

.progress-dot.done {
    background: rgba(184, 150, 62, 0.35);
}

/* ============================================================
   ACTION BAR
   ============================================================ */
.action-bar {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 48px;
    padding: 20px 0 32px;
    opacity: 0;
    animation: discoverFadeUp 0.9s var(--ease-out-expo) 0.7s forwards;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    cursor: none;
    transition:
        background var(--t-base),
        transform 300ms var(--ease-spring),
        box-shadow var(--t-base);
    flex-shrink: 0;
}

.action-btn:active {
    transform: scale(0.88) !important;
}

/* Skip — medium red-tinted ring */
.action-btn--skip {
    width: 60px;
    height: 60px;
    background: rgba(224, 92, 92, 0.08);
    border: 1.5px solid rgba(224, 92, 92, 0.3);
    color: #e05c5c;
}

.action-btn--skip:hover {
    background: rgba(224, 92, 92, 0.18);
    border-color: rgba(224, 92, 92, 0.6);
    transform: scale(1.1) rotate(-8deg);
    box-shadow: 0 8px 24px rgba(224, 92, 92, 0.2);
}

/* Undo — small neutral */
.action-btn--undo {
    width: 46px;
    height: 46px;
    background: rgba(245, 240, 232, 0.05);
    border: 1.5px solid rgba(245, 240, 232, 0.12);
    color: var(--text-on-dark-muted);
}

.action-btn--undo:hover {
    background: rgba(245, 240, 232, 0.1);
    border-color: rgba(245, 240, 232, 0.25);
    transform: scale(1.08);
}

/* Save — gold heart */
.action-btn--save {
    width: 72px;
    height: 72px;
    background: rgba(184, 150, 62, 0.1);
    border: 1.5px solid rgba(184, 150, 62, 0.45);
    color: var(--gold-light);
    box-shadow: 0 0 24px rgba(184, 150, 62, 0.06);
}

.action-btn--save:hover {
    background: rgba(184, 150, 62, 0.2);
    border-color: var(--gold);
    transform: scale(1.12);
    box-shadow: 0 8px 32px rgba(184, 150, 62, 0.28);
    color: var(--gold);
}

/* ============================================================
   SAVED SPELLS TRAY
   ============================================================ */
.saved-tray {
    position: relative;
    z-index: 10;
    padding: 0 var(--section-h) 80px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.saved-tray-label {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    color: var(--text-on-dark-muted);
    text-align: center;
    letter-spacing: 0.04em;
    padding: 24px 0;
}

.saved-tray-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.saved-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 10.5px;
    font-weight: 400;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold-light);
    border: 1px solid rgba(184, 150, 62, 0.35);
    background: rgba(184, 150, 62, 0.06);
    padding: 10px 18px;
    border-radius: 30px;
    animation: chipPop 0.5s var(--ease-spring) forwards;
    backdrop-filter: blur(4px);
}

.saved-chip .chip-icon {
    font-size: 13px;
}

@keyframes chipPop {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ============================================================
   ALL DONE STATE
   ============================================================ */
.deck-done {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 8, 6, 0.88);
    backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 600ms var(--ease-silk), visibility 600ms;
}

.deck-done.visible {
    opacity: 1;
    visibility: visible;
}

.deck-done-inner {
    text-align: center;
    padding: var(--section-h);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.deck-done-symbol {
    font-size: 52px;
    color: var(--gold);
    animation: symbolSpin 6s linear infinite;
    display: inline-block;
    text-shadow: 0 0 30px rgba(184, 150, 62, 0.6);
}

@keyframes symbolSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.deck-done-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: clamp(28px, 4vw, 46px);
    color: var(--cream);
    font-weight: 400;
    line-height: 1.1;
}

.deck-done-sub {
    font-size: 14px;
    color: var(--text-on-dark-muted);
    letter-spacing: 0.04em;
    line-height: 1.7;
    max-width: 340px;
}

.deck-done-restart {
    margin-top: 8px;
    font-family: var(--font-sans);
    font-size: 10.5px;
    font-weight: 400;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    background: none;
    border: 1px solid rgba(184, 150, 62, 0.45);
    color: var(--gold-light);
    padding: 15px 48px;
    border-radius: var(--radius-btn);
    cursor: none;
    transition:
        background var(--t-base),
        color var(--t-base),
        border-color var(--t-base),
        transform 300ms var(--ease-spring);
}

.deck-done-restart:hover {
    background: var(--gold);
    color: var(--charcoal);
    border-color: var(--gold);
    transform: translateY(-2px);
}

/* ============================================================
   WAND TRAIL (follows cursor on active card)
   ============================================================ */
.wand-trail-dot {
    position: fixed;
    pointer-events: none;
    border-radius: 50%;
    z-index: 60000;
    background: var(--gold);
    opacity: 0;
    transform: translate(-50%, -50%);
    animation: wandDot 0.7s ease forwards;
}

@keyframes wandDot {
    0% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .discovery-header {
        padding: 100px 24px 12px;
    }

    .card-stack {
        width: min(340px, 90vw);
        height: min(500px, 66vh);
    }

    .swipe-hint--left {
        left: 12px;
    }

    .swipe-hint--right {
        right: 12px;
    }

    .action-bar {
        gap: 14px;
    }

    .saved-tray {
        padding: 0 20px 60px;
    }
}