:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #5f5e58;
  --line: #e4e2da;
  --accent: #2f5d50;
  --accent-soft: #e3ece8;
  --ph-a: #e9ece7;
  --ph-b: #dfe5e0;
  --radius: 14px;
  --max: 1200px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1b1b1a;
    --text: #ecebe6;
    --muted: #a3a29b;
    --line: #2c2c2a;
    --accent: #8cc4b0;
    --accent-soft: #1f2d28;
    --ph-a: #1c211f;
    --ph-b: #222a27;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { line-height: 1.25; margin: 0; }
h1, h2 { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -0.01em; }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
}
.logo {
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
}
.nav nav { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.nav nav a { color: var(--muted); font-size: 0.95rem; }
.nav nav a:hover { color: var(--text); text-decoration: none; }
.nav nav a.nav-cv {
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.15rem 0.8rem;
  font-weight: 500;
}

/* Layout */
main { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }
section { padding: 4.5rem 0; border-top: 1px solid var(--line); }
section h2 { font-size: 1.9rem; margin-bottom: 2rem; }
.subhead { font-size: 1.05rem; margin: 2.5rem 0 1rem; }

/* Hero */
.hero {
  border-top: 0;
  padding: 5rem 0 4.5rem;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 2rem;
  align-items: center;
}
.portrait {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 30%;
  border: 4px solid var(--surface);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.12);
}
.eyebrow { color: var(--accent); font-weight: 500; margin: 0 0 0.4rem; font-size: 0.95rem; }
.hero h1 { font-size: clamp(2.5rem, 7vw, 4rem); }
.lede { color: var(--muted); font-size: 1.12rem; max-width: 40rem; margin: 1rem 0 0; }
.hero .chips { margin-top: 1.25rem; }
.cta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.75rem; }

.btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
  background: var(--surface);
  transition: transform .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
}

/* Projects: media and details alternate sides */
.projects { display: grid; }
.project:first-child { padding-top: 0; }
.project + .project { border-top: 1px solid var(--line); }
.project {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 2.75rem;
  padding: 3.25rem 0;
  align-items: center;
}
.project:nth-child(even) { grid-template-columns: 1fr 1.25fr; }
.project:nth-child(even) .media { order: 2; }

.media {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.07);
}
.media img, .media video { width: 100%; height: 100%; object-fit: cover; display: block; }

.placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(135deg, var(--ph-a), var(--ph-b));
}
.placeholder span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
}

.details .meta { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.5rem; }
.details h3 { font-size: 1.3rem; margin-bottom: 0.75rem; }
.details p { margin: 0 0 0.9rem; }
.badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 0.2rem 0.6rem;
}
.links { display: flex; gap: 1.25rem; font-weight: 500; }

/* Timelines */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1.5rem;
  padding: 1.1rem 0;
  border-bottom: 1px dashed var(--line);
}
.timeline li:last-child { border-bottom: 0; }
.when { color: var(--muted); font-size: 0.92rem; padding-top: 0.1rem; }
.timeline h3 { font-size: 1.05rem; margin-bottom: 0.25rem; }
.timeline p { margin: 0; color: var(--muted); }

/* Contact */
#contact .links { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: 0.7rem; }
#contact .links li { display: grid; grid-template-columns: 6rem 1fr; gap: 1rem; align-items: baseline; }
#contact .links span { color: var(--muted); font-size: 0.9rem; }
#contact .links a { font-weight: 500; font-size: 1.05rem; overflow-wrap: anywhere; }

footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav nav { gap: 0.85rem; }
  .nav nav a { font-size: 0.88rem; }
  .hero { grid-template-columns: 1fr; gap: 1.75rem; padding: 3rem 0; }
  .portrait { width: 110px; height: 110px; }
  section { padding: 3rem 0; }
  .project { padding: 2.25rem 0; }
  .project, .project:nth-child(even) { grid-template-columns: 1fr; gap: 1.25rem; }
  .project:nth-child(even) .media { order: 0; }
  .timeline li { grid-template-columns: 1fr; gap: 0.2rem; }
  #contact .links li { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 480px) {
  .nav { flex-wrap: nowrap; }
  .nav nav { flex-wrap: nowrap; gap: 0.75rem; }
  .nav-optional { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
