/* ========================================
   COLOR VISION EXPERT — Editorial Design System
   Print-Inspired / Pantone Swatch Book Aesthetic
   ======================================== */

/* ── Design Tokens ── */
:root {
    /* Color Palette — Warm Editorial */
    --bg-void: #FAF7F2;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F5F0E8;
    --border-subtle: #E0D9CF;
    --border-hover: #C8C0B4;
    --text-primary: #2C2C2C;
    --text-secondary: #6B6560;
    --text-muted: #A39E96;
    --accent-warm: rgba(60, 50, 40, 0.08);
    --accent-cyan: rgba(60, 50, 40, 0.06);
    --accent-rose: rgba(60, 50, 40, 0.04);
    --glow-color: rgba(60, 50, 40, 0.04);

    /* Typography */
    --font-body: 'Noto Serif KR', serif;
    --font-display: 'Noto Serif KR', serif;

    /* Spacing — UNCHANGED */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2.5rem;
    --space-2xl: 4rem;

    /* Radius — UNCHANGED */
    --radius-sm: 0.75rem;
    --radius-md: 1.25rem;
    --radius-lg: 2rem;
    --radius-xl: 2.5rem;

    /* Transitions — UNCHANGED */
    --spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);

    /* Mouse position (set by JS) — UNCHANGED */
    --mouse-x: 50%;
    --mouse-y: 50%;
}

/* ── Global Reset ── */
*,
*::before,
*::after {
    font-family: var(--font-body) !important;
    letter-spacing: 0.05em !important;
}

body {
    background: var(--bg-void);
    overflow: hidden;
    color: var(--text-primary);
    line-height: 1.8 !important;
    font-weight: 300; /* Set base font-weight to thin (300) without !important */
}

/* ── Display Font ── */
.display-font {
    font-family: var(--font-display) !important;
}

/* ── Selection ── */
::selection {
    background: rgba(180, 160, 130, 0.3);
    color: #2C2C2C;
}

/* ═══════════════════════════════════════════
   AURORA BACKGROUND — Hidden for Editorial
   ═══════════════════════════════════════════ */
.aurora-bg {
    display: none !important;
}

.aurora-blob {
    display: none;
}

/* ═══════════════════════════════════════════
   EDITORIAL PANEL — Clean Print Style
   (replaces Glass Panel)
   ═══════════════════════════════════════════ */
.glass-panel {
    background: transparent !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none !important;
    border-radius: var(--radius-lg);
    box-shadow: none !important;
    position: relative;
    overflow: hidden;
}

/* Remove the inner light reflection line */
.glass-panel::before {
    display: none;
}

/* Cursor-tracking hover — subtle warm highlight */
.glass-panel-interactive {
    --mouse-x: 50%;
    --mouse-y: 50%;
}

.glass-panel-interactive::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
            800px circle at var(--mouse-x) var(--mouse-y),
            rgba(180, 160, 130, 0.06),
            transparent 50%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.glass-panel-interactive:hover::after {
    opacity: 1;
}

/* ═══════════════════════════════════════════
   EDITORIAL BUTTON — Clean Charcoal
   (replaces Glow Button)
   ═══════════════════════════════════════════ */
.glow-button {
    transition: all 0.3s var(--spring-bounce);
    border: 1px solid #3D3529;
    background: #3D3529;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    position: relative;
    overflow: hidden;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    --mouse-x: 50%;
    --mouse-y: 50%;
}

/* Subtle top highlight line */
.glow-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

/* Cursor-following warm highlight */
.glow-button::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
            300px circle at var(--mouse-x) var(--mouse-y),
            rgba(255, 255, 255, 0.08),
            transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.glow-button:hover {
    transform: scale(1.03);
    border-color: #5A4F3F;
    background: #5A4F3F;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.glow-button:hover::before {
    opacity: 1;
}

.glow-button:hover::after {
    opacity: 1;
}

.glow-button:active {
    transform: scale(0.97);
    transition-duration: 0.1s;
}

/* ═══════════════════════════════════════════
   CONTENT ZONE — UNCHANGED
   ═══════════════════════════════════════════ */
