/* ===== Design tokens ===== */
:root {
  --ink:          #14181f;
  --ink-soft:     #3a424f;
  --muted:        #6b7585;
  --line:         #e4e7ec;
  --bg:           #ffffff;
  --bg-alt:       #f6f8fa;
  --bg-deep:      #0e1622;
  --surface:      #ffffff;            /* cards */
  --nav-bg:       rgba(255,255,255,.78);
  --nav-bg-solid: rgba(255,255,255,.98);
  --btn-bg:       #14181f;            /* primary button */
  --btn-fg:       #ffffff;
  --photo-ring:   #ffffff;
  --accent:       #c8862b;            /* warm bronze */
  --accent-ink:   #9c6512;
  --radius:       14px;
  --maxw:         1080px;
  --ease:         cubic-bezier(.2, .7, .2, 1);
  --shadow:       0 1px 2px rgba(16,24,40,.04), 0 8px 28px rgba(16,24,40,.06);
  color-scheme:   light;
}

/* ===== Dark theme ===== */
:root[data-theme="dark"] {
  --ink:          #f2f4f7;
  --ink-soft:     #c2c9d4;
  --muted:        #8b95a5;
  --line:         #28303c;
  --bg:           #0d121c;
  --bg-alt:       #121826;
  --bg-deep:      #070b12;
  --surface:      #161d2b;
  --nav-bg:       rgba(13,18,28,.72);
  --nav-bg-solid: rgba(13,18,28,.98);
  --btn-bg:       #f2f4f7;
  --btn-fg:       #0d121c;
  --photo-ring:   #1c2433;
  --accent:       #e0a64a;
  --accent-ink:   #e8b765;
  --shadow:       0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35);
  color-scheme:   dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

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

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

/* ===== Navigation ===== */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.nav.is-scrolled { border-color: var(--line); }
.nav__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav__brand {
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 1.25rem;
  letter-spacing: .04em;
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid var(--ink); color: var(--ink);
}
.nav__links { display: flex; gap: 30px; }
.nav__links a {
  font-size: .92rem; font-weight: 500; color: var(--ink-soft);
  position: relative; padding: 4px 0;
}
.nav__links a::after {
  content: ''; position: absolute; left: 0; bottom: -2px; height: 1.5px; width: 0;
  background: var(--accent); transition: width .3s var(--ease);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { width: 100%; }

.nav__toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 8px;
}
.nav__toggle span { width: 24px; height: 2px; background: var(--ink); border-radius: 2px; transition: .3s var(--ease); }
.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); }

/* ===== Hero ===== */
.hero {
  min-height: 92vh; display: flex; align-items: center;
  padding: 120px 24px 80px;
  background:
    radial-gradient(900px 500px at 78% -10%, rgba(200,134,43,.10), transparent 60%),
    radial-gradient(700px 500px at 0% 110%, rgba(14,22,34,.05), transparent 55%);
}
.hero__inner {
  max-width: var(--maxw); margin: 0 auto; width: 100%;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center;
}
.hero__photo { justify-self: center; }
.hero__photo img {
  width: clamp(220px, 28vw, 340px); height: clamp(220px, 28vw, 340px);
  border-radius: 50%; object-fit: cover; object-position: 50% 30%; display: block;
  border: 6px solid var(--photo-ring);
  box-shadow: 0 18px 50px rgba(16,24,40,.20), 0 0 0 1.5px var(--line);
}
.hero__eyebrow {
  font-size: .82rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: 22px;
}
.hero__name {
  font-family: 'Fraunces', serif; font-weight: 600;
  font-size: clamp(3rem, 8vw, 5.6rem); line-height: .98; letter-spacing: -.02em;
}
.hero__title {
  font-family: 'Fraunces', serif; font-weight: 400; font-style: italic;
  font-size: clamp(1.3rem, 3.4vw, 2rem); color: var(--ink-soft);
  margin-top: 12px;
}
.hero__tagline {
  margin-top: 20px; font-size: .98rem; font-weight: 500; color: var(--muted);
  letter-spacing: .01em;
}
.hero__summary {
  margin-top: 26px; max-width: 60ch; color: var(--ink-soft); font-size: 1.08rem;
}
.hero__summary strong { color: var(--ink); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 36px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 26px; border-radius: 100px; font-weight: 600; font-size: .95rem;
  transition: transform .2s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}
.btn--primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(16,24,40,.22); }
.btn--ghost { border: 1.5px solid var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); transform: translateY(-2px); }

