/* ==========================================================================
   Theme tokens (mirrors the Devstarter shadcn palette)
   ========================================================================== */
:root {
  --primary: #768c00;
  --primary-foreground: #f8f8f8;
  --background: #f8f8f8;
  --foreground: #030306;
  --card: #f1f1f5;
  --secondary: #e4e4eb;
  --muted-foreground: #55555b;
  --accent: #e4e4eb;
  --border: #d7d7de;
  --input: #d7d7de;
  --radius: 0.5rem;

  --font-body: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: max(1rem, env(safe-area-inset-left));
  --max: 80rem;
}

:root[data-theme="dark"] {
  --primary: #c8e928;
  --primary-foreground: #030308;
  --background: #030306;
  --foreground: #f8f8f8;
  --card: #050509;
  --secondary: #15151f;
  --muted-foreground: #7f7f86;
  --accent: #21202b;
  --border: #21202b;
  --input: #21202b;
}

/* ==========================================================================
   Base
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 4rem; }

body {
  font-family: var(--font-body);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color .3s, color .3s;
}

::selection { background: var(--primary); color: var(--primary-foreground); }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }

.container { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.mono { font-family: var(--font-mono); }
.display { font-weight: 700; letter-spacing: -0.05em; }
.muted { color: var(--muted-foreground); }
.primary { color: var(--primary); }
.section { padding-block: 6rem; border-top: 1px solid var(--border); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: 2.5rem; padding: 0 1.5rem; border-radius: calc(var(--radius) - 2px);
  font-size: .875rem; font-weight: 500; white-space: nowrap; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
}
.btn svg { width: 1rem; height: 1rem; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); text-transform: uppercase; }
.btn-primary:hover { background: color-mix(in oklab, var(--primary) 90%, transparent); }
.btn-outline { height: 2.25rem; padding: 0 1rem; background: var(--background); border-color: var(--border); }
.btn-outline:hover { background: var(--accent); }
.btn-resume {
  height: 2.25rem; padding: 0 1rem; font-family: var(--font-mono); font-size: .75rem;
  background: transparent; border-color: color-mix(in oklab, var(--primary) 50%, transparent);
  text-transform: none;
}
.btn-resume:hover {
  background: color-mix(in oklab, var(--primary) 10%, transparent);
  color: var(--primary); border-color: var(--primary);
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: calc(var(--radius) - 2px);
  background: none; border: 0; cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn svg { width: 1rem; height: 1rem; }
.icon-btn:hover { background: var(--accent); color: var(--primary); }

/* ==========================================================================
   Header
   ========================================================================== */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: color-mix(in oklab, var(--background) 80%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 4rem; text-transform: uppercase;
}
.logo { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.05em; }
.nav { display: none; gap: 2rem; font-size: .875rem; font-weight: 500; color: var(--muted-foreground); }
.nav a { transition: color .15s; }
.nav a:hover { color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: .5rem; }
@media (min-width: 768px) { .nav { display: flex; } }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; padding-top: 4rem; overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-bg::before {
  /* Tech grid + glow, in place of the template's photo */
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 75% 40%, color-mix(in oklab, var(--primary) 22%, transparent), transparent 55%),
    linear-gradient(color-mix(in oklab, var(--primary) 12%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in oklab, var(--primary) 12%, transparent) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom,
    color-mix(in oklab, var(--background) 80%, transparent),
    color-mix(in oklab, var(--background) 50%, transparent),
    var(--background));
}
.hero .container { position: relative; z-index: 10; width: 100%; }
.hero-grid { display: grid; gap: 3rem; align-items: center; }
.hero-copy > * + * { margin-top: 1.5rem; }

.status-pill {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .25rem .75rem; border-radius: 999px;
  border: 1px solid color-mix(in oklab, var(--primary) 30%, transparent);
  background: color-mix(in oklab, var(--primary) 5%, transparent);
  color: var(--primary); font-family: var(--font-mono); font-size: .75rem;
}
.ping { position: relative; display: flex; width: .5rem; height: .5rem; }
.ping::before, .ping::after {
  content: ""; position: absolute; inset: 0; border-radius: 999px; background: var(--primary);
}
.ping::before { opacity: .75; animation: ping 1s cubic-bezier(0,0,.2,1) infinite; }
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }

