/* ===========================
   graphers.net - Corrupted Data Observatory
   Triadic Palette: #FF3366 / #00E5CC / #FFB833
   =========================== */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #0A0A14;
    color: #EDEDED;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.15vw, 1.1rem);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* --- Noise Grain Texture --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.03;
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF0GlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+AAAAB3RJTUUH4wkBFjQnMPHvZAAAADxJREFUeNrtwTEBAAAAwqD1T20ND6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7waL0AABl8aSLwAAAABJRU5ErkJggg==");
    background-repeat: repeat;
}

/* --- CRT Scan Line Overlay --- */
#crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(0, 0, 0, 0.04) 1px,
        rgba(0, 0, 0, 0.04) 2px
    );
    mix-blend-mode: overlay;
}

/* --- Aurora Light Bands --- */
#aurora-bands {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background:
        linear-gradient(2deg, transparent 0%, rgba(0, 229, 204, 0.05) 20%, transparent 40%),
        linear-gradient(-1deg, transparent 30%, rgba(255, 51, 102, 0.04) 50%, transparent 70%),
        linear-gradient(0.5deg, transparent 60%, rgba(255, 184, 51, 0.03) 80%, transparent 100%);
    background-size: 100% 400px, 100% 500px, 100% 600px;
    will-change: background-position;
}

/* --- Sidebar Rail --- */
#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background-color: #0A0A14;
    z-index: 100;
    border-right: 1px solid rgba(120, 120, 160, 0.1);
    transform: translateX(-100%);
    transition: transform 400ms ease-out;
}

#sidebar.visible {
    transform: translateX(0);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 2.5rem 1.5rem;
}

.sidebar-logo {
    font-family: 'Jost', sans-serif;
    font-weight: 900;
    font-size: 1.6rem;
    letter-spacing: 0.08em;
    color: #EDEDED;
    margin-bottom: 3rem;
    text-transform: uppercase;
}

.sidebar-nav {
    list-style: none;
    flex-grow: 1;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.nav-item {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 0.95vw, 0.95rem);
    letter-spacing: 0.06em;
    color: #7878A0;
    text-decoration: none;
    padding: 0.6rem 0.8rem;
    position: relative;
    transition: color 200ms ease;
    clip-path: inset(0 0 0 0);
}

.nav-item:hover {
    color: #EDEDED;
    animation: glitchClip 300ms steps(4) forwards;
}

.nav-item.active {
    color: #00E5CC;
    text-shadow: 1px 0 #CC2952, -1px 0 #00E5CC;
}

@keyframes glitchClip {
    0% { clip-path: inset(0 0 0 0); transform: translateX(0); }
    25% { clip-path: inset(20% 0 60% 0); transform: translateX(3px); }
    50% { clip-path: inset(50% 0 20% 0); transform: translateX(-2px); }
    75% { clip-path: inset(10% 0 70% 0); transform: translateX(4px); }
    100% { clip-path: inset(0 0 0 0); transform: translateX(0); }
}

.sidebar-blob {
    width: 120px;
    height: 120px;
    margin-top: auto;
    align-self: center;
}

.sidebar-blob svg {
    width: 100%;
    height: 100%;
}

.blob-path {
    animation: sidebarBlobMorph 12s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes sidebarBlobMorph {
    0% { d: path("M100,30 C140,30 170,60 170,100 C170,140 140,170 100,170 C60,170 30,140 30,100 C30,60 60,30 100,30"); }
    25% { d: path("M100,20 C150,40 180,70 170,110 C160,150 130,180 90,170 C50,160 20,130 30,90 C40,50 60,20 100,20"); }
    50% { d: path("M110,25 C155,35 175,75 165,115 C155,155 120,175 80,165 C40,155 25,120 35,80 C45,40 65,25 110,25"); }
    75% { d: path("M95,30 C135,25 175,55 175,95 C175,135 145,175 105,175 C65,175 25,145 25,105 C25,65 55,30 95,30"); }
    100% { d: path("M100,30 C140,30 170,60 170,100 C170,140 140,170 100,170 C60,170 30,140 30,100 C30,60 60,30 100,30"); }
}

/* --- Main Content --- */
#main-content {
    margin-left: 280px;
    width: calc(100vw - 280px);
    position: relative;
    z-index: 2;
}

