/* iisugi.com - Dark Zen / Midnight Garden */
/* Palette: Dark Neon Ikebana */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400&family=Noto+Sans+JP:wght@300;400&family=Space+Grotesk:wght@500&display=swap');

/* CSS Custom Properties for counter-animate */
@property --counter-val {
    syntax: '<integer>';
    initial-value: 0;
    inherits: false;
}

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

:root {
    --void: #0a0a12;
    --surface: #14141f;
    --border: #2a2a3d;
    --border-hover: #3d3d55;
    --body-text: #b8b8cc;
    --headline: #e8e8f4;
    --neon-sakura: #ff2d7b;
    --electric-matcha: #00e8a2;
    --amber-lantern: #ffb830;
    --gradient-target: #0f0f1a;
    --darkest: #060609;
}

html {
    scroll-behavior: smooth;
}

body {
    background: radial-gradient(ellipse at 50% 30%, var(--gradient-target), var(--void));
    color: var(--body-text);
    font-family: 'Noto Sans JP', system-ui, -apple-system, sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.85;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Particle Canvas */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
    will-change: transform;
}

/* Scene Base */
.scene {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

/* Torii Gate Frame */
.torii-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

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

.torii-svg path {
    fill: none;
    stroke: var(--border);
    stroke-width: 1;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke 400ms ease;
}

.torii-frame.visible .torii-crossbar {
    animation: drawLine 800ms ease-out forwards;
}

.torii-frame.visible .torii-left,
.torii-frame.visible .torii-right {
    animation: drawLine 800ms ease-out 400ms forwards;
}

.torii-green .torii-svg path {
    stroke: var(--electric-matcha);
    opacity: 0.4;
}

.scene:hover .torii-svg path {
    stroke: var(--border-hover);
}

.torii-green.visible .torii-svg path,
.scene:hover .torii-green .torii-svg path {
    stroke: var(--electric-matcha);
    opacity: 0.6;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* ===== HERO SECTION ===== */
#hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void);
}

.hero-content {
    position: relative;
    z-index: 5;
    text-align: center;
    padding-left: 15%;
}

#hero-title {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 500;
    font-size: clamp(4rem, 10vw, 8rem);
    color: var(--headline);
    letter-spacing: 0.15em;
    opacity: 0;
    transform: translateY(20px);
}

#hero-title.animate {
    opacity: 1;
    transform: translateY(0);
    letter-spacing: 0.02em;
    transition: opacity 400ms ease, transform 400ms ease, letter-spacing 600ms ease;
}

#hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
}

#hero-title .char.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 400ms ease, transform 400ms ease;
}

#hero-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--neon-sakura);
    margin-top: 1.5rem;
    opacity: 0;
}

#hero-subtitle.animate {
    opacity: 1;
    transition: opacity 600ms ease;
}

#hero-subtitle .char {
    display: inline-block;
    opacity: 0;
}

#hero-subtitle .char.visible {
    opacity: 1;
    transition: opacity 80ms ease;
}

/* ===== MA-SPACE (Left Margin) ===== */
.ma-space {
    position: absolute;
    left: 3%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2rem;
}

.ma-space-right {
    left: auto;
    right: 3%;
    align-items: flex-end;
}

.margin-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--border);
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

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

.margin-label .char.visible {
    opacity: 1;
    transition: opacity 45ms ease;
}

/* ===== NARRATIVE SECTIONS ===== */
.narrative-content {
    position: relative;
    z-index: 5;
    max-width: 540px;
    padding: clamp(80px, 12vh, 160px) clamp(24px, 4vw, 48px);
}

.narrative-right {
    margin-left: auto;
    margin-right: 12%;
}

.narrative-left {
    margin-left: 12%;
    margin-right: auto;
}

.kinetic-heading {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 500;
    font-size: clamp(2.8rem, 7vw, 5.6rem);
    color: var(--headline);
    line-height: 1.1;
    letter-spacing: 0.15em;
    margin-bottom: 2.5rem;
}

.kinetic-heading .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
}

