/* =====================================================
   SocialDebug.Org - Styles
   Aurora-Gradient | Dark-Mode | Broken-Grid | Glitch
   ===================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --void-black: #0A0A14;
    --deep-indigo: #12122A;
    --neon-mint: #00E68A;
    --soft-ultraviolet: #B388FF;
    --hot-bloom: #FF2D7B;
    --ice-trace: #00D4FF;
    --silver-mist: #C8D6E5;
    --pale-mint: #E0FFF4;
    --pale-lavender: #F0E6FF;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--void-black);
    color: var(--silver-mist);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Aurora Background --- */
.aurora-bg {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(0, 230, 138, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(179, 136, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 30%, rgba(255, 45, 123, 0.04) 0%, transparent 50%);
    animation: auroraDrift 30s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes auroraDrift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(3%, -2%) rotate(1deg); }
    50% { transform: translate(-2%, 3%) rotate(-1deg); }
    75% { transform: translate(1%, -1%) rotate(0.5deg); }
}

/* --- Typography --- */
h1, h2 {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 800;
    color: var(--pale-mint);
    letter-spacing: -0.02em;
}

h2 {
    font-weight: 600;
}

.code-text {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 16px;
    color: var(--neon-mint);
    text-shadow: 0 0 8px rgba(0, 230, 138, 0.3);
}

/* --- Chapters --- */
.chapter {
    position: relative;
    min-height: 100vh;
    z-index: 1;
}

.chapter-content {
    position: relative;
    z-index: 2;
}

/* =====================================================
   CHAPTER 1 - Initializing (Hero)
   ===================================================== */
.chapter-1 {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 8%;
}

.chapter-1 .chapter-content {
    position: relative;
    max-width: 800px;
    margin-left: 8%;
}

.debug-rose-hero {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 350px;
    height: 350px;
    opacity: 0;
    transition: opacity 1.5s ease;
    z-index: 0;
}

.debug-rose-hero.visible {
    opacity: 0.2;
}

.rose-svg {
    width: 100%;
    height: 100%;
    animation: roseRotate 60s linear infinite;
}

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

.petal {
    fill: none;
    stroke-width: 1.5;
}

.petal-outer {
    stroke: var(--neon-mint);
    filter: drop-shadow(0 0 6px rgba(0, 230, 138, 0.4));
}

.petal-mid {
    stroke: var(--soft-ultraviolet);
    filter: drop-shadow(0 0 6px rgba(179, 136, 255, 0.4));
}

.petal-inner {
    stroke: var(--hot-bloom);
    filter: drop-shadow(0 0 6px rgba(255, 45, 123, 0.4));
}

.rose-center {
    fill: var(--hot-bloom);
    filter: drop-shadow(0 0 10px rgba(255, 45, 123, 0.6));
}

.hero-title {
    font-size: 72px;
    color: var(--pale-mint);
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hero-title.visible {
    opacity: 1;
    transform: translateX(0);
}

.hero-command {
    margin-top: 24px;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.5s ease;
    position: relative;
    z-index: 1;
}

.hero-command.visible {
    opacity: 1;
}

.cursor {
    font-family: 'Fira Code', monospace;
    color: var(--neon-mint);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero-tagline {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--soft-ultraviolet);
    margin-top: 32px;
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.hero-tagline.visible {
    opacity: 1;
}

.hero-tagline .tagline-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.05s ease, transform 0.05s ease;
}

.hero-tagline .tagline-letter.show {
    opacity: 1;
    transform: translateY(0);
}

/* =====================================================
   GLITCH SEAM DIVIDERS
   ===================================================== */
.glitch-seam {
    position: relative;
    height: 100px;
    overflow: hidden;
    z-index: 2;
    clip-path: polygon(0 15%, 5% 0, 15% 20%, 25% 5%, 35% 18%, 45% 2%, 55% 15%, 65% 0, 75% 22%, 85% 5%, 95% 18%, 100% 8%, 100% 85%, 95% 100%, 85% 80%, 75% 95%, 65% 82%, 55% 98%, 45% 85%, 35% 100%, 25% 82%, 15% 95%, 5% 80%, 0 92%);
}

.seam-content {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--neon-mint), var(--hot-bloom), var(--ice-trace));
    opacity: 0.15;
    animation: glitchBandShift 4s linear infinite;
}

