/* welcome/static/css/welcome.css */

/* Colors key off the worn theme's --is-dark-mode (0 or 1), so the page follows a switch of theme live. */
[data-welcome] {
    --dark: var(--is-dark-mode, 0);
    --ink: calc(255 * var(--dark));
    --surface: calc(250 - 239 * var(--dark)) calc(250 - 239 * var(--dark)) calc(248 - 236 * var(--dark));
    --hair: rgb(var(--ink) var(--ink) var(--ink) / 0.08);
    --wash: rgb(var(--ink) var(--ink) var(--ink) / 0.03);
}
.welcome-hero, .welcome-band { background: rgb(var(--surface)); }

/* A 64px hairline blueprint that fades out from the top edge. */
.welcome-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgb(var(--ink) var(--ink) var(--ink) / 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgb(var(--ink) var(--ink) var(--ink) / 0.05) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 80%);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 80%);
}
@media (max-width: 639px) { .welcome-grid { background-size: 40px 40px; } }

/* The logo's magma, with the theme's teal, behind the product shot. */
.welcome-magma {
    position: absolute;
    left: 50%;
    top: 560px;
    width: 1200px;
    height: 600px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 1;
}
.welcome-magma::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    filter: blur(90px);
    opacity: calc(0.6 - 0.18 * (1 - var(--dark)));
    background:
        radial-gradient(ellipse at 40% 50%, rgb(255 106 26 / 0.9), rgb(215 38 30 / 0.35) 40%, transparent 70%),
        radial-gradient(ellipse at 85% 60%, rgb(79 209 197 / 0.55), transparent 60%);
    animation: welcome-drift 16s ease-in-out infinite;
}
@media (max-width: 639px) {
    .welcome-magma { top: 380px; width: 520px; height: 260px; }
    .welcome-magma::before { filter: blur(50px); }
}
@keyframes welcome-drift {
    0%, 100% { transform: translateX(0) scale(1); }
    50% { transform: translateX(3%) scale(1.08); }
}

.welcome-droplet {
    position: absolute;
    bottom: 20%;
    width: 6px;
    height: 6px;
    border-radius: 9999px;
    background: rgb(255 176 46 / 0.85);
    filter: blur(1px);
    opacity: 0;
    animation: welcome-rise 9s ease-in infinite;
}
.welcome-droplet:nth-child(1) { left: 18%; animation-delay: 0s; }
.welcome-droplet:nth-child(2) { left: 31%; animation-delay: 3.1s; width: 4px; height: 4px; }
.welcome-droplet:nth-child(3) { left: 44%; animation-delay: 5.6s; }
.welcome-droplet:nth-child(4) { left: 57%; animation-delay: 1.7s; width: 5px; height: 5px; }
.welcome-droplet:nth-child(5) { left: 66%; animation-delay: 7.2s; width: 4px; height: 4px; }
.welcome-droplet:nth-child(6) { left: 75%; animation-delay: 4.3s; background: rgb(79 209 197 / 0.8); }
.welcome-droplet:nth-child(7) { left: 86%; animation-delay: 2.4s; width: 3px; height: 3px; }
@keyframes welcome-rise {
    0% { transform: translateY(0); opacity: 0; }
    15% { opacity: 0.9; }
    100% { transform: translateY(-420px); opacity: 0; }
}

