/* ── Tokens ── */
        :root {
            /* Dark Mode (Default) */
            --bg:       #0d1117;
            --surface:  #161b22;
            --surface2: #1c2330;
            --border:   #30363d;
            --text:     #c9d1d9;
            --heading:  #ffffff;
            --muted:    #8b949e;
            --accent:   #58a6ff;
            --green:    #3fb950;
            --warn:     #d29922;
            --red:      #f85149;
            --focus:    #58a6ff;
            --nav-h:    52px;
            --nav-bg:   rgba(13, 17, 23, 0.94);
            --code-bg:  rgba(88, 166, 255, 0.1);
        }

        :root[data-theme="light"] {
            --bg:       #f6f8fa;
            --surface:  #ffffff;
            --surface2: #f3f4f6;
            --border:   #d0d7de;
            --text:     #24292f;
            --heading:  #0f1419;
            --muted:    #57606a;
            --accent:   #0969da;
            --green:    #1a7f37;
            --warn:     #9a6700;
            --red:      #cf222e;
            --focus:    #0969da;
            --nav-bg:   rgba(255, 255, 255, 0.94);
            --code-bg:  rgba(9, 105, 218, 0.1);
        }

        /* ── Theme Toggle ── */
        .theme-toggle {
            background: none;
            min-height: 44px;
            margin: 0;
            border: none;
            color: var(--muted);
            cursor: pointer;
            padding: 8px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            transition: color 0.15s, background-color 0.15s;
        }
        .theme-toggle:hover {
            color: var(--text);
            background-color: var(--surface2);
        }
        .theme-icon-dark, .theme-icon-light { display: none; }
        :root[data-theme="dark"] .theme-icon-light { display: block; }
        :root[data-theme="light"] .theme-icon-dark { display: block; }


        /* ── Reset ── */
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
        html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
            background-color: var(--bg);
            color: var(--text);
            line-height: 1.65;
            min-height: 100vh;
        }

        /* ── Motion ── */
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
            html { scroll-behavior: auto; }
        }

        /* ── Skip nav (accessibility) ── */
        .skip-link {
            position: absolute;
            top: -100%;
            left: 16px;
            z-index: 100;
            padding: 10px 18px;
            background: var(--accent);
            color: var(--bg);
            font-weight: 700;
            font-size: 0.9rem;
            border-radius: 0 0 6px 6px;
            text-decoration: none;
            transition: top 0.1s;
        }
        .skip-link:focus { top: 0; }

        /* ── Focus ring ── */
        :focus-visible {
            outline: 2px solid var(--focus);
            outline-offset: 3px;
            border-radius: 3px;
        }

        /* ── Layout ── */
        .wrap {
            max-width: 960px;
            margin: 0 auto;
            padding: 0 clamp(16px, 4vw, 32px);
        }

        /* ── Nav ── */
        .topnav {
            position: sticky;
            top: 0;
            z-index: 50;
            background-color: var(--nav-bg);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border-bottom: 1px solid var(--border);
        }

        .topnav-inner {
            max-width: 960px;
            margin: 0 auto;
            padding: 0 clamp(16px, 4vw, 32px);
            height: var(--nav-h);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
        }

        .topnav-logo {
            font-family: "Courier New", monospace;
            font-size: clamp(0.78rem, 2.2vw, 0.92rem);
            color: var(--accent);
            text-decoration: none;
            font-weight: 700;
            letter-spacing: 0.02em;
            white-space: nowrap;
            min-height: 44px;
            display: inline-flex;
            align-items: center;
        }

        .topnav-links {
            display: flex;
            gap: clamp(14px, 3vw, 28px);
            list-style: none;
            align-items: center;
            flex-shrink: 0;
        }

        .topnav-links li { display: flex; align-items: center; }
        .topnav-links a {
            color: var(--muted);
            text-decoration: none;
            font-size: clamp(0.8rem, 2vw, 0.88rem);
            min-height: 44px;
            display: inline-flex;
            align-items: center;
            transition: color 0.15s;
            white-space: nowrap;
        }
        .topnav-links a:hover { color: var(--text); }

        /* ── Hero ── */
        .hero {
            padding: clamp(40px, 8vw, 80px) 0 clamp(36px, 6vw, 64px);
            border-bottom: 1px solid var(--border);
        }

        .hero-eyebrow {
            font-family: "Courier New", monospace;
            font-size: 0.78rem;
            color: var(--green);
            letter-spacing: 0.14em;
            text-transform: uppercase;
            margin-bottom: 14px;
        }

        .hero h1 {
            font-size: clamp(1.9rem, 6vw, 3.2rem);
            font-weight: 800;
            color: var(--heading);
            letter-spacing: -0.03em;
            line-height: 1.1;
            margin-bottom: 18px;
        }

        .hero-bio {
            max-width: 620px;
            font-size: clamp(0.95rem, 2.5vw, 1.08rem);
            color: var(--muted);
            line-height: 1.78;
            margin-bottom: 28px;
        }
        .hero-bio strong { color: var(--text); }

        .hero-links {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
        }

        .hero-link {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            color: var(--muted);
            text-decoration: none;
            font-size: clamp(0.78rem, 2vw, 0.88rem);
            font-family: "Courier New", monospace;
            border: 1px solid var(--border);
            padding: 10px 14px;
            border-radius: 6px;
            background-color: var(--surface);
            min-height: 44px;
            transition: color 0.15s, border-color 0.15s;
            word-break: break-all;
        }
        .hero-link:hover { color: var(--accent); border-color: rgba(88,166,255,0.5); }

        .hero-link-cv {
            background-color: var(--accent);
            color: var(--bg) !important;
            border-color: var(--accent);
            font-weight: 700;
            font-family: inherit;
        }
        .hero-link-cv:hover { background-color: #79baff; border-color: #79baff; }

        /* ── Sections ── */
        .section {
            padding: clamp(40px, 7vw, 70px) 0;
            border-bottom: 1px solid var(--border);
        }
        .section:last-of-type { border-bottom: none; }

        .section-label {
            font-family: "Courier New", monospace;
            font-size: 0.73rem;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.14em;
            margin-bottom: 6px;
        }

        .section-title {
            font-size: clamp(1.3rem, 4vw, 1.6rem);
            font-weight: 700;
            color: var(--heading);
            margin-bottom: clamp(20px, 4vw, 32px);
        }

        /* ── Featured card ── */
        .featured-card {
            background-color: var(--surface);
            border: 1px solid var(--border);
            border-left: 4px solid var(--accent);
            border-radius: 0 8px 8px 0;
            padding: clamp(20px, 4vw, 36px) clamp(20px, 4vw, 36px);
            margin-bottom: 24px;
            text-decoration: none;
            display: block;
            transition: border-color 0.15s, background-color 0.15s;
        }
        .featured-card:hover {
            border-left-color: var(--green);
            background-color: var(--surface2);
        }

        .featured-eyebrow {
            font-size: 0.73rem;
            font-family: "Courier New", monospace;
            color: var(--accent);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            margin-bottom: 10px;
        }

        .featured-card h2 {
            font-size: clamp(1.1rem, 3.5vw, 1.35rem);
            font-weight: 700;
            color: var(--heading);
            margin-bottom: 12px;
            line-height: 1.3;
            border: none;
            padding: 0;
        }

        .featured-desc {
            color: var(--muted);
            font-size: clamp(0.88rem, 2.2vw, 0.97rem);
            line-height: 1.72;
            margin-bottom: 20px;
            max-width: 680px;
        }

        .featured-stats {
            display: grid;
            grid-template-columns: repeat(4, minmax(80px, 1fr));
            gap: 12px;
            margin-bottom: 20px;
            padding: 16px 0;
            border-top: 1px solid var(--border);
            border-bottom: 1px solid var(--border);
        }

        @media (max-width: 500px) {
            .featured-stats { grid-template-columns: 1fr 1fr; }
        }

        .fstat-val {
            font-size: clamp(1.1rem, 4vw, 1.35rem);
            font-weight: 700;
            color: var(--green);
            font-family: "Courier New", monospace;
            line-height: 1;
            margin-bottom: 4px;
            display: block;
        }

        .fstat-label {
            font-size: 0.72rem;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.06em;
        }

        /* ── Tag row ── */
        .tag-row {
            display: flex;
            flex-wrap: wrap;
            gap: 7px;
        }

        .tag {
            font-size: 0.76rem;
            font-weight: 600;
            padding: 3px 9px;
            border-radius: 4px;
            background-color: rgba(88,166,255,0.08);
            color: var(--accent);
            border: 1px solid rgba(88,166,255,0.2);
            font-family: "Courier New", monospace;
            white-space: nowrap;
        }
        .tag.green { background-color: rgba(63,185,80,0.08); color: var(--green); border-color: rgba(63,185,80,0.2); }
        .tag.warn  { background-color: rgba(210,153,34,0.08); color: var(--warn); border-color: rgba(210,153,34,0.2); }

        /* ── Project grid ── */
        .project-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 16px;
        }

        @media (max-width: 640px) {
            .project-grid { grid-template-columns: 1fr; }
        }

        .project-card {
            background-color: var(--surface);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: clamp(18px, 3vw, 24px);
            text-decoration: none;
            display: flex;
            flex-direction: column;
            transition: border-color 0.15s, background-color 0.15s;
        }
        .project-card:hover {
            border-color: var(--muted);
            background-color: var(--surface2);
        }

        .card-top {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 10px;
            gap: 10px;
        }

        .project-card h3 {
            font-size: clamp(0.92rem, 2.5vw, 1.02rem);
            font-weight: 700;
            color: var(--heading);
            line-height: 1.35;
        }

        .card-badge {
            font-size: 0.68rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            padding: 3px 8px;
            border-radius: 4px;
            white-space: nowrap;
            flex-shrink: 0;
            line-height: 1.6;
        }
        .card-badge.live    { background-color: rgba(63,185,80,0.12); color: var(--green); border: 1px solid rgba(63,185,80,0.3); }
        .card-badge.private { background-color: rgba(210,153,34,0.08); color: var(--warn); border: 1px solid rgba(210,153,34,0.25); }
        .card-badge.hardware{ background-color: rgba(248,81,73,0.08); color: var(--red); border: 1px solid rgba(248,81,73,0.25); }
        .card-badge.progress{ background-color: rgba(88,166,255,0.08); color: var(--accent); border: 1px solid rgba(88,166,255,0.25); }

        .card-badge.live::before { content: '● '; font-size: 0.55rem; }

        .card-desc {
            color: var(--muted);
            font-size: clamp(0.84rem, 2vw, 0.9rem);
            line-height: 1.68;
            flex: 1;
            margin-bottom: 16px;
        }

        .card-footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

        /* ── Stack section ── */
        .stack-table {
            width: 100%;
            border-collapse: collapse;
        }

        .stack-table tr {
            border-bottom: 1px solid var(--border);
        }

        .stack-table tr:last-child { border-bottom: none; }

        .stack-cat {
            font-size: 0.76rem;
            font-weight: 700;
            color: var(--accent);
            font-family: "Courier New", monospace;
            padding: 13px 20px 13px 0;
            width: 130px;
            white-space: nowrap;
            vertical-align: top;
        }

        .stack-val {
            font-size: 0.88rem;
            color: var(--muted);
            padding: 13px 0;
            line-height: 1.6;
        }

        @media (max-width: 480px) {
            .stack-table, .stack-table tbody, .stack-table tr, .stack-table td {
                display: block;
                width: 100%;
            }
            .stack-cat { padding: 12px 0 2px; width: auto; }
            .stack-val { padding: 0 0 12px; }
        }

        /* ── About ── */
        .about-grid {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 40px;
            align-items: start;
        }

        @media (max-width: 700px) {
            .about-grid { grid-template-columns: 1fr; gap: 24px; }
        }

        .about-text p {
            font-size: clamp(0.9rem, 2.2vw, 0.97rem);
            color: var(--muted);
            margin-bottom: 16px;
            line-height: 1.78;
        }
        .about-text p:last-child { margin-bottom: 0; }
        .about-text strong { color: var(--text); }

        .about-facts {
            background-color: var(--surface);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 20px 24px;
            min-width: 240px;
        }

        @media (max-width: 700px) {
            .about-facts { min-width: unset; }
        }

        .fact-row {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            padding: 9px 0;
            border-bottom: 1px solid var(--border);
            font-size: 0.84rem;
            gap: 12px;
        }
        .fact-row:last-child { border-bottom: none; }
        .fact-label { color: var(--muted); flex-shrink: 0; }
        .fact-val {
            color: var(--text);
            font-family: "Courier New", monospace;
            font-size: 0.8rem;
            text-align: right;
            word-break: break-all;
        }

        /* ── Footer ── */
        footer {
            border-top: 1px solid var(--border);
            padding: clamp(24px, 5vw, 36px) clamp(16px, 4vw, 32px);
            text-align: center;
        }

        .footer-links {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: clamp(12px, 3vw, 24px);
            margin-bottom: 14px;
        }

        .footer-links a {
            color: var(--muted);
            text-decoration: none;
            font-size: 0.86rem;
            min-height: 44px;
            display: inline-flex;
            align-items: center;
            transition: color 0.15s;
        }
        .footer-links a:hover { color: var(--text); }

        .footer-note {
            font-size: 0.74rem;
            color: var(--muted);
            font-family: "Courier New", monospace;
        }

        /* ── High contrast mode support ── */
        @media (forced-colors: active) {
            .featured-card, .project-card, .about-facts { border: 2px solid ButtonText; }
            .tag, .card-badge { border: 1px solid ButtonText; }
        }
    

