/* ---------- Tokens ---------- */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e3e8ef;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #e7f5f3;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.05);

  /* Sidebar and hero stay dark in both themes */
  --night: #0b1426;
  --night-2: #0d1930;
  --night-ink: #e8edf5;
  --night-muted: #94a3b8;
  --night-line: rgba(255, 255, 255, 0.08);
  --glow: #5eead4;

  --radius: 14px;
  --sidebar-w: 264px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a101d;
    --surface: #101a2c;
    --ink: #e8edf5;
    --ink-2: #c3ccd9;
    --muted: #8d9ab0;
    --line: #1d2940;
    --accent: #5eead4;
    --accent-strong: #99f6e4;
    --accent-soft: rgba(94, 234, 212, 0.1);
    --on-accent: #042f2b;
    --shadow: none;
    --night: #070c17;
    --night-2: #0a1222;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { color: var(--ink); line-height: 1.2; margin: 0; }
p { margin: 0; }
strong { color: var(--ink); font-weight: 600; }

.icon { width: 18px; height: 18px; flex: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--glow); color: #042f2b; padding: 8px 14px; border-radius: 8px;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.sidebar :focus-visible, .hero :focus-visible { outline-color: var(--glow); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
  font: 600 0.95rem/1.2 var(--font); text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s, transform .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--glow); color: #042f2b; }
