/* ========================================
   YONGZOON.COM - GLITCH LULLABY STYLESHEET
   ======================================== */

:root {
    /* Earth Tone Palette */
    --bg-raw-umber: #f5efe6;
    --text-burnt-earth: #3d2b1f;
    --accent-ochre: #c9a227;
    --accent-patina: #5c7a5e;
    --accent-bronze: #8b6f47;
    --accent-sienna: #8b4513;
    --accent-charcoal: #2d2d2d;
    --bg-linen: #faf3e3;

    /* Animation Phases */
    --reveal-delay: 0ms;
    --drift-phase: 0;
    --glitch-intensity: 0;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(
        135deg,
        var(--bg-raw-umber) 0%,
        #faf6f1 100%
    );
    color: var(--text-burnt-earth);
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 1.75;
    position: relative;
    overflow-x: hidden;
}

/* Diagonal scan-line texture */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        37deg,
        rgba(139, 69, 19, 0.02) 0px,
        rgba(139, 69, 19, 0.02) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1;
}

/* Noise texture overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-conic-gradient(
        from 0deg at 1px 1px,
        #2d2d2d 0deg,
        #2d2d2d 90deg,
        transparent 90deg,
        transparent 180deg
    );
    background-size: 2px 2px;
    opacity: 0.015;
    pointer-events: none;
    z-index: 1;
}

/* ========== HERO SECTION ========== */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-raw-umber);
    position: relative;
    overflow: hidden;
}

.hero-container {
    text-align: center;
    position: relative;
    z-index: 2;
}

/* Angular hero element */
.hero-angular {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: angular-draw 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

@keyframes angular-draw {
    from {
        opacity: 0;
        stroke-dasharray: 500;
        stroke-dashoffset: 500;
    }
    to {
        opacity: 1;
        stroke-dasharray: 500;
        stroke-dashoffset: 0;
    }
}

.hero-title {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-burnt-earth);
    position: relative;
    z-index: 10;
    margin: 0;
    line-height: 1;
}

.letter {
    display: inline-block;
    opacity: 0;
    text-shadow: 3px 0 var(--accent-ochre),
                 -3px 0 var(--accent-patina);
    animation: letter-appear 0.15s ease-out forwards,
               letter-resolve 0.15s ease-out var(--letter-delay) forwards;
    --letter-delay: 0ms;
}

@keyframes letter-appear {
    from {
        opacity: 0;
        text-shadow: 3px 0 var(--accent-ochre),
                     -3px 0 var(--accent-patina);
    }
    to {
        opacity: 1;
        text-shadow: 3px 0 var(--accent-ochre),
                     -3px 0 var(--accent-patina);
    }
}

@keyframes letter-resolve {
    from {
        text-shadow: 3px 0 var(--accent-ochre),
                     -3px 0 var(--accent-patina);
    }
    to {
        text-shadow: 0px 0 transparent,
                     0px 0 transparent;
    }
}

.hero-subtitle {
    font-family: 'Josefin Sans', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    font-weight: 300;
    letter-spacing: 0.12em;
    color: var(--accent-bronze);
    margin-top: 1rem;
    opacity: 0;
    animation: subtitle-fade 0.5s ease-out 2.5s forwards,
               subtitle-float 6s ease-in-out 2.5s infinite;
}

@keyframes subtitle-fade {
    from {
        opacity: 0;
        letter-spacing: 0.3em;
    }
    to {
        opacity: 1;
        letter-spacing: 0.12em;
    }
}

@keyframes subtitle-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.hero-title {
    animation: title-float 6s ease-in-out 1.3s infinite;
}

@keyframes title-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

/* ========== GLITCH BANDS ========== */
.glitch-band {
    height: 6px;
    width: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--accent-ochre) 25%,
        var(--accent-sienna) 50%,
        var(--accent-charcoal) 75%,
        transparent 100%
    );
    mix-blend-mode: difference;
    position: relative;
    z-index: 5;
    animation: glitch-flicker 1s ease-in-out infinite;
}

@keyframes glitch-flicker {
    0%, 100% {
        opacity: 0.8;
        transform: scaleX(1);
    }
    25% {
        opacity: 0.5;
        transform: scaleX(0.98);
    }
    50% {
        opacity: 1;
        transform: scaleX(1);
    }
    75% {
        opacity: 0.6;
        transform: scaleX(0.99);
    }
}

/* ========== SECTION STRUCTURE ========== */
section.act {
    position: relative;
    z-index: 2;
    padding: 4rem 2rem;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
    opacity: 0;
    filter: blur(8px);
    animation: section-reveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#glitch-1 ~ .act-1,
#glitch-2 ~ .act-2,
#glitch-3 ~ .act-3,
#glitch-4 ~ .act-4,
#glitch-5 ~ .act-5 {
    animation-delay: 0.3s;
}

@keyframes section-reveal {
    0% {
        opacity: 0;
        filter: blur(8px);
    }
    100% {
        opacity: 1;
        filter: blur(0px);
    }
}

/* ========== TYPOGRAPHY ========== */
.section-header {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-burnt-earth);
    grid-column: 1 / -1;
    margin-bottom: 2rem;
    position: relative;
}

