/* ===========================================================
   GGIGGL.com — Graffiti-meets-Academia
   Palette
     Void Black       #0a0a0f
     Graphite Wall    #151520
     Magenta Spray    #ff2d7b
     Cyan Tag         #00f0ff
     Acid Lime        #b8ff00
     Chalk White      #e8e6e1
     Concrete Gray    #8a8a94
     Hot Violet       #9b30ff
     Electric Orange  #ff6b2b
   =========================================================== */

:root {
    --void:        #0a0a0f;
    --graphite:    #151520;
    --magenta:     #ff2d7b;
    --cyan:        #00f0ff;
    --lime:        #b8ff00;
    --chalk:       #e8e6e1;
    --concrete:    #8a8a94;
    --violet:      #9b30ff;
    --orange:      #ff6b2b;

    --serif-h:    "Playfair Display", Georgia, serif;
    --serif-b:    "Cormorant Garamond", Georgia, serif;
    --mono:       "IBM Plex Mono", "Space Mono", "Inter", monospace;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--void);
    color: var(--chalk);
    font-family: var(--serif-b);
    font-size: 19px;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

a { color: inherit; text-decoration: none; }
em, i { font-style: italic; color: var(--cyan); text-shadow: 0 0 6px rgba(0,240,255,0.35); }

/* ============== Spray-paint texture overlay ============== */
.texture-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
    mix-blend-mode: overlay;
    opacity: 0.18;
    background-image:
        radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
        radial-gradient(rgba(232,230,225,0.04) 1px, transparent 1px);
    background-size: 3px 3px, 7px 7px;
    background-position: 0 0, 1px 2px;
}

/* ============== Vertical Navigation Rail ============== */
.nav-rail {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 78px;
    z-index: 8000;
    padding: 28px 14px;
    background: linear-gradient(180deg, rgba(10,10,15,0.85), rgba(10,10,15,0.65));
    border-right: 1px solid rgba(155,48,255,0.35);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 26px;
    transition: width 0.35s ease;
}
.nav-rail:hover { width: 230px; }

.nav-brand {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--cyan);
    letter-spacing: 0.18em;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-shadow: 0 0 8px rgba(0,240,255,0.6);
}
.nav-brand-mark { font-size: 22px; color: var(--magenta); text-shadow: 0 0 10px rgba(255,45,123,0.7), 0 0 22px rgba(255,45,123,0.4); }
.nav-brand-slash { color: var(--violet); }
.nav-brand-name { color: var(--chalk); }

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--concrete);
    padding: 6px 4px;
    border-left: 2px solid transparent;
    transition: color 0.25s, border-color 0.25s, transform 0.25s;
    white-space: nowrap;
    overflow: hidden;
}
.nav-chevron {
    font-size: 14px;
    color: var(--violet);
    transition: color 0.25s, transform 0.25s;
    text-shadow: 0 0 6px rgba(155,48,255,0.5);
}
.nav-label {
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.nav-rail:hover .nav-label { opacity: 1; transform: translateX(0); }
.nav-item:hover { color: var(--chalk); }
.nav-item:hover .nav-chevron { color: var(--magenta); transform: translateX(3px); }
.nav-item.active {
    color: var(--magenta);
    border-left-color: var(--magenta);
    text-shadow: 0 0 6px rgba(255,45,123,0.6), 0 0 14px rgba(255,45,123,0.3);
    animation: pulse-mag 2.4s ease-in-out infinite;
}
.nav-item.active .nav-chevron { color: var(--magenta); }

@keyframes pulse-mag {
    0%, 100% { text-shadow: 0 0 6px rgba(255,45,123,0.6), 0 0 14px rgba(255,45,123,0.3); }
    50%      { text-shadow: 0 0 10px rgba(255,45,123,0.95), 0 0 26px rgba(255,45,123,0.55); }
}

.nav-progress {
    width: 2px;
    height: 120px;
    background: rgba(232,230,225,0.08);
    margin-left: 8px;
    position: relative;
}
.nav-progress-fill {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 0%;
    background: linear-gradient(180deg, var(--magenta), var(--violet), var(--cyan));
    box-shadow: 0 0 8px rgba(255,45,123,0.6);
    transition: height 0.18s linear;
}

/* ============== Parallax Stack ============== */
.parallax-stack {
    position: relative;
    margin-left: 78px;
}

.chapter {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    padding: 12vh 8vw 14vh 8vw;
    isolation: isolate;
}

.chapter:nth-child(odd)  { background: var(--void); }
.chapter:nth-child(even) { background: var(--graphite); }

/* Diagonal section transitions via clip-path */
.chapter--hero       { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6vw), 0 100%); }
.chapter--tagline    { clip-path: polygon(0 6vw, 100% 0, 100% 100%, 0 calc(100% - 6vw)); margin-top: -6vw; }
.chapter--dialectic  { clip-path: polygon(0 0, 100% 6vw, 100% calc(100% - 6vw), 0 100%); margin-top: -6vw; }
.chapter--marginalia { clip-path: polygon(0 6vw, 100% 0, 100% 100%, 0 calc(100% - 6vw)); margin-top: -6vw; }
.chapter--descent    { clip-path: polygon(0 0, 100% 6vw, 100% calc(100% - 6vw), 0 100%); margin-top: -6vw; }
.chapter--footnote   { clip-path: polygon(0 6vw, 100% 0, 100% 100%, 0 100%); margin-top: -6vw; }

.layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.layer--bg  { z-index: 0; }
.layer--mid { z-index: 1; will-change: transform; }
.layer--fg  { z-index: 2; position: relative; pointer-events: auto; max-width: 1280px; }

/* ============== Gradient Mesh Backgrounds ============== */
.mesh {
    position: absolute;
    inset: -10%;
    filter: blur(60px);
    opacity: 0.55;
}
.mesh--magenta {
    background:
        radial-gradient(ellipse at 18% 30%, rgba(255,45,123,0.55), transparent 55%),
        radial-gradient(ellipse at 80% 70%, rgba(155,48,255,0.45), transparent 60%),
        conic-gradient(from 200deg at 60% 40%, rgba(0,240,255,0.18), transparent 30%, rgba(255,107,43,0.18) 60%, transparent 80%);
}
.mesh--cyan {
    position: absolute;
    inset: 30% -20% -30% 40%;
    background: radial-gradient(circle, rgba(0,240,255,0.45), transparent 65%);
    filter: blur(80px);
    mix-blend-mode: screen;
    opacity: 0.6;
}
.mesh--violet-orange {
    background:
        radial-gradient(ellipse at 75% 25%, rgba(155,48,255,0.55), transparent 55%),
        radial-gradient(ellipse at 15% 80%, rgba(255,107,43,0.4), transparent 55%),
        conic-gradient(from 60deg at 40% 60%, rgba(255,45,123,0.2), transparent 35%, rgba(184,255,0,0.12) 70%, transparent 90%);
}
.mesh--lime-cyan {
    background:
        radial-gradient(ellipse at 30% 70%, rgba(184,255,0,0.32), transparent 55%),
        radial-gradient(ellipse at 75% 30%, rgba(0,240,255,0.45), transparent 55%),
        conic-gradient(from 130deg at 50% 50%, rgba(155,48,255,0.18), transparent 40%, rgba(255,45,123,0.18) 70%, transparent 95%);
}
.mesh--magenta-violet {
    background:
        radial-gradient(ellipse at 65% 35%, rgba(255,45,123,0.5), transparent 55%),
        radial-gradient(ellipse at 25% 75%, rgba(155,48,255,0.55), transparent 60%);
}
.mesh--cyan-orange {
    background:
        radial-gradient(ellipse at 20% 30%, rgba(0,240,255,0.5), transparent 55%),
        radial-gradient(ellipse at 80% 75%, rgba(255,107,43,0.45), transparent 60%),
        conic-gradient(from 280deg at 50% 50%, rgba(184,255,0,0.16), transparent 35%, rgba(155,48,255,0.18) 70%, transparent 95%);
}
.mesh--final {
    background:
        radial-gradient(ellipse at 50% 60%, rgba(155,48,255,0.4), transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(255,45,123,0.3), transparent 55%),
        radial-gradient(ellipse at 20% 80%, rgba(0,240,255,0.25), transparent 55%);
}

