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

:root {
    --bg: #0d0e12;
    --bg-elev: #16181f;
    --bg-elev2: #1d2029;
    --fg: #e6e7eb;
    --fg-muted: #9aa0ac;
    --fg-dim: #6b7280;
    --accent: #7c9eff;
    --accent-warm: #d4a574;
    --accent-cool: #6ec6b8;
    --truth: #d4a574;
    --memory: #7c9eff;
    --belief: #6ec6b8;
    --border: #2a2d36;
    --border-bright: #3a3e4a;
    --code-bg: #0a0b0f;
    --max-width: 1100px;
    --radius: 8px;
    --radius-lg: 14px;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: #a3baff;
}

code {
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    font-size: 0.88em;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--accent-warm);
}

pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    line-height: 1.5;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--fg);
}

/* ===== Hero ===== */
.hero {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    background:
        radial-gradient(ellipse at top, rgba(124, 158, 255, 0.08), transparent 60%),
        radial-gradient(ellipse at bottom, rgba(212, 165, 116, 0.05), transparent 60%),
        var(--bg);
    border-bottom: 1px solid var(--border);
    position: relative;
}

.hero-inner {
    max-width: var(--max-width);
    width: 100%;
}

.hero-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 32px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid var(--border-bright);
    border-radius: 999px;
    font-size: 0.75em;
    font-family: 'JetBrains Mono', monospace;
    color: var(--fg-muted);
    background: var(--bg-elev);
}

.badge-doi {
    color: var(--accent-warm);
    border-color: rgba(212, 165, 116, 0.4);
}

.badge-license {
    color: var(--accent-cool);
    border-color: rgba(110, 198, 184, 0.4);
}

.hero-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(56px, 12vw, 120px);
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--fg) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: clamp(16px, 2.5vw, 22px);
    color: var(--fg-muted);
    font-weight: 400;
    margin-bottom: 48px;
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
}

.hero-principle {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(13px, 2vw, 18px);
    margin-bottom: 48px;
    letter-spacing: 0.02em;
}

.hero-principle .truth { color: var(--truth); }
.hero-principle .memory { color: var(--memory); }
.hero-principle .belief { color: var(--belief); }
.hero-principle .neq {
    color: var(--fg-dim);
    margin: 0 12px;
    font-weight: 300;
}

.hero-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95em;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}
.btn-primary:hover {
    background: #a3baff;
    color: var(--bg);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--fg);
    border-color: var(--border-bright);
}
.btn-secondary:hover {
    background: var(--bg-elev);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--fg-muted);
    border-color: transparent;
}
.btn-ghost:hover {
    color: var(--fg);
}

/* ===== Sections ===== */
.section {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 80px 24px;
    border-bottom: 1px solid var(--border);
}

.section h2 {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
    color: var(--fg);
}

.section-intro {
    font-size: 1.05em;
    color: var(--fg-muted);
    margin-bottom: 40px;
    max-width: 720px;
}

.section p {
    margin-bottom: 16px;
    color: var(--fg);
}

.section p.quote {
    border-left: 3px solid var(--accent);
    padding-left: 20px;
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    color: var(--fg-muted);
    margin: 24px 0;
}

.quote-source {
    display: block;
    margin-top: 8px;
    font-size: 0.85em;
    color: var(--fg-dim);
    font-style: normal;
    font-family: 'Inter', sans-serif;
}

/* ===== Layers grid ===== */
.layers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.layer-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.layer-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.layer-card:hover {
    border-color: var(--border-bright);
    background: var(--bg-elev2);
    transform: translateY(-2px);
}

.layer-card:hover::before {
    opacity: 1;
}

.layer-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75em;
    color: var(--accent-warm);
    margin-bottom: 6px;
    display: block;
}

.layer-name {
    font-weight: 600;
    font-size: 0.95em;
    margin-bottom: 6px;
    color: var(--fg);
}

.layer-desc {
    font-size: 0.85em;
    color: var(--fg-muted);
    line-height: 1.45;
}

.layer-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, margin-top 0.3s ease;
    font-size: 0.82em;
    color: var(--fg-dim);
    font-family: 'JetBrains Mono', monospace;
}

