:root{
    --bg: #FAFAF7;
    --bg-alt: #F1F0E9;
    --ink: #14181F;
    --ink-soft: #565C63;
    --ink-faint: #8A8F94;
    --line: #E4E2D9;
    --accent: #0F9D8B;
    --accent-ink: #0B7A6C;
    --accent-soft: #E4F3F0;
    --amber: #F0A63B;
    --card: #FFFFFF;
    --radius: 14px;
    --max: 1120px;
    --ease: cubic-bezier(.22,.68,0,1);
  }

  *{ box-sizing: border-box; }
  html{ scroll-behavior: smooth; }
  body{
    margin:0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
  }
  h1,h2,h3{
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    line-height: 1.1;
    margin: 0;
    letter-spacing: -0.01em;
  }
  p{ margin: 0; }
  a{ color: inherit; text-decoration: none; }
  ul{ margin:0; padding:0; list-style:none; }
  .mono{ font-family: 'JetBrains Mono', monospace; }

  .wrap{
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 32px;
  }

  section{ position: relative; }

  ::selection{ background: var(--accent); color: #fff; }

  /* focus visibility */
  a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible{
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
  }

  /* ---------- NAV ---------- */
  header{
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 20px 0;
    transition: background .35s var(--ease), border-color .35s var(--ease), padding .35s var(--ease);
    border-bottom: 1px solid transparent;
  }
  header.scrolled{
    background: rgba(250,250,247,0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
  }
  nav.wrap{
    display:flex;
    align-items:center;
    justify-content: space-between;
  }
  .logo{
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
  }
  .logo span{ color: var(--accent); }
  .nav-links{
    display:flex;
    gap: 36px;
    align-items:center;
  }
  .nav-links a{
    position: relative;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-soft);
    padding: 4px 0;
    transition: color .2s;
  }
  .nav-links a::after{
    content:'';
    position:absolute;
    left:0; bottom:-2px;
    width:0; height: 1.5px;
    background: var(--accent);
    transition: width .25s var(--ease);
  }
  .nav-links a:hover{ color: var(--ink); }
  .nav-links a:hover::after{ width: 100%; }
  .nav-cta{
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 9px 18px !important;
    background: var(--ink);
    color: var(--bg) !important;
    border-radius: 100px;
  }
  .nav-cta::after{ display:none; }
  .nav-cta:hover{ background: var(--accent-ink); color:#fff !important; }
  .nav-toggle{ display:none; }

  /* ---------- HERO ---------- */
  .hero{
    min-height: 100svh;
    display:flex;
    align-items:center;
    padding: 140px 0 80px;
    background-image:
      radial-gradient(circle at 1.5px 1.5px, rgba(20,24,31,0.06) 1px, transparent 0);
    background-size: 28px 28px;
    background-position: -14px -14px;
  }
  .hero-inner{
    display:grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 64px;
    align-items:center;
    width:100%;
  }
  .eyebrow{
    display:inline-flex;
    align-items:center;
    gap:8px;
    font-family:'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--accent-ink);
    background: var(--accent-soft);
    padding: 6px 12px;
    border-radius: 100px;
    margin-bottom: 22px;
  }
  .eyebrow::before{
    content:'';
    width:6px; height:6px;
    border-radius:50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }
  .hero h1{
    font-size: clamp(38px, 4.8vw, 58px);
    margin-bottom: 18px;
  }
  .hero h1 em{
    font-style: normal;
    color: var(--accent-ink);
  }
  .hero-lede{
    font-size: 18px;
    color: var(--ink-soft);
    max-width: 480px;
    margin-bottom: 34px;
  }
  .hero-cta{
    display:flex;
    gap:14px;
    flex-wrap: wrap;
  }
  .btn{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding: 14px 24px;
    border-radius: 100px;
    font-size: 14.5px;
    font-weight: 600;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s, color .25s;
    border: 1px solid transparent;
    cursor:pointer;
  }
  .btn-primary{
    background: var(--ink);
    color: #fff;
  }
  .btn-primary:hover{
    background: var(--accent-ink);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -8px rgba(15,157,139,0.55);
  }
  .btn-ghost{
    background: transparent;
    border-color: var(--line);
    color: var(--ink);
  }
  .btn-ghost:hover{
    border-color: var(--ink);
    transform: translateY(-2px);
  }

  /* Terminal signature element */
  .terminal{
    background: #12161C;
    border-radius: var(--radius);
    box-shadow: 0 30px 60px -20px rgba(20,24,31,0.35);
    overflow: hidden;
    transform: rotate(0.6deg);
  }
  .term-bar{
    display:flex;
    align-items:center;
    gap:8px;
    padding: 13px 16px;
    background: #1B2027;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .term-dot{ width:10px; height:10px; border-radius:50%; }
  .term-dot:nth-child(1){ background:#EE6A5F; }
  .term-dot:nth-child(2){ background:#F5BD4F; }
  .term-dot:nth-child(3){ background:#61C554; }
  .term-title{
    margin-left: 8px;
    font-family:'JetBrains Mono',monospace;
    font-size: 12px;
    color: #7C8590;
  }
  .term-body{
    padding: 26px 24px 30px;
    font-family:'JetBrains Mono', monospace;
    font-size: 14.5px;
    color: #C9D1D9;
    min-height: 230px;
  }
  .term-line{ margin-bottom: 14px; }
  .term-prompt{ color: #61C554; }
  .term-path{ color: #6CA0F5; }
  .term-comment{ color: #7C8590; }
  .term-out{ color: #E8ECEF; }
  .term-tag{
    display:inline-block;
    color: var(--accent);
    font-weight: 500;
  }
  .caret{
    display:inline-block;
    width: 8px; height: 16px;
    background: var(--accent);
    margin-left: 3px;
    vertical-align: -3px;
    animation: blink 1s step-end infinite;
  }
  @keyframes blink{ 50%{ opacity: 0; } }

  /* ---------- SECTION HEADERS ---------- */
  .section-pad{ padding: 120px 0; }
  .section-head{
    max-width: 620px;
    margin-bottom: 64px;
  }
  .section-eyebrow{
    font-family:'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--accent-ink);
    margin-bottom: 14px;
    display:block;
  }
  .section-head h2{
    font-size: clamp(28px, 3.4vw, 38px);
    margin-bottom: 14px;
  }
  .section-head p{
    color: var(--ink-soft);
    font-size: 16.5px;
  }

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

  /* ---------- SKILLS ---------- */
  .skill-grid{
    display:grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
  .skill-card{
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 32px 28px;
    transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
  }
  .skill-card:hover{
    transform: translateY(-6px);
    box-shadow: 0 24px 40px -24px rgba(20,24,31,0.25);
    border-color: var(--accent);
  }
  .skill-icon{
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    display:flex; align-items:center; justify-content:center;
    margin-bottom: 20px;
    font-family:'JetBrains Mono',monospace;
    font-weight: 600;
    font-size: 15px;
  }
  .skill-card h3{
    font-size: 19px;
    margin-bottom: 10px;
  }
  .skill-card p{
    color: var(--ink-soft);
    font-size: 15px;
    margin-bottom: 20px;
  }
  .tag-row{ display:flex; flex-wrap:wrap; gap:8px; }
  .tag{
    font-family:'JetBrains Mono',monospace;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 6px;
    background: var(--bg-alt);
    color: var(--ink-soft);
    border: 1px solid var(--line);
  }

  .tool-cloud{
    margin-top: 40px;
    display:flex;
    flex-wrap:wrap;
    gap: 10px;
    justify-content:center;
  }
  .tool-cloud .tag{ background: var(--card); }

  /* ---------- PROJECTS ---------- */
  .project-grid{
    display:grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
  }
  .project-card{
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow:hidden;
    transition: transform .3s var(--ease), box-shadow .3s var(--ease);
  }
  .project-card:hover{
    transform: translateY(-6px);
    box-shadow: 0 30px 50px -26px rgba(20,24,31,0.28);
  }
  .project-thumb{
    height: 170px;
    position: relative;
    overflow: hidden;
  }
  .project-thumb::before{
    content:'';
    position:absolute; inset:0;
  }
  .thumb-1::before{ background: linear-gradient(135deg,#0F9D8B 0%, #12161C 130%); }
  .thumb-2::before{ background: linear-gradient(135deg,#F0A63B 0%, #14181F 130%); }
  .thumb-3::before{ background: linear-gradient(135deg,#6CA0F5 0%, #14181F 130%); }
  .thumb-4::before{ background: linear-gradient(135deg,#0F9D8B 10%, #F0A63B 100%); }
  .project-thumb-mark{
    position:absolute;
    right: 18px; bottom: 14px;
    font-family:'JetBrains Mono',monospace;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    letter-spacing: 0.02em;
  }
  .project-body{ padding: 24px 26px 28px; }
  .project-body h3{ font-size: 18.5px; margin-bottom: 8px; }
  .project-body p{ color: var(--ink-soft); font-size: 14.5px; margin-bottom: 16px; }
  .project-links{
    display:flex;
    gap: 18px;
    font-size: 13.5px;
    font-weight: 600;
  }
  .project-links a{
    color: var(--accent-ink);
    display:inline-flex;
    align-items:center;
    gap:5px;
  }
  .project-links a:hover{ text-decoration: underline; }
  .project-thumb img{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
  }
  .project-details-btn{
    color: var(--accent-ink);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
  }
  .project-details-btn:hover{ text-decoration: underline; }

  .project-modal{
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
  }
  .project-modal[hidden]{ display: none; }
  .project-modal-backdrop{
    position: absolute;
    inset: 0;
    background: rgba(20, 24, 31, 0.72);
    backdrop-filter: blur(4px);
  }
  .project-modal-panel{
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: min(88vh, 900px);
    overflow: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 30px 60px -24px rgba(20, 24, 31, 0.45);
  }
  .project-modal-close{
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
  }
  .project-modal-image{
    height: 220px;
    overflow: hidden;
    position: relative;
  }
  .project-modal-image img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .project-modal-image-fallback::before{
    content: '';
    position: absolute;
    inset: 0;
  }
  .project-modal-body{
    padding: 28px 30px 32px;
  }
  .project-modal-views{
    font-size: 12px;
    color: var(--ink-faint);
    margin-bottom: 10px;
  }
  .project-modal-body h3{
    font-size: 24px;
    margin-bottom: 12px;
  }
  .project-modal-description{
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 18px;
  }
  body.modal-open{ overflow: hidden; }

  /* ---------- PROCESS ---------- */
  .process{
    display:grid;
    grid-template-columns: repeat(3,1fr);
    gap: 32px;
  }
  .process-step{ position: relative; padding-left: 0; }
  .process-num{
    font-family:'JetBrains Mono',monospace;
    font-size: 13px;
    color: var(--accent-ink);
    margin-bottom: 14px;
    display:block;
  }
  .process-step h3{ font-size: 18px; margin-bottom: 10px; }
  .process-step p{ color: var(--ink-soft); font-size: 15px; }

  /* ---------- CONTACT ---------- */
  .contact-grid{
    display:grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 56px;
    align-items:start;
  }
  .field{
    margin-bottom: 18px;
  }
  .field label{
    display:block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--ink-soft);
  }
  .field input, .field textarea{
    width: 100%;
    padding: 13px 16px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    font-family: 'Inter', sans-serif;
    font-size: 14.5px;
    color: var(--ink);
    transition: border-color .2s;
  }
  .field input:focus, .field textarea:focus{
    border-color: var(--accent);
    outline: none;
  }
  .field textarea{ resize: vertical; min-height: 120px; }
  .form-note{
    font-size: 12.5px;
    color: var(--ink-faint);
    margin-top: 10px;
  }
  .form-success{
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(15, 157, 139, 0.12);
    border: 1px solid rgba(15, 157, 139, 0.35);
    color: #0a7a6c;
    font-size: 14.5px;
    line-height: 1.45;
  }
  .form-error{
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(220, 60, 60, 0.08);
    border: 1px solid rgba(220, 60, 60, 0.28);
    color: #b42318;
    font-size: 14.5px;
  }
  .field-error{
    margin-top: 6px;
    font-size: 12.5px;
    color: #b42318;
  }

  .contact-card{
    background: var(--ink);
    color: var(--bg);
    border-radius: var(--radius);
    padding: 34px 30px;
  }
  .contact-card h3{
    font-size: 18px;
    color: #fff;
    margin-bottom: 6px;
  }
  .contact-card > p{
    color: #9AA1A8;
    font-size: 14px;
    margin-bottom: 26px;
  }
  .contact-list{ display:flex; flex-direction:column; gap: 4px; }
  .contact-list a{
    display:flex;
    align-items:center;
    justify-content: space-between;
    padding: 14px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.09);
    font-size: 14.5px;
    font-weight: 500;
    color: #fff;
    transition: gap .2s, color .2s;
  }
  .contact-list a:last-child{ border-bottom: none; }
  .contact-list a span.arrow{
    color: var(--accent);
    transition: transform .2s var(--ease);
  }
  .contact-list a:hover span.arrow{ transform: translateX(4px); }
  .contact-list small{
    display:block;
    color: #7C8590;
    font-size: 12px;
    font-weight: 400;
    margin-top: 2px;
  }

  /* ---------- FOOTER ---------- */
  footer{
    padding: 34px 0;
    border-top: 1px solid var(--line);
  }
  .footer-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    font-size: 13px;
    color: var(--ink-faint);
  }
  .back-top{
    font-family:'JetBrains Mono',monospace;
    color: var(--ink-soft);
  }
  .back-top:hover{ color: var(--accent-ink); }

  /* ---------- SCROLL REVEAL ---------- */
  .reveal{
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .7s var(--ease), transform .7s var(--ease);
  }
  .reveal.in{ opacity: 1; transform: translateY(0); }

  /* ---------- RESPONSIVE ---------- */
  @media (max-width: 860px){
    .hero-inner{ grid-template-columns: 1fr; gap: 44px; }
    .terminal{ transform: none; }
    .skill-grid{ grid-template-columns: 1fr; }
    .project-grid{ grid-template-columns: 1fr; }
    .process{ grid-template-columns: 1fr; gap: 28px; }
    .contact-grid{ grid-template-columns: 1fr; gap: 36px; }
    .nav-links{
      position: fixed;
      top: 64px; right: 24px; left: 24px;
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 14px;
      flex-direction: column;
      align-items: flex-start;
      padding: 18px 20px;
      gap: 6px;
      box-shadow: 0 20px 40px -20px rgba(0,0,0,0.25);
      transform: translateY(-12px);
      opacity: 0;
      pointer-events: none;
      transition: opacity .25s var(--ease), transform .25s var(--ease);
    }
    .nav-links.open{
      transform: translateY(0);
      opacity: 1;
      pointer-events: auto;
    }
    .nav-links a{ padding: 10px 0; width:100%; }
    .nav-toggle{
      display:flex;
      flex-direction:column;
      gap:5px;
      background:none;
      border:none;
      cursor:pointer;
      padding: 6px;
    }
    .nav-toggle span{
      width: 22px; height: 2px;
      background: var(--ink);
      border-radius: 2px;
      transition: transform .25s, opacity .25s;
    }
    .section-pad{ padding: 80px 0; }
    .wrap{ padding: 0 22px; }
    .project-modal{ padding: 16px; }
    .project-modal-body{ padding: 22px 20px 26px; }
    .project-modal-image{ height: 180px; }
  }

  @media (prefers-reduced-motion: reduce){
    *{ animation: none !important; transition: none !important; }
    .reveal{ opacity: 1; transform: none; }
  }