/* ============================================
   prototype.rs - Wabi-Sabi Design Language
   Coastal Blend Palette / Split-Screen Layout
   ============================================ */

:root {
    /* Coastal Blend Palette */
    --deep-tideline: #2C3639;
    --weathered-cedar: #6B4F3A;
    --sea-glass: #8BA39E;
    --storm-fog: #B8C5C0;
    --tide-sand: #D9CFC1;
    --kiln-white: #F4F1EC;
    --mineral-black: #1A1C1E;
    --salt-crust: #E8E2D8;
    --kintsugi-gold: #C4A86B;

    /* Split ratio (animated via JS) */
    --split-left: 55%;
    --split-right: 45%;

    /* Typography */
    --font-display: 'Cormorant Garamond', serif;
    --font-secondary: 'Zen Kaku Gothic New', sans-serif;
    --font-body: 'Newsreader', serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Easing */
    --ease-in: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-out: cubic-bezier(0.55, 0.085, 0.68, 0.53);
}

/* ---- Reset & Base ---- */

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

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

body {
    background-color: var(--kiln-white);
    color: var(--deep-tideline);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw + 0.4rem, 1.2rem);
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Grain Overlay (Washi Paper Texture) ---- */

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    mix-blend-mode: multiply;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---- Scroll Indicator ---- */

.scroll-indicator {
    position: fixed;
    top: 0;
    right: 0;
    width: 1px;
    height: 100vh;
    background-color: transparent;
    z-index: 999;
}

.scroll-indicator-fill {
    width: 1px;
    height: 0%;
    background-color: var(--sea-glass);
    transition: height 0.1s linear;
}

/* ---- Split Section Layout ---- */

.split-section {
    display: grid;
    grid-template-columns: var(--split-left) var(--split-right);
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

/* ---- Material Panels (Left) ---- */

.panel-material {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.panel-material::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    mix-blend-mode: multiply;
    opacity: 0.09;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
    z-index: 2;
}

/* Soft divider edge - gradient bleed on right side of material panel */
.panel-material::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    z-index: 3;
}

.panel-material-1 {
    background-color: var(--storm-fog);
}

.panel-material-1::before {
    background: linear-gradient(to right, var(--storm-fog), var(--kiln-white));
}

.panel-material-2 {
    background-color: var(--tide-sand);
}

.panel-material-2::before {
    background: linear-gradient(to right, var(--tide-sand), var(--kiln-white));
}

.panel-material-3 {
    background-color: #3A4A4D;
}

.panel-material-3::before {
    background: linear-gradient(to right, #3A4A4D, var(--kiln-white));
}

.panel-material-4 {
    background-color: var(--tide-sand);
}

.panel-material-4::before {
    background: linear-gradient(to right, var(--tide-sand), var(--kiln-white));
}

.panel-material-5 {
    background-color: var(--storm-fog);
}

.panel-material-5::before {
    background: linear-gradient(to right, var(--storm-fog), var(--kiln-white));
}

/* ---- Mark Panels (Right) ---- */

.panel-mark {
    background-color: var(--kiln-white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 3rem;
    position: relative;
}

/* ---- Mark Content ---- */

.mark-content {
    max-width: 480px;
    width: 100%;
}

/* ---- Section 1: Begin ---- */

.title-begin {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.4rem, 5vw + 1rem, 4.8rem);
    letter-spacing: 0.02em;
    color: var(--deep-tideline);
    line-height: 1.1;
    margin-bottom: 1.2rem;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 1.2s var(--ease-in), transform 1.2s var(--ease-in);
}

.title-begin.revealed {
    opacity: 1;
    transform: translateX(0);
}

.subtitle-begin {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--weathered-cedar);
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 1.4s var(--ease-in) 0.3s, transform 1.4s var(--ease-in) 0.3s;
}

.subtitle-begin.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Circle breathing animation */
.circle-begin {
    width: 40vw;
    height: 40vw;
    max-width: 500px;
    max-height: 500px;
    position: relative;
    z-index: 1;
    /* Circle bleeds past divider */
    margin-right: -5vw;
}

.circle-begin svg {
    width: 100%;
    height: 100%;
    animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
}

/* ---- Section 2: Shape ---- */

.section-label {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw + 0.5rem, 1.4rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--weathered-cedar);
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s var(--ease-in), transform 1.2s var(--ease-in);
}

.section-label.revealed {
    opacity: 1;
    transform: translateY(0);
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw + 0.4rem, 1.2rem);
    line-height: 1.75;
    color: var(--deep-tideline);
    max-width: 38ch;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 1.4s var(--ease-in) 0.2s, transform 1.4s var(--ease-in) 0.2s;
}

