/* ---------- Design tokens ---------- */
:root {
  --bg: #faf7f0;
  --bg-raised: #f3efe4;
  --fg: #111113;
  --muted: #5b5f68;
  --border: #e6e0d2;
  --accent: #14161a;
  --accent-fg: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --radius: 10px;
  --max-width: 1100px;
  --font-display: "Syne", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Light mode is always the default (regardless of OS preference) — dark mode
   only applies once a visitor explicitly opts in via the toggle. */
:root[data-theme="dark"] {
  --bg: #121214;
  --bg-raised: #1b1c1f;
  --fg: #f0f0f2;
  --muted: #a3a7b0;
  --border: #2c2d31;
  --accent: #f0f0f2;
  --accent-fg: #121214;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

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

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

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

.site-nav .brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.site-nav .brand:hover { text-decoration: none; }

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

.nav-links a {
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 6px;
}
.nav-links a:hover {
  background: var(--bg-raised);
  text-decoration: none;
}

.nav-toggle,
.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--fg);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.theme-toggle:hover, .nav-toggle:hover { border-color: var(--accent); }

.nav-toggle { display: none; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline; }

/* ---------- Sections ---------- */
.section {
  padding-top: 56px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--border);
}
.section:last-of-type { border-bottom: none; }

.section h2 {
  font-size: 22px;
  margin: 0 0 24px;
}

.eyebrow {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.muted { color: var(--muted); }

/* ---------- Hero / About ---------- */
.hero {
  padding-top: 64px;
  padding-bottom: 48px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: clamp(32px, 6vw, 56px);
  margin: 0 0 10px;
}
.hero .tagline {
  color: var(--muted);
  font-size: 17px;
  margin: 0 0 18px;
}
.hero .bio {
  max-width: 65ch;
  margin: 0 0 24px;
}

.contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover { opacity: 0.92; }

.nav-resume {
  padding: 8px 14px;
  font-size: 13.5px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 26px;
  font-size: 14.5px;
}
.hero-meta a { color: var(--muted); }
.hero-meta a:hover { color: var(--fg); }

/* ---------- Experience / Education ---------- */
.entry {
  padding: 18px 0;
  border-top: 1px solid var(--border);
}
.entry:first-child { border-top: none; padding-top: 0; }

.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 4px;
}
.entry-head h3 { margin: 0; font-size: 17px; }
.entry-dates { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.entry-sub { color: var(--muted); font-size: 14px; margin: 0 0 10px; }

.entry ul {
  margin: 0;
  padding-left: 20px;
}
.entry li { margin-bottom: 6px; }
.entry li:last-child { margin-bottom: 0; }

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}
.project-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.project-card .thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: var(--border);
  border-bottom: 1px solid var(--border);
  display: block;
}

/* A wrapper around an image/thumb that overlays a status label on top of it,
   e.g. "Under Construction" over a placeholder image. */
.image-overlay-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
}
.image-overlay-wrap .overlay-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: clamp(18px, 6vw, 60px);
  line-height: 1.05;
  text-align: center;
  padding: 0 14px;
  overflow-wrap: break-word;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7), 0 0 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
/* Smaller cap in the project-card thumb, which is roughly half the width
   of the full hero image — vw-based sizing alone would overflow it. */
.project-card .image-overlay-wrap .overlay-label {
  font-size: clamp(16px, 5vw, 28px);
}

.project-card .body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-card h3 { margin: 0 0 6px; font-size: 16.5px; }
.project-card p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.tag {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--bg);
}

.project-card .view-link {
  margin-top: auto;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.skill-group h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 10px;
}
.skill-group .tag-row { margin-bottom: 0; }

/* ---------- Footer ---------- */
.site-footer {
  padding-top: 32px;
  padding-bottom: 48px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.site-footer .contact-row { justify-content: center; margin-bottom: 12px; }

/* ---------- Project detail pages ---------- */
.project-header { padding-top: 48px; padding-bottom: 24px; }
.back-link { font-size: 14px; font-weight: 600; display: inline-block; margin-bottom: 18px; }
.project-header h1 { font-size: clamp(26px, 4.5vw, 34px); margin: 0 0 8px; }
.project-meta { color: var(--muted); font-size: 14.5px; margin: 0 0 18px; }

.hero-image {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  background: var(--bg-raised);
}
.project-header .image-overlay-wrap {
  margin-bottom: 8px;
}
.project-header .image-overlay-wrap .hero-image {
  margin-bottom: 0;
}
.image-note {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 32px;
}

.project-body h2 {
  font-size: 19px;
  margin: 32px 0 12px;
}
.project-body p { margin: 0 0 14px; max-width: 70ch; }
.project-body ul { padding-left: 20px; }
.project-body li { margin-bottom: 8px; }

/* Two independent columns (not a grid) so images of very different aspect
   ratios can sit next to each other without one row stretching to match
   the tallest neighbor and leaving a gap under the shorter image. */
.gallery {
  display: flex;
  gap: 12px;
  margin: 16px 0 8px;
  align-items: flex-start;
}
.gallery-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.gallery img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  display: block;
}
.gallery figcaption {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
}
.gallery figure { margin: 0; }

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 40px;
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .nav-links {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 20px 14px;
    display: none;
    gap: 2px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 6px; }
  .nav-toggle { display: inline-flex; }

  .projects-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .gallery { flex-direction: column; }
}