.btn-primary:hover { background: #99f6e4; }
.btn-ghost { border-color: rgba(255, 255, 255, 0.22); color: #fff; }
.btn-ghost:hover { border-color: var(--glow); color: var(--glow); }
.btn-resume { width: 100%; border-color: rgba(94, 234, 212, 0.4); color: var(--glow); }
.btn-resume:hover { background: var(--glow); color: #042f2b; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  padding: 36px 22px 24px;
  background: var(--night); color: var(--night-ink);
  border-right: 1px solid var(--night-line);
  overflow-y: auto;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; }
.brand {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: 100%; text-align: center; text-decoration: none; color: inherit;
}
.avatar {
  width: 128px; height: 128px; border-radius: 50%; object-fit: cover;
  border: 3px solid rgba(94, 234, 212, 0.35);
  box-shadow: 0 0 0 6px rgba(94, 234, 212, 0.06);
}
.brand-name { display: block; font-size: 1.25rem; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.brand-role { display: block; font-size: 0.85rem; color: var(--night-muted); }
.menu-toggle { display: none; }

.site-nav { display: flex; flex-direction: column; flex: 1; margin-top: 30px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 8px; border-left: 2px solid transparent;
  color: var(--night-muted); text-decoration: none; font-size: 0.95rem; font-weight: 500;
  transition: color .15s, background-color .15s;
}
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
.nav-links a[aria-current="true"] { color: #fff; background: rgba(94, 234, 212, 0.08); border-left-color: var(--glow); }
.num { font-family: var(--mono); font-size: 0.72rem; color: var(--glow); opacity: 0.85; }

.sidebar-foot { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.social { display: flex; justify-content: center; gap: 10px; }
.social a {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  color: var(--night-muted); border: 1px solid var(--night-line);
  transition: color .15s, border-color .15s;
}
.social a:hover { color: #fff; border-color: var(--glow); }

/* ---------- Layout ---------- */
.content { margin-left: var(--sidebar-w); }
.wrap { max-width: 940px; }
.section { padding: 88px clamp(20px, 5vw, 72px); border-top: 1px solid var(--line); }
.section-head { margin-bottom: 36px; }
.kicker {
  margin-bottom: 10px; font-family: var(--mono); font-size: 0.78rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
}
.section h2 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); letter-spacing: -0.02em; }
.section-intro { margin-top: 10px; color: var(--muted); max-width: 640px; }
.note { margin-top: 20px; font-size: 0.85rem; color: var(--muted); }

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

.card, .case, .skill-group, .focus {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh; display: flex; align-items: center;
  padding: 72px clamp(20px, 5vw, 72px);
  color: #cbd5e1;
  background:
    radial-gradient(900px 520px at 90% -10%, rgba(94, 234, 212, 0.13), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(56, 189, 248, 0.07), transparent 60%),
    linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%);
}
.eyebrow { font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.04em; color: var(--glow); }
.hero h1 { margin-top: 18px; font-size: clamp(2.5rem, 5.5vw, 4.25rem); font-weight: 700; letter-spacing: -0.03em; color: #fff; }
.lede { margin-top: 20px; max-width: 660px; font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: #cbd5e1; }
.typed-line { margin-top: 18px; font-family: var(--mono); font-size: 0.98rem; color: var(--night-muted); min-height: 1.65em; }
.prompt { color: var(--glow); margin-right: 4px; }
.typed { color: #fff; }
.typed::after {
  content: ""; display: inline-block; width: 2px; height: 1.1em; margin-left: 2px;
  background: var(--glow); vertical-align: -3px; animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.metrics {
  list-style: none; margin: 56px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--night-line); border: 1px solid var(--night-line); border-radius: var(--radius); overflow: hidden;
}
.metrics li { padding: 20px 18px; background: rgba(9, 17, 33, 0.92); }
.metric-value { display: block; font-size: clamp(1.4rem, 2.2vw, 1.8rem); font-weight: 700; letter-spacing: -0.02em; color: #fff; font-variant-numeric: tabular-nums; }
.metric-label { display: block; margin-top: 4px; font-size: 0.82rem; line-height: 1.45; color: var(--night-muted); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 48px; }
.about-grid p { margin-bottom: 16px; font-size: 1.05rem; }
.focus { align-self: start; padding: 24px; }
.focus h3, .card-meta, .case-org {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.focus h3 { margin-bottom: 8px; }
.focus ul { list-style: none; margin: 0; padding: 0; }
.focus li { padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink); font-weight: 500; font-size: 0.95rem; }
.focus li:first-child { border-top: 0; }

/* ---------- Experience ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.job { position: relative; padding: 0 0 44px 32px; }
.job::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.job:last-child { padding-bottom: 0; }
.job:last-child::before { display: none; }
.job::after {
  content: ""; position: absolute; left: 0; top: 7px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.job-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.job h3 { font-size: 1.25rem; }
.org-note { font-size: 0.9rem; font-weight: 400; color: var(--muted); }
.job-meta { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.job-role { margin-top: 2px; font-weight: 500; color: var(--ink); }
.points { margin: 12px 0 0; padding-left: 18px; }
.points li { margin: 7px 0; }
.points li::marker { color: var(--accent); }

/* ---------- Selected work ---------- */
.work-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.case { display: flex; flex-direction: column; padding: 26px; }
.case h3 { margin: 8px 0 10px; font-size: 1.2rem; }
.case > p:not(.case-org):not(.case-result) { margin-bottom: 18px; font-size: 0.96rem; }
.flow { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.flow li { position: relative; padding: 5px 0 5px 32px; font-size: 0.9rem; color: var(--ink); }
.flow li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 6px; width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.7rem; background: var(--accent-soft); color: var(--accent);
}
.flow li:not(:last-child)::after { content: ""; position: absolute; left: 10px; top: 28px; bottom: -6px; width: 1px; background: var(--line); }
.case .tags { margin-bottom: 18px; }
.case-result { margin-top: auto; padding-top: 16px; border-top: 1px dashed var(--line); display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.result-value { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; color: var(--accent); white-space: nowrap; }
.result-label { font-size: 0.86rem; line-height: 1.4; color: var(--muted); }

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.project {
  display: flex; flex-direction: column; padding: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  color: inherit; text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.project:hover { border-color: var(--accent); transform: translateY(-2px); }
.project h3 { display: flex; justify-content: space-between; gap: 10px; font-size: 1rem; }
.project h3 .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); transition: color .15s; }
.project:hover h3 .icon { color: var(--accent); }
.project p { flex: 1; margin: 8px 0 14px; font-size: 0.9rem; }
.project .meta { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }

/* ---------- Skills ---------- */
.skill-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.skill-group { padding: 22px; }
.skill-group h3 { margin-bottom: 14px; font-size: 1rem; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font-size: 0.86rem; }

/* ---------- Education ---------- */
.edu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.card { padding: 22px 24px; }
.card h3 { margin-top: 8px; font-size: 1.08rem; }
.degree { margin-top: 4px; font-weight: 500; color: var(--ink); }
.card-note { margin-top: 6px; font-size: 0.92rem; color: var(--muted); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 720px; }
@media (max-width: 560px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); text-decoration: none; font-weight: 500;
  transition: border-color .15s;
}
a.contact-card:hover { border-color: var(--accent); }
.icon-wrap { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.contact-card small { display: block; font-family: var(--mono); font-size: 0.7rem; font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.contact-card span span { overflow-wrap: anywhere; }

.site-footer { padding: 28px clamp(20px, 5vw, 72px); border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .work-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .sidebar {
    position: sticky; bottom: auto; width: auto;
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--night-line);
    overflow: visible;
  }
  .brand { flex-direction: row; width: auto; gap: 12px; text-align: left; }
  .avatar { width: 40px; height: 40px; border-width: 2px; box-shadow: none; }
  .brand-name { font-size: 1rem; }
  .brand-role { font-size: 0.78rem; }
  .menu-toggle {
    display: grid; place-items: center; width: 42px; height: 42px;
    border: 1px solid var(--night-line); border-radius: 10px; background: transparent;
    color: var(--night-ink); cursor: pointer;
  }
  .site-nav { margin-top: 10px; padding-bottom: 8px; }
  .js .site-nav { display: none; }
  .js .nav-open .site-nav { display: flex; }
  .sidebar-foot { padding-top: 14px; }
  .content { margin-left: 0; }
  .section { scroll-margin-top: 62px; }
  .hero { min-height: auto; padding-block: 64px; }
  .about-grid, .skill-groups, .edu-grid { grid-template-columns: 1fr; }
  .about-grid { gap: 12px; }
}

@media (max-width: 560px) {
  .section { padding-block: 64px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics li { padding: 16px 14px; }
  .job { padding-left: 26px; }
  .job-head { flex-direction: column; }
  .case { padding: 22px 20px; }
}

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