/* ============== Sharp-Angle SVG Fragments ============== */
.frag {
    position: absolute;
    width: 18vw;
    height: auto;
    filter: drop-shadow(0 0 12px rgba(255,45,123,0.25));
}
.frag-1  { top: 8%;  right: 6%;  width: 20vw; transform: rotate(8deg); }
.frag-2  { bottom: 14%; right: 26%; width: 14vw; transform: rotate(-12deg); }
.frag-3  { top: 40%; left: 55%; width: 10vw; transform: rotate(20deg); }
.frag-4  { top: 12%; right: 8%;  width: 24vw; transform: rotate(-6deg); }
.frag-5  { bottom: 8%; left: 38%; width: 8vw; transform: rotate(14deg); }
.frag-6  { top: 18%; right: 6%; width: 28vw; transform: rotate(-3deg); }
.frag-7  { bottom: 12%; left: 50%; width: 12vw; transform: rotate(18deg); }
.frag-8  { top: 30%; left: 60%; width: 6vw; transform: rotate(-8deg); }
.frag-9  { top: 20%; right: 10%; width: 16vw; transform: rotate(25deg); opacity: 0.85; }
.frag-10 { bottom: 12%; right: 20%; width: 22vw; transform: rotate(-5deg); }
.frag-11 { top: 14%; right: 5%; width: 30vw; transform: rotate(4deg); }
.frag-12 { bottom: 18%; left: 55%; width: 9vw; transform: rotate(35deg); }
.frag-13 { top: 25%; left: 62%; width: 5vw; transform: rotate(-12deg); }
.frag-14 { top: 14%; right: 8%; width: 18vw; transform: rotate(10deg); }
.frag-15 { bottom: 18%; right: 25%; width: 16vw; transform: rotate(-7deg); }

/* ============== Hero Chapter ============== */
.chapter--hero { padding-top: 18vh; }

.hero-meta {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.22em;
    color: var(--cyan);
    text-shadow: 0 0 6px rgba(0,240,255,0.5);
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 36px;
}
.meta-tick { color: var(--magenta); text-shadow: 0 0 6px rgba(255,45,123,0.55); }
.meta-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--lime);
    box-shadow: 0 0 8px var(--lime), 0 0 16px rgba(184,255,0,0.6);
    animation: blink 1.4s steps(2) infinite;
}
.meta-time { color: var(--concrete); }

@keyframes blink { 50% { opacity: 0.2; } }

.hero-headline {
    position: relative;
    margin-bottom: 36px;
    max-width: 64%;
}

.typewriter {
    display: inline-block;
    font-family: var(--mono);
    font-size: clamp(18px, 2.2vw, 28px);
    color: var(--lime);
    letter-spacing: 0.04em;
    text-shadow: 0 0 6px rgba(184,255,0,0.5);
    white-space: pre-wrap;
    word-break: break-word;
}
.typewriter::after {
    content: "";
    display: inline-block;
    width: 0.6em;
    height: 1.05em;
    background: var(--magenta);
    margin-left: 4px;
    vertical-align: -0.15em;
    box-shadow: 0 0 8px rgba(255,45,123,0.7), 0 0 18px rgba(255,45,123,0.4);
    animation: caret 0.85s steps(2) infinite;
}
.typewriter--done::after { display: none; }
.typewriter--small { font-size: 13px; }

@keyframes caret { 50% { opacity: 0; } }

.serif-reveal {
    display: block;
    font-family: var(--serif-h);
    font-weight: 900;
    font-size: clamp(54px, 9vw, 120px);
    line-height: 0.95;
    letter-spacing: -0.01em;
    color: var(--chalk);
    margin-top: 18px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.9s ease, transform 0.9s ease;
    text-shadow:
        0 0 4px rgba(232,230,225,0.4),
        0 0 16px rgba(255,45,123,0.25),
        0 0 32px rgba(155,48,255,0.18);
    position: relative;
}
.serif-reveal.is-revealed { opacity: 1; transform: translateY(0); }
.serif-reveal .rot {
    display: inline-block;
    transform: rotate(var(--r, 0deg));
}
.serif-break { display: block; height: 0.1em; }
.serif-italic {
    display: block;
    font-style: italic;
    font-weight: 400;
    color: var(--magenta);
    font-size: 0.55em;
    margin-top: 0.1em;
    letter-spacing: 0.01em;
    text-shadow: 0 0 8px rgba(255,45,123,0.55), 0 0 22px rgba(255,45,123,0.3);
}

.hero-sub {
    font-family: var(--serif-b);
    font-size: clamp(18px, 1.5vw, 22px);
    color: var(--concrete);
    max-width: 560px;
    margin-top: 28px;
    line-height: 1.55;
}
.hero-sub::first-letter { color: var(--chalk); }

