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

:root {
    --abyssal-black: #0A0E1A;
    --deep-teal: #0D2E3C;
    --midnight-blue: #1A3A4A;
    --iridescent-magenta: #D946EF;
    --cyan-glow: #00D9FF;
    --crystalline-silver: #E0E0E0;
    --oxidized-blue: #2A5A6E;
    --pale-gray: #D9D9D9;
    --muted-teal: #6A8A9E;
    --biological-red: #D9164D;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--abyssal-black);
    color: var(--pale-gray);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Scanline overlay */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 11px,
        rgba(255, 255, 255, 0.015) 11px,
        rgba(255, 255, 255, 0.015) 12px
    );
}

/* Crystal background */
#crystal-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

#crystal-svg-bg {
    width: 100%;
    height: 100%;
}

/* Bioluminescent orbs */
#bioluminescent-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
}

.orb-magenta {
    background: var(--iridescent-magenta);
}

.orb-cyan {
    background: var(--cyan-glow);
}

.orb-1 {
    width: 300px;
    height: 300px;
    top: 10%;
    right: -5%;
    opacity: 0.08;
}

.orb-2 {
    width: 250px;
    height: 250px;
    top: 40%;
    left: -3%;
    opacity: 0.06;
}

.orb-3 {
    width: 200px;
    height: 200px;
    bottom: 20%;
    right: 15%;
    opacity: 0.05;
}

.orb-4 {
    width: 350px;
    height: 350px;
    bottom: -5%;
    left: 20%;
    opacity: 0.04;
}

/* Grid system */
.hero-grid,
.section-grid,
.footer-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 0 60px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 60px;
    position: relative;
    z-index: 2;
}

/* Hero Section */
#hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-crystal-container {
    grid-column: 1 / 7;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.hero-crystal-container.visible {
    opacity: 1;
}

#hero-crystal {
    width: 100%;
    max-width: 500px;
}

.hero-content {
    grid-column: 7 / 17;
    display: flex;
    flex-direction: column;
    gap: 24px;
    opacity: 0;
    transition: opacity 600ms ease-out 300ms;
}

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

.hero-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-teal);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.meta-separator {
    color: var(--oxidized-blue);
}

.hero-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(2.5rem, 8vw + 0.5rem, 5rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 0.9;
    color: var(--crystalline-silver);
    position: relative;
    transform: scale(0.7);
    transform-origin: bottom left;
    transition: transform 800ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-title.scaled {
    transform: scale(1);
}

.hero-subtitle {
    font-family: 'Courier Prime', monospace;
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--cyan-glow);
}

.hero-subtitle-secondary {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-teal);
}

.hero-designation {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--oxidized-blue);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--oxidized-blue);
}

.designation-code {
    color: var(--muted-teal);
}

.designation-divider {
    color: var(--iridescent-magenta);
}

.designation-value {
    color: var(--iridescent-magenta);
}

/* Glitch text effect */
.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

.glitch-text::before {
    color: var(--biological-red);
    left: 2px;
    text-shadow: none;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch-text::after {
    color: var(--cyan-glow);
    left: -2px;
    text-shadow: none;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

.glitch-text:hover::before,
.glitch-text:hover::after {
    opacity: 0.6;
}

.glitch-text.glitch-active::before {
    opacity: 0.5;
    left: 4px;
}

.glitch-text.glitch-active::after {
    opacity: 0.5;
    left: -4px;
}

/* Section dividers */
.section-divider {
    width: 100%;
    height: 60px;
    position: relative;
    z-index: 2;
    overflow: hidden;
}

.section-divider::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 11px,
        rgba(255, 255, 255, 0.02) 11px,
        rgba(255, 255, 255, 0.02) 12px
    );
}

.wave-divider {
    width: 100%;
    height: 100%;
}

.wave-path,
.wave-path-2 {
    transition: d 300ms ease;
}

/* Content sections */
.content-section {
    padding: 80px 0;
    position: relative;
    z-index: 2;
}

.section-header {
    grid-column: 1 / 17;
    display: flex;
    align-items: baseline;
    gap: 24px;
    margin-bottom: 48px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--oxidized-blue);
}

.section-index {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    color: var(--cyan-glow);
}

.section-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 0.9;
    color: var(--crystalline-silver);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.02) 2px,
        rgba(255, 255, 255, 0.02) 4px
    );
    -webkit-background-clip: text;
    background-clip: text;
}

