/* ---------- Theme tokens ---------- */
:root {
  --bg: #f8fafc;
  --bg-alt: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --maxw: 1000px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --bg-alt: #111a2e;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #1e293b;
    --accent: #60a5fa;
    --accent-soft: rgba(96, 165, 250, 0.12);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --bg-alt: #111a2e;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #1e293b;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.12);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  z-index: 100;
}
.skip-link:focus { left: 8px; }

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

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.scrolled { border-bottom-color: var(--border); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.accent { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.icon-moon { display: block; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-moon { display: none; }
  :root:not([data-theme="light"]) .icon-sun { display: block; }
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--accent);
  transition: transform 0.15s, background-color 0.15s, color 0.15s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn-primary { color: #0b1120; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary { color: #0b1120; }
}
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-lg { padding: 16px 32px; font-size: 1rem; }

/* ---------- Hero ---------- */
.hero {
  min-height: calc(100vh - 68px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 40px;
  padding-bottom: 80px;
}
.eyebrow {
  font-family: var(--mono);
  color: var(--accent);
  margin: 0 0 12px;
}
.hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.tagline {
  font-size: clamp(1.6rem, 5vw, 3rem);
  font-weight: 600;
  color: var(--muted);
  margin-top: 8px;
  letter-spacing: -0.01em;
}
.lead {
  max-width: 560px;
  color: var(--muted);
  margin: 24px 0 32px;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; }

.social {
  display: flex;
  gap: 18px;
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
}
.social a { color: var(--muted); display: block; }
.social a:hover { color: var(--accent); }
.social svg { width: 22px; height: 22px; fill: currentColor; }
.social svg.stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Sections ---------- */
.section { padding: 90px 24px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 40px;
  white-space: nowrap;
}
.section-title::after {
  content: "";
  flex: 1;
  max-width: 280px;
  height: 1px;
  background: var(--border);
}
.section-title.center { justify-content: center; }
.section-title.center::after { display: none; }
.num { font-family: var(--mono); font-size: 0.7em; color: var(--accent); font-weight: 400; }

.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.tags li {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.tags.small li { font-size: 0.72rem; padding: 3px 9px; }

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 48px;
  align-items: start;
}
.about-text p { color: var(--muted); margin: 0 0 16px; }
.about-photo img,
.photo-placeholder {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--border);
}
.photo-placeholder {
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 4rem;
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), transparent), var(--bg-alt);
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
}
.skill-card h3 { font-size: 1.05rem; margin-bottom: 16px; }

/* Experience */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 24px;
  border-left: 2px solid var(--border);
}
.job { position: relative; padding-bottom: 40px; }
.job:last-child { padding-bottom: 0; }
.job::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.job-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
  margin-bottom: 10px;
}
.job-head h3 { font-size: 1.15rem; }
.at { color: var(--accent); font-weight: 500; }
.dates { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
.job-points { color: var(--muted); padding-left: 18px; margin: 0 0 14px; }
.job-points li { margin-bottom: 6px; }

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.project {
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}
.project:hover { transform: translateY(-4px); border-color: var(--accent); }
.project-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.folder {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}
.project-links { display: flex; gap: 14px; font-size: 0.9rem; font-weight: 500; }
.project h3 { font-size: 1.2rem; margin-bottom: 10px; }
.project p { color: var(--muted); font-size: 0.95rem; margin: 0 0 20px; flex: 1; }

/* Contact */
.contact { text-align: center; max-width: 640px; }
.contact p { color: var(--muted); margin: 0 0 36px; }

/* Footer */
.site-footer {
  text-align: center;
  padding: 32px 24px;
  font-size: 0.85rem;
  color: var(--muted);
  font-family: var(--mono);
}

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s, transform 0.6s; }
.js .reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .project:hover { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .section { padding: 64px 16px; }

  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 0 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; text-align: center; }
  .nav-links a { display: block; padding: 12px; }
  .nav-links .theme-toggle { margin: 8px auto 0; }

  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-photo { order: -1; }
  .about-photo img, .photo-placeholder { max-width: 200px; }

  .section-title { white-space: normal; }
}

/* Experience / education extras */
.job-meta { font-size: 0.85rem; color: var(--muted); margin: -6px 0 10px; }
.edu-card .job-head { margin-bottom: 0; }
.cta-row.center { justify-content: center; }

/* Headshot: portrait crop, keep face in frame */
.about-photo img {
  display: block;
  height: auto;
  aspect-ratio: 4 / 5;
  object-position: 50% 25%;
  box-shadow: var(--shadow);
}
.edu-card + .edu-card { margin-top: 16px; }

/* Expandable experience bullets */
.point-details summary {
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-weight: 500;
}
.point-details summary::-webkit-details-marker { display: none; }
.point-details summary::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 10px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.2s;
}
.point-details[open] > summary::after { transform: translateY(0) rotate(-135deg); }
.point-details summary:hover { color: var(--accent); }
.sub-points {
  /* Spacing is padding (not margin) so the open/close height animation includes it */
  padding: 10px 0 4px 18px;
  margin: 0;
  list-style: circle;
}
.sub-points li { margin-bottom: 6px; padding-left: 4px; }
/* No sub-bullets yet: render as a plain bullet */
.point-details:not(:has(.sub-points li)) summary { cursor: text; pointer-events: none; color: inherit; font-weight: inherit; }
.point-details:not(:has(.sub-points li)) summary::after { display: none; }
.point-details.closing > summary::after { transform: translateY(-3px) rotate(45deg); }
.drawer { overflow: hidden; }