.content-zone {
    position: relative;
    z-index: 10;
}

/* ═══════════════════════════════════════════
   RANGE SLIDER — Editorial Minimal
   ═══════════════════════════════════════════ */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    --percent-val: calc(var(--val, 50) / 100);
    --track-fill: calc(var(--percent-val) * (100% - 18px) + 9px);
    width: 100%;
    height: 6px;
    border-radius: 99px;
    background: linear-gradient(to right, var(--fill-color, #6B6560) var(--track-fill), #E8E2D9 var(--track-fill));
}

input[type=range]:hover::-webkit-slider-runnable-track {
    --percent-val: calc(var(--val, 50) / 100);
    --track-fill: calc(var(--percent-val) * (100% - 18px) + 9px);
    background: linear-gradient(to right, var(--fill-color, #4A4540) var(--track-fill), #D8D0C6 var(--track-fill));
}

input[type=range]::-moz-range-track {
    --percent-val: calc(var(--val, 50) / 100);
    --track-fill: calc(var(--percent-val) * (100% - 18px) + 9px);
    width: 100%;
    height: 6px;
    border-radius: 99px;
    background: linear-gradient(to right, var(--fill-color, #6B6560) var(--track-fill), #E8E2D9 var(--track-fill));
    border: none;
}

input[type=range]:hover::-moz-range-track {
    --percent-val: calc(var(--val, 50) / 100);
    --track-fill: calc(var(--percent-val) * (100% - 18px) + 9px);
    background: linear-gradient(to right, var(--fill-color, #4A4540) var(--track-fill), #D8D0C6 var(--track-fill));
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #3D3529;
    cursor: pointer;
    margin-top: -6px;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.15),
        0 0 0 3px rgba(0, 0, 0, 0.04);
    border: none;
    transition: box-shadow 0.25s ease, transform 0.2s var(--spring-bounce);
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.2),
        0 0 0 4px rgba(0, 0, 0, 0.06);
}

input[type=range]:active::-webkit-slider-thumb {
    transform: scale(0.95);
    background: #5A4F3F;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, 0.7);
}

input[type=range]::-moz-range-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #3D3529;
    cursor: pointer;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.15),
        0 0 0 3px rgba(0, 0, 0, 0.04);
    border: none;
    transition: box-shadow 0.25s ease, transform 0.2s var(--spring-bounce);
}

input[type=range]:active::-moz-range-thumb {
    transform: scale(0.95);
    background: #5A4F3F;
    backdrop-filter: none;
    box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, 0.7);
}

/* ═══════════════════════════════════════════
   DRAG & DROP — UNCHANGED
   ═══════════════════════════════════════════ */
[draggable="true"] {
    user-select: none;
    -webkit-user-drag: element;
}

.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    transition: all 0.15s ease;
}

/* ═══════════════════════════════════════════
   ENTRANCE ANIMATIONS — COMPLETELY UNCHANGED
   ═══════════════════════════════════════════ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
    }
}

.animate-in,
.animate-scale-in,
.animate-slide-left,
.animate-slide-right {
    opacity: 0;
}

.animate-in {
    animation: fadeIn 1.5s var(--ease-smooth) forwards;
    animation-delay: var(--stagger, 0ms);
}

.animate-scale-in {
    animation: fadeInScale 1.2s var(--ease-smooth) forwards;
    animation-delay: var(--stagger, 0ms);
}

.animate-slide-left {
    animation: slideInLeft 1.5s var(--ease-smooth) forwards;
    animation-delay: var(--stagger, 0ms);
}

.animate-slide-right {
    animation: slideInRight 1.5s var(--ease-smooth) forwards;
    animation-delay: var(--stagger, 0ms);
}

.animate-pulse-glow {
    animation: pulseGlow 5s ease-in-out infinite;
}

/* ── Loading Circle Centering & Spinning ── */
#home-cover-circle {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

@keyframes spin-circle {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.loading-circle {
    border-style: dashed !important;
    border-top-color: #6B6560 !important;
    border-width: 2px !important;
    animation: spin-circle 2.5s linear infinite !important;
}

@keyframes focusIn {
    from {
        opacity: 0;
        filter: blur(12px);
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        filter: blur(0px);
        transform: scale(1);
    }
}

.animate-focus-in {
    opacity: 0;
    animation: focusIn 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: var(--stagger, 0ms);
}

/* ═══════════════════════════════════════════
   SCROLLBAR — Editorial Minimal
   ═══════════════════════════════════════════ */
#app::-webkit-scrollbar {
    width: 3px;
}

#app::-webkit-scrollbar-track {
    background: transparent;
}