.section-classification {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--iridescent-magenta);
    margin-left: auto;
    padding: 4px 12px;
    border: 1px solid var(--iridescent-magenta);
}

.section-body {
    grid-column: 1 / 17;
}

/* Content blocks */
.content-block {
    background-color: var(--midnight-blue);
    border: 2px solid var(--oxidized-blue);
    padding: 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.content-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    background: linear-gradient(
        135deg,
        transparent 0%,
        rgba(0, 217, 255, 0.03) 50%,
        transparent 100%
    );
    transition: opacity 300ms ease;
    pointer-events: none;
}

.content-block:hover::before {
    opacity: 1;
}

/* Grid overlay on hover */
.content-block::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 19px,
            rgba(255, 255, 255, 0.03) 19px,
            rgba(255, 255, 255, 0.03) 20px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 19px,
            rgba(255, 255, 255, 0.03) 19px,
            rgba(255, 255, 255, 0.03) 20px
        );
    transition: opacity 300ms ease;
}

.content-block:hover::after {
    opacity: 1;
}

.block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(42, 90, 110, 0.5);
}

.block-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-teal);
}

.block-status {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cyan-glow);
    padding: 2px 8px;
    border: 1px solid var(--cyan-glow);
}

.block-status.status-warning {
    color: var(--iridescent-magenta);
    border-color: var(--iridescent-magenta);
}

.block-text {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--pale-gray);
    max-width: 50ch;
}

.block-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(42, 90, 110, 0.3);
}

.footer-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--oxidized-blue);
}

/* Masonry layout */
.masonry-layout {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.block-card {
    background-color: var(--deep-teal);
    border: 2px solid var(--oxidized-blue);
    padding: 24px;
    transition: border-color 600ms ease;
}

.block-card:hover {
    border-color: var(--cyan-glow);
}

.block-card:hover .block-header .block-code {
    color: var(--cyan-glow);
}

.card-title {
    font-family: 'Courier Prime', monospace;
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--crystalline-silver);
    margin-bottom: 12px;
}

.card-data {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(42, 90, 110, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-teal);
}

.data-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--iridescent-magenta);
}

/* Protocol grid */
.protocol-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.protocol-item {
    background-color: var(--deep-teal);
    border: 2px solid var(--oxidized-blue);
    padding: 32px;
    text-align: left;
    transition: border-color 600ms ease;
    position: relative;
    overflow: hidden;
}

.protocol-item:hover {
    border-color: var(--cyan-glow);
    animation: neon-pulse 600ms ease-in-out infinite alternate;
}

@keyframes neon-pulse {
    from {
        border-color: var(--cyan-glow);
        box-shadow: 0 0 0 rgba(0, 217, 255, 0);
    }
    to {
        border-color: rgba(0, 217, 255, 0.3);
        box-shadow: 0 0 20px rgba(0, 217, 255, 0.1);
    }
}

.protocol-item[data-protocol="gamma"]:hover {
    border-color: var(--biological-red);
    animation: neon-pulse-red 600ms ease-in-out infinite alternate;
}

@keyframes neon-pulse-red {
    from {
        border-color: var(--biological-red);
        box-shadow: 0 0 0 rgba(217, 22, 77, 0);
    }
    to {
        border-color: rgba(217, 22, 77, 0.3);
        box-shadow: 0 0 20px rgba(217, 22, 77, 0.1);
    }
}

.protocol-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 20px;
}

.protocol-icon svg {
    width: 100%;
    height: 100%;
}

.protocol-name {
    font-family: 'Courier Prime', monospace;
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--crystalline-silver);
    margin-bottom: 12px;
}

.protocol-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--pale-gray);
    margin-bottom: 16px;
}

.protocol-status {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cyan-glow);
}

.protocol-status.status-danger {
    color: var(--biological-red);
}

/* Analysis section */
.analysis-display {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-bottom: 48px;
}

.analysis-meter {
    width: 100%;
}

.meter-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-teal);
    margin-bottom: 12px;
}

.meter-bar {
    width: 100%;
    height: 8px;
    background-color: var(--deep-teal);
    border: 1px solid var(--oxidized-blue);
    position: relative;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    width: 0%;
    background-color: var(--meter-color);
    transition: width 1500ms cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
}

