/* ============================================================
   thefirst.quest — Styles
   A scroll through the moment of creation.
   ============================================================ */

/* ----------------------------------------------------------
   CSS Custom Properties
   ---------------------------------------------------------- */
:root {
    /* Scene palette */
    --void: #08060E;
    --spark: #1B1040;
    --divide: #3A1F6E;
    --name: #B8860B;
    --path: #C8A882;
    --arrival: #F5E6E0;
    --echo-text: #2A1F1A;

    /* Accent colors */
    --gold: #D4AF37;
    --violet: #6B3FA0;
    --blush: #E8C4B0;

    /* Fonts */
    --font-playfair: 'Playfair Display', Georgia, serif;
    --font-libre: 'Libre Baskerville', 'Times New Roman', serif;
    --font-stint: 'Stint Ultra Expanded', serif;
}

/* ----------------------------------------------------------
   @property for animated gradient
   ---------------------------------------------------------- */
@property --gradient-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ----------------------------------------------------------
   Reset & Base
   ---------------------------------------------------------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    background: var(--void);
    color: #fff;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Font utility classes */
.playfair { font-family: var(--font-playfair); font-weight: 400; }
.playfair-bold { font-family: var(--font-playfair); font-weight: 700; }
.libre { font-family: var(--font-libre); font-weight: 400; line-height: 1.8; }
.stint { font-family: var(--font-stint); font-weight: 400; text-transform: uppercase; letter-spacing: 0.12em; }

/* ----------------------------------------------------------
   Scene Base
   ---------------------------------------------------------- */
