/* Theme tokens: warm near-black dark theme by default, light theme via prefers-color-scheme or the toggle. */
:root {
  --bg: #141210;
  --bg-raised: #1c1a17;
  --surface: #211e1b;
  --border: #2e2a26;
  --text: #f2ede6;
  --text-muted: #a39b91;
  --text-faint: #7a7269;
  --primary: #3dd9cf;
  --primary-ink: #0c1f1e;
  --aqua: #3dd9cf;
  --blue: #5c9dff;
  --green: #5ccf8a;
  --violet: #a38bff;
  --amber: #f0b45c;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px rgba(0, 0, 0, 0.25);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #faf8f5;
    --bg-raised: #ffffff;
    --surface: #ffffff;
    --border: #e6e0d8;
    --text: #1c1916;
    --text-muted: #5e574f;
    --text-faint: #8a8278;
    --primary: #0f8a82;
    --primary-ink: #ffffff;
    --aqua: #0f8a82;
    --blue: #2f6fd6;
    --green: #23894b;
    --violet: #6c4fd8;
    --amber: #b5730f;
    --shadow: 0 1px 2px rgba(28, 25, 22, 0.04), 0 8px 24px rgba(28, 25, 22, 0.06);
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #faf8f5;
  --bg-raised: #ffffff;
  --surface: #ffffff;
  --border: #e6e0d8;
  --text: #1c1916;
  --text-muted: #5e574f;
  --text-faint: #8a8278;
  --primary: #0f8a82;
  --primary-ink: #ffffff;
  --aqua: #0f8a82;
  --blue: #2f6fd6;
  --green: #23894b;
  --violet: #6c4fd8;
  --amber: #b5730f;
  --shadow: 0 1px 2px rgba(28, 25, 22, 0.04), 0 8px 24px rgba(28, 25, 22, 0.06);
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; }

.container { width: min(1080px, 100% - 40px); margin-inline: auto; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  padding: 8px 14px;
  background: var(--primary);
  color: var(--primary-ink);
  border-radius: 8px;
  z-index: 20;
}
.skip-link:focus { left: 12px; }

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

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav { display: flex; align-items: center; gap: 24px; height: 64px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary);
  color: var(--primary-ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}

.nav-links { display: flex; gap: 4px; list-style: none; margin: 0 0 0 auto; padding: 0; }

.nav-links a {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 15px;
  transition: color 0.15s, background 0.15s;
}

@media (hover: hover) {
  .nav-links a:hover { color: var(--text); background: var(--bg-raised); }
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-raised);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-sun { display: none; }
  :root:not([data-theme="dark"]) .icon-moon { display: block; }
}

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 48px; align-items: center; padding: 88px 0 72px; }

.terminal {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0f0d0b;
  color: #e9e3da;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.terminal-bar { display: flex; align-items: center; gap: 7px; padding: 12px 14px; border-bottom: 1px solid #2a2622; }
.terminal-bar span { width: 11px; height: 11px; border-radius: 50%; background: #3a352f; }
.terminal-bar em { margin-left: 8px; color: #8d857b; font-style: normal; font-family: var(--mono); font-size: 12.5px; }
.terminal pre { margin: 0; padding: 20px; overflow-x: auto; font-family: var(--mono); font-size: 14px; line-height: 1.75; }
.t-prompt { color: #3dd9cf; }
.t-str { color: #f0b45c; }
.t-dim { color: #8d857b; }
.t-ok { color: #5ccf8a; }
.t-cursor { display: inline-block; width: 8px; height: 1.1em; vertical-align: -0.2em; background: #3dd9cf; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 14px;
}

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }

.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.8rem); font-weight: 700; max-width: 18ch; }

.lead { max-width: 62ch; margin: 22px 0 0; color: var(--text-muted); font-size: 1.15rem; }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: transform 0.12s, filter 0.15s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-ghost { border-color: var(--border); background: var(--bg-raised); }
@media (hover: hover) {
  .btn-primary:hover { filter: brightness(1.08); }
  .btn-ghost:hover { background: var(--surface); }
}
.btn-icon { width: 18px; height: 18px; fill: currentColor; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  max-width: 640px;
  margin: 56px 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
}
.hero-stats li { display: flex; flex-direction: column; padding: 18px 20px; background: var(--bg-raised); }
.hero-stats strong { font-size: 1.25rem; }
.hero-stats span { color: var(--text-faint); font-size: 14px; }

/* Sections */
.section { padding: 72px 0; border-top: 1px solid var(--border); }

.section-head { margin-bottom: 36px; }
.kicker { margin: 0 0 6px; color: var(--primary); font-size: 15px; font-weight: 600; }
.section-head h2, .contact-card h2 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); }
.section-sub { max-width: 62ch; margin: 12px 0 0; color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* About */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 32px; align-items: start; }
.about-text p { margin: 0 0 16px; color: var(--text-muted); }
.about-text p:last-child { margin-bottom: 0; }
.about-card { padding: 24px; }
.about-card h3 { font-size: 1rem; margin-bottom: 14px; }
.about-card dl { margin: 0; display: grid; gap: 12px; }
.about-card dl div { display: grid; gap: 2px; }
.about-card dt { color: var(--text-faint); font-size: 13px; }
.about-card dd { margin: 0; font-size: 15px; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill-card { padding: 22px; }
.skill-card h3 { font-size: 1rem; margin-bottom: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chips li {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 14px;
}
.chips-sm li { font-size: 13px; padding: 3px 9px; font-family: var(--mono); }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.project { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 26px; overflow: hidden; }
.project-head h3::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 10px;
  border-radius: 3px;
  background: var(--accent);
  vertical-align: 0.1em;
}
.project-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-head h3 { font-size: 1.35rem; }
.project-tag { margin: 0; color: var(--text); font-weight: 500; }
.project-points { margin: 0; padding-left: 18px; color: var(--text-muted); font-size: 15.5px; display: grid; gap: 6px; }
.project-points li::marker { color: var(--accent); }
.project .chips { margin-top: auto; padding-top: 6px; }

.status {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-live::before { background: var(--green); }
.status-wip::before { background: var(--amber); }
.status-early::before { background: var(--blue); }

/* Contact */
.contact-card { padding: 44px; text-align: center; }
.contact-card p { color: var(--text-muted); margin: 12px auto 0; max-width: 50ch; }
.contact-card .hero-actions { justify-content: center; }

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  padding: 28px 0 40px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 14px;
}
.footer p { margin: 0; }
.footer a { text-decoration: none; }

/* Responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 40px; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .projects { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav-links { display: none; }
  .theme-toggle { margin-left: auto; }
  .hero { padding: 64px 0 48px; }
  .hero-stats { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .section { padding: 56px 0; }
  .project, .contact-card { padding: 22px; }
}

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