:root {
  --bg: #faf7f2;
  --bg-alt: #f2ece2;
  --surface: #ffffff;
  --text: #221d18;
  --muted: #6b6158;
  --line: #e4dccf;
  --accent: #b4532a;
  --accent-soft: #f6e3d7;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(34, 29, 24, .04), 0 8px 24px rgba(34, 29, 24, .06);
  --radius: 14px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171411; --bg-alt: #1e1a16; --surface: #24201b; --text: #f1ebe3; --muted: #a99e92;
    --line: #362f28; --accent: #e8875a; --accent-soft: #3a2519; --on-accent: #1a120c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171411; --bg-alt: #1e1a16; --surface: #24201b; --text: #f1ebe3; --muted: #a99e92;
  --line: #362f28; --accent: #e8875a; --accent-soft: #3a2519; --on-accent: #1a120c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.accent { color: var(--accent); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* NAV */
.nav {
  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 .2s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; text-decoration: none; margin-right: auto; }
.nav-links { display: flex; gap: 28px; }
.nav-links a { text-decoration: none; color: var(--muted); font-size: .95rem; font-weight: 500; transition: color .15s; }
.nav-links a:hover { color: var(--text); }
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: grid; place-items: center; cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

/* HERO */
.hero { padding-top: 112px; padding-bottom: 120px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--muted); font-weight: 500; margin-bottom: 28px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3f9a5a; box-shadow: 0 0 0 4px color-mix(in srgb, #3f9a5a 20%, transparent); }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(3rem, 9vw, 6rem); letter-spacing: -.02em; margin-bottom: 28px; }
.lead { font-size: clamp(1.1rem, 2.2vw, 1.35rem); max-width: 720px; color: var(--text); }
.lead strong { font-weight: 600; color: var(--accent); }
.sub { color: var(--muted); margin-top: 16px; max-width: 620px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 22px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  text-decoration: none; transition: transform .15s, background .15s, border-color .15s;
  border: 1px solid transparent; max-width: 100%; overflow-wrap: anywhere;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-ghost { border-color: var(--line); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); }

/* SECTIONS */
.section { padding: 96px 0; }
.section.alt { background: var(--bg-alt); }
.section-title { font-family: var(--serif); font-weight: 600; font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 40px; display: flex; align-items: baseline; gap: 14px; }
.section-title span { font-family: var(--sans); font-size: .85rem; font-weight: 600; color: var(--accent); letter-spacing: .05em; }
.meta { font-size: .85rem; color: var(--muted); font-weight: 500; margin-bottom: 6px; }

/* PROJECT */
.project { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 40px; box-shadow: var(--shadow); }
.project-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 36px; }
.project h3 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.5rem, 3vw, 2rem); }
.project-sub { color: var(--muted); margin-top: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; max-width: 360px; }
.tags li, .chips li { font-size: .8rem; font-weight: 500; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

.flow { display: flex; align-items: center; gap: 10px; }
.flow-step {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  font-weight: 500; font-size: .95rem; background: var(--bg);
}
.flow-step span {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: .8rem; font-weight: 600;
  background: var(--accent); color: var(--on-accent);
}
.flow-arrow { width: 18px; height: 2px; background: var(--line); position: relative; flex: none; }
.flow-arrow::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left-color: var(--line); border-right: 0; }
.flow-caption { color: var(--muted); font-size: .9rem; margin-top: 12px; }

.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }
.card { padding: 22px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); }
.card h4 { font-size: 1rem; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: .95rem; }

/* SKILLS */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.skill-group h3 { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; margin-bottom: 16px; }
.skill-group li { padding: 9px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.skill-group li:first-child { border-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }

/* TIMELINE */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.timeline { border-left: 2px solid var(--line); padding-left: 28px; }
.timeline li { position: relative; padding-bottom: 32px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -36px; top: 5px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
}
.timeline h3 { font-size: 1.08rem; font-weight: 600; margin-bottom: 6px; }
.timeline p:not(.meta) { color: var(--muted); font-size: .95rem; }

.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }
.mini-title { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; margin-bottom: 12px; }
.plain li { color: var(--muted); font-size: .95rem; padding: 3px 0; }
.plain strong { color: var(--text); font-weight: 600; }

/* CONTACT */
.contact { background: var(--bg-alt); }
.contact-inner { text-align: center; max-width: 720px; }
.contact h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.2rem, 6vw, 3.6rem); margin-bottom: 18px; }
.contact p { color: var(--muted); font-size: 1.1rem; }
.contact .cta { justify-content: center; }

.contact-form { margin-top: 36px; text-align: left; display: grid; gap: 16px; }
.contact-form .cta { margin-top: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; }
.field span { font-size: .85rem; font-weight: 600; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
button.btn { cursor: pointer; font-family: inherit; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { margin-top: 28px; padding: 14px 18px; border-radius: 10px; font-size: .95rem; text-align: left; }
.alert-success { background: color-mix(in srgb, #3f9a5a 14%, var(--surface)); border: 1px solid color-mix(in srgb, #3f9a5a 40%, transparent); }
.alert-error { background: color-mix(in srgb, #c0392b 12%, var(--surface)); border: 1px solid color-mix(in srgb, #c0392b 40%, transparent); }
.contact p.contact-alt { margin-top: 20px; font-size: .95rem; }
.contact-alt a { color: var(--accent); }

.footer { padding: 32px 0; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }

/* REVEAL */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* RESPONSIVE */
@media (max-width: 860px) {
  .project-grid, .skills { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; gap: 72px; }
  .flow { flex-direction: column; align-items: stretch; }
  .flow-arrow { width: 2px; height: 14px; margin-left: 28px; }
  .flow-arrow::after { right: auto; left: -4px; top: auto; bottom: -1px; border: 5px solid transparent; border-top-color: var(--line); border-bottom: 0; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav-links { display: none; }
  .hero { padding-top: 64px; padding-bottom: 80px; }
  .section { padding: 72px 0; }
  .project { padding: 24px 20px; }
  .mini-grid, .field-row { grid-template-columns: 1fr; }
  .cta .btn { width: 100%; }
}