.body-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 1.75;
    color: var(--text-burnt-earth);
    margin: 1rem 0;
}

.body-text.italic {
    font-style: italic;
    font-weight: 500;
    color: var(--accent-bronze);
}

/* ========== CONTENT BLOCKS WITH DRIFT ========== */
.content-block {
    grid-column: span 12;
    padding: 2rem;
    background: var(--bg-linen);
    border-left: 3px solid var(--accent-bronze);
    position: relative;
    transform: translate(calc(sin(var(--drift-phase)) * 3vw), calc(cos(var(--drift-phase)) * 2vh));
    transition: transform 0.3s ease-out;
}

.drift-0 { --drift-phase: 0deg; }
.drift-1 { --drift-phase: 45deg; }
.drift-2 { --drift-phase: 90deg; }
.drift-3 { --drift-phase: 135deg; }
.drift-4 { --drift-phase: 180deg; }
.drift-5 { --drift-phase: 225deg; }
.drift-6 { --drift-phase: 270deg; }

/* ========== DATA VISUALIZATIONS ========== */
.data-viz {
    grid-column: span 12;
    margin: 2rem 0;
    max-height: 400px;
}

.radial-chart {
    animation: chart-appear 1s ease-out var(--reveal-delay) forwards;
    opacity: 0;
}

@keyframes chart-appear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========== TRANSMISSION VISUAL ========== */
.transmission-visual {
    grid-column: span 12;
    margin: 2rem 0;
    position: relative;
}

.scan-lines {
    animation: scan-drift 3s linear infinite;
}

@keyframes scan-drift {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(4px);
    }
}

/* ========== INTERFERENCE GALLERY ========== */
.interference-gallery {
    grid-column: span 12;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.interference-item {
    background: var(--bg-linen);
    padding: 1.5rem;
    border: 1px solid var(--accent-bronze);
    opacity: 0;
    animation: item-appear 0.6s ease-out forwards;
    --item-delay: calc(var(--drift-phase) * 100ms);
}

.interference-item:nth-child(1) { animation-delay: 0.2s; }
.interference-item:nth-child(2) { animation-delay: 0.4s; }
.interference-item:nth-child(3) { animation-delay: 0.6s; }

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

.abstract-portrait {
    width: 100%;
    height: auto;
    transition: filter 0.3s ease;
}

.abstract-portrait:hover {
    filter: drop-shadow(0 0 4px var(--accent-ochre));
}

/* ========== TIMELINE GRAPH ========== */
.timeline-graph {
    grid-column: span 12;
    margin: 2rem 0;
    animation: graph-appear 1s ease-out 0.5s forwards;
    opacity: 0;
}

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

/* ========== RIVER PATH ========== */
.river-path {
    position: fixed;
    left: 50%;
    top: 0;
    width: 8vw;
    height: 100%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 0;
    opacity: 1;
}

@keyframes river-drift {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(2px);
    }
}

.river-path {
    animation: river-drift 20s ease-in-out infinite;
}

/* ========== ANGULAR INTERSECTION DECORATIONS ========== */
.angular-intersection {
    position: absolute;
    stroke: var(--accent-patina);
    stroke-width: 1.5px;
    opacity: 0.6;
}

/* ========== CHROMATIC ABERRATION HOVER ========== */
@media (hover: hover) {
    .content-block:hover,
    .interference-item:hover {
        text-shadow: 0.3px 0 var(--accent-ochre),
                     -0.3px 0 var(--accent-patina);
    }
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 768px) {
    section.act {
        padding: 2rem 1rem;
    }

    .content-block {
        grid-column: span 12;
        padding: 1.5rem;
    }

    .interference-gallery {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 1rem;
    }

    .hero {
        height: auto;
        padding: 3rem 1rem;
    }

    .hero-angular {
        width: 120px;
        height: 120px;
    }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .glitch-band {
        animation: none;
        opacity: 0.8;
    }

    .scan-lines {
        animation: none;
    }

    body::before {
        opacity: 0;
    }

    body::after {
        opacity: 0;
    }
}

/* ========== UTILITY CLASSES ========== */
.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0.5;
}

.glitch-text::before {
    color: var(--accent-ochre);
    z-index: -1;
    text-shadow: -1px 0 var(--accent-ochre);
    clip: rect(0, 900px, 0, 0);
    animation: glitch-anim 0.3s infinite;
}

.glitch-text::after {
    color: var(--accent-patina);
    z-index: -2;
    text-shadow: 2px 0 var(--accent-patina);
    clip: rect(0, 900px, 0, 0);
    animation: glitch-anim 0.3s infinite reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(0, 900px, 0, 0);
    }
    20% {
        clip: rect(10px, 900px, 20px, 0);
    }
    40% {
        clip: rect(5px, 900px, 10px, 0);
    }
    60% {
        clip: rect(20px, 900px, 25px, 0);
    }
    80% {
        clip: rect(15px, 900px, 30px, 0);
    }
    100% {
        clip: rect(0, 900px, 0, 0);
    }
}