.hero h1 { font-size: 3.75rem; line-height: .9; }
.gradient-text {
  background: linear-gradient(to right, var(--primary), var(--foreground));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cursor { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-lede { max-width: 28rem; line-height: 1.625; }
.hero-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding-top: 1rem; }
.socials { display: flex; gap: .5rem; }

.hud {
  display: none; position: relative; height: 500px; padding: 2rem;
  border: 1px solid color-mix(in oklab, var(--border) 30%, transparent);
  background: color-mix(in oklab, var(--card) 10%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.corner { position: absolute; width: 1rem; height: 1rem; border: 0 solid var(--primary); }
.corner.tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.corner.tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.corner.bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }
.hud-inner {
  height: 100%; display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--font-mono); font-size: .75rem; color: var(--muted-foreground);
}
.row { display: flex; justify-content: space-between; }
.meters > * + * { margin-top: .5rem; }
.bar { height: 4px; width: 100%; background: var(--secondary); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); width: 0; transition: width 1.2s ease-out; }
.hud-count { text-align: right; }
.hud-count strong { display: block; font-size: 2.25rem; color: var(--foreground); }

@media (min-width: 768px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 6rem; }
  .hero-lede { font-size: 1.25rem; }
  .hud { display: block; }
}

/* ==========================================================================
   Section heading
   ========================================================================== */
.section-head { display: grid; gap: 1rem; margin-bottom: 4rem; }
.section-head h2 { font-size: 2.25rem; line-height: 1; margin-bottom: 1rem; }
.rule { height: 4px; width: 6rem; background: var(--primary); }
.section-head p { max-width: 24rem; }
@media (min-width: 768px) { .section-head h2 { font-size: 3.75rem; } }

/* ==========================================================================
   Projects
   ========================================================================== */
.projects-grid {
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}
.card {
  display: grid; grid-template-rows: auto 1fr auto; gap: 1.5rem; padding-bottom: 1.5rem;
  background: var(--card); border: 1px solid var(--border); overflow: hidden;
  transition: border-color .3s;
}
.card:hover { border-color: color-mix(in oklab, var(--primary) 50%, transparent); }
.card-media {
  position: relative; aspect-ratio: 1; overflow: hidden;
  border-bottom: 1px solid var(--border); background: var(--secondary);
}
.card-media:has(img) { background: var(--primary); }
.card-media img {
  /* Template duotone: grayscale image blended over the accent colour */
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(1); mix-blend-mode: luminosity; transition: transform .5s;
}
:root[data-theme="dark"] .card-media img { mix-blend-mode: darken; }
.card-art {
  /* Generated placeholder art; swap for an <img> when you have screenshots */
  position: absolute; inset: 0; transition: transform .5s;
  background:
    repeating-linear-gradient(var(--angle, 45deg),
      color-mix(in oklab, var(--primary) 18%, transparent) 0 1px, transparent 1px 14px),
    radial-gradient(circle at var(--pos, 30% 30%), color-mix(in oklab, var(--primary) 35%, transparent), transparent 60%);
}
.card-art span {
  position: absolute; left: 1.5rem; bottom: 1.25rem;
  font-family: var(--font-mono); font-size: 4rem; font-weight: 700;
  color: color-mix(in oklab, var(--foreground) 12%, transparent);
}
.card:hover .card-media img,
.card:hover .card-art { transform: scale(1.05); }
.card-media::after {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .3s;
  background: color-mix(in oklab, var(--primary) 5%, transparent);
}
.card:hover .card-media::after { opacity: 1; }
.card-body { display: grid; gap: 1rem; align-content: start; padding-inline: 1.5rem; }
.card-title { font-size: 1.5rem; transition: color .15s; }
.card:hover .card-title { color: var(--primary); }
.badges { display: flex; flex-wrap: wrap; gap: .5rem; }
.badge {
  padding: .125rem .5rem; border-radius: 999px; font-family: var(--font-mono); font-size: .75rem;
  font-weight: 500; background: var(--secondary);
}
.card-footer { display: flex; justify-content: space-between; padding-inline: 1.5rem; }
.card-link {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .875rem; font-weight: 700; letter-spacing: -0.05em; transition: color .15s;
}
.card-link svg { width: 1rem; height: 1rem; }
.card-link:hover { color: var(--primary); }

/* ==========================================================================
   Skills
   ========================================================================== */