@keyframes glitchBandShift {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.seam-content {
    background-size: 200% 100%;
}

.seam-botanical {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.seam-vine {
    fill: none;
    stroke: var(--neon-mint);
    stroke-width: 2;
    filter: drop-shadow(0 0 4px rgba(0, 230, 138, 0.5));
}

.scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 230, 138, 0.08) 2px,
        rgba(0, 230, 138, 0.08) 3px
    );
    pointer-events: none;
}

.glitch-seam.animate-seam {
    animation: seamGlitch 200ms ease-out;
}

@keyframes seamGlitch {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

/* --- Seed Pods --- */
.seed-pod {
    fill: var(--soft-ultraviolet);
    filter: drop-shadow(0 0 6px rgba(179, 136, 255, 0.5));
    animation: podPulse 3s ease-in-out infinite;
}

.seed-pod:nth-child(even) {
    animation-delay: 1.5s;
}

@keyframes podPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* =====================================================
   CHAPTER 2 - Stack Trace (Content Discovery)
   ===================================================== */
.chapter-2 {
    padding: 120px 6% 80px;
    min-height: 120vh;
}

.fragment-cluster {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 900px;
}

.trace-vines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.trace-line {
    fill: none;
    stroke: var(--neon-mint);
    stroke-width: 1.5;
    stroke-dasharray: 8 4;
    filter: drop-shadow(0 0 4px rgba(0, 230, 138, 0.3));
    opacity: 0.6;
}

/* Stack frames - broken grid positions */
.stack-frame {
    position: absolute;
    background: var(--deep-indigo);
    border: 1px solid rgba(179, 136, 255, 0.2);
    border-radius: 8px;
    padding: 28px 32px;
    max-width: 420px;
    z-index: 1;
    opacity: 0;
    transform: translateX(var(--glitch-x, -30px));
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

.stack-frame.glitched-in {
    opacity: 1;
    transform: translateX(0);
}

.frame-1 {
    top: 40px;
    left: 5%;
    --glitch-x: -40px;
}

.frame-2 {
    top: 200px;
    left: 35%;
    --glitch-x: 30px;
}

.frame-3 {
    top: 380px;
    left: 10%;
    --glitch-x: -35px;
}

.frame-4 {
    top: 520px;
    left: 50%;
    --glitch-x: 40px;
}

.frame-5 {
    top: 700px;
    left: 20%;
    --glitch-x: -25px;
}

.frame-header {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 230, 138, 0.15);
}

.frame-header .code-text {
    font-size: 14px;
}

.frame-body p {
    font-size: 17px;
    color: var(--silver-mist);
    line-height: 1.65;
}

/* Leaf Fragments */
.leaf-fragment {
    position: absolute;
    width: 40px;
    height: 40px;
    overflow: visible;
}

.leaf-top-right {
    top: -12px;
    right: -12px;
}

.leaf-bottom-left {
    bottom: -12px;
    left: -12px;
}

.leaf-top-left {
    top: -12px;
    left: -12px;
}

.leaf-bottom-right {
    bottom: -12px;
    right: -12px;
}

.leaf-path {
    fill: none;
    stroke-width: 1.5;
}

.cyan-leaf {
    stroke: var(--ice-trace);
    filter: drop-shadow(0 0 4px rgba(0, 212, 255, 0.4));
}

/* =====================================================
   CHAPTER 3 - Variable Watch (Deep Content)
   ===================================================== */
.chapter-3 {
    padding: 120px 6% 100px;
    position: relative;
}

.breach-panel {
    overflow: hidden;
}

.breach-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(0, 230, 138, 0.08) 0%,
        rgba(179, 136, 255, 0.08) 40%,
        rgba(255, 45, 123, 0.06) 70%,
        rgba(0, 212, 255, 0.06) 100%
    );
    z-index: 0;
}