/* --- Sections --- */
.section {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Organic Blobs --- */
.blob {
    position: absolute;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    pointer-events: none;
    will-change: border-radius, transform;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle at center, rgba(0, 229, 204, 0.12), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: blobMorph1 10s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle at center, rgba(255, 51, 102, 0.15), transparent 70%);
    top: 20%;
    left: 10%;
    animation: blobMorph2 12s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.blob-3 {
    width: 280px;
    height: 280px;
    background: radial-gradient(circle at center, rgba(255, 184, 51, 0.15), transparent 70%);
    bottom: 15%;
    right: 15%;
    animation: blobMorph3 14s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.blob-4 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle at center, rgba(255, 184, 51, 0.18), transparent 70%);
    top: 30%;
    right: 10%;
    animation: blobMorph1 11s cubic-bezier(0.4, 0, 0.2, 1) infinite reverse;
}

.blob-5 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle at center, rgba(255, 51, 102, 0.2), transparent 70%);
    top: 40%;
    left: 20%;
    animation: blobMorph2 9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.blob-6 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle at center, rgba(0, 229, 204, 0.2), transparent 70%);
    top: 35%;
    left: 40%;
    animation: blobMorph3 11s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.blob-7 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle at center, rgba(255, 184, 51, 0.2), transparent 70%);
    top: 45%;
    right: 20%;
    animation: blobMorph1 13s cubic-bezier(0.4, 0, 0.2, 1) infinite reverse;
}

@keyframes blobMorph1 {
    0%   { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: translate(-50%, -50%) scale(1); }
    25%  { border-radius: 58% 42% 56% 44% / 44% 58% 42% 56%; transform: translate(-50%, -50%) scale(1.05); }
    50%  { border-radius: 42% 58% 36% 64% / 64% 36% 58% 42%; transform: translate(-50%, -50%) scale(0.97); }
    75%  { border-radius: 55% 45% 62% 38% / 38% 62% 45% 55%; transform: translate(-50%, -50%) scale(1.03); }
    100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: translate(-50%, -50%) scale(1); }
}

@keyframes blobMorph2 {
    0%   { border-radius: 40% 60% 55% 45% / 55% 45% 60% 40%; }
    33%  { border-radius: 55% 45% 40% 60% / 60% 40% 45% 55%; }
    66%  { border-radius: 45% 55% 65% 35% / 35% 65% 55% 45%; }
    100% { border-radius: 40% 60% 55% 45% / 55% 45% 60% 40%; }
}

@keyframes blobMorph3 {
    0%   { border-radius: 60% 40% 45% 55% / 45% 55% 40% 60%; }
    25%  { border-radius: 35% 65% 58% 42% / 58% 42% 65% 35%; }
    50%  { border-radius: 50% 50% 35% 65% / 65% 35% 50% 50%; }
    75%  { border-radius: 65% 35% 50% 50% / 40% 60% 35% 65%; }
    100% { border-radius: 60% 40% 45% 55% / 45% 55% 40% 60%; }
}

/* --- Section 1: Hero --- */
.section-hero {
    flex-direction: column;
    padding: 3rem;
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 5;
}

.wordmark {
    font-family: 'Jost', sans-serif;
    font-weight: 900;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: #EDEDED;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    min-height: 1.2em;
}

.wordmark .char {
    display: inline-block;
    opacity: 0;
    text-shadow: 2px 0 #FF3366, -2px 0 #00E5CC;
    animation: charReveal 300ms ease-out forwards;
}

