/* ═══════════════════════════════════════════════════════════════
   Kamii — Homepage scroll-driven horizontal tour ("sakura-night")
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --plum-black:    #100f10;
    --plum-raise:    #1a1717;
    --pink:          #c4293b;
    --pink-soft:     #d9576a;
    --lavender:      #f0dfc0;
    --lavender-soft: #f5e9d3;
    --text:          #f5ecdf;
    --text-dim:      #b6ab9c;

    --tour-gradient: linear-gradient(135deg, var(--pink), var(--lavender));
    --font-display:  'Fraunces', serif;
    --font-body:     'Inter', sans-serif;
}

body { background: var(--plum-black); }

/* ── Outer pinned section ─────────────────────────────────────── */
/* --panel-scroll is the scroll distance each panel-to-panel transition
   consumes. Lower = a given physical scroll gesture covers more ground
   (stronger/more responsive); the settle logic in tour.js (lockApply,
   exact panel offsets) is precise enough now that a shorter distance
   doesn't reintroduce the old drift/overshoot issues a short value used
   to cause. */
.tour {
    --panel-count: 5;
    --panel-scroll: 100vh;
    position: relative;
    height: calc(100vh + (var(--panel-count) - 1) * var(--panel-scroll));
    padding: 0;
    background: var(--plum-black);
}

.tour-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

.tour-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 5;
}

.tour-progress-bar {
    height: 100%;
    width: 100%;
    background: var(--tour-gradient);
    transform: scaleX(0);
    transform-origin: left center;
    will-change: transform;
}

.tour-petals {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.tour-petal {
    position: absolute;
    top: -6%;
    left: var(--x, 50%);
    width: var(--size, 8px);
    height: var(--size, 8px);
    border-radius: 60% 40% 55% 45% / 55% 45% 60% 40%;
    background: linear-gradient(135deg, var(--pink-soft), var(--lavender-soft));
    opacity: var(--o, 0.2);
    animation: tour-petal-fall var(--duration, 22s) linear infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes tour-petal-fall {
    0%   { transform: translate(0, -10vh) rotate(0deg); }
    100% { transform: translate(var(--drift, 40px), 115vh) rotate(360deg); }
}

/* ── Horizontal track ─────────────────────────────────────────── */
.tour-track {
    display: flex;
    width: max-content;
    height: 100%;
    position: relative;
    z-index: 2;
    will-change: transform;
}

/* This box is the horizontal-scroll unit — it must stay exactly 100vw for
   every panel, uniformly, or the live scroll-linked transform (a single
   ratio scaled against one "max translate" distance) drifts out of sync
   with the real per-panel boundaries. Content-width capping happens one
   level in, on .tour-panel-inner, so it never touches this box's own size. */
.tour-panel {
    width: 100vw;
    height: 100%;
    flex: 0 0 100vw;
    display: flex;
    align-items: center;
    padding: 0 8vw;
}

.tour-panel-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 64px;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
}

/* Ambient drifting glow — ::before/::after add no extra markup and, unlike
   width/flex, `position`/`overflow` don't affect this box's own size, so
   the horizontal-scroll math (which depends on .tour-panel staying exactly
   100vw) is untouched. Kept off the intro panel, which already has its own
   glow moment on the wordmark itself. */
.tour-panel:not(.tour-panel-intro) {
    position: relative;
    overflow: hidden;
}

.tour-panel:not(.tour-panel-intro)::before,
.tour-panel:not(.tour-panel-intro)::after {
    content: '';
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
}

.tour-panel:not(.tour-panel-intro)::before {
    top: -130px;
    left: -90px;
    background: radial-gradient(circle, rgba(255, 143, 199, 0.16), transparent 70%);
    animation: panel-glow-drift-a 14s ease-in-out infinite;
}

.tour-panel:not(.tour-panel-intro)::after {
    bottom: -150px;
    right: -100px;
    background: radial-gradient(circle, rgba(183, 156, 240, 0.16), transparent 70%);
    animation: panel-glow-drift-b 16s ease-in-out infinite;
}

@keyframes panel-glow-drift-a {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(45px, 30px) scale(1.15); }
}