/* ===== Stats ===== */
.stats { border-block: 1px solid var(--line); background: var(--bg-alt); }
.stats__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 44px 24px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
}
.stat { text-align: center; }
.stat__num {
  display: block; font-family: 'Fraunces', serif; font-weight: 600;
  font-size: clamp(2.2rem, 5vw, 3rem); color: var(--ink); line-height: 1;
}
.stat__label { display: block; margin-top: 10px; font-size: .86rem; color: var(--muted); }

/* ===== Sections ===== */
.section { padding: 110px 24px; }
.section--alt { background: var(--bg-alt); }
.section__inner { max-width: var(--maxw); margin: 0 auto; }
.section__inner--center { text-align: center; }
.section__kicker {
  font-size: .8rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: 14px;
}
.section__heading {
  font-family: 'Fraunces', serif; font-weight: 600; letter-spacing: -.015em;
  font-size: clamp(1.8rem, 4.4vw, 2.9rem); line-height: 1.1; color: var(--ink);
  max-width: 20ch;
}
.section__inner--center .section__heading { max-width: none; margin-inline: auto; }

/* ===== About ===== */
.about__grid {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; margin-top: 46px;
}
.about__lead p { color: var(--ink-soft); margin-bottom: 18px; font-size: 1.08rem; }
.about__lead strong { color: var(--ink); }
.about__facts { list-style: none; align-self: start; }
.about__facts li {
  padding: 16px 0; border-top: 1px solid var(--line); font-size: .98rem; color: var(--ink);
}
.about__facts li:last-child { border-bottom: 1px solid var(--line); }
.about__facts span {
  display: block; font-size: .76rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
}

/* ===== Timeline ===== */
.timeline { list-style: none; margin-top: 50px; position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(var(--accent), var(--line));
}
.timeline__item { position: relative; padding: 0 0 46px 42px; }
.timeline__item::before {
  content: ''; position: absolute; left: 0; top: 7px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--accent);
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__head { margin-bottom: 14px; }
.timeline__head h3 {
  font-size: 1.3rem; font-weight: 700; color: var(--ink); line-height: 1.25;
}
.timeline__org { display: block; font-weight: 600; color: var(--ink-soft); margin-top: 2px; font-size: .98rem; }
.timeline__date {
  display: inline-block; margin-top: 6px; font-size: .8rem; font-weight: 600;
  color: var(--accent-ink); letter-spacing: .03em;
}
.timeline__phase {
  font-weight: 700; color: var(--ink); margin: 18px 0 8px; font-size: .9rem;
  letter-spacing: .02em;
}
.timeline__body ul { list-style: none; }
.timeline__body li {
  position: relative; padding-left: 20px; margin-bottom: 10px;
  color: var(--ink-soft); font-size: 1rem;
}
.timeline__body li::before {
  content: ''; position: absolute; left: 2px; top: 11px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent);
}
.timeline__body strong { color: var(--ink); }

/* ===== Skills ===== */
.skills__grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; margin-top: 46px;
}
.skillcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.skillcard:hover { transform: translateY(-4px); box-shadow: 0 12px 34px rgba(16,24,40,.10); }
.skillcard h3 { font-size: 1.08rem; margin-bottom: 16px; color: var(--ink); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 9px; }
.tags li {
  font-size: .86rem; font-weight: 500; color: var(--ink-soft);
  background: var(--bg-alt); border: 1px solid var(--line);
  padding: 6px 13px; border-radius: 100px;
}
.section--alt .skillcard { background: var(--surface); }

.creds { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 56px; }
.creds__col h3 {
  font-family: 'Fraunces', serif; font-size: 1.2rem; margin-bottom: 16px; color: var(--ink);
}
.creds__col ul { list-style: none; }
.creds__col li {
  padding: 12px 0; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .98rem;
}
.creds__col strong { color: var(--ink); }
.creds__col span { color: var(--muted); font-size: .88rem; }

/* ===== Impact ===== */
.impact__grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; margin-top: 46px;
}
.impact {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .25s var(--ease);
}
.impact::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent);
}
.impact:hover { transform: translateY(-4px); }
.impact h3 { font-size: 1.16rem; margin-bottom: 10px; color: var(--ink); }
.impact p { color: var(--ink-soft); font-size: 1rem; }

