/* ══════════════════════════════════════════════════
   Wear the Mask · getXplain.ai
   Styling aligned with getxplain-ai-website
   ══════════════════════════════════════════════════ */

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

:root {
    --purple:  #7B4DFF;
    --purple-2:#5E33D4;
    --orange:  #F5A623;
    --yellow:  #FFD34E;
    --blue:    #3B82F6;
    --magenta: #9C2C6B;
    --coral:   #FF4B5C;
    --green:   #10B981;

    --font-h:  'Nunito', system-ui, sans-serif;
    --font-b:  'Space Grotesk', system-ui, sans-serif;
}

/* Theme: dark (default) */
html[data-theme="dark"] {
    --bg:          #0B0820;
    --bg-soft:     #140e33;
    --card-bg:     rgba(255, 255, 255, 0.04);
    --card-border: rgba(255, 255, 255, 0.10);
    --text:        #ffffff;
    --text-dim:    #c8c3e4;
    --shadow:      0 20px 60px rgba(0, 0, 0, .45);
    --glow:        radial-gradient(ellipse 55% 65% at 20% 20%, rgba(123,77,255,.30), transparent 60%),
                   radial-gradient(ellipse 45% 55% at 85% 80%, rgba(59,130,246,.22), transparent 60%);
}

/* Theme: light */
html[data-theme="light"] {
    --bg:          #F6F4FF;
    --bg-soft:     #ffffff;
    --card-bg:     #ffffff;
    --card-border: rgba(11, 8, 32, 0.10);
    --text:        #0B0820;
    --text-dim:    #5b5578;
    --shadow:      0 18px 45px rgba(123, 77, 255, .12);
    --glow:        radial-gradient(ellipse 55% 65% at 20% 20%, rgba(123,77,255,.12), transparent 60%),
                   radial-gradient(ellipse 45% 55% at 85% 80%, rgba(245,166,35,.12), transparent 60%);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-b);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: var(--glow);
    background-attachment: fixed;
}

img { max-width: 100%; display: block; }

/* The HTML `hidden` attribute must beat layout display rules like `.hero { display: flex }`. */
[hidden] { display: none !important; }

/* ── Layout ──────────────────────────────────────── */
.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 24px 96px;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 4px 24px;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 44px; height: 44px; border-radius: 10px; }

.tagline {
    font-family: var(--font-h);
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-dim);
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 6px 14px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: var(--card-bg);
}

/* ── Wordmark (get X plain . ai) ──────────────────── */
.wordmark {
    font-family: var(--font-h);
    font-weight: 900;
    font-size: 1.75rem;
    letter-spacing: -0.01em;
    line-height: 1;
    display: inline-flex;
    align-items: baseline;
}
.wordmark .wm-get,
.wordmark .wm-plain,
.wordmark .wm-dot { color: var(--text); }
.wordmark .wm-x {
    color: var(--purple);
    font-size: 1.15em;
    text-shadow: 0 0 24px rgba(123, 77, 255, .5);
}
.wordmark .wm-ai { color: var(--yellow); margin-left: 2px; }
.wordmark.wordmark-sm { font-size: 1.1rem; }

/* ── Hero / cards ─────────────────────────────────── */
.hero {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

.card {
    position: relative;
    width: 100%;
    max-width: 720px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px 36px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    text-align: center;
    z-index: 2;
}
.card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(123,77,255,.55), rgba(245,166,35,.45));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    opacity: .6;
}

.card-title {
    font-family: var(--font-h);
    font-weight: 900;
    font-size: clamp(1.6rem, 3.2vw, 2.25rem);
    line-height: 1.15;
    margin-bottom: 10px;
}
.accent-purple { color: var(--purple); }
.card-sub {
    color: var(--text-dim);
    max-width: 520px;
    margin: 0 auto 26px;
    font-size: 1rem;
}

/* ── Mascots ─────────────────────────────────────── */
.mascot {
    position: absolute;
    width: 120px;
    opacity: .92;
    filter: drop-shadow(0 10px 25px rgba(123, 77, 255, .25));
    animation: float 6s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
}
.mascot-left  { left: 0;  top: 12%;  transform: rotate(-8deg); animation-delay: 0s; }
.mascot-right { right: 0; bottom: 8%; transform: rotate(8deg);  animation-delay: 1.5s; }
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
    50%      { transform: translateY(-12px) rotate(var(--r, 0deg)); }
}
.mascot-left  { --r: -8deg; }
.mascot-right { --r:  8deg; }
@media (max-width: 860px) {
    .mascot { width: 80px; opacity: .6; }
    .mascot-left  { top: -8px; }
    .mascot-right { bottom: -8px; }
}