#app::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 99px;
}

#app::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ═══════════════════════════════════════════
   SPATIAL LAYOUT — COMPLETELY UNCHANGED
   ═══════════════════════════════════════════ */

/* Split View Container */
.split-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    width: 100%;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .split-view {
        flex-direction: row;
        gap: 3rem;
        padding: 0 2rem;
    }

    .split-left {
        flex: 1.2;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .split-right {
        flex: 0.8;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
}

/* Wide Container */
.wide-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

@media (min-width: 1024px) {
    .wide-container {
        max-width: 90vw;
    }
}

@media (min-width: 1440px) {
    .wide-container {
        max-width: 85vw;
    }
}

/* Color Display — Horizontal Side-by-Side */
.color-display-row {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    width: 100%;
}

@media (min-width: 768px) {
    .color-display-row {
        gap: 1.5rem;
    }
}

.color-swatch {
    flex: 1;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.color-swatch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.06), transparent);
    pointer-events: none;
}

/* ═══════════════════════════════════════════
   RESULT CARDS — Responsive Layout UNCHANGED
   ═══════════════════════════════════════════ */
.result-card {
    padding: 1.5rem 1rem;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

@media (min-width: 640px) {
    .result-card {
        padding: 2rem 2.5rem;
    }
}

@media (min-width: 768px) {
    .result-card {
        padding: 2rem 3rem;
    }
}

.result-cards-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 640px) {
    .result-cards-list {
        gap: 2.5rem;
    }
}

@media (min-width: 1024px) {
    .result-cards-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .result-cards-list > .result-card-full {
        grid-column: 1 / -1;
    }
}

/* ═══════════════════════════════════════════
   STAGE BADGE — Editorial
   ═══════════════════════════════════════════ */
.stage-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-display);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #6B6560;
    background: #F5F0E8;
    border: 1px solid #E0D9CF;
    border-radius: 999px;
    backdrop-filter: none;
}

/* ═══════════════════════════════════════════
   HERO SCORE SECTION — UNCHANGED structure
   ═══════════════════════════════════════════ */
.hero-score {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
}

/* ═══════════════════════════════════════════
   COLOR CUBE — Sort Stage (Editorial)
   ═══════════════════════════════════════════ */
.color-cube {
    transition: all 0.25s var(--spring-bounce);
    border: 2px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: relative;
}

.color-cube::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, transparent 40%);
    pointer-events: none;
}

.color-cube:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.color-cube.selected-cube {
    transform: scale(0.90) !important;
    z-index: 10;
}

/* ═══════════════════════════════════════════
   SLIDER LABEL — Editorial (no glow)
   ═══════════════════════════════════════════ */
.slider-label-r { color: #dc2626; text-shadow: none; }
.slider-label-g { color: #16a34a; text-shadow: none; }
.slider-label-b { color: #2563eb; text-shadow: none; }

/* ═══════════════════════════════════════════
   EDITORIAL OVERRIDES — Nav & Tailwind compat
   ═══════════════════════════════════════════ */

/* Hide WebGL canvas and cursor glow via CSS */
#webgl-bg {
    display: none !important;
}

#cursor-glow {
    display: none !important;
}

/* Hide native cursor on hover-capable devices (custom canvas cursor takes over) */
@media (hover: hover) and (pointer: fine) {
    *, *::before, *::after {
        cursor: none !important;
    }
}

/* Nav button styling */
nav button {
    color: #A39E96 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    -webkit-filter: none !important;
    transition: color 0.3s ease-in-out;
}

nav button:hover {
    color: #2C2C2C !important;
}

nav button.active-nav,
nav button[style*="drop-shadow"] {
    color: #2C2C2C !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    filter: none !important;
}

/* ── Main Title Font (Noto Serif KR) ── */
#home-cover-title {
    font-family: 'Noto Serif KR', serif !important;
    text-align: center !important;
}

