/* ============================================================
   HWAGRYUL.COM - COASTAL BLEND PALETTE & GLITCH AESTHETIC
   ============================================================ */

/* Color Palette Definition */
:root {
    --abyssal-ink: #0A1628;
    --slate-tide: #1B2838;
    --moonlit-foam: #C8D6E5;
    --fog-layer: #8395A7;
    --tidal-blue: #2E86AB;
    --bioluminescence: #A23B72;
    --driftwood-glow: #D4A574;
    --twilight-edge: #546E7A;
    --northern-lights-green: #1B6B4A;
    --steel-blue: #7B9DB7;
}

/* ============================================================
   RESET AND BASE STYLES
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--abyssal-ink);
    color: var(--moonlit-foam);
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    font-size: 16px;
    line-height: 1.85;
    overflow-x: hidden;
    position: relative;
}

/* ============================================================
   TYPOGRAPHY SYSTEM
   ============================================================ */

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
}

.display-text {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 96px;
    letter-spacing: -0.04em;
    line-height: 0.92;
    color: var(--moonlit-foam);
    text-align: center;
    opacity: 0;
    animation: fade-in-text 1200ms ease-out 2s forwards;
}

.heading {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 32px;
    letter-spacing: 0.02em;
    color: var(--steel-blue);
    opacity: 0;
    animation: fade-in-text 1200ms ease-out 0.5s forwards;
}

.heading-left {
    position: absolute;
    top: 10vh;
    left: 5%;
}

.heading-decay {
    position: absolute;
    top: 20vh;
    left: 5%;
}

.body-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    font-size: 17px;
    color: var(--fog-layer);
    line-height: 1.85;
    max-width: 42ch;
    opacity: 0;
    animation: fade-in-text 1200ms ease-out 1s forwards;
}

.metadata {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 12px;
    color: var(--twilight-edge);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.4;
    animation: pulse-metadata 3s ease-in-out infinite;
}

.metadata-final {
    opacity: 0.3;
    animation: pulse-final 2s ease-in-out infinite;
}

/* ============================================================
   NAVIGATION
   ============================================================ */

.nav-glyph {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    opacity: 0.3;
    cursor: pointer;
    transition: opacity 300ms ease;
}

.nav-glyph:hover {
    opacity: 0.6;
}

.nav-glyph svg {
    width: 24px;
    height: 24px;
}

.nav-menu {
    position: fixed;
    top: 3rem;
    right: 1rem;
    background: rgba(26, 40, 56, 0.15);
    backdrop-filter: blur(8px);
    padding: 2rem 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 800ms ease;
    z-index: 999;
    border: 1px solid rgba(200, 214, 229, 0.1);
}

.nav-menu.active {
    opacity: 1;
    pointer-events: all;
}

.nav-menu a {
    display: block;
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 14px;
    color: var(--moonlit-foam);
    text-decoration: none;
    line-height: 3em;
    transition: color 400ms ease;
}

.nav-menu a:hover {
    color: var(--tidal-blue);
    text-decoration: underline;
}

/* ============================================================
   BACKGROUND ELEMENTS
   ============================================================ */

.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(90deg, var(--twilight-edge) 1px, transparent 1px),
        linear-gradient(0deg, var(--twilight-edge) 1px, transparent 1px);
    background-size: 8.33% 100vh, 100% 12.5vh;
    background-position: 0 0, 0 0;
    opacity: 0.05;
    pointer-events: none;
    z-index: 1;
}

.aurora-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.aurora {
    position: absolute;
    width: 200%;
    height: 200%;
    opacity: 0.06;
    animation: aurora-drift 60s ease-in-out infinite;
}

.aurora-1 {
    top: -50%;
    left: -50%;
    background: radial-gradient(ellipse at 30% 40%, rgba(46, 134, 171, 0.8) 0%, transparent 70%);
    animation-duration: 60s;
}

.aurora-2 {
    top: -50%;
    right: -50%;
    background: radial-gradient(ellipse at 70% 50%, rgba(162, 59, 114, 0.6) 0%, transparent 70%);
    animation-duration: 75s;
    animation-delay: 10s;
}

.aurora-3 {
    bottom: -50%;
    left: -25%;
    background: radial-gradient(ellipse at 50% 30%, rgba(27, 107, 74, 0.7) 0%, transparent 70%);
    animation-duration: 90s;
    animation-delay: 20s;
}

@keyframes aurora-drift {
    0% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(10%, 5%);
    }
    100% {
        transform: translate(0, 0);
    }
}

/* ============================================================
   TRANSMISSION BARS
   ============================================================ */

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

.transmission-bar {
    position: absolute;
    background-color: var(--moonlit-foam);
    opacity: 0.04;
    animation: bar-flicker 6s ease-in-out infinite;
}

.bar-1 {
    width: 60vw;
    height: 2px;
    top: 20%;
    left: 15%;
    animation-delay: 0s;
}

.bar-2 {
    width: 40vw;
    height: 1px;
    top: 45%;
    left: 10%;
    animation-delay: 1s;
}