/* ===== Projects ===== */
.feature {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 0;
  margin-top: 46px; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.feature__body { padding: 40px; }
.feature__tag {
  font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: 12px;
}
.feature__title {
  font-family: 'Fraunces', serif; font-weight: 600; font-size: clamp(1.7rem, 4vw, 2.4rem);
  color: var(--ink); line-height: 1.05;
}
.feature__desc { margin-top: 16px; color: var(--ink-soft); font-size: 1.06rem; max-width: 50ch; }
.feature__links { margin-top: 26px; }
.feature__aside {
  display: grid; place-items: center;
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(200,134,43,.22), transparent 60%),
    var(--bg-deep);
}
.feature__mark {
  font-family: 'Fraunces', serif; font-weight: 600; font-size: clamp(3rem, 8vw, 5rem);
  color: var(--accent); letter-spacing: .02em;
}

.proj__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; margin-top: 22px; }
.projcard {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.projcard:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 12px 34px rgba(16,24,40,.10); }
.projcard__tag {
  font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: 10px;
}
.projcard h3 { font-size: 1.18rem; color: var(--ink); }
.projcard__desc { margin-top: 8px; color: var(--ink-soft); font-size: .98rem; }
.projcard__cta { display: inline-block; margin-top: 16px; font-weight: 600; font-size: .92rem; color: var(--accent-ink); }

/* ===== Social ===== */
.social { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 34px; }
.social a {
  display: inline-grid; place-items: center; width: 46px; height: 46px;
  border-radius: 50%; border: 1.5px solid rgba(255,255,255,.22); color: #fff;
  transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.social a:hover { transform: translateY(-3px); background: var(--accent); border-color: var(--accent); color: #14181f; }
.social svg { width: 20px; height: 20px; fill: currentColor; }

/* ===== Experience download ===== */
.experience__download { margin-bottom: 36px; }

/* ===== Contact ===== */
.section--contact {
  background: var(--bg-deep); color: #fff;
  background-image:
    radial-gradient(700px 400px at 50% -20%, rgba(200,134,43,.18), transparent 60%);
}
.section--contact .section__heading { color: #fff; }
.section--contact .section__kicker { color: var(--accent); }
.contact__lead { color: #b9c2cf; margin: 18px auto 0; max-width: 46ch; }
.contact__links { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 32px; }
.section--contact .btn--primary { background: var(--accent); color: #14181f; }
.section--contact .btn--primary:hover { box-shadow: 0 12px 26px rgba(200,134,43,.35); }
.section--contact .btn--ghost { border-color: rgba(255,255,255,.28); color: #fff; }
.section--contact .btn--ghost:hover { border-color: #fff; }
.contact__loc { margin-top: 26px; color: #8b95a5; font-size: .9rem; }

/* ===== Footer ===== */
.footer {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  text-align: center; padding: 34px 24px; color: var(--muted);
  font-size: .86rem; border-top: 1px solid var(--line);
}
.footer p { margin: 0; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 16px 9px 12px; border-radius: 100px;
  border: 1.5px solid var(--line); background: none; color: var(--ink-soft);
  font: inherit; font-weight: 500; font-size: .88rem; cursor: pointer;
  transition: border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-2px); }
.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.theme-toggle .icon-system,
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }
.theme-toggle[data-pref="system"] .icon-system { display: block; }
.theme-toggle[data-pref="light"]  .icon-sun    { display: block; }
.theme-toggle[data-pref="dark"]   .icon-moon   { display: block; }
.theme-toggle__label { font-size: 0; }
.theme-toggle__label::before { font-size: .88rem; }
.theme-toggle[data-pref="system"] .theme-toggle__label::before { content: "System"; }
.theme-toggle[data-pref="light"]  .theme-toggle__label::before { content: "Light"; }
.theme-toggle[data-pref="dark"]   .theme-toggle__label::before { content: "Dark"; }

/* ===== Reveal animation ===== */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .about__grid, .creds, .skills__grid, .impact__grid, .proj__grid { grid-template-columns: 1fr; gap: 28px; }
  .hero__inner { grid-template-columns: 1fr; gap: 36px; }
  .hero__photo { order: -1; justify-self: start; }
  .feature { grid-template-columns: 1fr; }
  .feature__aside { min-height: 140px; order: -1; }
  .stats__inner { grid-template-columns: repeat(2, 1fr); row-gap: 32px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav__links {
    position: fixed; inset: 64px 0 auto 0; flex-direction: column; gap: 0;
    background: var(--nav-bg-solid); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-12px); opacity: 0; pointer-events: none; transition: .25s var(--ease);
  }
  .nav__links.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .nav__links a { padding: 16px 24px; border-top: 1px solid var(--line); }
  .nav__toggle { display: flex; }
  .section { padding: 80px 22px; }
  .hero { padding: 110px 22px 70px; }
}
