/* ============================================
   CortaLabs — Alignment Principles
   Editorial dark theme, matched to index
   ============================================ */

:root {
    --accent: #0090ff;
    --accent-secondary: #00e4ff;
    --accent-tertiary: #7c3aff;
    --text: #eaeaea;
    --text-secondary: rgba(234, 234, 234, 0.68);
    --text-dim: rgba(234, 234, 234, 0.36);
    --bg: #030306;
    --card-bg: rgba(10, 10, 16, 0.7);
    --glow-blue: rgba(0, 144, 255, 0.14);
    --glow-cyan: rgba(0, 228, 255, 0.10);
    --glow-purple: rgba(124, 58, 255, 0.09);
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-accent: rgba(0, 144, 255, 0.10);
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    width: 100%;
    font-family: 'Work Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.78;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Canvas background ── */
#neuralCanvas {
    position: fixed;
    inset: 0;
    z-index: -3;
}

/* ── Atmosphere layers ── */
.atmosphere {
    position: fixed;
    inset: -50%;
    z-index: -2;
    pointer-events: none;
    will-change: transform;
}

.atmo-1 {
    background: radial-gradient(ellipse 600px 600px at 30% 20%, var(--glow-blue), transparent 70%);
    opacity: 0.75;
    animation: atmoDrift1 19.42s infinite alternate ease-in-out;
}

.atmo-2 {
    background: radial-gradient(ellipse 500px 500px at 70% 60%, var(--glow-purple), transparent 70%);
    opacity: 0.55;
    animation: atmoDrift2 24.71s infinite alternate ease-in-out;
}

.atmo-3 {
    background: radial-gradient(ellipse 700px 400px at 50% 80%, var(--glow-cyan), transparent 70%);
    opacity: 0.45;
    animation: atmoDrift3 15.27s infinite alternate ease-in-out;
}

@keyframes atmoDrift1 {
    0%   { transform: translate(-5%, -8%) scale(1); }
    100% { transform: translate(5%, 8%) scale(1.1); }
}
@keyframes atmoDrift2 {
    0%   { transform: translate(8%, 5%) scale(1.05); }
    100% { transform: translate(-8%, -3%) scale(0.95); }
}
@keyframes atmoDrift3 {
    0%   { transform: translate(-3%, 6%) scale(0.95); }
    100% { transform: translate(6%, -6%) scale(1.08); }
}

/* ── Overlay textures ── */
.scanlines {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.025) 2px,
        rgba(0, 0, 0, 0.025) 4px
    );
}

.grain {
    position: fixed;
    inset: -50%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.03;
    animation: grainShift 0.5s steps(10) infinite;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

@keyframes grainShift {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -10%); }
    30% { transform: translate(3%, -15%); }
    50% { transform: translate(12%, 9%); }
    70% { transform: translate(9%, 4%); }
    90% { transform: translate(-1%, 7%); }
}

/* ── Sweep line ── */
.sweep-line {
    position: fixed;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--accent-secondary) 30%, var(--accent) 50%, var(--accent-secondary) 70%, transparent 100%);
    opacity: 0.1;
    z-index: 3;
    pointer-events: none;
    animation: sweep 10s linear infinite;
    box-shadow: 0 0 20px 2px rgba(0, 228, 255, 0.06);
}

@keyframes sweep {
    0%   { top: -2px; }
    100% { top: 100%; }
}

/* ── Cursor glow ── */
.cursor-glow {
    position: fixed;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
    background: radial-gradient(circle, rgba(0, 140, 255, 0.05) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: opacity 0.3s;
    will-change: left, top;
}

/* ── Header ── */
header {
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 500px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-accent), transparent);
}

/* Header logo */
.header-logo-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.header-logo-glow {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 140, 255, 0.15) 0%, transparent 70%);
    pointer-events: none;
    animation: headerGlowBreathe 4s ease-in-out infinite;
}