.breach-heading {
    font-size: 56px;
    font-weight: 800;
    color: var(--pale-mint);
    text-align: center;
    margin-bottom: 80px;
    position: relative;
    z-index: 1;
}

/* Text Glitch Effect on Hover */
.glitch-text {
    position: relative;
    display: inline-block;
    width: 100%;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    text-align: center;
    opacity: 0;
    transition: opacity 0.1s;
}

.glitch-text::before {
    color: var(--neon-mint);
    mix-blend-mode: screen;
}

.glitch-text::after {
    color: var(--hot-bloom);
    mix-blend-mode: screen;
}

.glitch-text:hover::before {
    opacity: 0.8;
    animation: glitchShift1 200ms ease-out;
}

.glitch-text:hover::after {
    opacity: 0.8;
    animation: glitchShift2 200ms ease-out;
}

@keyframes glitchShift1 {
    0% { transform: translate(-3px, -2px); }
    50% { transform: translate(2px, 1px); }
    100% { transform: translate(0, 0); }
}

@keyframes glitchShift2 {
    0% { transform: translate(3px, 2px); }
    50% { transform: translate(-2px, -1px); }
    100% { transform: translate(0, 0); }
}

/* Variable Cards */
.variable-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.var-card {
    background: var(--deep-indigo);
    border: 1px solid rgba(179, 136, 255, 0.2);
    border-radius: 12px;
    padding: 32px;
    position: relative;
    transition: box-shadow 0.4s ease, border-color 0.4s ease;
    opacity: 0;
    transform: translateX(var(--glitch-x, 20px));
    overflow: visible;
}

.var-card:nth-child(odd) {
    --glitch-x: -20px;
}

.var-card:nth-child(even) {
    --glitch-x: 20px;
}

.var-card.glitched-in {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.17, 0.67, 0.83, 0.67), box-shadow 0.4s ease, border-color 0.4s ease;
}

.var-card:hover {
    box-shadow: 0 0 40px rgba(179, 136, 255, 0.25);
    border-color: rgba(179, 136, 255, 0.4);
}

.var-name {
    margin-bottom: 14px;
}

.var-name .code-text {
    font-size: 15px;
    color: var(--neon-mint);
}

.var-value {
    font-size: 17px;
    color: var(--silver-mist);
    line-height: 1.65;
}

/* =====================================================
   CHAPTER 4 - Breakpoint (Emotional Peak)
   ===================================================== */
