/* ───────── Tokens ───────── */
:root {
  --bg: #0b1120;
  --bg-elev: #111a2e;
  --bg-hover: rgba(148, 163, 184, 0.07);
  --text: #e2e8f0;
  --text-strong: #f8fafc;
  --muted: #94a3b8;
  --faint: #64748b;
  --line: rgba(148, 163, 184, 0.16);
  --accent: #5eead4;
  --accent-soft: rgba(94, 234, 212, 0.1);
  --accent-ink: #0b1120;
  --radius: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --bg-elev: #ffffff;
    --bg-hover: rgba(15, 23, 42, 0.04);
    --text: #334155;
    --text-strong: #0f172a;
    --muted: #64748b;
    --faint: #94a3b8;
    --line: rgba(15, 23, 42, 0.1);
    --accent: #0f766e;
    --accent-soft: rgba(15, 118, 110, 0.08);
    --accent-ink: #ffffff;
    color-scheme: light;
  }
}

/* ───────── Base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(700px 500px at 0% 0%, var(--accent-soft), transparent 70%);
}

a { color: inherit; text-decoration: none; }
p a, .more a, .contact a:not(.btn) { color: var(--accent); }
p a:hover, .more a:hover { text-decoration: underline; text-underline-offset: 3px; }
strong { color: var(--text-strong); font-weight: 600; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 10;
  padding: 8px 14px; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.skip-link:focus { top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mono { font-family: var(--mono); font-size: 0.9em; }

/* ───────── Layout ───────── */
.layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .layout { grid-template-columns: 5fr 7fr; gap: 80px; padding: 0 40px; }
}

/* ───────── Sidebar ───────── */
.sidebar { padding: 64px 0 24px; }

@media (min-width: 1024px) {
  .sidebar {
    position: sticky; top: 0;
    height: 100vh; max-height: 100vh;
    padding: 96px 0;
    display: flex; flex-direction: column; justify-content: space-between;
  }
}

.avatar {
  width: 160px; height: 160px; border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  margin-bottom: 28px;
}
@media (max-width: 639px) { .avatar { width: 128px; height: 128px; } }

.name {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 3rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-strong);
}

.role {
  margin: 10px 0 0;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-strong);
}

.pitch { margin: 14px 0 0; max-width: 22rem; color: var(--muted); }

.nav { display: none; margin-top: 56px; }
@media (min-width: 1024px) { .nav { display: block; } }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav a {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 8px 0;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint);
  transition: color 0.2s;
}
.nav-line { display: inline-block; width: 32px; height: 1px; background: currentColor; transition: width 0.2s; }
.nav a:hover, .nav a.active { color: var(--text-strong); }
.nav a:hover .nav-line, .nav a.active .nav-line { width: 64px; }

.sidebar-foot { margin-top: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }

.socials { list-style: none; margin: 0; padding: 0; display: flex; gap: 18px; }
.socials a { display: block; color: var(--muted); transition: color 0.2s; }
.socials a:hover { color: var(--text-strong); }
.socials svg { width: 22px; height: 22px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.socials svg.fill { fill: currentColor; stroke: none; }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.9rem; font-weight: 500;
  color: var(--text-strong);
  transition: border-color 0.2s, background 0.2s;
}
.btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { border-color: var(--accent); color: var(--accent); }

/* ───────── Content ───────── */
.content { padding: 24px 0 48px; min-width: 0; }
@media (min-width: 1024px) { .content { padding: 96px 0; } }

.section { margin-bottom: 96px; scroll-margin-top: 96px; }
.section > p { margin: 0 0 16px; }

.section-title {
  margin: 0 0 24px;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-strong);
}
@media (max-width: 1023px) {
  .section-title {
    position: sticky; top: 0; z-index: 2;
    margin: 0 -16px 24px; padding: 16px;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(8px);
  }
}

.sub-title { margin: 56px 0 16px; font-size: 1.05rem; font-weight: 600; color: var(--text-strong); }

