/* =========================================================
   hwakryul.com — a surreal neon reading room on fire
   editorial-flow · dopamine-neon · zen-contemplative
   ========================================================= */

:root {
    --bg-void: #0a0a1a;
    --bg-void-dim: #050510;
    --bg-elevated-solid: #141428;
    --bg-elevated: rgba(20, 20, 40, 0.45);
    --bg-elevated-strong: rgba(20, 20, 40, 0.6);
    --neon-magenta: #ff2daa;
    --neon-cyan: #00f5d4;
    --neon-chartreuse: #c8ff00;
    --text-primary: #e0e0f0;
    --text-muted: #8888aa;

    --ease-expo: cubic-bezier(0.19, 1, 0.22, 1);
    --ease-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);

    --font-display: "Playfair Display", "Lora", Georgia, serif;
    --font-body: "Lora", Georgia, "Times New Roman", serif;
    --font-kr: "Noto Serif KR", "Lora", serif;

    --read-column: 38rem;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    background: var(--bg-void);
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--bg-void);
    line-height: 1.75;
    font-size: 18px;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    background-image:
        radial-gradient(ellipse at 20% 10%, rgba(255, 45, 170, 0.06), transparent 50%),
        radial-gradient(ellipse at 80% 85%, rgba(0, 245, 212, 0.05), transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(10, 10, 30, 0) 0%, var(--bg-void) 70%);
}

::selection {
    background: rgba(255, 45, 170, 0.35);
    color: var(--text-primary);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 245, 212, 0.04);
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255, 45, 170, 0.4), rgba(0, 245, 212, 0.3));
    border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(255, 45, 170, 0.6), rgba(0, 245, 212, 0.5));
}

/* =========================================================
   Ember particles (ambient background field)
   ========================================================= */
.ember-field {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.ember {
    position: absolute;
    border-radius: 50%;
    bottom: -20px;
    will-change: transform, opacity;
    animation-name: emberRise;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    filter: blur(0.5px);
}

.ember.magenta {
    background: #ff2daa;
    box-shadow: 0 0 8px rgba(255, 45, 170, 0.9), 0 0 18px rgba(255, 45, 170, 0.5);
}
.ember.cyan {
    background: #00f5d4;
    box-shadow: 0 0 8px rgba(0, 245, 212, 0.9), 0 0 18px rgba(0, 245, 212, 0.5);
}
.ember.chartreuse {
    background: #c8ff00;
    box-shadow: 0 0 8px rgba(200, 255, 0, 0.8), 0 0 18px rgba(200, 255, 0, 0.4);
}

@keyframes emberRise {
    0% {
        transform: translate(0, 0) scale(0.7);
        opacity: 0;
    }
    10% {
        opacity: var(--ember-peak, 0.35);
    }
    50% {
        transform: translate(var(--sway, 30px), -50vh) scale(1);
    }
    90% {
        opacity: var(--ember-peak, 0.35);
    }
    100% {
        transform: translate(calc(var(--sway, 30px) * -0.3), -110vh) scale(0.5);
        opacity: 0;
    }
}

/* =========================================================
   Hero / Opening passage
   ========================================================= */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2rem;
    z-index: 2;
    overflow: hidden;
}

.hero-brushstroke {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.85;
    pointer-events: none;
}

.hero-stroke,
.hero-stroke-thin {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 2400;
    stroke-dashoffset: 2400;
    animation: drawStroke 4s var(--ease-quad) 0.6s forwards;
}

.hero-stroke-main {
    stroke: var(--neon-magenta);
    stroke-width: 6;
    opacity: 0.35;
}
.hero-stroke-glow {
    stroke: var(--neon-magenta);
    stroke-width: 18;
    opacity: 0.18;
    filter: blur(10px);
}
.hero-stroke-thin {
    stroke: var(--neon-magenta);
    stroke-width: 2;
    opacity: 0.5;
    animation-delay: 1s;
    animation-duration: 5s;
}

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