@keyframes panel-glow-drift-b {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-40px, -25px) scale(1.1); }
}

.tour-panel-intro {
    justify-content: center;
    text-align: center;
    flex-direction: column;
}

.tour-panel-text {
    flex: 1 1 0;
    min-width: 0;
    text-align: left;
}

.tour-eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.18em;
    background: var(--tour-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 18px;
}

/* ── Intro sequence ────────────────────────────────────────────
   A single deterministic, pure-CSS cascade — no JS, no font loading,
   nothing that can drift out of sync: eyebrow fades up, "Kamii" pops
   in with an elastic bounce, a light shimmer sweeps across it once
   settled, then the tagline and cue fade up in turn. Every stage is
   just transform/opacity/background-position, so it's cheap to
   composite and collapses to an instant snap under
   prefers-reduced-motion via the site-wide 0.01ms override in
   style.css — no separate reduced-motion handling needed here. */
.tour-panel-intro .tour-eyebrow {
    opacity: 0;
    animation: intro-fade-up 0.5s ease-out 0.05s forwards;
}

.tour-panel-text h2 {
    font-family: var(--font-display);
    font-size: clamp(30px, 4vw, 52px);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.08;
    color: var(--text);
    margin-bottom: 20px;
}

.tour-panel-text p {
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.7;
    color: var(--text-dim);
    max-width: 460px;
}

/* ── Intro panel ──────────────────────────────────────────────── */
.tour-wordmark {
    position: relative;
    font-family: var(--font-display);
    font-size: clamp(56px, 11vw, 128px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    background: var(--tour-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    animation:
        wordmark-entrance 0.9s cubic-bezier(0.22, 1.4, 0.36, 1) 0.15s forwards,
        wordmark-glow-pulse 1.3s ease-in-out 1.05s 1 forwards;
}

@keyframes wordmark-entrance {
    0%   { opacity: 0; transform: translateY(-52px) scale(0.75) rotate(-4deg); }
    58%  { opacity: 1; transform: translateY(10px) scale(1.06) rotate(1.5deg); }
    78%  { transform: translateY(-4px) scale(0.99) rotate(-0.5deg); }
    100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

/* A soft glow that blooms in sync with the shimmer sweep below, so the
   pass of light reads as a distinct "flash" rather than a faint streak. */
@keyframes wordmark-glow-pulse {
    0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 143, 199, 0)); }
    50%      { filter: drop-shadow(0 0 26px rgba(255, 143, 199, 0.55)); }
}

/* A duplicate of the wordmark's own text, laid directly on top, showing
   only a bright diagonal band clipped to the letterforms — a one-time
   shine sweeping across the settled word, like light catching a gem. */
.tour-wordmark::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    background-image: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.98) 50%, transparent 65%);
    background-size: 260% 100%;
    background-position: -140% 0;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    pointer-events: none;
    opacity: 0;
    animation: wordmark-shimmer 1.3s ease-in-out 1.05s 1 forwards;
}

@keyframes wordmark-shimmer {
    0%   { opacity: 0; background-position: -140% 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { opacity: 0; background-position: 140% 0; }
}

.tour-tagline {
    font-family: var(--font-body);
    font-size: 18px;
    color: var(--text-dim);
    max-width: 480px;
    margin: 22px auto 0;
    opacity: 0;
    animation: intro-fade-up 0.6s ease-out 1.05s forwards;
}

.tour-cue {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 48px;
    padding: 10px 8px;
    border-radius: 8px;
    color: var(--text-dim);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
    opacity: 0;
    animation: intro-fade-up 0.5s ease-out 1.5s forwards;
}

@keyframes intro-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* The site-wide reduced-motion rule in style.css zeroes animation-DURATION
   only — animation-DELAY is untouched, so the tagline and cue (staggered
   1.05s/1.5s into the sequence) would still sit invisible for a couple of
   seconds before snapping in. Deliberately its own query (not merged with
   the narrow-viewport stacking rules below) since a small viewport with
   motion allowed should still get the full delayed choreography. */
@media (prefers-reduced-motion: reduce) {
    .tour-panel-intro .tour-eyebrow,
    .tour-wordmark,
    .tour-tagline,
    .tour-cue {
        animation-delay: 0s !important;
    }

    .tour-wordmark::after {
        display: none;
    }
}

.tour-cue svg { transition: transform 0.2s ease; }

.tour-cue:hover,
.tour-cue:focus-visible { color: var(--pink-soft); }

.tour-cue:hover svg,
.tour-cue:focus-visible svg { transform: translateX(4px); }

/* ── Panel visual (screenshot / mockup placeholder) ──────────────── */
.tour-panel-visual {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    justify-content: center;
}

.tour-mock {
    position: relative;
    width: 100%;
    max-width: 420px;
    aspect-ratio: 4 / 3;
    border-radius: 22px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 143, 199, 0.5), rgba(183, 156, 240, 0.5));
}

