/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --ink: #14171c;
  --ink-soft: #3a3f46;
  --paper: #f3f4f1;
  --paper-card: #ffffff;
  --line: #d9dad4;
  --muted: #6b6f72;
  --green: #1c9a53;
  --green-soft: #e6f3ea;
  --amber: #d98c2b;

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --max: 1140px;
  --gutter: clamp(20px, 5vw, 64px);
  --radius: 10px;
}

/* ==========================================================================
   Reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
.mono { font-family: var(--font-mono); }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 10px 16px; z-index: 999;
}
.skip-link:focus { left: 16px; top: 16px; }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

/* ==========================================================================
   Background blueprint grid
   ========================================================================== */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(20,23,28,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20,23,28,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, black 60%, transparent 100%);
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */
.section-inner, .nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  position: relative;
  z-index: 1;
}
.section { padding: clamp(64px, 10vw, 120px) 0; border-top: 1px solid var(--line); }

.eyebrow {
  display: inline-block;
  color: var(--green);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.section-head h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 600;
}
.section-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}
.section-note code {
  font-family: var(--font-mono);
  background: var(--paper-card);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   Reveal-on-scroll
   ========================================================================== */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   Nav
   ========================================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(243, 244, 241, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-brand {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
}
.nav-brand .dot { color: var(--green); }
.nav-links { display: flex; gap: 28px; font-size: 0.92rem; }
.nav-links a { color: var(--ink-soft); transition: color 0.2s ease; }
.nav-links a:hover { color: var(--ink); }
.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-cta {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  border: 1px solid var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav-cta:hover { background: var(--ink); color: var(--paper); }
@media (max-width: 720px) {
  .nav-links { display: none; }
}

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.lang-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.lang-btn:hover { color: var(--ink); }
.lang-btn.active { background: var(--ink); color: var(--paper); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(48px, 9vw, 96px) var(--gutter) clamp(64px, 9vw, 100px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
}
.hero-inner { grid-column: 1; max-width: 640px; }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 22px;
}
.meta-sep { opacity: 0.5; }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--green); }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(28,154,83,0.5);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(28,154,83,0.45); }
  70% { box-shadow: 0 0 0 8px rgba(28,154,83,0); }
  100% { box-shadow: 0 0 0 0 rgba(28,154,83,0); }
}
.hero-title {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 700;
  line-height: 0.98;
  margin-bottom: 24px;
}
.hero-lede {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--ink-soft);
  max-width: 54ch;
  margin-bottom: 28px;
}
.hero-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.88rem;
  margin-bottom: 16px;
}
.hero-contact a {
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.hero-contact a:hover { border-color: var(--ink); }
.hero-tags { font-size: 0.78rem; color: var(--muted); }

/* gauge */
.gauge-wrap {
  grid-column: 2;
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.gauge { transform: rotate(-90deg); }
.gauge-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 10;
}
.gauge-value {
  fill: none;
  stroke: var(--green);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 540.35;
  stroke-dashoffset: 540.35;
  transition: stroke-dashoffset 1.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.gauge-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.gauge-number {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
}
.gauge-caption {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.3;
}
@media (max-width: 780px) {
  .hero { grid-template-columns: 1fr; }
  .gauge-wrap { grid-column: 1; width: 140px; height: 140px; margin-top: 8px; }
  .gauge { width: 140px; height: 140px; }
  .gauge-number { font-size: 1.9rem; }
}

/* ==========================================================================
   Skills sheet
   ========================================================================== */
.skills-sheet {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-card);
  overflow: hidden;
  margin-top: 32px;
}
.skills-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  padding: 16px 22px;
}
.skills-row + .skills-row { border-top: 1px solid var(--line); }
.skills-key { color: var(--green); font-size: 0.82rem; }
.skills-val { color: var(--ink-soft); font-size: 0.95rem; }
@media (max-width: 640px) {
  .skills-row { grid-template-columns: 1fr; gap: 4px; }
}

/* stat strip */
.stat-strip {
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat {
  background: var(--paper-card);
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-num-row { display: flex; align-items: baseline; gap: 2px; }
.stat-num, .stat-num-text {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--ink);
}
.stat-plus { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; }
.stat-label {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}
@media (max-width: 780px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   Projects grid
   ========================================================================== */
.projects-grid {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.project-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--ink);
  box-shadow: 0 12px 28px rgba(20,23,28,0.08);
}
.project-thumb {
  aspect-ratio: auto;
  border-radius: 6px;
  background: linear-gradient(135deg, #eceee9, #e2e4de);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  overflow: hidden;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.project-name { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.project-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--green);
  background: var(--green-soft);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.project-note { color: var(--muted); font-size: 0.85rem; }
.project-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.project-link:hover .arrow { transform: translateX(3px); }
.arrow { transition: transform 0.2s ease; }

/* ==========================================================================
   Timeline
   ========================================================================== */
.timeline {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
}
.tl-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 28px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}
.tl-item:first-child { border-top: 1px solid var(--line); }
.tl-when { color: var(--muted); font-size: 0.82rem; padding-top: 4px; }
.tl-body h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 4px; }
.tl-company { color: var(--green); font-size: 0.82rem; margin-bottom: 12px; }
.tl-body ul { display: flex; flex-direction: column; gap: 8px; }
.tl-body li {
  position: relative;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.5;
}
.tl-body li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.65em;
  width: 6px; height: 1px;
  background: var(--ink-soft);
}
.tl-inline-note { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.tl-compact { padding: 20px 0; }
.tl-compact .tl-company { margin-bottom: 0; }
@media (max-width: 640px) {
  .tl-item { grid-template-columns: 1fr; gap: 8px; }
}

.thesis-card {
  margin-top: 40px;
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--paper-card);
}
.thesis-card h3 { font-size: 1.1rem; margin: 6px 0 10px; font-weight: 600; }
.thesis-card .mono { color: var(--muted); font-size: 0.85rem; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  border-top: 1px solid var(--line);
  padding: clamp(56px, 9vw, 96px) 0 40px;
  background: var(--ink);
  color: var(--paper);
}
.footer .eyebrow { color: #63d68f; }
.footer h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  margin-bottom: 24px;
  max-width: 16ch;
}
.footer-contact { display: flex; gap: 22px; flex-wrap: wrap; font-size: 1rem; margin-bottom: 14px; }
.footer-contact a { border-bottom: 1px solid rgba(243,244,241,0.3); padding-bottom: 2px; }
.footer-contact a:hover { border-color: var(--paper); }
.footer-links { display: flex; gap: 18px; font-size: 0.85rem; color: rgba(243,244,241,0.6); }
.footer-links a:hover { color: var(--paper); }
.footer-note {
  margin-top: 56px;
  color: rgba(243,244,241,0.45);
  font-size: 0.78rem;
}
.footer-inner { display: flex; flex-direction: column; }