.skills { background: color-mix(in oklab, var(--secondary) 20%, transparent); }
.skills-grid { display: grid; gap: 3rem; }
.skills h2 { font-size: 2.25rem; margin-bottom: 1.5rem; }
.skills-intro p { margin-bottom: 2rem; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.tile {
  aspect-ratio: 1; padding: 1rem; display: flex; flex-direction: column; gap: .75rem;
  align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--background);
  font-family: var(--font-mono); font-size: .75rem; transition: border-color .15s;
}
.tile svg { width: 2rem; height: 2rem; color: var(--primary); }
.tile:hover { border-color: var(--primary); }
.stack-cols { display: grid; gap: 2rem; }
.stack-cols h3 {
  display: inline-block; font-size: 1.25rem; padding-bottom: .5rem; margin-bottom: 1.5rem;
  border-bottom: 1px solid color-mix(in oklab, var(--primary) 30%, transparent);
}
.stack-cols ul { list-style: none; }
.stack-cols li { display: flex; align-items: center; justify-content: space-between; }
.stack-cols li + li { margin-top: .75rem; }
.stack-cols li span { font-family: var(--font-mono); font-size: .875rem; color: var(--muted-foreground); transition: color .15s; }
.stack-cols li::after { content: ""; height: 2px; width: 3rem; background: var(--secondary); transition: background .15s; }
.stack-cols li:hover span { color: var(--foreground); }
.stack-cols li:hover::after { background: var(--primary); }
@media (min-width: 640px) { .stack-cols { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .skills-grid { grid-template-columns: 4fr 8fr; } }

/* ==========================================================================
   Blog / logs
   ========================================================================== */
.blog h2 { font-size: 2.25rem; margin-bottom: 3rem; text-transform: uppercase; }
.posts { display: grid; gap: 2rem; }
.post-head { display: grid; gap: 1rem; align-items: baseline; margin-bottom: .5rem; }
.post h3 { font-size: 1.5rem; text-wrap: balance; transition: color .15s; }
.post time, .post .meta { font-family: var(--font-mono); font-size: .75rem; color: var(--muted-foreground); white-space: nowrap; }
.post p { max-width: 42rem; margin-bottom: 1rem; }
.post .line { height: 1px; background: var(--border); transition: background .15s; }
.post:hover h3 { color: var(--primary); }
.post:hover .line { background: color-mix(in oklab, var(--primary) 50%, transparent); }
.center { text-align: center; margin-top: 3rem; }
@media (min-width: 768px) { .post-head { grid-template-columns: 1fr auto; } }

/* ==========================================================================
   Contact
   ========================================================================== */
.contact { background: var(--card); }
.contact-inner { max-width: 42rem; margin-inline: auto; }
.contact-head { text-align: center; margin-bottom: 3rem; }
.contact h2 { font-size: 2.25rem; margin-bottom: 1rem; }
.form { display: grid; gap: 1.5rem; }
.form-row { display: grid; gap: 1.5rem; }
.field { display: grid; gap: .5rem; }
.field label { font-family: var(--font-mono); font-size: .75rem; color: var(--muted-foreground); }
.field input, .field textarea {
  width: 100%; padding: .25rem .75rem; border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--input); outline: none; font-size: .875rem;
  background: color-mix(in oklab, var(--input) 30%, transparent);
  transition: border-color .15s, box-shadow .15s;
}
.field input { height: 2.25rem; }
.field textarea { min-height: 150px; padding-block: .5rem; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-foreground); }
.field input:focus-visible, .field textarea:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 50%, transparent);
}
.form .btn { width: 100%; }
.form-status { font-family: var(--font-mono); font-size: .75rem; text-align: center; color: var(--primary); min-height: 1rem; }
@media (min-width: 768px) { .form-row { grid-template-columns: 1fr 1fr; } }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer { border-top: 1px solid var(--border); }
.footer .container {
  padding-block: 2rem; display: flex; flex-direction: column; align-items: center; gap: 1rem;
  font-family: var(--font-mono); font-size: .75rem; color: var(--muted-foreground);
}
.footer nav { display: flex; gap: 1.5rem; }
.footer a:hover { color: var(--primary); }
@media (min-width: 768px) { .footer .container { flex-direction: row; justify-content: space-between; } }

/* ==========================================================================
   Reveal-on-scroll
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ==========================================================================
   Additions: HUD counters, card notes, experience
   ========================================================================== */
.meta { font-family: var(--font-mono); font-size: .75rem; color: var(--muted-foreground); }

.hud-counts { display: flex; justify-content: space-between; align-items: flex-end; }
.hud-counts > div:last-child { text-align: right; }
.hud-counts strong { display: block; font-size: 2.25rem; color: var(--foreground); }

.card-note {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-mono); font-size: .75rem; color: var(--muted-foreground);
}
.card-note svg { width: .875rem; height: .875rem; }

.exp-grid { display: grid; gap: 3rem; }
.exp-title { font-size: 2.25rem; margin-bottom: 1.5rem; }
.exp-intro { margin-bottom: 2.5rem; }
.exp-sub { font-size: .75rem; font-weight: 500; color: var(--primary); margin-bottom: 1rem; }
.edu { display: grid; gap: 1rem; margin-bottom: 2.5rem; }
.edu-item {
  display: grid; gap: .25rem; padding: 1rem;
  border: 1px solid var(--border); background: var(--background); transition: border-color .15s;
}
.edu-item:hover { border-color: var(--primary); }
.awards { list-style: none; display: grid; gap: .75rem; font-size: .875rem; }
.awards li { display: grid; grid-template-columns: 3rem 1fr; align-items: baseline; }
.awards a { text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--primary) 50%, transparent); text-underline-offset: 3px; }
.awards a:hover { color: var(--primary); }