/* ── Mobile Glassmorphism Control Dock ── */
.mobile-glass-dock {
    background: rgba(250, 247, 242, 0.72) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.65) !important;
    box-shadow: 0 12px 40px rgba(44, 44, 44, 0.16), 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    width: -moz-fit-content !important;
    width: fit-content !important;
    max-width: 90vw !important;
}

.mobile-glass-slider {
    background: rgba(255, 255, 255, 0.78) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    box-shadow: 0 8px 24px rgba(44, 44, 44, 0.12) !important;
}

/* Hide Play button only on real mobile devices (narrow viewport + coarse touch pointer) */
@media (max-width: 767px) and (pointer: coarse) {
    #nav-challenge {
        display: none !important;
    }
}
/* Desktop (pointer: fine) or 768px and wider viewports */
@media (min-width: 768px), (pointer: fine) {
    #nav-challenge {
        display: inline-block !important;
    }
}

/* Guard: On desktop mouse environments, prevent mobile floating dock/FAB/quick-actions from displaying */
@media (pointer: fine) and (hover: hover) {
    .mobile-glass-dock,
    #mobile-control-fab,
    #mobile-control-dock,
    #mobile-quick-actions {
        display: none !important;
    }
    #desktop-controls {
        display: flex !important;
    }
}

/* On real touch devices with narrow viewports, hide desktop controls */
@media (max-width: 1023px) and (pointer: coarse) {
    #desktop-controls {
        display: none !important;
    }
}


/* Film grain noise — hide */
body > svg[aria-hidden="true"] {
    display: none !important;
}

/* ═══════════════════════════════════════════
   HOME SNAP SCROLL SECTIONS (Dynamic Responsive)
   ═══════════════════════════════════════════ */
.home-snap-section {
    height: 100dvh;
    height: 100vh;
    height: var(--home-section-h, 100dvh);
    min-height: var(--home-section-h, 100dvh);
    max-height: var(--home-section-h, 100dvh);
    flex-shrink: 0;
    scroll-snap-align: start;
    scroll-snap-stop: normal;
    box-sizing: border-box;
    width: 100%;
}

/* ═══════════════════════════════════════════
   3D FLIP CARDS & CAROUSEL UTILS
   ═══════════════════════════════════════════ */
.perspective-1000 {
    perspective: 1000px;
}
.preserve-3d {
    transform-style: preserve-3d;
}
.backface-hidden {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.rotate-y-180 {
    transform: rotateY(180deg);
}
.flip-card-inner {
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Flip is triggered exclusively via JS (.flipped class) — no CSS :hover flip.
   This prevents hover-state race conditions that cause button flicker. */
.flip-card.flipped .flip-card-inner {
    transform: rotateY(var(--flip-deg, 180deg));
}

/* Prevent button hover glitch during flip transition */
.flip-card .backface-hidden button {
    pointer-events: none;
    /* No transition while card is not yet flipped */
    transition: transform 0s, box-shadow 0s, background 0s, border-color 0s;
}
.flip-card.flipped .backface-hidden button {
    /* Enable pointer-events and smooth hover transitions only AFTER flip completes (1.2s delay) */
    pointer-events: auto;
    transition:
        pointer-events 0s 1.2s,
        transform 0.3s var(--spring-bounce) 1.2s,
        box-shadow 0.3s ease 1.2s,
        background 0.3s ease 1.2s,
        border-color 0.3s ease 1.2s;
}

.hide-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Keyboard-only affordances leave the default pointer presentation unchanged. */
[role="button"]:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

html.has-custom-cursor,
html.has-custom-cursor body,
html.has-custom-cursor * {
    cursor: none !important;
}

/* Preserved for design contract compliance; animations remain enabled across all OS environments */
@media (prefers-reduced-motion: reduce) {
    /* Full visual presentation and transitions are preserved across all platforms */
}