/* ── Dropzone ────────────────────────────────────── */
.upload-form { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.dropzone {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 240px;
    border: 2px dashed var(--card-border);
    border-radius: 18px;
    cursor: pointer;
    transition: all .2s ease;
    background: rgba(123, 77, 255, .04);
    overflow: hidden;
}
.dropzone:hover,
.dropzone.is-drag {
    border-color: var(--purple);
    background: rgba(123, 77, 255, .10);
    transform: translateY(-2px);
}
.dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-dim);
    text-align: center;
    padding: 28px;
}
.dz-title {
    font-family: var(--font-h);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}
.dz-sub { font-size: .9rem; }
.preview-img {
    display: none;
    max-height: 320px;
    width: auto;
    max-width: 100%;
    border-radius: 12px;
    object-fit: contain;
}
.dropzone.has-preview .dropzone-inner { display: none; }
.dropzone.has-preview .preview-img { display: block; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
    --btn-pad-y: 14px;
    --btn-pad-x: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: var(--btn-pad-y) var(--btn-pad-x);
    border: 0;
    border-radius: 14px;
    font-family: var(--font-h);
    font-weight: 800;
    font-size: 1rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease;
    white-space: nowrap;
}
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-2) 100%);
    box-shadow: 0 14px 32px rgba(123, 77, 255, .35);
}
.btn-primary:hover:not([disabled]) { transform: translateY(-2px); box-shadow: 0 18px 38px rgba(123, 77, 255, .45); }
.btn-ghost {
    color: var(--text);
    background: transparent;
    border: 1.5px solid var(--card-border);
}
.btn-ghost:hover { border-color: var(--purple); color: var(--purple); }
.btn-arrow { transition: transform .2s ease; }
.btn:hover .btn-arrow { transform: translateX(3px); }

/* ── Error ───────────────────────────────────────── */
.error-box {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255, 75, 92, .12);
    border: 1px solid rgba(255, 75, 92, .35);
    color: var(--coral);
    font-size: .95rem;
    text-align: left;
}

/* ── Loading ─────────────────────────────────────── */
.loading-card { display: flex; flex-direction: column; align-items: center; }
.loading-mascot {
    width: 120px;
    margin-bottom: 14px;
    animation: bob 1.4s ease-in-out infinite;
}
@keyframes bob {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50%      { transform: translateY(-10px) rotate(4deg); }
}

/* Loading visual — photo with scanning effect + mascot */
.loading-visual {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 4px auto 22px;
}
.loading-photo-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 10px 40px rgba(123, 77, 255, .35);
    background: var(--bg-soft);
    overflow: hidden;
}
/* spinning conic gradient ring via pseudo-element (photo stays still) */
.loading-photo-ring::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--purple), var(--orange), var(--blue), var(--yellow), var(--purple));
    animation: spin 3.2s linear infinite;
    z-index: 0;
}
.loading-photo-ring::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--bg-soft);
    z-index: 0;
}
.loading-photo {
    position: absolute;
    inset: 8px;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border-radius: 50%;
    object-fit: cover;
    z-index: 1;
    filter: saturate(1.05);
}
.loading-scan {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 8px;
    height: 18%;
    border-radius: 50%;
    background: linear-gradient(180deg,
        rgba(123, 77, 255, 0) 0%,
        rgba(123, 77, 255, .35) 50%,
        rgba(245, 166, 35, .55) 100%);
    box-shadow: 0 0 22px rgba(123, 77, 255, .6);
    mix-blend-mode: screen;
    animation: scan 2.2s ease-in-out infinite;
    z-index: 2;
    pointer-events: none;
}
@keyframes scan {
    0%   { transform: translateY(0);    opacity: .2; }
    50%  { transform: translateY(360%); opacity: 1;  }
    100% { transform: translateY(0);    opacity: .2; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spark {
    position: absolute;
    color: var(--yellow);
    font-size: 20px;
    text-shadow: 0 0 14px rgba(255, 211, 78, .9);
    z-index: 3;
    pointer-events: none;
}
.loading-spark-1 { top:  6%;  left:  10%; animation-name: twinkle; animation-delay: 0s; }
.loading-spark-2 { top:  18%; right: 8%;  animation-name: twinkle; animation-delay: .3s; color: var(--purple); }
.loading-spark-3 { bottom: 12%; left: 6%; animation-name: twinkle; animation-delay: .6s; color: var(--orange); }
.loading-spark-4 { bottom: 8%; right: 14%; animation-name: twinkle; animation-delay: .9s; }
@keyframes twinkle {
    0%, 100% { transform: scale(0.6); opacity: .3; }
    50%      { transform: scale(1.2); opacity: 1; }
}

.loading-mascot-overlay {
    position: absolute;
    width: 86px;
    right: -14px;
    bottom: -18px;
    margin: 0;
    z-index: 4;
    filter: drop-shadow(0 10px 22px rgba(123, 77, 255, .45));
}

/* Animated title dots */
.dots { display: inline-flex; gap: 2px; margin-left: 2px; }
.dots span {
    display: inline-block;
    animation: dot-pulse 1.2s ease-in-out infinite;
}
.dots span:nth-child(2) { animation-delay: .18s; }
.dots span:nth-child(3) { animation-delay: .36s; }
@keyframes dot-pulse {
    0%, 80%, 100% { opacity: .25; transform: translateY(0); }
    40%           { opacity: 1;   transform: translateY(-3px); }
}

/* Step list */
.loading-steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px auto 18px;
    padding: 0;
    text-align: left;
    width: 100%;
    max-width: 320px;
}
.loading-steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-h);
    font-weight: 700;
    font-size: .95rem;
    color: var(--text-dim);
    opacity: .55;
    transition: opacity .3s ease, color .3s ease, transform .3s ease;
}
.loading-steps .step-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--card-border);
    background: transparent;
    flex-shrink: 0;
    transition: background .3s ease, border-color .3s ease, box-shadow .3s ease, transform .3s ease;
    position: relative;
}
.loading-steps li.is-done {
    opacity: 1;
    color: var(--text);
}
.loading-steps li.is-done .step-dot {
    background: var(--green);
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, .15);
}
.loading-steps li.is-done .step-dot::after {
    content: '';
    position: absolute;
    inset: 2px 3px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
    border-radius: 1px;
}
.loading-steps li.is-active {
    opacity: 1;
    color: var(--text);
    transform: translateX(2px);
}
.loading-steps li.is-active .step-dot {
    background: var(--purple);
    border-color: var(--purple);
    box-shadow: 0 0 0 4px rgba(123, 77, 255, .2);
    animation: step-pulse 1.2s ease-in-out infinite;
}
@keyframes step-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(123, 77, 255, .18); }
    50%      { box-shadow: 0 0 0 8px rgba(123, 77, 255, .06); }
}