.bar-3 {
    width: 70vw;
    height: 3px;
    top: 65%;
    left: 5%;
    animation-delay: 2s;
}

.bar-4 {
    width: 50vw;
    height: 1px;
    top: 30%;
    left: 20%;
    animation-delay: 0.5s;
}

.bar-5 {
    width: 45vw;
    height: 2px;
    top: 75%;
    left: 10%;
    animation-delay: 1.5s;
}

@keyframes bar-flicker {
    0%, 100% {
        opacity: 0.04;
    }
    50% {
        opacity: 0.08;
    }
}

/* ============================================================
   SIGNAL CIRCLES
   ============================================================ */

.signal-circles {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.signal-circles svg {
    animation: rotate-outer 120s linear infinite;
}

.signal-group-1 {
    width: 200px;
    height: 200px;
    top: 50%;
    right: 10%;
    transform: translateY(-50%);
    animation: fade-in-elements 1500ms ease-out 2s forwards;
}

.signal-group-2 {
    width: 150px;
    height: 150px;
    top: 50%;
    right: 15%;
    transform: translateY(-50%);
    animation: fade-in-elements 1500ms ease-out 1s forwards;
}

.signal-group-3 {
    width: 200px;
    height: 200px;
    top: 50%;
    right: 10%;
    transform: translateY(-50%);
    animation: fade-in-elements 1500ms ease-out 0.5s forwards;
}

.signal-group-4 {
    width: 120px;
    height: 120px;
    top: 60%;
    right: 20%;
    transform: translateY(-50%);
    animation: fade-in-elements 1500ms ease-out 1s forwards;
}

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

/* ============================================================
   CHROMATIC SHARDS
   ============================================================ */

.chromatic-shard {
    position: absolute;
    opacity: 0.12;
    mix-blend-mode: screen;
    animation: shard-drift 45s ease-in-out infinite;
}

.shard-1 {
    width: 200px;
    height: 200px;
    top: 20%;
    right: 5%;
    background: linear-gradient(135deg, rgba(46, 134, 171, 0.5), rgba(162, 59, 114, 0.3));
    clip-path: polygon(20% 0%, 80% 10%, 90% 50%, 70% 90%, 20% 80%, 10% 40%);
    animation-delay: 0s;
}

.shard-2 {
    width: 150px;
    height: 150px;
    bottom: 15%;
    left: 8%;
    background: linear-gradient(45deg, rgba(162, 59, 114, 0.4), rgba(46, 134, 171, 0.2));
    clip-path: polygon(30% 10%, 70% 20%, 85% 60%, 50% 85%, 15% 70%, 5% 30%);
    animation-delay: 10s;
}

@keyframes shard-drift {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    50% {
        transform: translate(20px, 30px) rotate(10deg);
    }
    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

/* ============================================================
   GLITCH EFFECT
   ============================================================ */

.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    z-index: 500;
}

.glitch-overlay.active {
    animation: glitch-event 300ms ease-out;
}

@keyframes glitch-event {
    0% {
        background-color: rgba(162, 59, 114, 0);
        transform: translateX(0);
    }
    20% {
        background-color: rgba(162, 59, 114, 0.1);
        transform: translateX(8px);
    }
    40% {
        background-color: rgba(162, 59, 114, 0.05);
        transform: translateX(-5px);
    }
    60% {
        background-color: rgba(162, 59, 114, 0.08);
        transform: translateX(3px);
    }
    80% {
        background-color: rgba(162, 59, 114, 0.03);
        transform: translateX(-2px);
    }
    100% {
        background-color: rgba(162, 59, 114, 0);
        transform: translateX(0);
    }
}

/* Glitch text effect */
.glitch-text {
    position: relative;
    animation: glitch-text-pulse 3s ease-in-out infinite;
}

@keyframes glitch-text-pulse {
    0%, 100% {
        text-shadow:
            -2px 0 #2E86AB,
            2px 0 #A23B72,
            0 0 0 rgba(162, 59, 114, 0);
    }
    50% {
        text-shadow:
            -3px 0 #2E86AB,
            3px 0 #A23B72,
            0 0 10px rgba(162, 59, 114, 0.2);
    }
}

/* ============================================================
   FRAME LAYOUTS
   ============================================================ */

.content {
    position: relative;
    z-index: 10;
}

.frame {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
}

.frame-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Frame 0: Static Field */
.frame-0 {
    min-height: 100vh;
    background-color: var(--abyssal-ink);
}

.frame-0 .frame-content {
    flex-direction: column;
    gap: 2rem;
}

.frame-0 .metadata {
    opacity: 0;
    animation: fade-in-text 800ms ease-out 2s forwards;
}

/* Frame 1: First Signal */
.frame-1 {
    min-height: 150vh;
    background-color: var(--abyssal-ink);
    position: relative;
}

.frame-1 .frame-content {
    flex-direction: column;
    gap: 10vh;
    align-items: center;
}

.frame-1 .body-text {
    text-align: center;
    font-size: 16px;
    max-width: 50ch;
}

/* Frame 2: Fragment Field */
.frame-2 {
    min-height: 200vh;
    background-color: var(--abyssal-ink);
    position: relative;
}

.frame-2 .frame-content {
    position: relative;
    width: 100%;
    height: 100%;
}

.heading-left {
    grid-column: 2 / 5;
}

.text-right {
    position: absolute;
    bottom: 30%;
    right: 5%;
    text-align: right;
    animation: fade-in-text 1200ms ease-out 1s forwards;
}

.text-lower {
    position: absolute;
    bottom: 10%;
    left: 10%;
    animation: fade-in-text 1200ms ease-out 1.5s forwards;
}

/* Frame 3: Surge */
.frame-3 {
    min-height: 100vh;
    background-color: var(--abyssal-ink);
    position: relative;
    overflow: hidden;
}

.surge-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    animation: surge-intensity 2000ms ease-out 0.5s forwards;
}