.timeline { list-style: none; position: relative; display: grid; gap: 2.5rem; padding-left: 1.75rem; }
.timeline::before {
  content: ""; position: absolute; left: 4px; top: .5rem; bottom: .5rem; width: 1px; background: var(--border);
}
.job { position: relative; }
.job::before {
  content: ""; position: absolute; left: calc(-1.75rem); top: .3rem;
  width: 9px; height: 9px; background: var(--background); border: 2px solid var(--primary);
  transition: background .15s;
}
.job:hover::before { background: var(--primary); }
.job h3 { font-size: 1.375rem; margin: .375rem 0 .5rem; transition: color .15s; }
.job .at { color: var(--muted-foreground); font-weight: 500; letter-spacing: -0.02em; }
.job a.at:hover { color: var(--primary); }
.job p { max-width: 44rem; }

@media (min-width: 768px) { .exp-grid { grid-template-columns: 4fr 8fr; } }

@media (min-width: 1024px) { .projects-grid { grid-template-columns: repeat(3, 1fr); } }

/* ==========================================================================
   v4: ML-first hero, project filters, card facts, publication status
   ========================================================================== */
.kicker { display: block; font-family: var(--font-mono); font-size: .75rem; color: var(--primary); margin-bottom: .75rem; }
.btn-resume svg { width: .875rem; height: .875rem; }

/* Three focus areas at equal weight; sized so "MACHINE LEARNING" fits one line */
.hero .hero-title { font-size: clamp(2.25rem, 9.5vw, 3.75rem); line-height: .95; }
.hero-title > span { display: block; }
@media (min-width: 768px) { .hero .hero-title { font-size: clamp(2.5rem, 3.7vw, 3.6rem); } .hero-title > span { white-space: nowrap; } }

.focus { display: grid; gap: 1.25rem; }
.focus > div { display: grid; gap: .35rem; padding-left: .875rem; border-left: 2px solid var(--primary); }
.focus-k { color: var(--foreground); font-weight: 700; }
.focus-v { line-height: 1.6; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: -2rem 0 2.5rem; }
.filter {
  height: 2rem; padding: 0 .875rem; border-radius: 999px; cursor: pointer;
  font-family: var(--font-mono); font-size: .75rem; background: transparent;
  border: 1px solid var(--border); color: var(--muted-foreground); transition: all .15s;
}
.filter:hover { color: var(--primary); border-color: color-mix(in oklab, var(--primary) 50%, transparent); }
.filter.is-active { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.filter:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.project-group + .project-group { margin-top: 3.5rem; }
.project-group[hidden], .card[hidden] { display: none; }
.group-label { font-family: var(--font-mono); font-size: .75rem; font-weight: 500; color: var(--primary); margin-bottom: 1.25rem; }

.card-cats { font-family: var(--font-mono); font-size: .6875rem; color: var(--primary); letter-spacing: .04em; }
.facts { display: grid; gap: .75rem; font-size: .9375rem; }
.facts dt { font-family: var(--font-mono); font-size: .6875rem; text-transform: uppercase; color: var(--foreground); margin-bottom: -.5rem; }
.facts dd { color: var(--muted-foreground); line-height: 1.55; }

/* Publications */
.blog h2 { margin-bottom: 2.5rem; }
.blog .group-label { margin-top: 2.5rem; }
.blog .posts { gap: 1.75rem; }
.post h3 a { transition: color .15s; }
.post h3 a:hover { color: var(--primary); }
.post:hover h3 { color: inherit; }
.post .meta { margin-bottom: .5rem; white-space: normal; }
.status {
  font-family: var(--font-mono); font-size: .6875rem; padding: .125rem .5rem; white-space: nowrap;
  border: 1px solid color-mix(in oklab, var(--primary) 50%, transparent); color: var(--primary);
}
.post-links { display: flex; gap: 1.25rem; margin-top: -.5rem; font-family: var(--font-mono); font-size: .75rem; }
.post-links a { color: var(--foreground); }
.post-links a:hover { color: var(--primary); }
@media (min-width: 768px) { .post-head { align-items: start; } }

/* Experience: industry and research tracks */
.exp-tracks > .exp-sub { margin-top: 0; }
.exp-tracks > .timeline + .exp-sub { margin-top: 3rem; }
.exp-tracks .exp-sub { margin-bottom: 1.5rem; }

/* Skills: four balanced groups */
.stack-cols.four li span { font-size: .8125rem; }
@media (min-width: 640px) { .stack-cols.four { grid-template-columns: repeat(2, 1fr); row-gap: 2.5rem; } }
