/* lrx.st - License and Right eXchange */
/* Japanese-minimal, dreamy-ethereal, parallax-sections */

:root {
    --aged-washi: #E8E2D6;
    --sumi-dusk: #3D3832;
    --kawa-ishi: #7B7263;
    --kasumi: #8B9EA8;
    --sunago: #C4A882;
    --matsu: #C5CCBF;
    --kage: #5A5347;
    --sasayaki: #A89F91;
    --yuugure: #DDD8CE;

    --blob-1: polygon(30% 0%, 70% 0%, 100% 30%, 95% 65%, 80% 100%, 45% 95%, 10% 70%, 0% 35%);
    --blob-2: polygon(25% 5%, 65% 0%, 90% 25%, 100% 60%, 75% 95%, 40% 100%, 5% 75%, 0% 40%);
    --blob-3: polygon(35% 2%, 72% 0%, 98% 35%, 90% 70%, 70% 98%, 30% 92%, 5% 65%, 2% 28%);
    --blob-4: polygon(28% 0%, 68% 3%, 95% 28%, 100% 62%, 78% 97%, 42% 100%, 8% 72%, 0% 38%);
}

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Mono', monospace;
    background: var(--aged-washi);
    color: var(--sumi-dusk);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Noise overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    mix-blend-mode: soft-light;
    opacity: 0.03;
}

/* Scroll progress */
.scroll-progress {
    position: fixed;
    top: 0;
    right: 0;
    width: 1px;
    height: 0;
    background: var(--sasayaki);
    opacity: 0;
    z-index: 999;
    transition: opacity 0.5s ease;
}

/* Scene base */
.scene {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    scroll-snap-align: start;
}

/* Parallax layers */
.parallax-bg,
.parallax-mid,
.parallax-fg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
    transform: translateZ(0);
}

/* Blob base */
.blob {
    position: absolute;
    width: var(--blob-size, 300px);
    height: var(--blob-size, 300px);
    background: var(--blob-color, var(--sasayaki));
    opacity: var(--blob-opacity, 0.2);
    clip-path: var(--blob-1);
    animation: blob-breathe 16s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes blob-breathe {
    0%   { clip-path: var(--blob-1); }
    25%  { clip-path: var(--blob-2); }
    50%  { clip-path: var(--blob-3); }
    75%  { clip-path: var(--blob-4); }
    100% { clip-path: var(--blob-1); }
}

.blob-bg {
    animation-delay: 0s;
}

.blob-mid {
    animation-delay: -4s;
}

/* Scene 1: Threshold */
.scene-1 {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--aged-washi);
}

.scene-1 .parallax-fg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.618rem;
}

.enso-circle {
    animation: enso-pulse 8s ease-in-out infinite;
}

@keyframes enso-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.domain-name-scene1 {
    font-size: clamp(2.4rem, 6vw, 5rem);
    font-weight: 700;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--sumi-dusk);
}

.domain-char {
    display: inline-block;
    opacity: 0;
}

.domain-char.fade-in {
    animation: char-appear 600ms ease-out forwards;
}

@keyframes char-appear {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Scene 2: Suspension */
.scene-2 {
    background: var(--aged-washi);
}

.blob-drift-1 {
    top: 15%;
    left: 10%;
    animation-delay: 0s;
}

.blob-drift-2 {
    top: 35%;
    right: 5%;
    left: auto;
    animation-delay: -4s;
}

.blob-drift-3 {
    bottom: 10%;
    left: 30%;
    animation-delay: -8s;
}

.text-column {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 480px;
    padding: 0 clamp(2rem, 8vw, 12rem);
}

.text-column p {
    font-size: clamp(0.85rem, 1.8vw, 1.05rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 2.2;
    color: var(--sumi-dusk);
}

/* Scene 3: Intersection */
.scene-3 {
    background: var(--aged-washi);
}

.geometric-composition {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
}

.geo-rect,
.geo-triangle,
.geo-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    will-change: transform;
}

.ink-drop-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 160px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    overflow: hidden;
}

.ink-drop-svg {
    width: 100%;
    height: 100%;
}

.ink-morph-1 {
    animation: ink-expand 12s ease-in-out infinite;
}

.ink-morph-2 {
    animation: ink-expand 12s ease-in-out infinite;
    animation-delay: -4s;
}

.ink-morph-3 {
    animation: ink-contract 12s ease-in-out infinite;
    animation-delay: -2s;
}

@keyframes ink-expand {
    0%, 100% { r: 30; opacity: 0.3; }
    50% { r: 60; opacity: 0.1; }
}