.hero-scrollcue {
    position: absolute;
    bottom: 8vh;
    left: 8vw;
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.25em;
    color: var(--cyan);
    text-shadow: 0 0 6px rgba(0,240,255,0.5);
}
.cue-arrow {
    font-size: 18px;
    color: var(--magenta);
    animation: drop 1.6s ease-in-out infinite;
    text-shadow: 0 0 8px rgba(255,45,123,0.6);
}
@keyframes drop {
    0%, 100% { transform: translateY(0); opacity: 0.6; }
    50%      { transform: translateY(8px); opacity: 1; }
}

/* ============== Chapter Generic ============== */
.chapter-label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.32em;
    color: var(--violet);
    text-shadow: 0 0 6px rgba(155,48,255,0.5);
    margin-bottom: 28px;
    padding-left: 22px;
    position: relative;
}
.chapter-label::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    width: 14px; height: 1px;
    background: var(--violet);
    box-shadow: 0 0 6px var(--violet);
}

.chapter-heading {
    position: relative;
    font-family: var(--serif-h);
    font-weight: 900;
    font-size: clamp(48px, 7.5vw, 96px);
    line-height: 0.95;
    color: var(--chalk);
    max-width: 70%;
    margin-bottom: 36px;
    transition: text-shadow 0.35s ease-out, transform 0.35s;
    text-shadow:
        0 0 4px rgba(232,230,225,0.3),
        0 0 12px rgba(0,240,255,0.18);
}
.chapter-heading--quiet {
    font-size: clamp(38px, 5.5vw, 72px);
    color: var(--concrete);
}
.chapter-heading .line { display: block; }
.chapter-heading .rot { display: inline-block; transform: rotate(var(--r, 0deg)); }
.chapter-heading[data-glow]:hover {
    text-shadow:
        0 0 6px rgba(255,45,123,0.7),
        0 0 20px rgba(255,45,123,0.55),
        0 0 38px rgba(155,48,255,0.45),
        0 0 60px rgba(0,240,255,0.25);
}

.chapter-body {
    font-family: var(--serif-b);
    font-size: clamp(18px, 1.4vw, 22px);
    line-height: 1.6;
    color: var(--chalk);
    max-width: 560px;
    margin-bottom: 22px;
}
.chapter-body--echo {
    font-style: italic;
    color: var(--cyan);
    font-size: clamp(20px, 1.6vw, 26px);
    margin-top: 18px;
    text-shadow: 0 0 8px rgba(0,240,255,0.4);
    border-left: 2px solid var(--cyan);
    padding-left: 18px;
}

.dropcap {
    float: left;
    font-family: var(--serif-h);
    font-weight: 900;
    font-size: 5em;
    line-height: 0.9;
    color: var(--magenta);
    margin: 0.05em 0.12em -0.1em 0;
    text-shadow: 0 0 10px rgba(255,45,123,0.55), 0 0 24px rgba(255,45,123,0.3);
}

.pull-quote {
    font-family: var(--serif-h);
    font-style: italic;
    font-size: clamp(28px, 3vw, 44px);
    line-height: 1.2;
    color: var(--lime);
    text-shadow: 0 0 10px rgba(184,255,0,0.4), 0 0 24px rgba(184,255,0,0.22);
    max-width: 720px;
    margin: 36px 0 24px;
    padding-left: 24px;
    border-left: 3px solid var(--lime);
    transform: rotate(-0.6deg);
}

/* ============== Margin Annotations ============== */
.margin-note {
    position: absolute;
    right: 6vw;
    top: 18vh;
    width: 240px;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.45;
    color: var(--concrete);
    border-left: 2px solid var(--violet);
    padding: 8px 0 8px 12px;
    transform: rotate(2deg);
    background: linear-gradient(90deg, rgba(155,48,255,0.05), transparent);
    box-shadow: -1px 0 0 rgba(155,48,255,0.3);
}
.margin-note em { color: var(--cyan); font-style: italic; text-shadow: none; }
.margin-note--low { top: auto; bottom: 14vh; transform: rotate(-1.6deg); }
.margin-note--hero { top: 22vh; right: 8vw; width: 220px; }
.margin-tick {
    display: inline-block;
    color: var(--magenta);
    margin-right: 6px;
    text-shadow: 0 0 4px rgba(255,45,123,0.5);
}