.scene {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scene-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* ----------------------------------------------------------
   Gradient Veils (scene transitions)
   ---------------------------------------------------------- */
.gradient-veil {
    position: relative;
    width: 100%;
    height: 20vh;
    z-index: 1;
    pointer-events: none;
}

.veil-1-2 {
    background: linear-gradient(to bottom, #08060E, #1B1040);
}

.veil-2-3 {
    background: linear-gradient(to bottom, #1B1040, #3A1F6E);
}

.veil-3-4 {
    background: linear-gradient(to bottom, #3A1F6E, #B8860B);
}

.veil-4-5 {
    background: linear-gradient(to bottom, #B8860B, #1B1040);
}

.veil-5-6 {
    background: linear-gradient(to bottom, #1B1040, #F5E6E0);
}

.veil-6-7 {
    background: linear-gradient(to bottom, #F5E6E0, #F5E6E0);
}

/* ----------------------------------------------------------
   Scene 1: The Void
   ---------------------------------------------------------- */
#scene-void {
    background: var(--void);
}

.domain-name {
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.03em;
    color: var(--gold);
    text-align: center;
    animation: breathe 4s ease-in-out infinite;
}

.domain-name .letter {
    display: inline-block;
    opacity: 0;
    animation: letterFadeIn 0.5s forwards, breathe 4s ease-in-out infinite;
}

.domain-name .letter:nth-child(1) { animation-delay: 0.5s, 1.5s; }
.domain-name .letter:nth-child(2) { animation-delay: 0.65s, 1.65s; }
.domain-name .letter:nth-child(3) { animation-delay: 0.8s, 1.8s; }
.domain-name .letter:nth-child(4) { animation-delay: 0.95s, 1.95s; }
.domain-name .letter:nth-child(5) { animation-delay: 1.1s, 2.1s; }
.domain-name .letter:nth-child(6) { animation-delay: 1.25s, 2.25s; }
.domain-name .letter:nth-child(7) { animation-delay: 1.4s, 2.4s; }
.domain-name .letter:nth-child(8) { animation-delay: 1.55s, 2.55s; }
.domain-name .letter:nth-child(9) { animation-delay: 1.7s, 2.7s; }
.domain-name .letter:nth-child(10) { animation-delay: 1.85s, 2.85s; }
.domain-name .letter:nth-child(11) { animation-delay: 2.0s, 3.0s; }
.domain-name .letter:nth-child(12) { animation-delay: 2.15s, 3.15s; }
.domain-name .letter:nth-child(13) { animation-delay: 2.3s, 3.3s; }
.domain-name .letter:nth-child(14) { animation-delay: 2.45s, 3.45s; }

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

@keyframes breathe {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.circle-bg-decoration {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid var(--gold);
    opacity: 0.04;
    pointer-events: none;
}

/* ----------------------------------------------------------
   Scene 2: The Spark
   ---------------------------------------------------------- */
#scene-spark {
    background: radial-gradient(ellipse at center, #1B1040, #08060E);
}

.spark-rings {
    position: relative;
    width: 80vmin;
    height: 80vmin;
    max-width: 800px;
    max-height: 800px;
}

.rings-svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.ring {
    fill: none;
    stroke-width: 1;
    opacity: 0;
    transform-origin: 400px 400px;
}

.ring-1 { stroke: #D4AF37; }
.ring-2 { stroke: #6B3FA0; }
.ring-3 { stroke: #D4AF37; }
.ring-4 { stroke: #6B3FA0; }
.ring-5 { stroke: #D4AF37; }

.ring.visible {
    animation: ringExpand 2s ease-out forwards;
}

.ring-1.visible { animation-delay: 0s; }
.ring-2.visible { animation-delay: 0.3s; }
.ring-3.visible { animation-delay: 0.6s; }
.ring-4.visible { animation-delay: 0.9s; }
.ring-5.visible { animation-delay: 1.2s; }

@keyframes ringExpand {
    0% {
        opacity: 0;
        transform: scale(0.2);
    }
    30% {
        opacity: 0.8;
    }
    100% {
        opacity: 0.3;
        transform: scale(1);
    }
}

.spark-point {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 30px 10px rgba(212, 175, 55, 0.4),
                0 0 60px 20px rgba(212, 175, 55, 0.2);
    z-index: 3;
}

.myth-fragments {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.myth-text {
    position: absolute;
    color: var(--blush);
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
    opacity: 0;
    transition: opacity 1.2s ease;
    max-width: 280px;
    text-align: center;
    letter-spacing: 0.01em;
}

.myth-text.visible { opacity: 0.7; }

.myth-1 { top: 15%; left: 10%; }
.myth-2 { top: 20%; right: 8%; text-align: right; }
.myth-3 { bottom: 22%; left: 12%; }
.myth-4 { bottom: 15%; right: 10%; text-align: right; }

/* ----------------------------------------------------------
   Scene 3: The Divide
   ---------------------------------------------------------- */
#scene-divide {
    background: linear-gradient(to bottom, #1B1040 0%, #3A1F6E 50%, #B8860B 50%, #C8A882 100%);
}

.divide-upper,
.divide-lower {
    position: absolute;
    width: 100%;
    height: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.divide-upper {
    top: 0;
    background: linear-gradient(to bottom, #1B1040, #3A1F6E);
}

.divide-lower {
    bottom: 0;
    background: linear-gradient(to bottom, #B8860B, #C8A882);
}

.divide-text {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    letter-spacing: 0.05em;
    opacity: 0;
    transition: opacity 1s ease;
}

.divide-before {
    color: #a0b8d0;
}

.divide-after {
    color: #2A1F1A;
}

.divide-sub {
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
    opacity: 0;
    transition: opacity 1.2s ease 0.3s;
    letter-spacing: 0.08em;
}

.divide-upper .divide-sub { color: rgba(160, 184, 208, 0.6); }
.divide-lower .divide-sub { color: rgba(42, 31, 26, 0.6); }

.divide-text.visible,
.divide-sub.visible {
    opacity: 1;
}

.divide-crack-svg {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 40px;
    transform: translateY(-50%);
    z-index: 5;
}

.crack-path {
    fill: none;
    stroke: var(--gold);
    stroke-width: 2;
    stroke-dasharray: 1800;
    stroke-dashoffset: 1800;
    transition: stroke-dashoffset 0.05s linear;
}

.bg-path-decoration {
    position: absolute;
    top: 0;
    right: 5%;
    width: 200px;
    height: 100%;
    opacity: 0.04;
    pointer-events: none;
}

.bg-winding-path {
    fill: none;
    stroke: var(--gold);
    stroke-width: 1;
}

.bg-winding-path-light {
    stroke: var(--echo-text);
}

/* ----------------------------------------------------------
   Scene 4: The Name
   ---------------------------------------------------------- */
#scene-name {
    background: radial-gradient(ellipse at center, #B8860B, #3A1F6E 70%, #1B1040);
}

.first-word {
    font-size: clamp(15rem, 30vw, 40rem);
    line-height: 0.85;
    letter-spacing: 0.12em;
    background: linear-gradient(var(--gradient-angle), #3A1F6E, #D4AF37, #F5E6E0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.75;
    --gradient-angle: 135deg;
    transition: --gradient-angle 0.1s linear;
    position: relative;
    z-index: 3;
    text-align: center;
    will-change: opacity, transform;
}

.parallax-symbols {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200%;
    pointer-events: none;
    z-index: 1;
    will-change: transform;
}

.symbol {
    position: absolute;
    width: 50px;
    height: 50px;
    opacity: 0.35;
}

.symbol-flame { top: 10%; left: 15%; }
.symbol-eye { top: 30%; right: 18%; }
.symbol-footprint { top: 50%; left: 22%; }
.symbol-seed { top: 70%; right: 25%; }
.symbol-note { top: 90%; left: 30%; }

/* ----------------------------------------------------------
   Scene 5: The Path
   ---------------------------------------------------------- */
#scene-path {
    background: linear-gradient(to bottom, #1B1040, #3A1F6E);
    min-height: 150vh;
}

#scene-path .scene-content {
    min-height: 150vh;
    position: relative;
}

.winding-path-svg {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 500px;
    height: 100%;
    z-index: 1;
}

.winding-path {
    fill: none;
    stroke: #C8A882;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 2800;
    stroke-dashoffset: 2800;
    transition: stroke-dashoffset 0.05s linear;
}

.waypoints {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
}

.waypoint {
    position: absolute;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.waypoint.visible {
    opacity: 1;
    transform: translateY(0);
}

.waypoint-label {
    color: var(--blush);
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
    white-space: nowrap;
    letter-spacing: 0.03em;
    text-shadow: 0 0 20px rgba(27, 16, 64, 0.8);
}

/* ----------------------------------------------------------
   Scene 6: The Arrival
   ---------------------------------------------------------- */
#scene-arrival {
    background: var(--arrival);
}

.arrival-text {
    max-width: 700px;
    padding: 2rem;
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.arrival-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.arrival-line {
    color: #2A1F1A;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    line-height: 2;
    letter-spacing: 0.01em;
    margin-bottom: 0.5em;
}

.arrival-line-last {
    margin-top: 1em;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.2vw, 1.8rem);
    color: var(--name);
}

.arrival-bg-path {
    right: auto;
    left: 8%;
    opacity: 0.06;
}

/* ----------------------------------------------------------
   Scene 7: The Echo
   ---------------------------------------------------------- */
#scene-echo {
    background: var(--arrival);
}

.echo-domain {
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.03em;
    color: #2A1F1A;
    text-align: center;
    position: relative;
    z-index: 3;
}

.echo-ripples {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    max-width: 90vw;
    max-height: 90vw;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
}

.ripple {
    fill: none;
    stroke: #D4AF37;
    stroke-width: 1;
    opacity: 0;
    transform-origin: 300px 300px;
}

.ripple.animating {
    animation: rippleExpand 4s ease-out infinite;
}

.ripple-1.animating { animation-delay: 0s; }
.ripple-2.animating { animation-delay: 0.8s; }
.ripple-3.animating { animation-delay: 1.6s; }
.ripple-4.animating { animation-delay: 2.4s; }
.ripple-5.animating { animation-delay: 3.2s; }

@keyframes rippleExpand {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(8);
    }
}

.echo-tagline {
    color: #2A1F1A;
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
    letter-spacing: 0.05em;
    margin-top: 3rem;
    opacity: 0.6;
    position: relative;
    z-index: 3;
    text-align: center;
}

/* ----------------------------------------------------------
   Reduced Motion
   ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ----------------------------------------------------------
   Responsive Adjustments
   ---------------------------------------------------------- */
@media (max-width: 768px) {
    .myth-text {
        max-width: 180px;
        font-size: 0.85rem;
    }

    .myth-1 { top: 8%; left: 5%; }
    .myth-2 { top: 12%; right: 5%; }
    .myth-3 { bottom: 12%; left: 5%; }
    .myth-4 { bottom: 8%; right: 5%; }

    .symbol {
        width: 35px;
        height: 35px;
    }

    .waypoint-label {
        font-size: 0.85rem;
    }

    .arrival-text {
        padding: 1.5rem;
    }
}