@keyframes charReveal {
    0% { opacity: 0; text-shadow: 2px 0 #FF3366, -2px 0 #00E5CC; transform: translateY(10px); }
    60% { opacity: 1; text-shadow: 1px 0 #FF3366, -1px 0 #00E5CC; }
    100% { opacity: 1; text-shadow: 0 0 transparent, 0 0 transparent; transform: translateY(0); }
}

.tagline {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.85rem, 1vw, 1rem);
    letter-spacing: 0.06em;
    color: #7878A0;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.tagline.visible {
    opacity: 1;
}

/* --- Graph Fragments --- */
.graph-fragment {
    position: absolute;
    pointer-events: none;
    opacity: 0.6;
}

.fragment-1 {
    width: 160px;
    height: 160px;
    bottom: 8%;
    right: 8%;
    transform: rotate(8deg);
}

.fragment-2 {
    width: 220px;
    height: 80px;
    top: 10%;
    right: 5%;
    transform: rotate(-5deg);
}

.fragment-3 {
    width: 120px;
    height: 160px;
    bottom: 5%;
    left: 5%;
    transform: rotate(12deg);
}

.draw-line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.2s ease-out;
}

.draw-line.drawn {
    stroke-dashoffset: 0;
}

.draw-dot {
    opacity: 0;
    transition: opacity 0.6s ease-out 0.8s;
}

.draw-dot.drawn {
    opacity: 1;
}

/* --- Glitch Seam --- */
.glitch-seam {
    height: 60px;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(2deg, rgba(255, 51, 102, 0.3) 0%, transparent 33%),
        linear-gradient(-1deg, rgba(0, 229, 204, 0.3) 33%, transparent 66%),
        linear-gradient(0.5deg, rgba(255, 184, 51, 0.3) 66%, transparent 100%);
    background-size: 200% 100%;
    opacity: 0.4;
    transition: opacity 300ms ease;
}

.glitch-seam.pulsed {
    animation: seamPulse 3s ease-in-out forwards;
}

@keyframes seamPulse {
    0% { opacity: 0.4; background-position: 0% 0%; }
    15% { opacity: 1; }
    30% { opacity: 0.6; background-position: 50% 0%; }
    100% { opacity: 0.3; background-position: 100% 0%; }
}

/* --- Section 2: The Line --- */
.section-line {
    padding: 5rem 3rem;
}

.line-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    position: relative;
    z-index: 5;
}

.line-col-left,
.line-col-right {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2rem;
}

.section-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: #7878A0;
    text-transform: uppercase;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
}

.section-title {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 4.5vw, 4rem);
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: #EDEDED;
    margin-bottom: 2rem;
}

.sine-wave-svg {
    width: 100%;
    height: 80px;
    margin-bottom: 2rem;
}

.sine-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 2s ease-out;
}

.sine-path.drawn {
    stroke-dashoffset: 0;
}

.sine-path.glitched {
    animation: sineGlitch 200ms ease forwards;
}

@keyframes sineGlitch {
    0% { transform: skewX(0deg); stroke: #00E5CC; }
    50% { transform: skewX(3deg); stroke: #FF3366; }
    100% { transform: skewX(0deg); stroke: #00E5CC; }
}

.body-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.15vw, 1.1rem);
    line-height: 1.75;
    color: #B0B0C8;
    margin-bottom: 1.5rem;
    font-feature-settings: "tnum" 1, "ss01" 1;
}

.body-text-large {
    font-size: clamp(1.15rem, 1.5vw, 1.4rem);
    color: #EDEDED;
}

/* --- Fade Reveal Animations --- */
.fade-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.fade-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.fade-reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.fade-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.fade-reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.fade-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* --- Section 3: The Grid --- */
.section-grid {
    padding: 8rem 3rem;
    flex-direction: column;
}

.grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(120, 120, 160, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(120, 120, 160, 0.07) 1px, transparent 1px);
    background-size: 60px 60px;
    transform: rotate(0.5deg);
    pointer-events: none;
}

.grid-content {
    position: relative;
    z-index: 5;
    max-width: 1100px;
    width: 100%;
}

.grid-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 2rem;
    margin-top: 2rem;
}

.grid-panel {
    background: rgba(18, 18, 31, 0.85);
    border: 1px solid rgba(120, 120, 160, 0.15);
    padding: 2.5rem;
    position: relative;
}