/* ── Project Specific Styles ── */

        .project-header { margin-bottom: 40px; border-bottom: 1px solid var(--border); padding-bottom: 30px; margin-top: 40px; }
        h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); margin-bottom: 15px; color: var(--heading); line-height: 1.2; }
        .meta { color: var(--muted); font-size: 0.95rem; font-family: "Courier New", Courier, monospace; }
        h2 { font-size: clamp(1.2rem, 3vw, 1.4rem); color: var(--accent); margin: 40px 0 15px; }
        h3 { font-size: 1.1rem; color: var(--text); margin: 25px 0 10px; }
        p { margin-bottom: 18px; font-size: clamp(0.95rem, 2vw, 1.03rem); line-height: 1.7; }
        
        .highlight-box { background-color: var(--surface); border-left: 4px solid var(--green); padding: 20px; margin: 30px 0; border-radius: 0 8px 8px 0; }
        .highlight-box.warn { border-left-color: var(--warn); }
        .highlight-box.danger { border-left-color: var(--red); }
        
        .tech-stack { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
        .tech-tag { background-color: var(--code-bg); color: var(--accent); padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; font-family: "Courier New", monospace;}
        .tech-tag.green { background-color: rgba(63, 185, 80, 0.1); color: var(--green); border: 1px solid rgba(63, 185, 80, 0.2); }
        .tech-tag.warn { background-color: rgba(210, 153, 34, 0.1); color: var(--warn); border: 1px solid rgba(210, 153, 34, 0.2); }
        
        main ul { margin-bottom: 18px; padding-left: 22px; }
        main li { margin-bottom: 10px; font-size: clamp(0.95rem, 2vw, 1.03rem); line-height: 1.7; }
        .topnav-links li { margin: 0; padding: 0; }
        
        code { background-color: var(--code-bg); color: var(--accent); padding: 2px 6px; border-radius: 4px; font-family: "Courier New", monospace; font-size: 0.9em; }

        .metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin: 30px 0; }
        @media (max-width: 600px) { .metrics-grid { grid-template-columns: 1fr 1fr; } }
        .metric-card { background-color: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 18px; text-align: center; }
        .metric-value { font-size: 2rem; font-weight: 700; color: var(--green); font-family: "Courier New", monospace; display: block; margin-bottom: 6px; }
        .metric-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

        .architecture-diagram { background-color: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 24px; margin: 30px 0; font-family: "Courier New", monospace; font-size: 0.82rem; color: var(--green); overflow-x: auto; line-height: 1.6; }
        .layer-label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; font-family: sans-serif; }
        .layer-block { margin-bottom: 20px; }

        .timeline { border-left: 2px solid var(--border); padding-left: 24px; margin: 20px 0; }
        .timeline-item { position: relative; margin-bottom: 22px; }
        .timeline-item::before { content: ''; position: absolute; left: -30px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background-color: var(--green); border: 2px solid var(--surface); }
        .timeline-item.warn::before { background-color: var(--warn); }
        .timeline-item.danger::before { background-color: var(--red); }
        .timeline-title { font-weight: 600; color: var(--text); font-size: 0.95rem; }
        .timeline-sub { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }

        .slo-bar-wrap { background-color: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 20px; margin: 20px 0; }
        .slo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
        .slo-label { width: 90px; font-size: 0.83rem; color: var(--muted); font-family: monospace; flex-shrink: 0; }
        .slo-track { flex: 1; height: 10px; background-color: var(--border); border-radius: 5px; overflow: hidden; }
        .slo-fill { height: 100%; border-radius: 5px; background-color: var(--green); }
        .slo-val { font-size: 0.83rem; color: var(--green); font-family: monospace; width: 55px; text-align: right; flex-shrink: 0; }
        
        /* ── Footer ── */
        footer { border-top: 1px solid var(--border); padding: clamp(24px, 5vw, 36px) clamp(16px, 4vw, 32px); text-align: center; margin-top: 60px; }
        .footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: clamp(12px, 3vw, 24px); margin-bottom: 14px; }
        .footer-links a { color: var(--muted); text-decoration: none; font-size: 0.86rem; min-height: 44px; display: inline-flex; align-items: center; transition: color 0.15s; }
        .footer-links a:hover { color: var(--text); }
        .footer-note { font-size: 0.74rem; color: var(--muted); font-family: "Courier New", monospace; }