/* ===========================================================
   Design tokens
=========================================================== */
:root {
  --bg: #eef0f4;
  --surface: #eef0f4;
  --surface-raised: #f7f8fb;
  --shadow-dark: #cdd2dc;
  --shadow-light: #ffffff;
  --text-primary: #232830;
  --text-muted: #5c6472;
  --text-faint: #8a93a3;
  --accent: #0d9488;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --accent-2: #ea580c;
  --border-hair: rgba(35, 40, 48, 0.08);

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --max-width: 1180px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(18px, 5vw, 32px);
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ===========================================================
   Neomorphic primitives
=========================================================== */
.neo-raised {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow:
    8px 8px 18px var(--shadow-dark),
    -8px -8px 18px var(--shadow-light);
}

.neo-pressed {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow:
    inset 6px 6px 14px var(--shadow-dark),
    inset -6px -6px 14px var(--shadow-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 500;
  padding: 15px 30px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
}
.btn:hover { transform: translateY(-2px); }
.btn:active {
  transform: translateY(0);
  box-shadow: inset 4px 4px 10px var(--shadow-dark), inset -4px -4px 10px var(--shadow-light);
}
.btn-primary { color: var(--bg); background: var(--accent); box-shadow: 0 10px 24px -8px rgba(94, 234, 212, 0.45); }
.btn-primary:hover { box-shadow: 0 14px 28px -8px rgba(94, 234, 212, 0.55); }

/* ===========================================================
   Type
=========================================================== */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; }

.section-heading {
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  margin-bottom: 14px;
}

.section-lede {
  color: var(--text-muted);
  max-width: 56ch;
  font-size: 1.05rem;
  margin-bottom: 52px;
}

.section-pad { padding: clamp(64px, 12vw, 120px) 0; }

/* ===========================================================
   Navbar
=========================================================== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(238, 240, 244, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-hair);
  box-shadow: 0 12px 30px -18px rgba(35, 40, 48, 0.18);
  transition: box-shadow 0.2s ease;
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}
.nav-mark {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.nav-mark span { color: var(--accent); }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
  position: relative;
  padding: 9px 16px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.94rem;
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.nav-links a:hover {
  color: var(--text-primary);
  background: var(--surface-raised);
  box-shadow: 3px 3px 8px var(--shadow-dark), -3px -3px 8px var(--shadow-light);
}
.nav-links a.active { color: var(--accent); }
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  transition: background 0.2s ease;
  position: relative;
  z-index: 101;
}
.nav-toggle:hover { background: var(--surface-raised); }
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--text-primary);
  transition: transform 0.28s ease, opacity 0.2s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(35, 40, 48, 0.32);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: opacity 0.3s ease, backdrop-filter 0.3s ease, -webkit-backdrop-filter 0.3s ease;
  z-index: 98;
}
.nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

@media (max-width: 860px) {
  .nav-backdrop { display: block; }
  .nav-links {
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    width: min(78vw, 320px);
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 6px;
    background: var(--surface-raised);
    border-left: 1px solid var(--border-hair);
    border-radius: 20px 0 0 20px;
    box-shadow: -18px 0 40px -20px rgba(35, 40, 48, 0.35), -1px 0 0 rgba(255, 255, 255, 0.4) inset;
    padding: 32px 22px;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 99;
    overflow: hidden;
  }
  .nav-links.open { transform: translateX(0); }
  .nav-links a {
    display: block;
    text-align: left;
    padding: 16px 18px;
    font-size: 1.08rem;
    font-weight: 600;
    border-radius: 14px;
  }
  .nav-toggle { display: flex; }
}

/* ===========================================================
   Hero
=========================================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 76px;
  position: relative;
}
.hero .container {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.hero-eyebrow::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.hero h1 {
  font-size: clamp(2.6rem, 5.4vw, 4.2rem);
  margin-bottom: 22px;
}
.hero h1 .accent-underline {
  position: relative;
  display: inline-block;
}
.hero h1 .accent-underline::after {
  content: '';
  position: absolute;
  left: 2px; right: 2px; bottom: 6px;
  height: 0.28em;
  background: var(--accent-soft);
  z-index: -1;
  border-radius: 4px;
}
.hero-tagline {
  color: var(--text-muted);
  font-size: 1.12rem;
  max-width: 52ch;
  margin-bottom: 38px;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

.hero-canvas-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 560px;
}
#hero-canvas { width: 100%; height: 100%; display: block; }

@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; text-align: left; }
  .hero-canvas-wrap { order: -1; max-height: 340px; }
}

/* ===========================================================
   About
=========================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 64px;
  align-items: start;
}
.about-portrait {
  aspect-ratio: 4/5;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.about-portrait img { width: 100%; height: 100%; object-fit: cover; }
.about-portrait .placeholder-mono {
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px;
}
.about-body p { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 18px; max-width: 62ch; }
.about-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 34px; }
.about-stat { padding: 22px 18px; }
.about-stat .num { font-family: var(--font-display); font-size: 1.7rem; color: var(--accent); }
.about-stat .label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-portrait { max-width: 320px; }
}

/* ===========================================================
   Skills
=========================================================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 20px;
}
.skill-tile { padding: 24px; }
.skill-tile-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.skill-tile-top .name { font-family: var(--font-display); font-size: 1.05rem; }
.skill-tile-top .pct { color: var(--accent); font-family: var(--font-mono); font-size: 0.85rem; }
.skill-bar-track {
  height: 8px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
  overflow: hidden;
}
.skill-bar-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
  width: 0%;
  transition: width 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}
.skill-tile.in-view .skill-bar-fill { width: var(--fill); }

/* ===========================================================
   Projects
=========================================================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 28px;
}
.project-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.project-card:hover { transform: translateY(-6px); }
.project-media {
  aspect-ratio: 16/10;
  background: linear-gradient(135deg, var(--surface-raised), var(--surface));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.project-media img { width: 100%; height: 100%; object-fit: cover; }
.project-media .no-image {
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: 0.8rem;
}
.project-body { padding: 26px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.project-body h3 { font-size: 1.2rem; }
.project-body p { color: var(--text-muted); font-size: 0.95rem; flex: 1; }
.project-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.project-tags span {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 5px 11px;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-muted);
  box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
}
.project-links { display: flex; gap: 14px; margin-top: 4px; }
.project-links a {
  font-size: 0.9rem;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.project-links a:hover { text-decoration: underline; }

/* ===========================================================
   Experience timeline
=========================================================== */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border-hair);
}
.timeline-item { position: relative; padding-bottom: 40px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -32px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline-item .period { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); margin-bottom: 6px; display: block; }
.timeline-item h3 { font-size: 1.12rem; margin-bottom: 4px; }
.timeline-item .org { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 10px; }
.timeline-item p { color: var(--text-muted); font-size: 0.95rem; max-width: 60ch; }

