:root {
    --surface: #0f1117;
    --soft: #161927;
    --soft-2: #1a1e30;
    --text: #e8eaed;
    --muted: #8b92a5;
    --border: #2a2f42;
    --primary: #ea580c;
    --primary-hover: #c2410c;
    --accent-2: #14b8a6;
    --accent-3: #f97316;
    --dark: #0a0c14;
    --dark-muted: #6b7280;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--surface);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.page { width: 100%; background: var(--surface); position: relative; }

a:focus-visible, button:focus-visible, .btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Progress Bar */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent-3));
    z-index: 1000;
    width: 0%;
    transition: width 0.1s ease;
}

/* Scroll to Top */
#scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #0f1117;
    border: none;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
#scroll-top.visible {
    opacity: 1;
    visibility: visible;
}
#scroll-top:hover {
    transform: translateY(-4px);
    background: var(--primary-hover);
}

/* Filtering */
.filter-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 24px;
}
.filter-btn {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.filter-btn:hover {
    color: var(--text);
    border-color: var(--muted);
}
.filter-btn.active {
    background: var(--primary);
    color: #0f1117;
    border-color: var(--primary);
}
[data-category].hidden {
    display: none;
}

/* Micro-interactions */
.stack-card {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}
.mockup {
    transition: transform 0.5s ease;
}
.feature-row:hover .mockup {
    transform: scale(1.02);
}

/* Page grain overlay */
.page::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.03;
    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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }

/* Nav */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 48px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 17, 23, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: box-shadow 0.3s, background 0.3s;
}
.nav.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    background: rgba(15, 17, 23, 0.92);
}
.nav-left { display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; gap: 22px; color: var(--muted); font-size: 14px; }
.nav-links a:hover { color: var(--text); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand-mark {
    width: 32px; height: 32px;
    object-fit: contain;
}

/* Buttons */
.btn {
    font: inherit;
    padding: 9px 18px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color .15s, border-color .15s, color .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent-3));
    color: #0f1117;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #9a3412);
    box-shadow: 0 6px 18px rgba(234, 88, 12, 0.35);
}
.btn-secondary {
    background: transparent;
    color: var(--primary);
    border-color: var(--border);
}
.btn-secondary:hover { background: rgba(234, 88, 12, 0.08); border-color: var(--primary); }