/* ============== Manuscript Layout (Chapter 03) ============== */
.manuscript {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 280px;
    gap: 56px;
    align-items: start;
    max-width: 1100px;
}
.manuscript-margin {
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding-top: 12px;
}
.margin-note--inline {
    position: relative;
    right: auto; top: auto;
    width: 100%;
    transform: rotate(1.5deg);
}
.margin-note--inline:nth-child(2) { transform: rotate(-1.2deg); }
.margin-note--inline:nth-child(3) { transform: rotate(0.8deg); }

/* ============== Drip Animations ============== */
.drips {
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 80px;
    pointer-events: none;
}
.drip {
    position: absolute;
    bottom: 100%;
    width: 3px;
    background: linear-gradient(180deg, currentColor, transparent);
    transform-origin: top center;
    transform: scaleY(0);
    transition: transform 1.1s cubic-bezier(.4,0,.2,1);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 0 8px currentColor;
}
.drip.is-on { transform: scaleY(1); }

/* ============== Footnote / Final ============== */
.chapter--footnote { padding-top: 16vh; }
.footnote-cta {
    margin-top: 40px;
    padding: 28px 30px;
    border: 1px solid rgba(155,48,255,0.5);
    border-left: 3px solid var(--magenta);
    background: linear-gradient(90deg, rgba(155,48,255,0.08), transparent);
    max-width: 720px;
    display: flex;
    gap: 18px;
    align-items: flex-start;
    transform: rotate(-0.6deg);
    box-shadow: 0 0 24px rgba(155,48,255,0.15) inset;
}
.footnote-mark {
    font-family: var(--serif-h);
    font-size: 36px;
    color: var(--magenta);
    line-height: 1;
    text-shadow: 0 0 10px rgba(255,45,123,0.6);
}
.footnote-text {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--chalk);
    line-height: 1.6;
    flex: 1;
}

.colophon {
    margin-top: 80px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 740px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--concrete);
    letter-spacing: 0.06em;
    border-top: 1px dashed rgba(155,48,255,0.3);
    padding-top: 24px;
}
.colophon-row { display: flex; gap: 18px; }
.col-key {
    color: var(--cyan);
    text-shadow: 0 0 4px rgba(0,240,255,0.4);
    width: 90px;
    flex-shrink: 0;
}
.col-val { color: var(--chalk); }
.col-val em { color: var(--magenta); font-style: italic; }

/* ============== Diagonal-cut Edge Trace ============== */
.diagonal-cut {
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    pointer-events: none;
    z-index: 5;
    overflow: visible;
}
.diagonal-cut--down { bottom: 0; transform: rotate(-2.5deg); transform-origin: left bottom; }
.diagonal-cut--up   { top: 0; transform: rotate(2.5deg); transform-origin: left top; }
.diagonal-cut::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    box-shadow: 0 0 8px var(--cyan);
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left center;
    transition: opacity 0.4s, transform 1.2s cubic-bezier(.4,0,.2,1);
}
.diagonal-cut.is-tracing::after {
    opacity: 1;
    transform: scaleX(1);
}

/* ============== Reveal on enter ============== */
.chapter-heading,
.chapter-body,
.pull-quote,
.margin-note,
.footnote-cta,
.colophon {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}
.is-in .chapter-heading,
.is-in .chapter-body,
.is-in .pull-quote,
.is-in .margin-note,
.is-in .footnote-cta,
.is-in .colophon {
    opacity: 1;
    transform: translateY(0);
}
.is-in .chapter-body              { transition-delay: 0.15s; }
.is-in .chapter-body--echo        { transition-delay: 0.30s; }
.is-in .pull-quote                { transition-delay: 0.30s; }
.is-in .margin-note               { transition-delay: 0.45s; }
.is-in .margin-note--low          { transition-delay: 0.6s; }
.is-in .footnote-cta              { transition-delay: 0.25s; }
.is-in .colophon                  { transition-delay: 0.45s; }

/* ============== Responsive ============== */
@media (max-width: 900px) {
    .nav-rail { width: 56px; }
    .nav-rail:hover { width: 200px; }
    .parallax-stack { margin-left: 56px; }
    .chapter { padding: 10vh 6vw 12vh 6vw; }
    .hero-headline { max-width: 100%; }
    .chapter-heading { max-width: 100%; }
    .margin-note { position: relative; right: auto; top: auto; bottom: auto; width: 100%; margin-top: 24px; transform: rotate(0); }
    .manuscript { grid-template-columns: 1fr; gap: 28px; }
}