.body-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

.rectangles-shape {
    width: 80%;
    max-width: 400px;
    z-index: 1;
}

.rectangles-shape svg {
    width: 100%;
    height: auto;
}

.rectangles-shape svg rect {
    opacity: 0;
    transform-origin: center;
}

.rectangles-shape svg rect.revealed {
    animation: slideInRect 0.8s var(--ease-in) forwards;
}

.rectangles-shape svg rect.revealed:nth-child(1) { animation-delay: 0s; }
.rectangles-shape svg rect.revealed:nth-child(2) { animation-delay: 0.2s; }
.rectangles-shape svg rect.revealed:nth-child(3) { animation-delay: 0.4s; }

@keyframes slideInRect {
    from {
        opacity: 0;
        transform: translateX(-60px) rotate(0deg);
    }
    to {
        opacity: 0.25;
        transform: translateX(0);
    }
}

/* ---- Section 3: Fracture ---- */

.triangles-fracture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.triangle-shard {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    transition: opacity 1.2s var(--ease-in);
}

.triangle-shard.revealed {
    opacity: 1;
}

/* ---- Section 4: Repair ---- */

.line-repair {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 1;
}

.golden-line {
    width: 0%;
    height: 1px;
    background-color: var(--weathered-cedar);
    opacity: 0.15;
    position: absolute;
    top: 61.8%;
    left: 0;
    transition: width 2s var(--ease-in);
}

.golden-line.revealed {
    width: 100%;
}

.mark-content-repair .body-text {
    font-style: italic;
}

/* ---- Section 5: Continue ---- */

.compass-continue {
    width: 200px;
    height: 200px;
    z-index: 1;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.4s var(--ease-in), transform 1.4s var(--ease-in);
}

.compass-continue.revealed {
    opacity: 1;
    transform: translateY(0);
}

.mark-content-continue {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.compass-mark {
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 1.4s var(--ease-in), transform 1.4s var(--ease-in);
}

.compass-mark.revealed {
    opacity: 1;
    transform: translateX(0);
}

.compass-mark svg {
    width: 120px;
    height: 60px;
}

.version-meta,
.date-meta {
    font-family: var(--font-mono);
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--weathered-cedar);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 1.2s var(--ease-in), transform 1.2s var(--ease-in);
}

.version-meta.revealed,
.date-meta.revealed {
    opacity: 1;
    transform: translateY(0);
}

.version-meta {
    margin-bottom: 0.3rem;
}

.date-meta {
    transition-delay: 0.15s;
}

/* ---- Kintsugi Lines ---- */

.kintsugi-container {
    position: relative;
    height: 40px;
    overflow: hidden;
    z-index: 10;
}

.kintsugi-3 {
    height: 80px;
}

.kintsugi-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.kintsugi-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.5s var(--ease-in);
}

.kintsugi-path.traced {
    stroke-dashoffset: 0;
}

.kintsugi-path-b {
    transition-delay: 0.3s;
}

.kintsugi-path-c {
    transition-delay: 0.6s;
}

/* ---- Geometric Shape Drift (parallax) ---- */

.geometric-shape {
    will-change: transform;
}

/* ---- Mobile Layout (< 768px) ---- */

@media (max-width: 768px) {
    .split-section {
        grid-template-columns: 1fr;
        grid-template-rows: 30vh auto;
    }

    .panel-material {
        min-height: 30vh;
    }

    .panel-material::before {
        display: none;
    }

    .panel-mark {
        padding: 3rem 2rem;
    }

    .mark-content {
        max-width: 100%;
    }

    .circle-begin {
        width: 60vw;
        height: 60vw;
        margin-right: 0;
    }

    .mark-content-begin {
        text-align: center;
    }

    .body-text {
        max-width: 100%;
    }

    .kintsugi-container {
        height: 30px;
    }

    .kintsugi-3 {
        height: 60px;
    }
}

/* ---- Reduced Motion ---- */

@media (prefers-reduced-motion: reduce) {
    .circle-begin svg {
        animation: none;
    }

    .title-begin,
    .subtitle-begin,
    .section-label,
    .body-text,
    .compass-continue,
    .compass-mark,
    .version-meta,
    .date-meta {
        transition: none;
        opacity: 1;
        transform: none;
    }

    .kintsugi-path {
        transition: none;
        stroke-dashoffset: 0;
    }

    .golden-line {
        transition: none;
        width: 100%;
    }

    .triangle-shard {
        transition: none;
        opacity: 1;
    }

    .rectangles-shape svg rect {
        animation: none;
        opacity: 0.25;
    }
}
