/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #f7f6f2;
  --bg-alt: #efede6;
  --surface: #ffffff;
  --text: #16171a;
  --text-muted: #5d6067;
  --border: #e2dfd6;
  --accent: #2f5d50;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(47, 93, 80, 0.1);

  --radius: 14px;
  --container: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 68px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f11;
    --bg-alt: #15171a;
    --surface: #1a1c20;
    --text: #ecebe6;
    --text-muted: #9a9ca3;
    --border: #2a2d33;
    --accent: #8fc7b4;
    --accent-contrast: #0e0f11;
    --accent-soft: rgba(143, 199, 180, 0.12);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0f11;
  --bg-alt: #15171a;
  --surface: #1a1c20;
  --text: #ecebe6;
  --text-muted: #9a9ca3;
  --border: #2a2d33;
  --accent: #8fc7b4;
  --accent-contrast: #0e0f11;
  --accent-soft: rgba(143, 199, 180, 0.12);
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.875rem, 3.6vw, 2.75rem); }
h3 { font-size: 1.375rem; }

p { margin: 0 0 1em; }
a { color: inherit; }
em { font-style: italic; color: var(--accent); }

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

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

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.narrow { max-width: 820px; }
.center { text-align: center; justify-content: center; }

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

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--border); }

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand-dot { color: var(--accent); }

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.9375rem;
}
.nav a {
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.2s var(--ease);
}
.nav a:hover { color: var(--text); }
.nav .nav-cta {
  color: var(--text);
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.nav .nav-cta:hover { border-color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.icon-btn:hover { border-color: var(--text); }
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Show the icon for the theme you'd switch to */
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

.menu-toggle { display: none; }
.menu-toggle span {
  grid-area: 1 / 1;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s var(--ease);
}
.menu-toggle span:first-child { transform: translateY(-3px); }
.menu-toggle span:last-child { transform: translateY(3px); }
.menu-toggle[aria-expanded="true"] span:first-child { transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { transform: rotate(-45deg); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: var(--accent-contrast); }
.btn-ghost { border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { padding: clamp(56px, 10vw, 120px) 0 clamp(48px, 7vw, 80px); }

.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 28px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fb27f;
  box-shadow: 0 0 0 4px rgba(63, 178, 127, 0.18);
}

.hero h1 { margin-bottom: 24px; }

.lead {
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  color: var(--text-muted);
  max-width: 56ch;
}
.center .lead { margin-left: auto; margin-right: auto; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.portrait-frame {
  position: relative;
  width: min(100%, 255px);
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background:
    radial-gradient(120% 80% at 20% 10%, var(--accent-soft), transparent 60%),
    var(--bg-alt);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.portrait-photo {
  display: block;
  width: calc(100% - 18px); /* 10px gray ring, incl. frame border */
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  border: 6px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border), 0 24px 48px -24px rgba(0, 0, 0, 0.35);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  column-gap: clamp(40px, 8vw, 96px);
  margin: clamp(56px, 8vw, 96px) 0 0;
  border-top: 1px solid var(--border);
}
.stats > div {
  padding: 24px 0 0;
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
}
.stats dt { font-size: 0.875rem; color: var(--text-muted); }
.stats dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  letter-spacing: -0.02em;
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding: clamp(72px, 10vw, 128px) 0; }
.section-alt { background: var(--bg-alt); }

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

.section-head { margin-bottom: clamp(40px, 6vw, 64px); }

.split {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: clamp(32px, 6vw, 96px);
}

.prose p { color: var(--text-muted); }
.prose p:first-child { color: var(--text); font-size: 1.1875rem; }

.tags {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tags li {
  font-size: 0.875rem;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); }
.card-num {
  display: block;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  color: var(--accent);
  margin-bottom: 40px;
}
.card h3 { margin-bottom: 12px; }
.card p { color: var(--text-muted); margin: 0; }

.cards-2 { grid-template-columns: repeat(2, 1fr); }

/* Pipeline */
.pipeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  counter-reset: step;
}
.pipeline li {
  position: relative;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  counter-increment: step;
}
.pipeline li::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--accent);
}
.pipeline .step {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}
.pipeline .step::before {
  content: "0" counter(step) "  ";
  font-size: 0.9375rem;
  color: var(--accent);
  white-space: pre;
}
.pipeline p { color: var(--text-muted); margin: 0; }

/* Skills */
.skills { margin-top: 48px; }
.skills h3 { font-size: 1.125rem; margin-bottom: 16px; }
.skills dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  margin: 0;
  font-size: 0.9375rem;
}
.skills dt { color: var(--accent); font-weight: 500; }
.skills dd { margin: 0; color: var(--text-muted); }

/* Work list */
.work-list { border-top: 1px solid var(--border); }
.work-item {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: padding 0.3s var(--ease), color 0.3s var(--ease);
}
.work-item:hover { padding-left: 12px; }
.work-item:hover .work-title { color: var(--accent); }
.work-meta { font-size: 0.875rem; color: var(--text-muted); }
.work-title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  letter-spacing: -0.015em;
  line-height: 1.25;
  transition: color 0.3s var(--ease);
}
.work-result {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* Timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  position: relative;
  padding: 0 0 40px 28px;
  border-left: 1px solid var(--border);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 2px solid var(--accent);
}
.tl-date { font-size: 0.8125rem; color: var(--text-muted); letter-spacing: 0.02em; }
.timeline h3 { margin: 6px 0 2px; }
.tl-org { color: var(--accent); font-weight: 500; margin-bottom: 10px; }
.timeline p:last-child { color: var(--text-muted); margin: 0; }

/* Quote */
.quote { margin: 0; text-align: center; }
.quote blockquote {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.2vw, 2.25rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.quote figcaption { color: var(--text-muted); font-size: 0.9375rem; }
.quote strong { color: var(--text); font-weight: 600; }

/* Contact */
.contact { border-top: 1px solid var(--border); }
.contact-title { font-size: clamp(2.5rem, 7vw, 5rem); margin-bottom: 20px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
.site-footer a { text-decoration: none; color: var(--text); }
.site-footer a:hover { color: var(--accent); }

/* ==========================================================================
   Reveal on scroll
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .hero-grid, .split { grid-template-columns: 1fr; }
  .hero-portrait { width: 100%; max-width: 240px; margin: 0 auto; }
  .cards, .cards-2 { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(2, 1fr); row-gap: 40px; }
  .work-item { grid-template-columns: 1fr auto; row-gap: 6px; }
  .work-meta { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .menu-toggle { display: inline-grid; }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 1.125rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
  }
  .nav.open { opacity: 1; visibility: visible; transform: none; }
  .nav a { padding: 14px 0; border-bottom: 1px solid var(--border); color: var(--text); }
  .nav .nav-cta {
    margin-top: 16px;
    text-align: center;
    border: none;
    background: var(--text);
    color: var(--bg);
    padding: 14px;
  }
}

@media (max-width: 480px) {
  .pipeline { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; column-gap: 24px; }
  .work-item { grid-template-columns: 1fr; }
  .work-result { justify-self: start; }
  .hero-actions .btn { flex: 1 1 100%; justify-content: center; }
}