.panel-bottom {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.panel-title {
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: 1.3rem;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: #FFB833;
    margin-bottom: 1rem;
}

.corrupted-chart {
    width: 100%;
    max-width: 400px;
    height: auto;
}

.displaced-bar {
    animation: barDisplace 4s ease-in-out infinite alternate;
}

@keyframes barDisplace {
    0% { transform: rotate(2deg) translateY(0); }
    100% { transform: rotate(-1deg) translateY(-5px); }
}

/* --- Section 4: The Spectrum --- */
.section-spectrum {
    padding: 13rem 3rem;
    flex-direction: column;
}

.spectrum-content {
    position: relative;
    z-index: 5;
    max-width: 800px;
    text-align: center;
}

.spectrum-text-block {
    margin-top: 2.5rem;
}

.spectrum-text-block .body-text-large {
    margin-bottom: 2rem;
}

/* --- Section 5: The Signal --- */
.section-signal {
    min-height: 80vh;
    padding: 5rem 3rem;
    flex-direction: column;
    background-color: #0A0A14;
}

.signal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    position: relative;
    z-index: 5;
}

.signal-axis {
    width: 200px;
    height: 200px;
    opacity: 0.5;
}

.signal-axis .draw-line {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
}

.signal-repeats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.signal-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.3rem);
    letter-spacing: 0.06em;
    color: #7878A0;
    display: block;
    transition: all 300ms ease;
}

.signal-glitch-1 {
    color: #EDEDED;
    opacity: 1;
}

.signal-glitch-2 {
    color: #B0B0C8;
    opacity: 0.85;
    transform: skewX(1deg);
    text-shadow: 1px 0 #FF3366, -1px 0 #00E5CC;
}

.signal-glitch-3 {
    color: #7878A0;
    opacity: 0.7;
    transform: skewX(-2deg) translateX(3px);
    text-shadow: 2px 0 #FF3366, -2px 0 #00E5CC;
}

.signal-glitch-4 {
    color: #7878A0;
    opacity: 0.55;
    transform: skewX(3deg) translateX(-5px);
    text-shadow: 3px 0 #FF3366, -3px 0 #00E5CC;
}

.signal-glitch-5 {
    color: #7878A0;
    opacity: 0.4;
    transform: skewX(-4deg) translateX(8px);
    text-shadow: 4px 0 #FF3366, -4px 0 #00E5CC;
}

.signal-glitch-6 {
    color: #7878A0;
    opacity: 0.25;
    transform: skewX(5deg) translateX(-10px);
    text-shadow: 5px 0 #FF3366, -5px 0 #00E5CC;
}

.signal-glitch-7 {
    color: #7878A0;
    opacity: 0.1;
    transform: skewX(-7deg) translateX(15px);
    text-shadow: 7px 0 #FF3366, -7px 0 #00E5CC;
}

/* --- Background Panel Colors --- */
.section-hero {
    background-color: #0A0A14;
}

.section-line {
    background-color: #12121F;
}

.section-grid {
    background-color: #0A0A14;
}

.section-spectrum {
    background-color: #12121F;
}

.section-signal {
    background-color: #0A0A14;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    #sidebar {
        width: 220px;
    }

    #main-content {
        margin-left: 220px;
        width: calc(100vw - 220px);
    }

    .line-content {
        grid-template-columns: 1fr;
    }

    .line-col-left,
    .line-col-right {
        display: none;
    }

    .grid-panels {
        grid-template-columns: 1fr;
    }

    .panel-bottom {
        grid-column: auto;
    }
}

@media (max-width: 600px) {
    #sidebar {
        width: 60px;
        padding: 1rem 0.5rem;
    }

    .sidebar-logo {
        font-size: 0.9rem;
        text-align: center;
    }

    .sidebar-nav .nav-item {
        font-size: 0;
        padding: 0.5rem;
    }

    .sidebar-nav .nav-item::first-letter {
        font-size: 0.8rem;
    }

    .sidebar-blob {
        width: 40px;
        height: 40px;
    }

    #main-content {
        margin-left: 60px;
        width: calc(100vw - 60px);
    }

    .section {
        padding: 2rem 1.5rem;
    }
}