@keyframes headerGlowBreathe {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 0.6; transform: translate(-50%, -50%) scale(1.05); }
}

.header-logo-ring {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid transparent;
    border-top-color: rgba(0, 140, 255, 0.25);
    border-right-color: rgba(0, 228, 255, 0.1);
    pointer-events: none;
    animation: headerOrbit 14s linear infinite;
}

@keyframes headerOrbit {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

.header-logo-svg {
    position: relative;
    z-index: 1;
    display: block;
    width: 44px;
    height: 44px;
    filter: drop-shadow(0 0 10px rgba(0, 140, 255, 0.25));
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.header-brand-text {
    font-family: 'Space Mono', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

nav a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    transition: color 0.3s ease, background 0.3s ease;
    border-radius: 5px;
    font-size: 0.786rem;
    font-family: 'Space Mono', monospace;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

nav a:hover {
    background: rgba(0, 144, 255, 0.07);
    color: var(--accent-secondary);
}

nav a.active {
    color: var(--accent-secondary);
    background: rgba(0, 228, 255, 0.05);
    border: 1px solid rgba(0, 228, 255, 0.10);
}

/* ── Main content ── */
main {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
    position: relative;
}

/* ── Manifesto hero ── */
.manifesto-hero {
    padding: 4.236rem 0 2.618rem;
    text-align: center;
}

.manifesto-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1.618rem;
    opacity: 0;
    animation: fadeSlideUp 0.8s 0.2s ease-out forwards;
}

.manifesto-hero h1 {
    font-family: 'Space Mono', monospace;
    font-size: clamp(1.9rem, 5vw, 2.618rem);
    line-height: 1.2;
    margin-bottom: 2.618rem;
    background: linear-gradient(180deg, #fff 0%, rgba(255,255,255,0.85) 40%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 18px rgba(0, 144, 255, 0.10));
    opacity: 0;
    animation: fadeSlideUp 0.8s 0.35s ease-out forwards;
}

.manifesto-lede {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
    opacity: 0;
    animation: fadeSlideUp 0.8s 0.5s ease-out forwards;
}

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

/* ── Principle sections ── */
.principle {
    padding: 2.618rem 0;
    border-top: 1px solid var(--border-subtle);
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.principle.revealed {
    opacity: 1;
    transform: translateY(0);
}

.principle-number {
    font-family: 'Space Mono', monospace;
    font-size: 0.618rem;
    letter-spacing: 0.22em;
    color: var(--accent);
    opacity: 0.45;
    margin-bottom: 0.618rem;
}

.principle h2 {
    font-family: 'Space Mono', monospace;
    font-size: 1.618rem;
    line-height: 1.3;
    margin-bottom: 1.618rem;
    color: var(--text);
    position: relative;
}

.principle h2::after {
    content: '';
    display: block;
    width: 32px;
    height: 1px;
    margin-top: 0.618rem;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0.35;
}

.principle p {
    color: var(--text-secondary);
    margin-bottom: 1.000rem;
    font-size: 1.000rem;
    line-height: 1.82;
}

.principle p:last-child {
    margin-bottom: 0;
}

/* ── Closing section ── */
.manifesto-close {
    padding: 4.236rem 0 2.618rem;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.manifesto-close.revealed {
    opacity: 1;
    transform: translateY(0);
}

.close-rule {
    width: 52px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary), transparent);
    margin-bottom: 1.618rem;
    opacity: 0.4;
}

.manifesto-close p {
    color: var(--text-dim);
    font-size: 0.786rem;
    line-height: 1.85;
    font-style: italic;
}

/* ── Back to top ── */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 34px;
    height: 34px;
    background: rgba(0, 144, 255, 0.08);
    color: var(--accent-secondary);
    border: 1px solid var(--border-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.35s ease, background 0.35s ease, transform 0.3s ease, border-color 0.35s ease;
    pointer-events: none;
    z-index: 100;
    font-size: 0.8rem;
}

.back-to-top.visible {
    opacity: 0.5;
    pointer-events: auto;
}

.back-to-top:hover {
    opacity: 1;
    background: rgba(0, 228, 255, 0.10);
    border-color: rgba(0, 228, 255, 0.3);
    transform: translateY(-2px);
}

/* ── Provenance block ── */
.provenance {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.provenance.revealed {
    opacity: 1;
    transform: translateY(0);
}

.provenance-accent {
    height: 1px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary), var(--accent-tertiary), transparent 80%);
    opacity: 0.5;
    margin-bottom: 1.75rem;
    box-shadow: 0 0 8px rgba(0, 144, 255, 0.15), 0 0 20px rgba(0, 228, 255, 0.06);
}

.provenance-header {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1.25rem;
    opacity: 0.7;
}

.provenance-icon {
    display: inline-block;
    margin-right: 0.4rem;
    font-size: 0.55rem;
    opacity: 0.6;
    vertical-align: 0.05em;
}

.provenance-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 1.25rem 1.5rem;
    background: rgba(0, 144, 255, 0.02);
    border: 1px solid rgba(0, 144, 255, 0.06);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.provenance-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent), var(--accent-secondary), transparent);
    opacity: 0.3;
}