@keyframes surge-intensity {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.3;
    }
}

.frame-3 .frame-content {
    flex-direction: column;
    gap: 1.5rem;
    z-index: 2;
}

.surge-h1 {
    font-size: 96px;
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 0.92;
}

.surge-h2 {
    font-size: 64px;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.surge-h3 {
    font-size: 48px;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.surge-text-1, .surge-text-2, .surge-text-3 {
    opacity: 0;
    color: var(--moonlit-foam);
}

.surge-text-1 {
    animation: fade-in-text 800ms ease-out 0.5s forwards;
}

.surge-text-2 {
    animation: fade-in-text 800ms ease-out 0.8s forwards;
}

.surge-text-3 {
    animation: fade-in-text 800ms ease-out 1.1s forwards;
}

.surge-body {
    text-align: center;
    opacity: 0;
    animation: fade-in-text 1200ms ease-out 1.4s forwards;
}

/* Accent Element */
.accent-element {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--driftwood-glow);
    opacity: 0;
    animation: fade-in-elements 1200ms ease-out 1.7s forwards;
    box-shadow: 0 0 20px rgba(212, 165, 116, 0.3);
}

.driftwood-glow {
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.6;
        box-shadow: 0 0 20px rgba(212, 165, 116, 0.3);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 40px rgba(212, 165, 116, 0.6);
    }
}

/* Frame 4: Decay */
.frame-4 {
    min-height: 150vh;
    background-color: var(--abyssal-ink);
    position: relative;
}

.frame-4 .frame-content {
    position: relative;
    width: 100%;
    height: 100%;
}

.heading-decay {
    animation: fade-in-text 1200ms ease-out 0.5s forwards;
}

.text-decay {
    position: absolute;
    top: 35%;
    left: 15%;
    animation: fade-in-text 1200ms ease-out 1s forwards;
}

.text-fade {
    position: absolute;
    bottom: 20%;
    right: 10%;
    animation: fade-in-text 1200ms ease-out 1.5s forwards;
    opacity: 0.5;
}

/* Frame 5: Silence */
.frame-5 {
    min-height: 100vh;
    background-color: var(--abyssal-ink);
}

.frame-5 .frame-content {
    flex-direction: column;
}

.metadata-final {
    text-align: center;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes fade-in-text {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fade-in-elements {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse-metadata {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes pulse-final {
    0%, 100% {
        opacity: 0.25;
    }
    50% {
        opacity: 0.4;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .display-text {
        font-size: 56px;
    }

    .heading {
        font-size: 24px;
    }

    .body-text {
        font-size: 15px;
        max-width: 35ch;
    }

    .surge-h1 {
        font-size: 56px;
    }

    .surge-h2 {
        font-size: 40px;
    }

    .surge-h3 {
        font-size: 32px;
    }

    .signal-group-1 {
        width: 120px;
        height: 120px;
        right: 5%;
    }

    .text-right {
        right: 10%;
        bottom: 25%;
        font-size: 14px;
    }

    .text-lower {
        left: 5%;
    }

    .text-decay {
        left: 10%;
        top: 30%;
    }

    .text-fade {
        right: 5%;
        font-size: 14px;
    }

    .nav-glyph {
        top: 1rem;
        right: 1rem;
    }

    .nav-menu {
        right: 0;
        padding: 1rem 1rem;
    }

    .grid-overlay {
        background-size: 10% 100vh, 100% 15vh;
    }
}

@media (max-width: 480px) {
    .display-text {
        font-size: 40px;
    }

    .heading {
        font-size: 20px;
    }

    .body-text {
        font-size: 14px;
        max-width: 30ch;
    }

    .surge-h1 {
        font-size: 40px;
    }

    .surge-h2 {
        font-size: 28px;
    }

    .surge-h3 {
        font-size: 22px;
    }

    .frame {
        min-height: 70vh;
    }

    .frame-1 {
        min-height: 100vh;
    }

    .frame-2 {
        min-height: 140vh;
    }

    .frame-4 {
        min-height: 100vh;
    }

    .signal-group-1,
    .signal-group-2,
    .signal-group-3 {
        width: 100px;
        height: 100px;
    }

    .shard-1 {
        width: 120px;
        height: 120px;
    }

    .shard-2 {
        width: 100px;
        height: 100px;
    }
}