.hero-content {
    position: relative;
    text-align: center;
    z-index: 2;
    max-width: 100%;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 14vw, 10rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin: 0;
    color: var(--text-primary);
    text-shadow:
        0 0 40px rgba(255, 45, 170, 0.8),
        0 0 80px rgba(255, 45, 170, 0.3),
        0 0 140px rgba(255, 45, 170, 0.15);
    display: inline-block;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    animation: heroLetter 1.6s var(--ease-expo) forwards;
    animation-delay: calc(0.8s + var(--i) * 0.05s);
}

@keyframes heroLetter {
    0% {
        opacity: 0;
        transform: translateY(10px);
        letter-spacing: 0.2em;
    }
    40% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: -0.03em;
    }
}

/* Animate letter-spacing collectively via a wrapper effect */
.hero-title {
    animation: heroSpacing 1.8s var(--ease-expo) 0.8s forwards;
    letter-spacing: 0.2em;
}

@keyframes heroSpacing {
    from { letter-spacing: 0.2em; }
    to   { letter-spacing: -0.03em; }
}

.hero-subtitle {
    font-family: var(--font-kr);
    font-weight: 300;
    font-size: clamp(1rem, 2.5vw, 1.35rem);
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeUp 1.4s var(--ease-quad) 2s forwards;
}

.hero-caption {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    text-transform: lowercase;
    margin: 0;
    opacity: 0;
    animation: fadeUp 1.4s var(--ease-quad) 2.5s forwards;
}

@keyframes fadeUp {
    0%   { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hero-scroll-cue {
    position: absolute;
    bottom: 3.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    animation: fadeUp 1.4s var(--ease-quad) 3.2s forwards;
}

.cue-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--neon-cyan);
    box-shadow: 0 0 8px var(--neon-cyan), 0 0 16px rgba(0, 245, 212, 0.5);
    animation: cuePulse 2.2s ease-in-out infinite;
}

.cue-line {
    display: block;
    width: 1px;
    height: 44px;
    background: linear-gradient(to bottom, rgba(0, 245, 212, 0.6), rgba(0, 245, 212, 0));
}

@keyframes cuePulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.3); }
}

/* =========================================================
   Reading passages (editorial-flow)
   ========================================================= */
.passage {
    position: relative;
    z-index: 2;
    padding: 8rem 2rem 6rem;
}

.passage-inner {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, var(--read-column)) minmax(0, 1fr);
    gap: 4rem;
    padding-left: clamp(0rem, 6vw, 6rem);
}

.chapter-marker {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    margin-bottom: 3rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(0, 245, 212, 0.15);
}

.chapter-kr {
    font-family: var(--font-kr);
    font-weight: 500;
    font-size: 1.35rem;
    color: var(--neon-cyan);
    letter-spacing: 0.1em;
    text-shadow: 0 0 12px rgba(0, 245, 212, 0.4);
}

.chapter-en {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    text-transform: lowercase;
}

.reading-column {
    grid-column: 1;
    max-width: var(--read-column);
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--text-primary);
}

.reading-column p {
    margin: 0 0 2.5rem;
}

.reading-column p em {
    font-style: italic;
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(255, 45, 170, 0.2);
}

.em-highlight {
    color: var(--neon-magenta);
    font-style: italic;
    text-shadow: 0 0 10px rgba(255, 45, 170, 0.4);
}

/* Drop cap */
.drop-cap .initial {
    font-family: var(--font-display);
    font-weight: 900;
    font-style: italic;
    font-size: 4.5rem;
    line-height: 0.9;
    float: left;
    padding: 0.3rem 0.7rem 0 0;
    color: var(--neon-magenta);
    text-shadow:
        0 0 20px rgba(255, 45, 170, 0.6),
        0 0 48px rgba(255, 45, 170, 0.25);
}

/* Horizontal rules between paragraphs */
.rule-svg {
    display: block;
    width: 60%;
    max-width: 22rem;
    height: 10px;
    margin: 0 0 2.5rem;
    overflow: visible;
}

.rule-line {
    fill: none;
    stroke: var(--neon-cyan);
    stroke-width: 1;
    stroke-dasharray: 420;
    stroke-dashoffset: 420;
    opacity: 0.6;
    filter: drop-shadow(0 0 4px rgba(0, 245, 212, 0.5));
}

.rule-dot {
    fill: var(--neon-cyan);
    opacity: 0;
    filter: drop-shadow(0 0 6px rgba(0, 245, 212, 0.8));
}