@keyframes ink-contract {
    0%, 100% { r: 55; opacity: 0.15; }
    50% { r: 25; opacity: 0.25; }
}

.intersection-text {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
}

.serif-accent {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.02em;
    color: var(--kawa-ishi);
}

/* Scene 4: Breath */
.scene-4 {
    background: var(--aged-washi);
}

.breath-blob-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70vw;
    height: 70vh;
    background: var(--matsu);
    opacity: 0.2;
    clip-path: var(--blob-1);
    animation: blob-breathe 16s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.breath-blob {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    max-width: 600px;
}

.breath-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.618rem;
}

.reveal-line {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 2.2;
    color: var(--sumi-dusk);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
    text-align: center;
}

.reveal-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.serif-line {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.02em;
    color: var(--kawa-ishi);
    margin-top: 1rem;
}

/* Scene 5: Geometry */
.scene-5 {
    background: var(--aged-washi);
}

.shape-grid {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    grid-template-columns: repeat(6, 40px);
    grid-template-rows: repeat(8, 40px);
    gap: 16px;
}

.grid-shape {
    width: 24px;
    height: 24px;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-shape.visible {
    opacity: 1;
    transform: scale(1);
}

.grid-shape svg {
    width: 24px;
    height: 24px;
}

.grid-text {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    max-width: 480px;
    text-align: center;
    padding: 0 2rem;
}

.grid-text p {
    font-size: clamp(0.85rem, 1.8vw, 1.05rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 2.2;
    color: var(--kawa-ishi);
}

.kaleidoscope-container {
    position: absolute;
    bottom: 10%;
    right: 10%;
    width: 200px;
    height: 200px;
    opacity: 0.5;
    mix-blend-mode: multiply;
}

.kaleidoscope-svg {
    width: 100%;
    height: 100%;
    animation: kaleidoscope-rotate 30s linear infinite;
}

@keyframes kaleidoscope-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Scene 6: Dissolution */
.scene-6 {
    background: var(--yuugure);
}

.dissolution-bg {
    position: relative;
}

.ghost-blob {
    position: absolute;
    clip-path: var(--blob-1);
    animation: blob-breathe 16s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.ghost-1 {
    width: 400px;
    height: 400px;
    background: var(--sasayaki);
    opacity: 0.08;
    top: 10%;
    left: 15%;
    animation-delay: -2s;
}

.ghost-2 {
    width: 300px;
    height: 300px;
    background: var(--kasumi);
    opacity: 0.06;
    top: 40%;
    right: 10%;
    animation-delay: -6s;
}

.ghost-3 {
    width: 250px;
    height: 250px;
    background: var(--sunago);
    opacity: 0.1;
    bottom: 15%;
    left: 40%;
    animation-delay: -10s;
}

.ghost-geo {
    position: absolute;
}

.ghost-rect {
    top: 20%;
    right: 25%;
}

.ghost-tri {
    bottom: 30%;
    left: 20%;
}

.ghost-enso {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

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

.domain-name-scene6 {
    opacity: 0;
    transition: opacity 1200ms ease-out;
}

.domain-name-scene6.visible {
    opacity: 1;
}

.domain-name-scene6 span {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 700;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--sumi-dusk);
}

.closing-line {
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sasayaki);
    margin-top: 2.618rem;
}

/* Caption style */
.caption {
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sasayaki);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .blob,
    .breath-blob-bg,
    .ghost-blob {
        animation: none;
    }
    .enso-circle {
        animation: none;
    }
    .kaleidoscope-svg {
        animation: none;
    }
    .ink-morph-1,
    .ink-morph-2,
    .ink-morph-3 {
        animation: none;
    }
    .domain-char {
        opacity: 1;
    }
    .reveal-line {
        opacity: 1;
        transform: none;
    }
    html {
        scroll-snap-type: none;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .blob {
        --blob-size: calc(var(--blob-size, 300px) * 0.6);
    }

    .text-column {
        padding: 0 2rem;
    }

    .geometric-composition {
        width: 220px;
        height: 220px;
    }

    .shape-grid {
        grid-template-columns: repeat(4, 40px);
        grid-template-rows: repeat(6, 40px);
    }

    .kaleidoscope-container {
        width: 120px;
        height: 120px;
        bottom: 5%;
        right: 5%;
    }

    .breath-blob {
        width: 85vw;
    }

    .reveal-line {
        line-height: 2.4;
    }
}

@media (max-width: 480px) {
    .geometric-composition {
        width: 180px;
        height: 180px;
    }

    .text-column {
        padding: 0 1.5rem;
        max-width: 100%;
    }
}