.progress-bar {
    margin-top: 6px;
    width: 100%;
    max-width: 320px;
    height: 8px;
    border-radius: 999px;
    background: rgba(123, 77, 255, .12);
    overflow: hidden;
    position: relative;
}
.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--orange));
    border-radius: 999px;
    transition: width .6s ease;
    position: relative;
}
.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
    animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.loading-hint {
    margin-top: 14px;
    font-size: .85rem;
    color: var(--text-dim);
    font-style: italic;
}

/* ── Result ──────────────────────────────────────── */
.result-image-wrap {
    margin: 10px auto 22px;
    display: inline-block;
    padding: 8px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(123,77,255,.4), rgba(245,166,35,.4));
}
.result-img {
    max-height: 460px;
    max-width: 100%;
    border-radius: 12px;
    background: #000;
}
.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* ── App store CTA ───────────────────────────────── */
.app-cta {
    position: relative;
    margin: 80px auto 24px;
    text-align: center;
    padding: 48px 32px;
    border-radius: 28px;
    background:
        linear-gradient(135deg, rgba(123,77,255,.18), rgba(245,166,35,.10)),
        var(--card-bg);
    border: 1px solid var(--card-border);
    max-width: 900px;
    overflow: hidden;
}
.cta-mascot {
    width: 96px;
    margin: 0 auto 12px;
    filter: drop-shadow(0 8px 20px rgba(245, 166, 35, .35));
    animation: float 5s ease-in-out infinite;
}
.cta-title {
    font-family: var(--font-h);
    font-weight: 900;
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 8px;
}
.cta-sub {
    color: var(--text-dim);
    max-width: 520px;
    margin: 0 auto 24px;
}
.store-badges {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}
.store-badge-link {
    display: inline-flex;
    transition: transform .15s ease;
}
.store-badge-link:hover { transform: translateY(-3px); }
.store-badge-img { height: 48px; width: auto; }
.store-badge-img.appstore { height: 48px; }
.store-badge-img.googleplay { height: 48px; }

/* ── Footer ──────────────────────────────────────── */
.site-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-dim);
    font-size: .9rem;
    flex-wrap: wrap;
    gap: 12px;
}

/* ── Theme toggle button ─────────────────────────── */
.theme-toggle {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
    z-index: 1000;
    transition: transform .15s ease, box-shadow .2s ease;
}
.theme-toggle:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(123, 77, 255, .35); }
.toggle-icon { width: 22px; height: 22px; position: absolute; transition: opacity .25s ease, transform .25s ease; }
html[data-theme="dark"]  .icon-sun  { opacity: 1; transform: rotate(0deg); }
html[data-theme="dark"]  .icon-moon { opacity: 0; transform: rotate(-40deg); }
html[data-theme="light"] .icon-sun  { opacity: 0; transform: rotate(40deg); }
html[data-theme="light"] .icon-moon { opacity: 1; transform: rotate(0deg); }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 640px) {
    .page { padding: 20px 16px 80px; }
    .card { padding: 28px 20px; border-radius: 20px; }
    .wordmark { font-size: 1.5rem; }
    .tagline  { display: none; }
    .result-img { max-height: 340px; }
    .theme-toggle { bottom: 16px; right: 16px; width: 46px; height: 46px; }
    .app-cta { margin-top: 56px; padding: 36px 20px; }
}