.layer-card.expanded .layer-detail {
    max-height: 200px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* ===== Laws list ===== */
.laws-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.law {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color 0.2s ease;
}

.law:hover {
    border-color: var(--border-bright);
}

.law header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.law-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8em;
    color: var(--accent-warm);
    background: rgba(212, 165, 116, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.law h3 {
    font-size: 1em;
    font-weight: 600;
    color: var(--fg);
    margin: 0;
}

.law p {
    font-size: 0.9em;
    color: var(--fg-muted);
    line-height: 1.55;
    margin: 0;
}

/* ===== Causal chain ===== */
.chain {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    margin: 32px 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
}

.chain-node {
    flex: 1 1 auto;
    min-width: 120px;
    background: var(--bg-elev);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 14px 12px;
    text-align: center;
    position: relative;
    transition: all 0.2s ease;
}

.chain-node:hover {
    background: var(--bg-elev2);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.chain-node strong {
    display: block;
    color: var(--accent);
    font-size: 0.85em;
    margin-bottom: 4px;
}

.chain-node span {
    color: var(--fg-muted);
    font-size: 0.78em;
    line-height: 1.3;
}

.chain-arrow {
    align-self: center;
    color: var(--fg-dim);
    font-size: 1.2em;
    font-weight: 300;
}

.chain-note {
    margin-top: 32px;
    font-size: 0.92em;
    color: var(--fg-muted);
    font-style: italic;
    padding-left: 16px;
    border-left: 2px solid var(--border-bright);
}

/* ===== Goran scenario ===== */
.goran-scenario {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin: 32px 0;
}

.goran-step {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: all 0.2s ease;
}

.goran-step:hover {
    border-color: var(--accent);
    transform: translateX(2px);
}

.step-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4em;
    font-weight: 500;
    color: var(--accent-warm);
    line-height: 1;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 0.95em;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--fg);
}

.step-content p {
    font-size: 0.85em;
    color: var(--fg-muted);
    line-height: 1.5;
    margin: 0;
}

.goran-criterion {
    margin-top: 32px;
    padding: 20px;
    background: var(--bg-elev);
    border-left: 3px solid var(--accent-warm);
    border-radius: var(--radius);
    font-size: 0.95em;
}

.goran-criterion em {
    color: var(--accent-warm);
    font-style: italic;
}

/* ===== Anti-bond list ===== */
.anti-bond-list {
    list-style: none;
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 10px;
}

.anti-bond-list li {
    padding: 12px 16px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88em;
    color: var(--fg);
}

.anti-bond-list li::before {
    content: '— ';
    color: var(--fg-dim);
}

/* ===== Citation ===== */
.section-citation {
    background: var(--bg-elev);
    border-radius: var(--radius-lg);
    margin: 40px 24px;
    padding: 60px 40px;
    border: 1px solid var(--border);
}

.citation-blocks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.citation-block h4 {
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--fg-dim);
    margin-bottom: 10px;
}

/* ===== Links ===== */
.section-links {
    padding-bottom: 60px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.link-card {
    display: block;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: all 0.2s ease;
    position: relative;
}

.link-card:hover {
    border-color: var(--accent);
    background: var(--bg-elev2);
    transform: translateY(-2px);
}

.link-card h4 {
    font-size: 1.05em;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--fg);
}

.link-card p {
    font-size: 0.85em;
    color: var(--fg-muted);
    margin: 0;
    line-height: 1.45;
}

.link-arrow {
    position: absolute;
    top: 24px;
    right: 24px;
    color: var(--fg-dim);
    font-size: 1.2em;
    transition: transform 0.2s ease, color 0.2s ease;
}

.link-card:hover .link-arrow {
    color: var(--accent);
    transform: translate(4px, -4px);
}

/* ===== Footer ===== */
footer {
    padding: 40px 24px;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.footer-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82em;
    color: var(--fg-muted);
    margin-bottom: 8px;
}

.footer-note {
    font-size: 0.82em;
    color: var(--fg-dim);
    font-style: italic;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero {
        min-height: 80vh;
        padding: 40px 20px;
    }
    .section {
        padding: 60px 20px;
    }
    .section-citation {
        margin: 32px 20px;
        padding: 40px 24px;
    }
    .chain {
        flex-direction: column;
    }
    .chain-arrow {
        transform: rotate(90deg);
        text-align: center;
    }
    .anti-bond-list {
        grid-template-columns: 1fr;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.layer-card, .law, .goran-step, .chain-node {
    animation: fadeIn 0.4s ease-out backwards;
}

.layer-card:nth-child(1) { animation-delay: 0.05s; }
.layer-card:nth-child(2) { animation-delay: 0.1s; }
.layer-card:nth-child(3) { animation-delay: 0.15s; }
.layer-card:nth-child(4) { animation-delay: 0.2s; }
.layer-card:nth-child(5) { animation-delay: 0.25s; }
.layer-card:nth-child(6) { animation-delay: 0.3s; }
.layer-card:nth-child(7) { animation-delay: 0.35s; }
.layer-card:nth-child(8) { animation-delay: 0.4s; }
.layer-card:nth-child(9) { animation-delay: 0.45s; }
.layer-card:nth-child(10) { animation-delay: 0.5s; }
.layer-card:nth-child(11) { animation-delay: 0.55s; }
.layer-card:nth-child(12) { animation-delay: 0.6s; }