.provenance-row {
    display: flex;
    align-items: baseline;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.provenance-row:last-child {
    border-bottom: none;
}

.provenance-key {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    width: 110px;
    flex-shrink: 0;
    opacity: 0.7;
}

.provenance-val {
    font-family: 'Space Mono', monospace;
    font-size: 0.618rem;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

.provenance-status {
    color: var(--accent-secondary);
    opacity: 0.7;
}

.provenance-hash {
    color: var(--text-dim);
    opacity: 0.5;
    font-size: 0.618rem;
    letter-spacing: 0.04em;
    word-break: break-all;
    line-height: 1.6;
}

/* ── Footer ── */
footer {
    text-align: center;
    padding: 2.618rem 2rem 1.618rem;
    font-size: 0.618rem;
    color: var(--text-dim);
    position: relative;
    max-width: 680px;
    margin: 0 auto;
    letter-spacing: 0.02em;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 84px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-accent), transparent);
}

footer p {
    color: var(--text-dim);
    margin-bottom: 0.3rem;
}

footer b {
    color: rgba(0, 144, 255, 0.5);
    font-weight: 700;
    font-family: 'Space Mono', monospace;
}

/* ── Accessibility ── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1.15rem 1.5rem;
    }

    main {
        padding: 1.5rem;
    }

    .manifesto-hero {
        padding: 2.618rem 0 1.618rem;
    }

    .manifesto-hero h1 {
        font-size: 1.618rem;
    }

    .manifesto-lede {
        font-size: 0.92rem;
    }

    .principle {
        padding: 1.618rem 0;
    }

    .principle h2 {
        font-size: 1.272rem;
    }

    .header-logo-wrap { width: 36px; height: 36px; }
    .header-logo-svg { width: 36px; height: 36px; }
    .header-logo-glow { width: 60px; height: 60px; }
    .header-logo-ring { width: 46px; height: 46px; }
}

@media (max-width: 480px) {
    .manifesto-hero {
        padding: 1.618rem 0 1.000rem;
    }

    .manifesto-hero h1 {
        font-size: 1.272rem;
    }

    .principle {
        padding: 1.618rem 0;
    }

    .principle p {
        font-size: 0.786rem;
    }
}

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

    .manifesto-label,
    .manifesto-hero h1,
    .manifesto-lede {
        opacity: 1;
        transform: none;
    }

    .principle,
    .manifesto-close,
    .provenance {
        opacity: 1;
        transform: none;
    }

    .grain, .scanlines, .sweep-line, .cursor-glow { display: none; }
    .header-logo-ring { opacity: 0; }
    .header-logo-glow { animation: none; opacity: 0.4; }
}