.welcome-chip {
    min-height: 34px;
    padding: 0 6px 0 14px;
    border: 1px solid var(--hair);
    background: var(--wash);
}
.welcome-chip-label, .welcome-eyebrow, .welcome-act-count, .welcome-area-act {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.welcome-chip-label { font-size: 11px; }
.welcome-eyebrow { font-size: 12px; }
.welcome-act-count, .welcome-area-act { font-size: 10px; }

.welcome-headline, .welcome-display, .welcome-chapter-title {
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
    letter-spacing: -0.045em;
}
.welcome-headline { font-size: 46px; line-height: 1; }
@media (min-width: 640px) { .welcome-headline { font-size: 88px; line-height: 0.98; } }
.welcome-display { font-size: 34px; line-height: 1.05; }
@media (min-width: 1024px) { .welcome-display { font-size: 56px; line-height: 1.02; } }
.welcome-gradient {
    background: linear-gradient(92deg, #ff7a28, #ffb02e 55%, #4fd1c5);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* The Overview's glass frame; welcome.js tilts it back and lets it settle as it scrolls in. */
.welcome-stage { perspective: 1600px; }
.welcome-tilt {
    transform-origin: 50% 0%;
    transform: rotateX(calc(14deg * var(--tilt, 0))) scale(calc(1 - 0.05 * var(--tilt, 0)));
    will-change: transform;
}

/* The areas grid: one row per chapter on a phone, a hairline cell at 1024px and up. */
.welcome-hairline { border-color: var(--hair); }
.welcome-area { border-bottom: 1px solid var(--hair); }
@media (min-width: 1024px) {
    .welcome-area { border: 1px solid var(--hair); border-radius: 16px; background: var(--wash); transition: border-color 0.2s; }
    .welcome-area:hover { border-color: rgb(var(--ink) var(--ink) var(--ink) / 0.2); }
}

/* The act chips, pinned under the top bar (which sits above them) while the tour scrolls by. */
.welcome-acts-bar {
    position: sticky;
    top: var(--sticky-header-offset, 0px);
    z-index: 30;
    padding: 12px 16px;
    background: rgb(var(--surface) / 0.72);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: top 0.3s ease-in-out;
}
.welcome-acts {
    display: flex;
    width: fit-content;
    gap: 2px;
    padding: 4px;
    border-radius: 9999px;
    border: 1px solid var(--hair);
    background: var(--wash);
}
.welcome-act-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 9999px;
    border: 1px solid transparent;
    color: rgb(var(--text-subtle));
}
.welcome-act-tab[aria-current="true"] {
    color: rgb(var(--text-body));
    font-weight: 600;
    border-color: var(--hair);
    background: rgb(var(--bg-card));
}
.welcome-act-count { color: rgb(var(--text-subtle)); }
@media (max-width: 639px) { .welcome-act-tab { gap: 6px; padding: 0 10px; } }
.welcome-act-progress { position: relative; height: 2px; margin: 10px -16px -12px; background: var(--hair); }
.welcome-act-progress::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--act-progress, 0) * 100%);
    background: rgb(var(--primary));
}

/* Below 1024px each chapter stacks its text over its picture and fades up once as it enters. */
.welcome-rail { list-style: none; margin: 0; padding: 0; }
.welcome-chapter { padding: 28px 0 40px; scroll-margin-top: 128px; transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.welcome-chapter-name { font-size: 18px; font-weight: 600; }
.welcome-chapter-title { font-size: 30px; line-height: 1.1; letter-spacing: -0.03em; }
.welcome-tick { display: none; }
.welcome-picture-open { position: absolute; right: 16px; bottom: 16px; }
/* A chapter link moves focus to its chapter; the ring shows only when the keyboard followed it. */
.welcome-chapter:focus { outline: none; }
.welcome-chapter:focus-visible { outline: 2px solid rgb(var(--primary)); outline-offset: 4px; border-radius: 12px; }
@media (max-width: 1023px) {
    [data-welcome-tour-bound] .welcome-chapter:not([data-shown]) { opacity: 0; transform: translateY(16px); }
}

/* At 1024px and up the act's stage holds still while its chapters pass: 60vh of scroll each. */
@media (min-width: 1024px) {
    .welcome-act { height: calc(var(--chapters) * 60vh + 100vh); }
    .welcome-act-stage {
        position: sticky;
        top: 0;
        height: 100vh;
        display: grid;
        grid-template-columns: 400px minmax(0, 1fr);
        gap: 48px;
        align-items: center;
        padding-top: 136px;
        padding-bottom: 32px;
    }
    .welcome-chapter { position: relative; padding: 12px 0 12px 24px; opacity: 0.5; scroll-margin-top: 0; transition: opacity 0.3s; }
    .welcome-chapter[data-active] { opacity: 1; padding: 20px 0 24px 24px; }
    .welcome-chapter > .welcome-eyebrow, .welcome-chapter:not([data-active]) .welcome-chapter-body { display: none; }
    .welcome-chapter[data-active] > .welcome-eyebrow { display: block; }
    .welcome-chapter > .welcome-eyebrow + div { margin-top: 0; }
    .welcome-chapter[data-active] > .welcome-eyebrow + div { margin-top: 14px; }
    .welcome-chapter:not([data-active]) .welcome-chapter-name { font-size: 16px; font-weight: 400; }
    .welcome-tick { display: block; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--hair); }
    .welcome-chapter[data-active] .welcome-tick::after {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        width: 2px;
        height: calc(var(--fill, 0) * 100%);
        background: rgb(var(--primary));
    }
    .welcome-pane { display: grid; align-items: center; }
    .welcome-pane-picture { grid-area: 1 / 1; opacity: 0; transition: opacity 0.5s ease-in-out; }
    .welcome-pane-picture[data-active] { opacity: 1; }
    /* No taller than the stage leaves (its padding and the frame's 22px rim), centred at its own width. */
    .welcome-pane-picture .glass-frame { width: fit-content; max-width: 100%; margin-inline: auto; }
    .welcome-pane-picture img { width: auto; max-width: 100%; max-height: calc(100vh - 136px - 32px - 22px); }
}
/* A laptop window under 800px tall tightens the rail and drops the open chapter's "Chapter n of m". */
@media (min-width: 1024px) and (max-height: 799px) {
    .welcome-act-stage { padding-bottom: 16px; }
    .welcome-pane-picture img { max-height: calc(100vh - 136px - 16px - 22px); }
    .welcome-chapter { padding-top: 6px; padding-bottom: 6px; }
    .welcome-chapter[data-active] { padding: 10px 0 12px 24px; }
    .welcome-chapter[data-active] > .welcome-eyebrow { display: none; }
    .welcome-chapter[data-active] > .welcome-eyebrow + div { margin-top: 0; }
    .welcome-chapter .welcome-chapter-title { font-size: 24px; margin-top: 10px; }
    .welcome-chapter-body ul { margin-top: 10px; font-size: 14px; }
}