/* ───────── Project cards ───────── */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.card {
  position: relative;
  padding: 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: background 0.2s, border-color 0.2s;
}
.card { margin: 0 -16px; padding: 16px; }
@media (min-width: 1024px) { .card { margin: 0 -20px; padding: 20px; } }
.card:hover { background: var(--bg-hover); border-color: var(--line); }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 0.95rem; }

.card-feature { display: grid; gap: 20px; }
@media (min-width: 640px) { .card-feature { grid-template-columns: 200px 1fr; align-items: start; } }
.card-media {
  display: block; overflow: hidden;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff;
}
.card-media img { width: 100%; aspect-ratio: 16 / 10; object-fit: contain; padding: 6px; }

.eyebrow {
  margin: 0 0 4px !important;
  font-family: var(--mono); font-size: 0.75rem !important;
  color: var(--faint) !important;
}

.card-title { margin: 0 0 8px; font-size: 1.05rem; font-weight: 600; line-height: 1.4; color: var(--text-strong); }
.card-title a { transition: color 0.2s; }
.card-title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card:hover .card-title a { color: var(--accent); }
.arrow { display: inline-block; margin-left: 6px; font-size: 0.85em; transition: transform 0.2s; }
.card:hover .arrow { transform: translate(2px, -2px); }

.links { position: relative; z-index: 1; display: flex; gap: 16px; margin: 4px 0 0 !important; }
.links a { font-size: 0.875rem; font-weight: 500; color: var(--text-strong); }
.links a:hover { color: var(--accent); }

.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem; font-weight: 500; line-height: 1.6;
}

/* ───────── Archive table ───────── */
.table-wrap { overflow-x: auto; }
.archive { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.archive th {
  padding: 10px 12px 10px 0; text-align: left;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
}
.archive td { padding: 14px 12px 14px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.archive td:first-child strong { display: block; }
.archive td:first-child span { display: block; color: var(--muted); font-size: 0.875rem; }
.archive td:nth-child(2) { color: var(--muted); font-family: var(--mono); font-size: 0.78rem; white-space: nowrap; }
.archive td:last-child { text-align: right; padding-right: 0; }
.archive td:last-child a { color: var(--muted); font-size: 1.05rem; padding: 4px; }
.archive td:last-child a:hover { color: var(--accent); }
@media (max-width: 639px) { .hide-sm { display: none; } }

.more { margin-top: 24px; font-size: 0.92rem; color: var(--muted); }

/* ───────── Skills ───────── */
.skills { margin: 0; display: grid; gap: 20px; }
.skills > div { display: grid; gap: 8px; }
@media (min-width: 640px) { .skills > div { grid-template-columns: 140px 1fr; align-items: baseline; } }
.skills dt { font-size: 0.875rem; font-weight: 600; color: var(--text-strong); }
.skills dd { margin: 0; }

/* ───────── Timeline ───────── */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 0 20px; border-left: 2px solid var(--line); }
.timeline li + li { margin-top: 28px; }
.timeline-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 6px; }
.timeline h3 { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--text-strong); }
.timeline .muted { font-size: 0.9rem; }
.timeline p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ───────── Writing ───────── */
.posts { list-style: none; margin: 0; padding: 0; }
.posts a {
  display: block; padding: 18px 20px;
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
}
.posts a:hover { border-color: var(--accent); background: var(--bg-hover); }
.post-title { display: block; font-weight: 600; color: var(--text-strong); }
.post-meta { display: block; margin-top: 4px; font-family: var(--mono); font-size: 0.78rem; color: var(--faint); }

/* ───────── Contact ───────── */
.contact-lead { font-size: 1.05rem; max-width: 34rem; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 16px !important; }
.contact-actions .btn { overflow-wrap: anywhere; }

/* ───────── Footer ───────── */
.footer { padding-top: 24px; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--faint); }
.footer p { margin: 0; }
.timeline .period { margin-left: auto; font-family: var(--mono); font-size: 0.8rem; color: var(--faint); white-space: nowrap; }
@media (max-width: 639px) { .timeline .period { margin-left: 0; flex-basis: 100%; } }
.section > p.more { margin-top: 24px; }
