:root{
    --ink:#EDEFF5;
    --ink-soft:#B7BDD1;
    --muted:#7E869C;
    --bg:#0A0E17;
    --bg-raised:#121826;
    --bg-glass:rgba(255,255,255,0.035);
    --line:rgba(255,255,255,0.09);
    --line-strong:rgba(255,255,255,0.18);
    --amber:#F2B84B;
    --amber-deep:#E0A030;
    --resolved:#4ADE80;
    --resolved-soft:rgba(74,222,128,0.12);
    --code-key:#F2B84B;
    --code-str:#8FD6A8;
    --code-fn:#7FB7F2;
    --code-com:#5C6478;

    --font-display:'Fraunces', serif;
    --font-body:'IBM Plex Sans', sans-serif;
    --font-mono:'IBM Plex Mono', monospace;

    --maxw:1040px;
  }

  html[data-theme="light"]{
    --ink:#16213E;
    --ink-soft:#3A4260;
    --muted:#6B7185;
    --bg:#FAF9F6;
    --bg-raised:#FFFFFF;
    --bg-glass:rgba(22,33,62,0.03);
    --line:#E4E0D4;
    --line-strong:#CFC8B6;
    --amber:#E0A030;
    --amber-deep:#B87A1C;
    --resolved:#2F8F5B;
    --resolved-soft:rgba(47,143,91,0.1);
    --code-key:#B87A1C;
    --code-str:#2F8F5B;
    --code-fn:#2A5FA8;
    --code-com:#9BA0B0;
  }

  *{box-sizing:border-box;}
  html{scroll-behavior:smooth;}
  @media (prefers-reduced-motion: reduce){
    html{scroll-behavior:auto;}
    *{animation-duration:0.01ms !important; animation-iteration-count:1 !important; transition-duration:0.01ms !important;}
  }

  body{
    margin:0;
    background:var(--bg);
    color:var(--ink);
    font-family:var(--font-body);
    line-height:1.6;
    -webkit-font-smoothing:antialiased;
    transition:background .3s ease, color .3s ease;
    position:relative;
    overflow-x:hidden;
  }

  body::before{
    content:"";
    position:fixed; inset:0; z-index:0; pointer-events:none;
    background-image:
      linear-gradient(var(--line) 1px, transparent 1px),
      linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size:64px 64px;
    opacity:0.35;
    mask-image:radial-gradient(circle at 50% 0%, black, transparent 75%);
  }

  .spotlight{
    position:fixed; inset:0; z-index:1; pointer-events:none;
    background:radial-gradient(600px circle at var(--mx,50%) var(--my,20%), rgba(242,184,75,0.08), transparent 60%);
    transition:background .1s ease;
  }

  a{color:inherit;}
  ::selection{background:var(--amber); color:#0A0E17;}

  .wrap{max-width:var(--maxw); margin:0 auto; padding:0 28px; position:relative; z-index:2;}

  /* ---------- NAV ---------- */
  .nav{
    position:sticky; top:0; z-index:50;
    background:color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter:blur(10px);
    border-bottom:1px solid var(--line);
  }
  .nav-inner{
    max-width:var(--maxw); margin:0 auto; padding:14px 28px;
    display:flex; align-items:center; justify-content:space-between; gap:16px;
  }
  .nav-mark{
    font-family:var(--font-mono); font-size:13px; font-weight:600;
    letter-spacing:0.02em; color:var(--ink);
    text-decoration:none; display:flex; align-items:center; gap:8px;
  }
  .nav-mark .cursor-blink{
    display:inline-block; width:8px; height:14px; background:var(--amber);
    animation:blink 1.1s steps(1) infinite;
  }
  @keyframes blink{0%,49%{opacity:1;}50%,100%{opacity:0;}}
  .nav-links{
    display:flex; gap:24px; list-style:none; margin:0; padding:0;
    font-family:var(--font-mono); font-size:12.5px; letter-spacing:0.03em;
  }
  .nav-links a{
    text-decoration:none; color:var(--muted);
    padding:4px 2px; border-bottom:1px solid transparent;
    transition:color .15s ease, border-color .15s ease;
  }
  .nav-links a:hover, .nav-links a:focus-visible, .nav-links a.active{color:var(--ink); border-color:var(--amber);}
  .nav-right{display:flex; align-items:center; gap:14px;}
  .theme-toggle{
    font-family:var(--font-mono); font-size:11px;
    background:var(--bg-glass); border:1px solid var(--line);
    color:var(--ink-soft); border-radius:7px; padding:7px 10px;
    cursor:pointer; letter-spacing:0.04em;
    transition:border-color .15s ease, color .15s ease;
  }
  .theme-toggle:hover, .theme-toggle:focus-visible{border-color:var(--amber-deep); color:var(--ink);}
  @media (max-width:680px){ .nav-links{display:none;} }

  /* ---------- HERO ---------- */
  .hero{padding:76px 0 56px; display:grid; grid-template-columns:1.1fr 1fr; gap:48px; align-items:center;}
  @media (max-width:860px){ .hero{grid-template-columns:1fr; padding-top:52px;} }

  .status-bar{
    display:inline-flex; align-items:center; gap:9px;
    font-family:var(--font-mono); font-size:12px; letter-spacing:0.04em;
    color:var(--resolved); border:1px solid var(--resolved-soft);
    background:var(--resolved-soft); padding:6px 12px 6px 10px;
    border-radius:999px; margin-bottom:26px;
  }
  .dot{
    width:7px; height:7px; border-radius:50%; background:var(--resolved);
    box-shadow:0 0 0 0 rgba(74,222,128,0.5);
    animation:pulse 2.2s infinite; flex:none;
  }
  @keyframes pulse{
    0%{box-shadow:0 0 0 0 rgba(74,222,128,0.45);}
    70%{box-shadow:0 0 0 7px rgba(74,222,128,0);}
    100%{box-shadow:0 0 0 0 rgba(74,222,128,0);}
  }

  .hero h1{
    font-family:var(--font-display);
    font-weight:600;
    font-size:clamp(38px, 5.4vw, 60px);
    line-height:1.03;
    margin:0 0 14px;
    letter-spacing:-0.01em;
  }
  .hero h1 em{font-style:italic; font-weight:500; color:var(--amber-deep);}
  .hero-role{
    font-family:var(--font-mono); font-size:14px; color:var(--muted);
    margin:0 0 22px; letter-spacing:0.02em;
  }
  .hero-lede{
    font-size:16.5px; color:var(--ink-soft); max-width:52ch; margin:0 0 32px;
  }
  .hero-actions{display:flex; flex-wrap:wrap; gap:12px;}

  .btn{
    font-family:var(--font-mono); font-size:13px; letter-spacing:0.02em;
    padding:12px 20px; border-radius:8px; text-decoration:none;
    transition:transform .15s ease, background .15s ease, border-color .15s ease;
    display:inline-flex; align-items:center; gap:8px; cursor:pointer;
    border:1px solid transparent; font-weight:500;
  }
  .btn-primary{background:var(--amber); color:#12100A; font-weight:600;}
  .btn-primary:hover, .btn-primary:focus-visible{background:#F7C86B; transform:translateY(-1px);}
  .btn-ghost{border:1px solid var(--line-strong); color:var(--ink); background:var(--bg-glass);}
  .btn-ghost:hover, .btn-ghost:focus-visible{border-color:var(--amber); transform:translateY(-1px);}

  /* ---------- TERMINAL ---------- */
  .terminal{
    background:var(--bg-raised); border:1px solid var(--line);
    border-radius:12px; overflow:hidden;
    box-shadow:0 20px 60px -20px rgba(0,0,0,0.5);
  }
  .term-bar{
    display:flex; align-items:center; gap:8px;
    padding:11px 14px; border-bottom:1px solid var(--line);
    background:var(--bg-glass);
  }
  .term-dot{width:10px; height:10px; border-radius:50%;}
  .term-bar .term-dot:nth-child(1){background:#EF6A5F;}
  .term-bar .term-dot:nth-child(2){background:#F5BD4F;}
  .term-bar .term-dot:nth-child(3){background:#61C454;}
  .term-title{
    margin-left:8px; font-family:var(--font-mono); font-size:11.5px; color:var(--muted);
  }
  .term-body{
    padding:20px 22px; font-family:var(--font-mono); font-size:13.5px; line-height:1.75;
    min-height:230px;
  }
  .term-body .c-key{color:var(--code-key);}
  .term-body .c-str{color:var(--code-str);}
  .term-body .c-fn{color:var(--code-fn);}
  .term-body .c-com{color:var(--code-com);}
  .term-body .c-plain{color:var(--ink-soft);}
  #termOut{white-space:pre-wrap; word-break:break-word;}
  .term-cursor{display:inline-block; width:8px; height:15px; background:var(--amber); vertical-align:middle; animation:blink 1s steps(1) infinite;}

  /* ---------- SECTION SCAFFOLD ---------- */
  section{padding:56px 0;}
  .section-head{display:flex; align-items:baseline; gap:12px; margin-bottom:30px;}
  .section-num{font-family:var(--font-mono); font-size:12px; color:var(--amber-deep); letter-spacing:0.06em;}
  .section-title{font-family:var(--font-display); font-weight:600; font-size:28px; margin:0; letter-spacing:-0.01em;}
  .section-rule{flex:1; height:1px; background:var(--line); margin-left:6px;}

  .reveal{opacity:0; transform:translateY(14px); transition:opacity .55s ease, transform .55s ease;}
  .reveal.in{opacity:1; transform:translateY(0);}

  /* ---------- ABOUT ---------- */
  .about-text{font-size:16.5px; color:var(--ink-soft); max-width:66ch;}

  /* ---------- EXPERIENCE TIMELINE ---------- */
  .timeline{position:relative; padding-left:34px;}
  .timeline::before{
    content:""; position:absolute; left:9px; top:6px; bottom:6px; width:1px;
    background:linear-gradient(var(--line-strong), var(--line));
  }
  .tl-item{position:relative; margin-bottom:6px;}
  .tl-node{
    position:absolute; left:-34px; top:22px; width:19px; height:19px; border-radius:50%;
    background:var(--bg-raised); border:1px solid var(--line-strong);
    display:flex; align-items:center; justify-content:center;
  }
  .tl-node::after{content:""; width:7px; height:7px; border-radius:50%; background:var(--amber-deep);}
  .tl-item.current .tl-node::after{background:var(--resolved);}
  .tl-card{
    background:var(--bg-raised); border:1px solid var(--line); border-radius:10px;
    padding:20px 22px; cursor:pointer; transition:border-color .2s ease, box-shadow .2s ease;
  }
  .tl-card:hover{border-color:var(--line-strong); box-shadow:0 10px 30px -18px rgba(0,0,0,0.5);}
  .tl-top{display:flex; justify-content:space-between; gap:16px; flex-wrap:wrap; align-items:flex-start;}
  .tl-role{font-family:var(--font-display); font-weight:600; font-size:18.5px; margin:0;}
  .tl-company{font-size:14px; color:var(--muted); margin:3px 0 0;}
  .tl-dates{font-family:var(--font-mono); font-size:11.5px; color:var(--muted); white-space:nowrap; text-align:right; display:flex; align-items:center; gap:8px;}
  .tl-chevron{transition:transform .2s ease; color:var(--muted); font-size:11px;}
  .tl-item.open .tl-chevron{transform:rotate(90deg);}
  .tl-body{
    max-height:0; overflow:hidden; transition:max-height .3s ease, margin-top .3s ease;
    margin-top:0;
  }
  .tl-item.open .tl-body{max-height:260px; margin-top:14px;}
  .tl-body ul{margin:0; padding-left:18px; color:var(--ink-soft); font-size:14.5px;}
  .tl-body li{margin-bottom:7px;}
  .tl-body li::marker{color:var(--amber-deep);}

  /* ---------- SKILLS (tabbed) ---------- */
  .skill-tabs{display:flex; gap:8px; margin-bottom:22px; flex-wrap:wrap;}
  .skill-tab{
    font-family:var(--font-mono); font-size:12.5px; padding:9px 15px;
    border-radius:999px; border:1px solid var(--line); background:var(--bg-glass);
    color:var(--muted); cursor:pointer; transition:all .15s ease;
  }
  .skill-tab.active{background:var(--amber); border-color:var(--amber); color:#12100A; font-weight:600;}
  .skill-tab:hover:not(.active){border-color:var(--line-strong); color:var(--ink);}
  .skill-panel{display:none;}
  .skill-panel.active{display:block;}
  .skill-tags{display:flex; flex-wrap:wrap; gap:9px;}
  .tag{
    font-family:var(--font-mono); font-size:12.5px;
    background:var(--bg-raised); border:1px solid var(--line);
    padding:7px 12px; border-radius:6px; color:var(--ink-soft);
    transition:border-color .15s ease, color .15s ease, transform .15s ease;
  }
  .tag:hover{border-color:var(--amber-deep); color:var(--ink); transform:translateY(-2px);}

  /* ---------- PROJECTS ---------- */
  .projects{display:grid; grid-template-columns:1fr 1fr; gap:18px;}
  @media (max-width:680px){.projects{grid-template-columns:1fr;}}
  .project-card{
    position:relative; background:var(--bg-raised); border:1px solid var(--line);
    border-radius:12px; padding:24px; overflow:hidden;
    transition:border-color .2s ease, box-shadow .2s ease, transform .2s ease;
  }
  .project-card:hover{border-color:var(--line-strong); box-shadow:0 16px 40px -22px rgba(0,0,0,0.55); transform:translateY(-3px);}
  .project-card::before{
    content:""; position:absolute; top:0; left:0; right:0; height:2px;
    background:linear-gradient(90deg, var(--amber-deep), transparent);
    opacity:0; transition:opacity .2s ease;
  }
  .project-card:hover::before{opacity:1;}
  .project-tag{font-family:var(--font-mono); font-size:11px; color:var(--amber-deep); letter-spacing:0.05em; margin-bottom:10px;}
  .project-title{font-family:var(--font-display); font-weight:600; font-size:18.5px; margin:0 0 10px;}
  .project-desc{font-size:14.5px; color:var(--ink-soft); margin:0 0 14px;}
  .project-stack{display:flex; flex-wrap:wrap; gap:6px;}
  .mini-tag{font-family:var(--font-mono); font-size:10.5px; color:var(--muted); border:1px solid var(--line); padding:3px 8px; border-radius:5px;}

  /* ---------- EDUCATION ---------- */
  .edu-row{
    display:flex; justify-content:space-between; align-items:baseline;
    gap:16px; flex-wrap:wrap; border-top:1px solid var(--line); padding:18px 0;
  }
  .edu-row:last-child{border-bottom:1px solid var(--line);}
  .edu-name{font-family:var(--font-display); font-weight:600; font-size:17px;}
  .edu-sub{font-size:13.5px; color:var(--muted); margin-top:2px;}
  .edu-dates{font-family:var(--font-mono); font-size:12px; color:var(--muted); white-space:nowrap;}

  /* ---------- CONTACT ---------- */
  .contact{
    background:var(--bg-raised); border:1px solid var(--line);
    border-radius:16px; padding:50px 40px; margin:20px 0 60px; text-align:center;
    position:relative; overflow:hidden;
  }
  .contact h2{font-family:var(--font-display); font-weight:600; font-size:clamp(26px,4vw,34px); margin:16px 0 10px;}
  .contact p{color:var(--muted); font-size:15px; margin:0 0 30px;}
  .contact-actions{display:flex; justify-content:center; gap:12px; flex-wrap:wrap;}
  .copy-note{
    font-family:var(--font-mono); font-size:11px; color:var(--resolved);
    margin-top:14px; height:14px; opacity:0; transition:opacity .2s ease;
  }
  .copy-note.show{opacity:1;}

  footer{
    text-align:center; font-family:var(--font-mono); font-size:11.5px;
    color:var(--muted); padding-bottom:44px; letter-spacing:0.02em;
  }

  :focus-visible{outline:2px solid var(--amber-deep); outline-offset:2px;}

  .back-to-top{
    position:fixed; right:20px; bottom:20px; z-index:40;
    width:42px; height:42px; border-radius:50%;
    background:var(--amber); color:#12100A; border:none;
    font-size:16px; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    opacity:0; pointer-events:none; transform:translateY(8px);
    transition:opacity .2s ease, transform .2s ease, background .15s ease;
    box-shadow:0 8px 20px -8px rgba(0,0,0,0.5);
  }
  .back-to-top.show{opacity:1; pointer-events:auto; transform:translateY(0);}
  .back-to-top:hover, .back-to-top:focus-visible{background:#F7C86B;}

  .confetti-piece{
    position:fixed; top:0; z-index:60; pointer-events:none;
    font-size:16px; will-change:transform, opacity;
  }