/* The AI bento: the prompt types itself over 7s and each drafted step rises once it is done. */
.welcome-ai-cell { min-width: 0; padding: 24px; border-radius: 16px; border: 1px solid var(--hair); background: var(--wash); }
@media (max-width: 639px) { .welcome-ai-cell { padding: 18px; } .welcome-ai-typed { font-size: 13px; } }
.welcome-ai-typed { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.welcome-ai-score { font-family: 'Lexend', sans-serif; font-weight: 500; font-size: 44px; line-height: 1; letter-spacing: -0.04em; }
.welcome-ai-score > span { font-size: 22px; }
.welcome-ai-typed {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid rgb(var(--primary));
    animation: welcome-type 7s steps(var(--chars)) infinite;
}
@keyframes welcome-type {
    0% { width: 0; }
    45%, 100% { width: calc(var(--chars) * 1ch + 2px); }
}
.welcome-ai-step { animation: welcome-step 7s ease-out infinite; }
@keyframes welcome-step {
    0%, 50% { opacity: 0; transform: translateY(6px); }
    62%, 100% { opacity: 1; transform: none; }
}
.welcome-ai-step { animation-delay: calc(var(--step) * 0.56s); }

/* The closing call: the hero's magma raised to sit behind the headline, then the footer. */
.welcome-close .welcome-magma { top: 40px; }
.welcome-closing, .welcome-footer-brand, .welcome-wordmark {
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
    letter-spacing: -0.045em;
}
.welcome-closing { font-size: 40px; line-height: 1; }
@media (min-width: 1024px) { .welcome-closing { font-size: 72px; } }
.welcome-footer-brand { font-size: 18px; }
.welcome-footer-heading { font-size: 11px; margin-bottom: 4px; }
.welcome-footer-link { display: flex; align-items: center; min-height: 32px; }
.welcome-footer-link:hover { color: rgb(var(--primary)); }
/* A ghost wordmark at 3.5% that runs off the bottom edge. */
.welcome-wordmark {
    font-size: 120px;
    line-height: 0.8;
    color: rgb(var(--ink) var(--ink) var(--ink) / 0.035);
    text-align: center;
    white-space: nowrap;
    margin-bottom: -0.12em;
    user-select: none;
}
@media (min-width: 1024px) { .welcome-wordmark { font-size: 300px; } }

html:has([data-welcome]) { scroll-behavior: smooth; }

/* Still under the system's reduced motion and the app's own Calm and Off. */
@media (prefers-reduced-motion: reduce) {
    .welcome-magma::before, .welcome-droplet { animation: none; }
    .welcome-droplet { display: none; }
    .welcome-tilt { transform: none; }
    .welcome-ai-typed, .welcome-ai-step { animation: none; }
    html:has([data-welcome]) { scroll-behavior: auto; }
    .welcome-chapter, .welcome-pane-picture, .welcome-acts-bar { transition: none; }
    [data-welcome-tour-bound] .welcome-chapter:not([data-shown]) { opacity: 1; transform: none; }
}
:root[data-motion="calm"] .welcome-magma::before, :root[data-motion="off"] .welcome-magma::before { animation: none; }
:root[data-motion="calm"] .welcome-droplet, :root[data-motion="off"] .welcome-droplet { display: none; }
:root[data-motion="off"] .welcome-tilt { transform: none; }
:root[data-motion="calm"] .welcome-ai-typed, :root[data-motion="off"] .welcome-ai-typed,
:root[data-motion="calm"] .welcome-ai-step, :root[data-motion="off"] .welcome-ai-step { animation: none; }
:root[data-motion="off"] .welcome-chapter, :root[data-motion="off"] .welcome-pane-picture { transition: none; }
:root[data-motion="off"] [data-welcome-tour-bound] .welcome-chapter:not([data-shown]) { opacity: 1; transform: none; }