.rule-svg.visible .rule-line {
    animation: drawRule 1.1s var(--ease-quad) forwards;
}

.rule-svg.visible .rule-dot {
    animation: dotFade 0.8s var(--ease-quad) 0.9s forwards;
}

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

@keyframes dotFade {
    to { opacity: 0.9; }
}

/* =========================================================
   Floating glassmorphic annotation cards
   ========================================================= */
.annotations {
    grid-column: 2;
    position: relative;
    min-height: 100%;
}

.annotation {
    position: relative;
    padding: 1.25rem 1.5rem;
    background: var(--bg-elevated);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid transparent;
    background-clip: padding-box;
    border-radius: 2px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.35),
        inset 0 0 0 1px rgba(255, 45, 170, 0.12);
    max-width: 22rem;
}

.annotation::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 2px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 45, 170, 0.35), rgba(0, 245, 212, 0.25) 60%, rgba(200, 255, 0, 0.15));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.anno-a {
    margin-top: 3rem;
    margin-left: 4rem;
    animation-delay: 0.2s;
}

.anno-b {
    margin-top: 4rem;
    margin-left: 0;
    max-width: 18rem;
    animation-delay: 0.4s;
}

.anno-c {
    margin-top: 4rem;
    margin-left: 5rem;
    max-width: 16rem;
    animation-delay: 0.6s;
}

.annotation.visible[data-float="a"] {
    animation: driftA 10s var(--ease-quad) infinite;
}
.annotation.visible[data-float="b"] {
    animation: driftB 12s var(--ease-quad) infinite;
}
.annotation.visible[data-float="c"] {
    animation: driftC 9s var(--ease-quad) infinite;
}