.kinetic-heading .char.visible {
    opacity: 1;
    transform: translateY(0);
    letter-spacing: 0.02em;
    transition: opacity 400ms ease, transform 400ms ease;
}

.prose-block {
    font-family: 'Noto Sans JP', system-ui, sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.85;
    color: var(--body-text);
    margin-bottom: 1.8rem;
    opacity: 0;
    transform: translateY(12px);
}

.prose-block.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 600ms ease, transform 600ms ease;
}

/* Counter Values */
.counter-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    color: var(--electric-matcha);
    font-variant-numeric: tabular-nums;
}

/* Glow Phrases */
.glow-phrase {
    color: var(--headline);
}

.glow-phrase.animate {
    text-shadow: 0 0 20px rgba(255, 45, 123, 0.3);
    animation: glowPulse 2s ease-in-out;
}

@keyframes glowPulse {
    0%, 100% { text-shadow: 0 0 20px rgba(255, 45, 123, 0); }
    50% { text-shadow: 0 0 20px rgba(255, 45, 123, 0.3); }
}

/* ===== BLOBS ===== */
.blob {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

/* Ambient Drifters */
.ambient-drifter {
    filter: blur(80px);
    will-change: transform;
}

.drifter-1 {
    width: 500px;
    height: 500px;
    background: var(--neon-sakura);
    opacity: 0.04;
    top: 20%;
    left: -10%;
    animation: drift1 30s ease-in-out infinite;
}

.drifter-2 {
    width: 400px;
    height: 400px;
    background: var(--electric-matcha);
    opacity: 0.035;
    bottom: 10%;
    right: -5%;
    animation: drift2 35s ease-in-out infinite;
}

.drifter-3 {
    width: 550px;
    height: 550px;
    background: var(--neon-sakura);
    opacity: 0.045;
    top: 30%;
    right: -15%;
    animation: drift3 25s ease-in-out infinite;
}

.drifter-4 {
    width: 450px;
    height: 450px;
    background: var(--electric-matcha);
    opacity: 0.04;
    top: 15%;
    left: -8%;
    animation: drift1 32s ease-in-out infinite reverse;
}

.drifter-5 {
    width: 350px;
    height: 350px;
    background: var(--neon-sakura);
    opacity: 0.03;
    bottom: 20%;
    right: 10%;
    animation: drift2 28s ease-in-out infinite;
}

.drifter-6 {
    width: 600px;
    height: 600px;
    background: var(--amber-lantern);
    opacity: 0.05;
    top: 30%;
    left: 20%;
    animation: drift3 40s ease-in-out infinite;
}

@keyframes drift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, -40px) scale(1.05); }
    66% { transform: translate(-30px, 30px) scale(0.95); }
}

@keyframes drift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-50px, -60px) scale(0.97); }
    66% { transform: translate(40px, 20px) scale(1.03); }
}

@keyframes drift3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -50px) scale(1.04); }
    50% { transform: translate(-40px, -20px) scale(0.96); }
    75% { transform: translate(20px, 40px) scale(1.02); }
}

/* Micro Accents */
.micro-accent {
    width: 30px;
    height: 30px;
    animation: pulse 3s ease-in-out infinite;
}

.accent-1 {
    background: var(--neon-sakura);
    opacity: 0.5;
}

.accent-2 {
    background: var(--electric-matcha);
    opacity: 0.45;
    width: 40px;
    height: 40px;
}

.accent-3 {
    background: var(--neon-sakura);
    opacity: 0.4;
    width: 20px;
    height: 20px;
}

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

/* ===== INTERLUDE SECTION ===== */
.interlude-scene {
    min-height: 60vh;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.interlude-label {
    position: absolute;
    top: 2rem;
    left: 3%;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--border);
    z-index: 5;
}

.interlude-blobs {
    position: relative;
    width: 80vw;
    height: 50vh;
    max-width: 800px;
}

.interlude-blob {
    position: absolute;
    width: 300px;
    height: 300px;
    mix-blend-mode: screen;
}