.meter-fill.animated {
    width: calc(var(--target-width) * 1%);
}

.meter-values {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.625rem;
    letter-spacing: 0.1em;
    color: var(--oxidized-blue);
}

.analysis-data-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.data-cell {
    background-color: var(--deep-teal);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid rgba(42, 90, 110, 0.3);
}

.data-key {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-teal);
}

.data-val {
    font-family: 'Courier Prime', monospace;
    font-size: 1.125rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--crystalline-silver);
}

.data-val.val-safe {
    color: var(--cyan-glow);
}

/* Terminal section */
.terminal-window {
    background-color: rgba(10, 14, 26, 0.9);
    border: 2px solid var(--oxidized-blue);
    overflow: hidden;
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background-color: var(--deep-teal);
    border-bottom: 1px solid var(--oxidized-blue);
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-red {
    background-color: var(--biological-red);
}

.dot-yellow {
    background-color: #E0A000;
}

.dot-green {
    background-color: var(--cyan-glow);
}

.terminal-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-teal);
    margin-left: 12px;
}

.terminal-body {
    padding: 24px;
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.terminal-line {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.8;
    color: var(--pale-gray);
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 300ms ease, transform 300ms ease;
}

.terminal-line.revealed {
    opacity: 1;
    transform: translateY(0);
}

.terminal-line.success {
    color: var(--cyan-glow);
}

.terminal-line.warning {
    color: var(--iridescent-magenta);
}

.terminal-line.blink {
    animation: cursor-blink 1s step-end infinite;
}

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

/* Footer */
#footer-section {
    padding: 40px 0;
    border-top: 2px solid var(--oxidized-blue);
    position: relative;
    z-index: 2;
}

.footer-grid {
    align-items: center;
}

.footer-left {
    grid-column: 1 / 9;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-right {
    grid-column: 9 / 17;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: right;
}

.footer-designation {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-teal);
}

.footer-classification {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.625rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--oxidized-blue);
}

.footer-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--iridescent-magenta);
}

.footer-timestamp {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.625rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--oxidized-blue);
}

.footer-scanline {
    width: 100%;
    height: 2px;
    margin-top: 24px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--cyan-glow) 20%,
        var(--iridescent-magenta) 50%,
        var(--cyan-glow) 80%,
        transparent 100%
    );
    opacity: 0.3;
}

/* Intersection observer entrance animations */
.content-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.content-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Wave distortion animation */
@keyframes wave-shift {
    0% {
        d: path("M0,30 Q360,10 720,30 Q1080,50 1440,30");
    }
    50% {
        d: path("M0,30 Q360,50 720,30 Q1080,10 1440,30");
    }
    100% {
        d: path("M0,30 Q360,10 720,30 Q1080,50 1440,30");
    }
}

/* Neon accent hover on interactive blocks */
.block-card,
.protocol-item {
    cursor: default;
}

/* Crystal formation entrance */
.crystal-formation {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.crystal-formation.visible {
    opacity: 1;
    transform: scale(1);
}

/* Responsive */
@media (max-width: 1024px) {
    .hero-grid,
    .section-grid,
    .footer-grid {
        gap: 0 30px;
        padding: 0 30px;
    }

    .hero-crystal-container {
        grid-column: 1 / 17;
        margin-bottom: 40px;
    }

    .hero-content {
        grid-column: 1 / 17;
    }

    .masonry-layout {
        grid-template-columns: repeat(2, 1fr);
    }

    .protocol-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .analysis-data-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hero-grid,
    .section-grid,
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0 16px;
        padding: 0 20px;
    }

    .hero-crystal-container {
        grid-column: 1 / 5;
    }

    .hero-content {
        grid-column: 1 / 5;
    }

    .section-header {
        grid-column: 1 / 5;
        flex-wrap: wrap;
    }

    .section-body {
        grid-column: 1 / 5;
    }

    .footer-left {
        grid-column: 1 / 5;
        margin-bottom: 16px;
    }

    .footer-right {
        grid-column: 1 / 5;
        text-align: left;
    }

    .masonry-layout {
        grid-template-columns: 1fr;
    }

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

    .analysis-data-grid {
        grid-template-columns: 1fr;
    }

    .section-classification {
        margin-left: 0;
    }

    #hero-section {
        min-height: auto;
        padding: 80px 0;
    }
}
