/* =============================================
   VARIABLES
   ============================================= */
:root {
  --bg: #F9F8F6;
  --surface: #FFFFFF;
  --border: #E8E5E0;
  --text-primary: #1A1A1A;
  --text-secondary: #6B6B6B;
  --accent: #2D6A4F;
  --accent-rgb: 45, 106, 79;
  --accent-dim: #E8F4F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius-card: 12px;
  --radius-tag: 6px;
  --dur: 200ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0E0E0E;
  --surface: #161616;
  --border: #2A2A2A;
  --text-primary: #F0EFEC;
  --text-secondary: #888884;
  --accent: #52B788;
  --accent-rgb: 82, 183, 136;
  --accent-dim: #1A2E24;
  --shadow-sm: none;
  --shadow-md: none;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.6;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 32px;
}

section {
  padding: 96px 0;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 40px;
}

/* =============================================
   NAV
   ============================================= */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  z-index: 100;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              backdrop-filter var(--dur) var(--ease);
  border-bottom: 1px solid transparent;
}

#nav.scrolled {
  background: rgba(var(--bg-surface, 249,248,246), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
}

[data-theme="dark"] #nav.scrolled {
  background: rgba(14,14,14,0.85);
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color var(--dur) var(--ease);
}

.nav-links a:hover { color: var(--text-primary); }

.nav-resume {
  font-family: var(--font-mono);
  font-size: 0.75rem !important;
  color: var(--accent) !important;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: var(--radius-tag);
  padding: 3px 10px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease) !important;
}

.nav-resume:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent) !important;
}

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-secondary);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

#theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text-primary);
  transition: var(--dur) var(--ease);
}

/* =============================================
   HERO
   ============================================= */
#hero {
  max-width: 1000px;
  margin: 0 auto;
  padding: 120px 32px 72px;
}

.hero-content {
  max-width: 560px;
}

.hero-eyebrow {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.hero-name {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 20px;
}

.hero-line {
  font-style: italic;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 420px;
}

/* =============================================
   EXPERIENCE — flat list
   ============================================= */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.exp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.exp-row:first-child { border-top: 1px solid var(--border); }

.exp-entry { font-size: 0.9rem; }

.exp-company {
  font-weight: 500;
  color: var(--text-primary);
}

.exp-role {
  font-style: italic;
  color: var(--text-secondary);
}

.exp-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Tech tags */
.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-tag);
  padding: 2px 8px;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.timeline-card:hover .tag {
  border-color: rgba(var(--accent-rgb), 0.25);
}

/* =============================================
   SKILLS
   ============================================= */
#skills { background: var(--surface); }

.skill-tile-pipeline {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease);
  margin-bottom: 32px;
}

.skill-tile-pipeline:hover { border-color: rgba(var(--accent-rgb), 0.4); }

.tile-header {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.tile-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.tile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Pipeline grid — 4 steps + 3 arrows */
.pl-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  gap: 0 12px;
  align-items: start;
}

.pl-arrow {
  font-size: 0.9rem;
  color: var(--border);
  padding-top: 28px;
  align-self: start;
  transition: color 400ms;
}

.pl-step {
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0.35;
  transition: opacity 350ms var(--ease);
}

.pl-step.active { opacity: 1; }
.pl-step.done   { opacity: 0.65; }

.pl-step-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.pl-num {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--accent);
  opacity: 0.6;
}

.pl-step-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.pl-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 110px;
}

/* Step 01 — code */
.pl-code {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  line-height: 1.75;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}

.pl-code-line { display: block; white-space: pre; }