.interlude-blob:nth-child(1) {
    top: 0;
    left: 10%;
    width: 280px;
    height: 280px;
    opacity: 0.2;
}

.interlude-blob:nth-child(2) {
    top: 15%;
    left: 35%;
    width: 250px;
    height: 250px;
    opacity: 0.18;
}

.interlude-blob:nth-child(3) {
    top: 5%;
    right: 10%;
    width: 300px;
    height: 300px;
    opacity: 0.15;
}

.morph-pink {
    fill: var(--neon-sakura);
    animation: morphBlob1 12s ease-in-out infinite;
}

.morph-green {
    fill: var(--electric-matcha);
    animation: morphBlob2 14s ease-in-out infinite;
}

.morph-mixed {
    fill: var(--neon-sakura);
    opacity: 0.6;
    animation: morphBlob3 10s ease-in-out infinite;
}

@keyframes morphBlob1 {
    0%, 100% { d: path('M250,100 C350,100 420,180 420,260 C420,360 350,420 250,420 C150,420 80,360 80,260 C80,180 150,100 250,100Z'); }
    25% { d: path('M270,80 C380,110 440,190 430,280 C420,370 340,440 240,430 C140,410 60,340 70,240 C80,140 160,70 270,80Z'); }
    50% { d: path('M240,110 C340,90 430,170 440,270 C450,370 360,440 260,440 C160,440 70,380 60,270 C50,160 140,130 240,110Z'); }
    75% { d: path('M260,90 C370,80 440,160 440,250 C440,350 370,430 270,440 C170,440 80,370 70,260 C60,150 150,100 260,90Z'); }
}

@keyframes morphBlob2 {
    0%, 100% { d: path('M200,80 C320,60 440,160 430,280 C420,400 320,460 200,440 C80,420 40,300 60,200 C80,100 120,90 200,80Z'); }
    33% { d: path('M220,70 C340,80 450,170 440,290 C430,410 330,470 210,450 C90,430 30,310 50,190 C70,70 140,60 220,70Z'); }
    66% { d: path('M190,90 C300,50 430,150 420,270 C410,390 310,450 190,430 C70,410 50,290 70,190 C90,90 130,100 190,90Z'); }
}

@keyframes morphBlob3 {
    0%, 100% { d: path('M260,70 C380,90 450,200 420,320 C390,440 280,470 180,430 C80,390 30,280 70,170 C110,60 180,50 260,70Z'); }
    33% { d: path('M250,80 C370,100 440,210 410,330 C380,450 270,480 170,440 C70,400 20,290 60,180 C100,70 170,60 250,80Z'); }
    66% { d: path('M270,60 C390,80 460,190 430,310 C400,430 290,460 190,420 C90,380 40,270 80,160 C120,50 190,40 270,60Z'); }
}

/* ===== CODA SECTION ===== */
.coda-scene {
    min-height: 80vh;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 1s ease;
}

.coda-content {
    position: relative;
    z-index: 5;
    text-align: center;
}

.coda-phrase {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 500;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    color: var(--amber-lantern);
    line-height: 1.4;
    letter-spacing: 0.02em;
}

.coda-phrase .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
}

.coda-phrase .char.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 400ms ease, transform 400ms ease;
}

/* ===== SCROLL-BASED BLOB PARALLAX ===== */
.scene .ambient-drifter {
    transition: transform 0.1s linear;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero-content {
        padding-left: 0;
        text-align: center;
    }

    .narrative-content {
        max-width: 100%;
        padding: 60px 24px;
    }

    .narrative-right,
    .narrative-left {
        margin-left: 0;
        margin-right: 0;
    }

    .kinetic-heading {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .ma-space {
        display: none;
    }

    .interlude-blob {
        width: 150px !important;
        height: 150px !important;
    }

    .torii-svg {
        opacity: 0.5;
    }
}

@media (max-width: 480px) {
    #hero-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .kinetic-heading {
        font-size: clamp(1.8rem, 7vw, 2.4rem);
    }
}