/* Hero */
.hero {
    padding: 96px 48px 104px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse 900px 600px at 85% 10%, rgba(234, 88, 12, 0.08), transparent 55%),
        radial-gradient(ellipse 700px 500px at 10% 90%, rgba(20, 184, 166, 0.07), transparent 55%),
        radial-gradient(ellipse 500px 400px at 95% 95%, rgba(249, 115, 22, 0.06), transparent 55%),
        linear-gradient(180deg, #111520 0%, var(--surface) 100%);
}
.hero h1 {
    background: linear-gradient(135deg, var(--text) 20%, var(--primary) 75%, var(--accent-3) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.eyebrow {
    display: inline-block;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 14px;
    padding: 4px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.12), rgba(249, 115, 22, 0.12));
    border: 1px solid rgba(234, 88, 12, 0.20);
}
.hero h1 {
    font-size: 40px;
    max-width: 640px;
    margin-bottom: 18px;
}
.hero p {
    max-width: 560px;
    color: var(--muted);
    margin: 0 0 28px;
    font-size: 17px;
}
.hero-actions { display: flex; gap: 12px; }
.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 48px;
    align-items: center;
}
.hero-code {
    display: flex;
    align-items: center;
    justify-content: stretch;
}
.code-window {
    width: 100%;
    min-width: 0;
    background: var(--dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.5);
}
.code-dots {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.code-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.code-dots span:nth-child(1) { background: #ef4444; }
.code-dots span:nth-child(2) { background: #f59e0b; }
.code-dots span:nth-child(3) { background: #22c55e; }
.code-lang {
    padding: 8px 16px;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.code-body {
    padding: 24px;
    margin: 0;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    height: 220px;
}
.code-body code {
    display: block;
    white-space: pre;
}
.code-body .kw { color: #c084fc; }
.code-body .fn { color: #60a5fa; }
.code-body .str { color: #34d399; }
.code-body .cm { color: var(--muted); }
.code-body .ty { color: #f59e0b; }
.code-fade-in { animation: codeFade 0.8s ease-in-out; }
@keyframes codeFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Section wrapper */
section { padding: 72px 48px; position: relative; }
section.banded { background: linear-gradient(180deg, var(--soft) 0%, var(--soft-2) 100%); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head {
    text-align: center;
    max-width: 560px;
    margin: 0 auto 44px;
}
.section-head h2 {
    font-size: 28px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--text) 30%, var(--primary) 80%, var(--accent-3) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.section-head p { color: var(--muted); margin: 0; }

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    max-width: 860px;
    margin: 0 auto;
}
.stat {
    background: var(--soft);
    border-radius: 6px;
    padding: 24px 18px;
    text-align: center;
    border: 1px solid var(--border);
}
.stat-number { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Feature rows */
.feature-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
    max-width: 1080px;
    margin: 0 auto;
}
.mockup {
    background: linear-gradient(135deg, #1a1e30 0%, #111520 50%, #161927 100%);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
}
.mockup::before {
    content: "";
    position: absolute; inset: 0;
    background:
        radial-gradient(circle at 72% 60%, rgba(234, 88, 12, 0.15) 0 70px, transparent 71px),
        radial-gradient(circle at 28% 78%, rgba(20, 184, 166, 0.12) 0 46px, transparent 47px),
        radial-gradient(circle at 80% 22%, rgba(249, 115, 22, 0.12) 0 30px, transparent 31px);
    filter: blur(0.5px);
}
.mockup.browser::after {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 26px;
    background: linear-gradient(180deg, #1a1e30 0%, #161927 100%);
    border-bottom: 1px solid var(--border);
}
.mockup-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    position: relative;
    z-index: 1;
}
.mockup-date {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-align: right;
    z-index: 2;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    border-radius: 0 0 12px 12px;
}
.mockup:hover .mockup-date {
    opacity: 1;
    transform: translateY(0);
}
.feature-list { display: flex; flex-direction: column; gap: 22px; }
.feature-list { display: flex; flex-direction: column; gap: 22px; }
.feature-item { display: flex; gap: 14px; }
.feature-icon {
    flex: 0 0 40px; height: 40px; border-radius: 8px;
    background: var(--soft); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.feature-item h3 { font-size: 15px; margin-bottom: 4px; }
.feature-item p { margin: 0; font-size: 14px; color: var(--muted); }

.feature-text .eyebrow { margin-bottom: 10px; }
.feature-text h2 { font-size: 26px; margin-bottom: 12px; }
.feature-text p { color: var(--muted); margin: 0 0 18px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    border: 1px solid var(--border);
}

/* Tech stack */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
}
.stack-card {
    --card-color: var(--primary);
    --card-glow: rgba(234, 88, 12, 0.10);
    background: linear-gradient(160deg, rgba(26,30,48,0.95), rgba(22,25,39,0.7));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    position: relative;
    overflow: hidden;
    transition: transform .25s, box-shadow .25s;
}
.stack-card::before {
    content: "";
    position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent-3));
}
.stack-card::after {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(circle at 90% 10%, var(--card-glow) 0%, transparent 65%);
    pointer-events: none;
}
.stack-card:nth-child(1) { --card-color: #ea580c; --card-glow: rgba(234, 88, 12, 0.12); }
.stack-card:nth-child(1)::before { background: linear-gradient(90deg, #ea580c, #fb923c); }
.stack-card:nth-child(2) { --card-color: #14b8a6; --card-glow: rgba(20, 184, 166, 0.12); }
.stack-card:nth-child(2)::before { background: linear-gradient(90deg, #14b8a6, #2dd4bf); }
.stack-card:nth-child(3) { --card-color: #f97316; --card-glow: rgba(249, 115, 22, 0.12); }
.stack-card:nth-child(3)::before { background: linear-gradient(90deg, #f97316, #f59e0b); }
.stack-card:nth-child(4) { --card-color: #e879f9; --card-glow: rgba(232, 121, 249, 0.12); }
.stack-card:nth-child(4)::before { background: linear-gradient(90deg, #e879f9, #c084fc); }
.stack-card:nth-child(5) { --card-color: #34d399; --card-glow: rgba(52, 211, 153, 0.12); }
.stack-card:nth-child(5)::before { background: linear-gradient(90deg, #34d399, #14b8a6); }
.stack-card:nth-child(6) { --card-color: #fb923c; --card-glow: rgba(251, 146, 60, 0.12); }
.stack-card:nth-child(6)::before { background: linear-gradient(90deg, #fb923c, #f59e0b); }
.stack-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 20px 40px -16px var(--card-glow),
        0 8px 20px -8px rgba(0,0,0,0.06);
}
.stack-icon {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--card-glow), transparent);
    border: 1px solid var(--border);
    font-size: 18px;
    margin-bottom: 12px;
}
.stack-card h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--card-color);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 14px;
}
.stack-card .tag {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border);
    color: var(--text);
    font-weight: 600;
    transition: transform .15s, box-shadow .15s;
}
.stack-card .tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px -2px var(--card-glow);
}

/* Contact CTA */
.contact {
    background:
        radial-gradient(circle at 15% 20%, rgba(234, 88, 12, 0.10), transparent 55%),
        radial-gradient(circle at 85% 85%, rgba(20, 184, 166, 0.08), transparent 55%),
        linear-gradient(135deg, #1a1e30 0%, #161927 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 56px 48px;
    text-align: center;
    max-width: 1080px;
    margin: 0 auto;
}
.contact h2 {
    font-size: 28px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--text) 20%, var(--primary) 80%, var(--accent-3) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.contact p { color: var(--muted); margin: 0 0 24px; }
.contact-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Footer */
.footer {
    background: var(--dark);
    color: #8b92a5;
    padding: 40px 48px 24px;
    border-top: 1px solid var(--border);
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.footer .brand { color: var(--text); font-size: 16px; }
.footer-links {
    display: flex;
    gap: 28px;
    font-size: 14px;
}
.footer-links a {
    color: #8b92a5;
    transition: color .15s;
}
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px; color: var(--dark-muted);
    padding-top: 20px; margin-top: 24px;
    border-top: 1px solid var(--border);
}

/* Active nav / footer link (Donate page) */
.nav-links a.active { color: var(--primary); }
.footer-links a.active { color: var(--primary); }

/* Donate page — centered hero */
.hero-centered {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}
.hero-centered h1,
.hero-centered p {
    margin-left: auto;
    margin-right: auto;
}

/* Donate page — impact cards */
.donate-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1080px;
    margin: 0 auto;
}
.donate-card {
    background: linear-gradient(160deg, rgba(26,30,48,0.95), rgba(22,25,39,0.7));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    transition: transform .25s, box-shadow .25s;
}
.donate-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -16px rgba(234, 88, 12, 0.10), 0 8px 20px -8px rgba(0,0,0,0.2);
}
.donate-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    margin-bottom: 16px;
}
.donate-card h3 { font-size: 16px; margin-bottom: 8px; }
.donate-card p { margin: 0; font-size: 14px; color: var(--muted); }

/* Donate page — ways to support */
.ways-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 680px;
    margin: 0 auto;
}
.way-card {
    display: flex;
    align-items: center;
    gap: 22px;
    background: var(--soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 26px 30px;
    transition: transform .2s, border-color .2s, box-shadow .2s;
}
.way-card:hover { transform: translateY(-3px); }
.way-icon-wrapper {
    flex: 0 0 64px;
    height: 64px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}
.way-info { flex: 1; min-width: 0; }
.way-info h3 { font-size: 19px; margin-bottom: 5px; }
.way-info p { margin: 0; font-size: 15px; color: var(--muted); }
.way-arrow {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    color: var(--muted);
    transition: color .2s, transform .2s;
}
.way-card:hover .way-arrow { transform: translateX(4px); }

/* Per-platform banner tints (matched to canontrails.com/donate) */
.way-card-kofi {
    background: rgba(236, 72, 153, 0.10);
    border-color: rgba(236, 72, 153, 0.35);
}
.way-card-kofi:hover {
    border-color: rgba(236, 72, 153, 0.60);
    box-shadow: 0 12px 28px -14px rgba(236, 72, 153, 0.40);
}
.way-card-kofi .way-arrow { color: #ec4899; }

.way-card-bmc {
    background: rgba(234, 179, 8, 0.10);
    border-color: rgba(234, 179, 8, 0.35);
}
.way-card-bmc:hover {
    border-color: rgba(234, 179, 8, 0.60);
    box-shadow: 0 12px 28px -14px rgba(234, 179, 8, 0.40);
}
.way-card-bmc .way-arrow { color: #eab308; }

.way-card-patreon {
    background: rgba(249, 104, 84, 0.15);
    border-color: rgba(249, 104, 84, 0.40);
}
.way-card-patreon:hover {
    border-color: rgba(249, 104, 84, 0.65);
    box-shadow: 0 12px 28px -14px rgba(249, 104, 84, 0.40);
}
.way-card-patreon .way-arrow { color: #F96854; }

/* Donate page — other (free) ways */
.other-ways-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 880px;
    margin: 0 auto;
}
.other-way-item {
    background: linear-gradient(160deg, rgba(26,30,48,0.6), rgba(22,25,39,0.4));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px 24px;
}
.other-way-item h3 { font-size: 15px; margin-bottom: 8px; color: var(--text); }
.other-way-item p { margin: 0; font-size: 14px; color: var(--muted); }

/* Donate page — thank you */
.thank-you-box {
    max-width: 620px;
    margin: 0 auto;
    text-align: center;
    background:
        radial-gradient(circle at 50% 0%, rgba(234, 88, 12, 0.10), transparent 60%),
        linear-gradient(135deg, #1a1e30 0%, #161927 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 44px 40px;
}
.thank-you-heart {
    width: 40px;
    height: 40px;
    color: var(--primary);
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 960px) {
    .stack-grid { grid-template-columns: repeat(2, 1fr); }
    .donate-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .nav { padding: 14px 20px; }
    .nav-links { display: none; }
    section, .hero { padding: 48px 20px; }
    .hero { padding-top: 56px; padding-bottom: 56px; }
    .hero h1 { font-size: 28px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stack-grid { grid-template-columns: 1fr; }
    .hero-grid { grid-template-columns: 1fr; gap: 28px; }
    .feature-row { grid-template-columns: 1fr; gap: 28px; }
    .contact { padding: 32px 20px; }
    .footer { padding: 28px 20px 20px; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
    .other-ways-container { grid-template-columns: 1fr; }
    .way-card { padding: 16px 18px; gap: 14px; }
    .thank-you-box { padding: 32px 24px; }
}