.chapter-4 {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.breakpoint-content {
    text-align: center;
    position: relative;
    width: 100%;
    max-width: 600px;
}

.breakpoint-title {
    font-size: 44px;
    font-weight: 800;
    color: var(--pale-mint);
    margin-bottom: 60px;
    position: relative;
    z-index: 3;
    opacity: 0;
    transform: translateY(-20px);
}

.breakpoint-title.glitched-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

.bloom-rose {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto;
    z-index: 2;
}

.bloom-rose-svg {
    width: 100%;
    height: 100%;
}

.bloom-ring ellipse {
    fill: none;
    stroke-width: 1.5;
}

.bloom-ring-outer ellipse {
    stroke: var(--neon-mint);
}

.bloom-ring-mid ellipse {
    stroke: var(--soft-ultraviolet);
}

.bloom-ring-inner ellipse {
    stroke: var(--hot-bloom);
}

.bloom-center {
    fill: var(--hot-bloom);
    filter: drop-shadow(0 0 12px rgba(255, 45, 123, 0.6));
}

/* Bloom animation - petals scale in */
.bloom-ring-outer {
    transform-origin: center;
    transform: scale(0);
    transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bloom-ring-mid {
    transform-origin: center;
    transform: scale(0);
    transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s;
}

.bloom-ring-inner {
    transform-origin: center;
    transform: scale(0);
    transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s;
}

.bloom-center {
    transform-origin: center;
    transform: scale(0);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.9s;
}

.bloom-rose.bloomed .bloom-ring-outer,
.bloom-rose.bloomed .bloom-ring-mid,
.bloom-rose.bloomed .bloom-ring-inner,
.bloom-rose.bloomed .bloom-center {
    transform: scale(1);
}

/* Scattered seed pods */
.seed-pod-scatter {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.floating-pod {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--soft-ultraviolet);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(179, 136, 255, 0.5);
    animation: podPulse 3s ease-in-out infinite;
}

.floating-pod:nth-child(2n) { animation-delay: 0.5s; }
.floating-pod:nth-child(3n) { animation-delay: 1s; }
.floating-pod:nth-child(4n) { animation-delay: 1.5s; }
.floating-pod:nth-child(5n) { animation-delay: 2s; }
.floating-pod:nth-child(6n) { animation-delay: 2.5s; }

/* Aurora intensify in chapter 4 */
.chapter-4 .aurora-intensify {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 40% 50%, rgba(0, 230, 138, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse at 60% 50%, rgba(179, 136, 255, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 45, 123, 0.07) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* =====================================================
   CHAPTER 5 - Resolution (Closing)
   ===================================================== */
.chapter-5 {
    padding: 120px 6% 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.resolution-content {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    padding-left: 60px;
}

.closing-vine {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 100%;
}

.closing-trace {
    stroke: var(--neon-mint);
    stroke-width: 1.5;
    fill: none;
    filter: drop-shadow(0 0 4px rgba(0, 230, 138, 0.3));
    opacity: 0.5;
}

.resolution-text {
    margin-bottom: 60px;
}

.resolution-para {
    font-size: 18px;
    color: var(--silver-mist);
    margin-bottom: 28px;
    line-height: 1.75;
    opacity: 0;
    transform: translateX(-15px);
}

.resolution-para.glitched-in {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

.closing-command {
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    color: var(--neon-mint);
    text-shadow: 0 0 8px rgba(0, 230, 138, 0.3);
    opacity: 0;
    transform: translateX(-15px);
}

.closing-command.glitched-in {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

/* =====================================================
   GLITCH ENTRANCE ANIMATION
   ===================================================== */
@keyframes glitchIn {
    0% {
        opacity: 0;
        transform: translateX(var(--glitch-x, -30px));
        filter: blur(2px);
    }
    40% {
        opacity: 0.7;
        transform: translateX(calc(var(--glitch-x, -30px) * -0.3));
    }
    70% {
        opacity: 0.9;
        transform: translateX(calc(var(--glitch-x, -30px) * 0.1));
    }
    100% {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

/* Glitch RGB offset on entrance */
.glitch-enter::before,
.glitch-enter::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
}

.glitch-enter::before {
    border: 1px solid var(--neon-mint);
    animation: rgbOffsetGreen 200ms ease-out;
}

.glitch-enter::after {
    border: 1px solid var(--hot-bloom);
    animation: rgbOffsetMagenta 200ms ease-out;
}

@keyframes rgbOffsetGreen {
    0% { transform: translate(-3px, 0); opacity: 0.8; }
    100% { transform: translate(0); opacity: 0; }
}

@keyframes rgbOffsetMagenta {
    0% { transform: translate(3px, 0); opacity: 0.8; }
    100% { transform: translate(0); opacity: 0; }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
    .hero-title {
        font-size: 48px;
    }

    .breach-heading {
        font-size: 36px;
    }

    .breakpoint-title {
        font-size: 32px;
    }

    .stack-frame {
        position: relative;
        top: auto !important;
        left: auto !important;
        max-width: 100%;
        margin-bottom: 24px;
    }

    .fragment-cluster {
        min-height: auto;
    }

    .trace-vines {
        display: none;
    }

    .variable-cards {
        grid-template-columns: 1fr;
    }

    .bloom-rose {
        width: 280px;
        height: 280px;
    }

    .chapter-1 .chapter-content {
        margin-left: 0;
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: 36px;
    }

    body {
        font-size: 16px;
    }

    .breach-heading {
        font-size: 28px;
    }

    .resolution-content {
        padding-left: 40px;
    }

    .var-card {
        padding: 24px;
    }

    .stack-frame {
        padding: 20px 24px;
    }
}
