/* ===== CSS Variables — Protein/Green Theme ===== */
:root {
    --primary: #276749;
    --primary-light: #48bb78;
    --primary-dark: #1a4731;
    --accent: #e07b39;
    --accent-light: #f6ad55;

    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;

    --bg-primary: #ffffff;
    --bg-secondary: #f0fff4;
    --bg-alt: #e6ffed;

    --border-color: #c6f6d5;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;

    --transition: all 0.3s ease;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f7fafc;
        --text-secondary: #cbd5e0;
        --text-muted: #a0aec0;

        --bg-primary: #1a202c;
        --bg-secondary: #1c2b23;
        --bg-alt: #1e3028;

        --border-color: #2d5a40;
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
    }
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-primary);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    font-weight: 600;
    margin-bottom: 1rem;
}

h1 { font-size: 2.75rem; font-weight: 700; }
h2 { font-size: 2rem; margin-bottom: 1.5rem; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.15rem; }

p { margin-bottom: 1rem; }

.lead {
    font-size: 1.2rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

code {
    font-family: var(--font-mono);
    background: var(--bg-alt);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.88em;
    border: 1px solid var(--border-color);
}

pre {
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===== Navigation ===== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border-color);
}

@media (prefers-color-scheme: dark) {
    .navbar { background: rgba(26, 32, 44, 0.95); }
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 2rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    text-decoration: none;
}

.logo { color: var(--primary); }

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

/* ===== Hero ===== */
.hero {
    padding: 9rem 0 6rem;
    margin-top: 60px;
    text-align: center;
    background: linear-gradient(160deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border-color);
}

.hero-content {
    max-width: 860px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    padding: 0.35rem 1rem;
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1.5rem;
    letter-spacing: 0.03em;
}

.tagline {
    font-size: 1.4rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    max-width: 780px;
    margin-left: auto;
    margin-right: auto;
}

.motto {
    font-style: italic;
    color: var(--text-muted);
    margin: 1.5rem 0;
    font-size: 1rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.hero-metrics {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 3rem;
    flex-wrap: wrap;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.hero-metric { text-align: center; }

.hm-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}

.hm-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.75rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.btn-outline:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-link {
    background: transparent;
    color: var(--primary);
    padding: 0.4rem 0;
    font-size: 0.95rem;
    font-weight: 500;
}

.btn-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== Sections ===== */
.section { padding: 5rem 0; }

.section-alt { background: var(--bg-secondary); }

.section-intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 3rem;
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ===== Insight Cards ===== */
.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.insight-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.insight-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.visual-placeholder {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===== Principle Section ===== */
.principle-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
    margin-top: 2rem;
}

.formula {
    background: var(--bg-alt);
    padding: 1.25rem 1.5rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    text-align: center;
    margin: 1.5rem 0;
    border-left: 4px solid var(--accent);
    line-height: 1.5;
    word-break: break-all;
}

.benefits-list {
    list-style: none;
    margin-top: 1rem;
}

.benefits-list li {
    padding: 0.6rem 0 0.6rem 1.75rem;
    position: relative;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.benefits-list li:last-child { border-bottom: none; }

.benefits-list li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

/* Scale diagram */
.scale-diagram {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.scale-diagram h4 {
    color: var(--primary);
    margin-bottom: 1.25rem;
    font-size: 1rem;
}

.scale-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.scale-bar {
    height: 12px;
    background: linear-gradient(to right, var(--primary-light), var(--accent));
    border-radius: 6px;
    flex-shrink: 0;
    min-width: 12px;
}

.scale-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    white-space: nowrap;
}

.caption {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.75rem;
}

.triplication-note {
    background: var(--bg-alt);
    border-left: 4px solid var(--primary);
    padding: 1.25rem 1.5rem;
    border-radius: 0 8px 8px 0;
}

.triplication-note h4 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.triplication-note p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.7;
}

/* ===== Architecture Grid ===== */
.arch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.arch-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    padding-top: 2.5rem;
}