/* ===========================================================
   Contact
=========================================================== */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.contact-form { padding: 36px; }
.form-row { margin-bottom: 20px; }
.form-row label { display: block; font-size: 0.86rem; color: var(--text-muted); margin-bottom: 8px; }
.form-row input, .form-row textarea {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  box-shadow: inset 4px 4px 10px var(--shadow-dark), inset -4px -4px 10px var(--shadow-light);
}
.form-row input:focus, .form-row textarea:focus { outline: none; box-shadow: inset 4px 4px 10px var(--shadow-dark), inset -4px -4px 10px var(--shadow-light), 0 0 0 2px var(--accent); }
.form-row textarea { resize: vertical; min-height: 130px; }
.form-status { margin-top: 16px; font-size: 0.92rem; min-height: 1.2em; }
.form-status.success { color: var(--accent); }
.form-status.error { color: var(--accent-2); }

/* Honeypot: off-screen but still in the DOM/tab order-excluded, so bots that
   blindly fill every input still trip it, while it stays invisible and
   unreachable for real (including keyboard/screen-reader) users. */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-side h3 { font-size: 1.3rem; margin-bottom: 14px; }
.contact-side p { color: var(--text-muted); margin-bottom: 28px; max-width: 46ch; }
.social-links { display: flex; gap: 12px; flex-wrap: wrap; }
.social-links a {
  width: 50px; height: 50px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease;
}
.social-links a:hover { color: var(--accent); transform: translateY(-3px); }

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

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { justify-content: center; }
  .about-stats { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .about-stat { padding: 16px 10px; text-align: center; }
  .about-stat .num { font-size: 1.4rem; }
  .contact-form { padding: 24px 20px; }
  .project-body { padding: 20px; }
  .skill-tile { padding: 20px; }
}

/* ===========================================================
   Footer
=========================================================== */
footer {
  padding: 44px 0;
  border-top: 1px solid var(--border-hair);
  text-align: center;
  color: var(--text-faint);
  font-size: 0.88rem;
}

/* ===========================================================
   Reveal-on-scroll (single orchestrated pattern, used once per section)
=========================================================== */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in-view { opacity: 1; transform: translateY(0); }