@keyframes driftA {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-14px); }
}
@keyframes driftB {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-18px); }
}
@keyframes driftC {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

.anno-num {
    display: inline-block;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
    color: var(--neon-chartreuse);
    font-size: 0.95rem;
    margin-bottom: 0.6rem;
    text-shadow: 0 0 10px rgba(200, 255, 0, 0.5);
    letter-spacing: 0.05em;
}

.anno-body {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.anno-trans {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.anno-quote {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0 0 0.6rem;
    text-shadow: 0 0 14px rgba(255, 45, 170, 0.15);
}

.anno-attr {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: 0.05em;
}

.anno-korean {
    font-family: var(--font-kr);
    font-weight: 500;
    font-size: 1.6rem;
    color: var(--neon-cyan);
    margin: 0 0 0.75rem;
    text-shadow: 0 0 14px rgba(0, 245, 212, 0.45);
    letter-spacing: 0.05em;
}

/* =========================================================
   Immersive breath sections
   ========================================================= */
.breath {
    position: relative;
    height: 140vh;
    z-index: 2;
}

.breath-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.breath-svg {
    width: 70vw;
    max-width: 900px;
    height: auto;
    aspect-ratio: 4 / 3;
    opacity: 0.9;
}

.breath-stroke,
.breath-stroke-cross,
.breath-circle {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.breath-circle {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.breath-dot {
    opacity: 0;
}

/* magenta breath */
.breath-magenta .breath-stroke-main,
.breath-magenta .breath-stroke-cross.breath-stroke-main {
    stroke: var(--neon-magenta);
    stroke-width: 5;
}
.breath-magenta .breath-stroke-glow,
.breath-magenta .breath-stroke-cross.breath-stroke-glow {
    stroke: var(--neon-magenta);
    stroke-width: 18;
    opacity: 0.3;
    filter: blur(10px);
}
.breath-magenta .breath-dot {
    fill: var(--neon-magenta);
    filter: drop-shadow(0 0 12px rgba(255, 45, 170, 0.8));
}

/* cyan breath */
.breath-cyan .breath-stroke-main,
.breath-cyan .breath-circle.breath-stroke-main {
    stroke: var(--neon-cyan);
    stroke-width: 5;
}
.breath-cyan .breath-stroke-glow,
.breath-cyan .breath-circle.breath-stroke-glow {
    stroke: var(--neon-cyan);
    stroke-width: 18;
    opacity: 0.3;
    filter: blur(10px);
}

/* chartreuse breath */
.breath-chartreuse .breath-stroke-main,
.breath-chartreuse .breath-stroke-cross.breath-stroke-main {
    stroke: var(--neon-chartreuse);
    stroke-width: 5;
}
.breath-chartreuse .breath-stroke-glow,
.breath-chartreuse .breath-stroke-cross.breath-stroke-glow {
    stroke: var(--neon-chartreuse);
    stroke-width: 18;
    opacity: 0.28;
    filter: blur(10px);
}

/* animate when visible */
.breath.visible .breath-stroke,
.breath.visible .breath-stroke-cross {
    animation: drawStroke 5s var(--ease-quad) forwards;
}
.breath.visible .breath-stroke-cross {
    animation-delay: 1.8s;
}
.breath.visible .breath-circle {
    animation: drawCircle 4.5s var(--ease-quad) 0.6s forwards;
}
.breath.visible .breath-dot {
    animation: dotFade 1s var(--ease-quad) 3.5s forwards;
}

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

.breath-caption {
    position: absolute;
    bottom: 4rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-kr);
    font-weight: 300;
    font-size: 0.95rem;
    color: var(--text-muted);
    letter-spacing: 0.25em;
    text-transform: lowercase;
    opacity: 0;
}

.breath.visible .breath-caption {
    animation: fadeUp 1.5s var(--ease-quad) 4s forwards;
}

/* =========================================================
   Colophon
   ========================================================= */
.colophon {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    z-index: 2;
    background: linear-gradient(to bottom, var(--bg-void) 0%, var(--bg-void-dim) 70%);
}

.colophon-card {
    position: relative;
    max-width: 28rem;
    width: 100%;
    padding: 3.5rem 2.5rem;
    background: rgba(20, 20, 40, 0.4);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    text-align: center;
    border-radius: 2px;
    box-shadow:
        0 0 60px rgba(255, 45, 170, 0.1),
        0 0 120px rgba(0, 245, 212, 0.05),
        inset 0 0 0 1px rgba(255, 45, 170, 0.15);
}

.colophon-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 2px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 45, 170, 0.35), rgba(0, 245, 212, 0.25) 60%, rgba(200, 255, 0, 0.15));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.colophon-domain {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.5rem;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin: 0 0 1.25rem;
    text-shadow: 0 0 24px rgba(255, 45, 170, 0.35);
}

.colophon-rule {
    display: block;
    width: 8rem;
    height: 10px;
    margin: 0 auto 1.5rem;
    overflow: visible;
}

.colophon-rule path {
    fill: none;
    stroke: var(--neon-cyan);
    stroke-width: 1;
    opacity: 0.5;
    filter: drop-shadow(0 0 4px rgba(0, 245, 212, 0.5));
}

.col-diamond {
    fill: var(--neon-magenta);
    filter: drop-shadow(0 0 6px rgba(255, 45, 170, 0.7));
}

.colophon-haiku {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-muted);
    margin: 0 0 1.5rem;
}

.colophon-date {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    margin: 0;
    opacity: 0.7;
}

/* =========================================================
   Reveal animations
   ========================================================= */
.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition:
        opacity 1.4s var(--ease-quad),
        transform 1.4s var(--ease-quad);
}

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

/* =========================================================
   Responsive — mobile collapses annotations below paragraphs
   ========================================================= */
@media (max-width: 860px) {
    .passage {
        padding: 5rem 1.5rem 4rem;
    }
    .passage-inner {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        padding-left: 0;
    }
    .reading-column {
        grid-column: 1;
        max-width: 100%;
    }
    .annotations {
        grid-column: 1;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }
    .annotation {
        margin: 0 !important;
        max-width: 100%;
    }
    .drop-cap .initial {
        font-size: 3.5rem;
    }
    .breath {
        height: 110vh;
    }
    .breath-svg {
        width: 85vw;
    }
    .hero-title {
        font-size: clamp(2.5rem, 18vw, 6rem);
    }
}

@media (max-width: 500px) {
    body { font-size: 16px; }
    .reading-column { font-size: 1rem; }
    .passage { padding: 4rem 1.25rem 3rem; }
    .chapter-marker {
        flex-direction: column;
        gap: 0.4rem;
    }
    .colophon-card {
        padding: 2.5rem 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