.arch-number {
    position: absolute;
    top: -14px;
    left: 1.5rem;
    background: var(--primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.arch-card h3 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.arch-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.7;
}

/* ===== Comparison Table ===== */
.comparison-table {
    overflow-x: auto;
    margin-top: 1rem;
}

.comparison-table h3 {
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

thead { background: var(--primary); color: white; }

th, td {
    padding: 0.9rem 1.1rem;
    text-align: left;
    font-size: 0.95rem;
}

tbody tr { border-bottom: 1px solid var(--border-color); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-alt); }

/* ===== Results Grid ===== */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.result-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    border-top: 4px solid var(--accent);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--accent);
}

.result-tag {
    display: inline-block;
    padding: 0.2rem 0.75rem;
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.metric-row {
    display: flex;
    gap: 1.5rem;
    margin: 1.25rem 0;
    flex-wrap: wrap;
}

.metric { display: flex; flex-direction: column; }

.metric-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.metric-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.findings {
    list-style: none;
    margin-top: 1rem;
}

.findings li {
    padding: 0.45rem 0 0.45rem 1.5rem;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.findings li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.key-finding {
    margin-top: 3rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    border-left: 4px solid var(--primary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
}

.key-finding h3 {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

/* ===== Papers Section ===== */
.papers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.paper-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.paper-number {
    display: inline-block;
    padding: 0.2rem 0.75rem;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
}

.paper-card h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.paper-meta {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

.paper-abstract {
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 1.5rem;
    font-size: 0.97rem;
}

.paper-highlights {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.paper-highlights h4 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.paper-highlights ul { list-style: none; }

.paper-highlights li {
    padding: 0.45rem 0 0.45rem 1.5rem;
    position: relative;
    line-height: 1.6;
    font-size: 0.93rem;
    color: var(--text-secondary);
}

.paper-highlights li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--accent);
}

.paper-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.citation {
    margin-top: 3rem;
    padding: 1.75rem;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.citation h4 { margin-bottom: 0.75rem; }

.citation code {
    display: block;
    padding: 1rem;
    background: var(--bg-alt);
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.6;
    word-break: break-all;
}

/* ===== Quick Start ===== */
.quickstart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.quickstart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.quickstart-card h3 {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.repo-link {
    margin-top: 2.5rem;
    text-align: center;
}

.repo-note {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Resources Grid ===== */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.75rem;
    margin-top: 2rem;
}

.resource-card {
    background: var(--bg-primary);
    padding: 1.75rem;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.resource-card h3 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.resource-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.link-list { list-style: none; margin-top: 0.5rem; }

.link-list li { padding: 0.45rem 0; }

.link-list a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.93rem;
}

.link-list a:hover { text-decoration: underline; }

/* ===== About Section ===== */
.about-content {
    max-width: 780px;
    margin: 0 auto;
}

.about-content p {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text-secondary);
}

.contact {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 1rem !important;
}

.contact a {
    color: var(--primary);
    text-decoration: none;
}

.contact a:hover { text-decoration: underline; }

/* ===== Footer ===== */
.footer {
    background: var(--bg-secondary);
    padding: 3rem 0 1.5rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.footer-links {
    display: flex;
    gap: 1.75rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover { color: var(--primary); }

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    html { font-size: 14px; }

    h1 { font-size: 2.1rem; }
    h2 { font-size: 1.7rem; }

    .nav-links {
        position: fixed;
        top: 60px;
        right: -100%;
        flex-direction: column;
        background: var(--bg-primary);
        width: 240px;
        padding: 2rem;
        box-shadow: var(--shadow-lg);
        transition: right 0.3s ease;
        gap: 1rem;
        border-left: 1px solid var(--border-color);
    }

    .nav-links.mobile-active { right: 0; }

    .menu-toggle { display: block !important; }

    .hero { padding: 7rem 0 4rem; }

    .hero-actions { flex-direction: column; align-items: center; }

    .hero-metrics { gap: 1.5rem; }

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

    .insight-grid,
    .results-grid,
    .papers-grid,
    .resources-grid,
    .arch-grid,
    .quickstart-grid { grid-template-columns: 1fr; }

    .metric-row { gap: 1.25rem; }

    .footer-content { flex-direction: column; text-align: center; }

    .footer-links { justify-content: center; }
}

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

.hero-content { animation: fadeInUp 0.7s ease-out; }

/* ===== Utility ===== */
strong { color: var(--text-primary); }
sub { font-size: 0.75em; }
sup { font-size: 0.75em; }