.tour-mock-inner {
    position: relative;
    height: 100%;
    width: 100%;
    border-radius: 21px;
    background: var(--plum-raise);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* A faint sheen that periodically sweeps the card, like light catching
   glass — pauses between passes (40%-100% hold) rather than looping
   continuously, so it reads as an occasional detail, not a distraction. */
.tour-mock-inner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 40%, rgba(255, 255, 255, 0.09) 50%, transparent 60%);
    background-size: 250% 100%;
    background-position: -140% 0;
    pointer-events: none;
    animation: mock-shimmer-loop 5.5s ease-in-out infinite;
}

@keyframes mock-shimmer-loop {
    0%   { background-position: -140% 0; }
    40%  { background-position: 140% 0; }
    100% { background-position: 140% 0; }
}

.tour-mock-chrome {
    display: flex;
    gap: 6px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tour-mock-chrome span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.tour-mock-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 28px;
}

.tour-mock-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 143, 199, 0.18), rgba(183, 156, 240, 0.18));
    border: 1px solid rgba(255, 143, 199, 0.32);
    color: var(--pink-soft);
    animation:
        mock-icon-float 3.6s ease-in-out infinite,
        mock-icon-breathe 3.6s ease-in-out infinite;
}

@keyframes mock-icon-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

@keyframes mock-icon-breathe {
    0%, 100% { box-shadow: 0 0 0 rgba(255, 143, 199, 0); }
    50%      { box-shadow: 0 8px 22px rgba(255, 143, 199, 0.28); }
}

.tour-panel:nth-child(3) .tour-mock-icon,
.tour-panel:nth-child(5) .tour-mock-icon {
    background: linear-gradient(135deg, rgba(183, 156, 240, 0.2), rgba(255, 143, 199, 0.14));
    border-color: rgba(183, 156, 240, 0.35);
    color: var(--lavender-soft);
    animation-name: mock-icon-float, mock-icon-breathe-lavender;
}

@keyframes mock-icon-breathe-lavender {
    0%, 100% { box-shadow: 0 0 0 rgba(183, 156, 240, 0); }
    50%      { box-shadow: 0 8px 22px rgba(183, 156, 240, 0.28); }
}

.tour-mock-line {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
}

.tour-mock-line-a { width: 70%; }
.tour-mock-line-b { width: 92%; }
.tour-mock-line-c { width: 55%; }

/* ── Reduced motion + narrow viewport fallback: stack vertically ── */
@media (prefers-reduced-motion: reduce), (max-width: 860px) {
    .tour {
        height: auto;
    }

    .tour-sticky {
        position: static;
        height: auto;
        overflow: visible;
    }

    .tour-progress,
    .tour-petals { display: none; }

    .tour-track {
        flex-direction: column;
        width: 100%;
        height: auto;
        transform: none !important;
    }

    .tour-panel {
        width: 100%;
        height: auto;
        flex: none;
        text-align: center;
        padding: 88px 24px;
    }

    .tour-panel-inner {
        flex-direction: column;
        gap: 40px;
    }

    .tour-panel-intro { padding: 96px 24px; }

    .tour-panel-text { text-align: center; }

    .tour-panel-text p { margin-left: auto; margin-right: auto; }

    .tour-mock { max-width: 340px; }
}

@media (max-width: 480px) {
    .tour-panel { padding: 72px 20px; gap: 32px; }
    .tour-wordmark { font-size: clamp(44px, 16vw, 72px); }
}