/* syntax */
.kw  { color: #2D6A4F; }
.fn  { color: #1A6B8A; }
.str { color: #8B5E3C; }
.op  { color: var(--text-secondary); }
.va  { color: var(--text-primary); }
.ty  { color: #6B3FA0; }

[data-theme="dark"] .kw  { color: #52B788; }
[data-theme="dark"] .fn  { color: #56CFE1; }
[data-theme="dark"] .str { color: #E9C46A; }
[data-theme="dark"] .ty  { color: #C3A6FF; }

/* Step 02 — vector bars */
.pl-vector {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 48px;
}

.pl-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  background: rgba(var(--accent-rgb), 0.25);
  transition: height 500ms var(--ease), background 300ms;
  min-height: 3px;
}

.pl-bar.pos { background: rgba(var(--accent-rgb), 0.6); }
.pl-bar.neg { background: rgba(var(--accent-rgb), 0.15); }

.pl-meta {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-secondary);
}

/* Step 03 — retrieved docs */
.pl-docs {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pl-doc {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-secondary);
  border-left: 2px solid var(--border);
  padding-left: 7px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 300ms, transform 300ms, border-color 300ms;
}

.pl-doc.shown {
  opacity: 1;
  transform: translateX(0);
  border-color: rgba(var(--accent-rgb), 0.4);
}

/* Step 04 — generated tags */
.pl-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-content: flex-start;
}

.pl-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 3px 9px;
  border-radius: var(--radius-tag);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  color: var(--accent);
  background: var(--accent-dim);
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 220ms, transform 220ms;
}

.pl-tag.shown { opacity: 1; transform: translateY(0); }

/* Skill tags row */
.skill-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
}

.skill-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-tag);
  padding: 4px 10px;
  cursor: default;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease),
              background var(--dur) var(--ease);
}

.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

@keyframes blink {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0; }
}

/* =============================================
   PROJECTS
   ============================================= */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(var(--accent-rgb), 0.3);
}

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.project-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
}

.project-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.active-badge {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
}

.ms-badge {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.project-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 8px;
}

.project-mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Camera scene visual */
.project-visual {
  flex-shrink: 0;
}

.camera-scene {
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-frame {
  position: relative;
  width: 100%;
  height: 110px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.bbox-anim {
  position: absolute;
  top: 12%;
  left: 12%;
  width: 45%;
  height: 70%;
  animation: bbox-pulse 3s ease-in-out infinite;
}

.bbox-anim-2 {
  top: 20%;
  left: 52%;
  width: 35%;
  height: 50%;
  animation-delay: 1.2s;
}

.bbox {
  width: 100%;
  height: 100%;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
}

.bbox-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  padding: 1px 4px;
  position: absolute;
  top: -1px;
  left: 0;
  transform: translateY(-100%);
  white-space: nowrap;
  border-radius: 2px;
}

@keyframes bbox-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Metrics visual */
.metrics-visual {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px 0 4px;
}

.metric-row {
  display: grid;
  grid-template-columns: 90px 1fr 36px;
  align-items: center;
  gap: 10px;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.metric-track {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  width: var(--w, 0);
  background: linear-gradient(90deg, var(--accent), rgba(var(--accent-rgb), 0.6));
  border-radius: 3px;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  text-align: right;
}

/* =============================================
   CONTACT
   ============================================= */
#contact {
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.contact-inner {
  text-align: center;
  padding: 16px 0;
}

.contact-heading {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.contact-email {
  font-size: 0.95rem;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: border-color var(--dur) var(--ease);
}

.contact-email:hover { border-bottom-color: var(--accent); }

/* =============================================
   FOOTER
   ============================================= */
footer {
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-text {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-icon-link {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  transition: color var(--dur) var(--ease);
}

.footer-icon-link:hover { color: var(--accent); }

.footer-resume {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  transition: color var(--dur) var(--ease);
}

.footer-resume:hover { color: var(--accent); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
  .pl-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 16px 12px;
  }
  .pl-arrow { display: none; }
}

@media (max-width: 768px) {
  #nav { padding: 0 24px; }

  .nav-links {
    position: fixed;
    top: 64px; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms var(--ease), padding 300ms var(--ease);
  }

  .nav-links.open {
    max-height: 320px;
    padding: 16px 0;
  }

  .nav-links a {
    padding: 12px 24px;
    width: 100%;
    text-align: center;
  }

  .nav-hamburger { display: flex; }

  section { padding: 56px 0; }

  #hero { padding: 110px 20px 60px; }

  .container { padding: 0 20px; }

  .exp-row { gap: 12px; }
  .exp-entry { font-size: 0.85rem; }

  .projects-grid { grid-template-columns: 1fr; }

  .footer-inner { flex-direction: column; gap: 12px; text-align: center; }
}

@media (max-width: 480px) {
  .about-stats { grid-template-columns: 1fr 1fr; }
  .rag-pipeline { gap: 2px; }
  .rag-icon { width: 34px; height: 34px; font-size: 0.7rem; }
}

/* =============================================
   REDUCED MOTION
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .bar-fill { transition: none; }
  .gauge-fill-arc { transition: none; }
}
