/* ---------- Tokens ---------- */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --ink: #0b0b0c;
  --ink-2: #4b4d52;
  --ink-3: #8b8e94;
  --line: #e7e7e9;
  --chip: #f0f0f2;
  --accent: #2563eb;
  --radius: 18px;
  --font: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --surface: #121215;
    --ink: #f4f4f5;
    --ink-2: #a8abb2;
    --ink-3: #6e7178;
    --line: #1f1f23;
    --chip: #18181c;
    --accent: #7aa7ff;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 96px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--chip);
  border: 1px solid var(--line);
  padding: .1em .4em;
  border-radius: 6px;
}
::selection { background: var(--ink); color: var(--bg); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- Header: floating pill ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  padding-top: 14px;
  pointer-events: none;
}
.site-header .wrap {
  pointer-events: auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 54px; gap: 16px;
  padding: 0 8px 0 22px;
  max-width: 1072px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0,0,0,.06);
}
.brand { font-weight: 650; color: var(--ink); font-size: 16px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; }
.nav a {
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  padding: 8px 14px; border-radius: 999px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav a:hover { color: var(--ink); background: var(--chip); text-decoration: none; }
@media (max-width: 760px) { .nav { display: none; } }

/* ---------- Hero ---------- */
.hero {
  margin: -68px 12px 0;
  padding: 180px 0 72px;
  min-height: min(78vh, 720px);
  border-radius: 0 0 32px 32px;
  display: flex; align-items: flex-end;
  color: #fff;
  overflow: hidden;
  background:
    linear-gradient(to top, rgba(5,5,7,.92) 0%, rgba(5,5,7,.5) 50%, rgba(5,5,7,.2) 100%),
    url("../assets/img/hero.jpg") center 70% / cover no-repeat;
}
.hero .wrap { width: 100%; }
.hero .label {
  display: inline-block;
  color: rgba(255,255,255,.85);
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
}
.hero h1 {
  font-size: clamp(56px, 11vw, 136px);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: .92;
  margin-top: 22px !important;
}
.hero .tagline { font-size: clamp(19px, 2.4vw, 24px); color: rgba(255,255,255,.88); margin-top: 22px; letter-spacing: -0.01em; }
.hero .degrees { margin-top: 10px; color: rgba(255,255,255,.55); font-size: 14px; font-family: var(--mono); letter-spacing: .01em; }
.hero .wrap > * { animation: rise .8s var(--ease) both; }
.hero .wrap > :nth-child(2) { animation-delay: .06s; }
.hero .wrap > :nth-child(3) { animation-delay: .12s; }
.hero .wrap > :nth-child(4) { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hero .wrap > * { animation: none; } }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 64px;
  padding: 72px 0 96px;
}
.layout > * { min-width: 0; }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 48px; padding-top: 48px; }
}

/* Sidebar */
.sidebar { position: sticky; top: 100px; align-self: start; }
@media (max-width: 900px) { .sidebar { position: static; } }
.side-group + .side-group { margin-top: 32px; }
.side-group .label { display: block; margin-bottom: 8px; }
.side-links { list-style: none; margin: 0; padding: 0; }
.side-links a {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); font-size: 15px;
  padding: 7px 10px; margin: 0 -10px;
  border-radius: 10px;
  transition: background .2s var(--ease);
}
.side-links a:hover { background: var(--chip); color: var(--accent); text-decoration: none; }
.side-links svg { width: 16px; height: 16px; flex: none; color: var(--ink-3); }
@media (max-width: 900px) {
  .sidebar { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; }
  .side-group + .side-group { margin-top: 0; }
}

/* ---------- Sections ---------- */
.content { counter-reset: sec; }
.section { padding-top: 40px; border-top: 1px solid var(--line); }
.section:first-child { padding-top: 0; border-top: 0; }
.section + .section { margin-top: 72px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.section h2 { font-size: clamp(30px, 4vw, 40px); font-weight: 650; letter-spacing: -0.035em; }
.section h2::before {
  counter-increment: sec;
  content: counter(sec, decimal-leading-zero);
  display: block;
  font-family: var(--mono); font-size: 12px; font-weight: 400;
  letter-spacing: .06em; color: var(--ink-3);
  margin-bottom: 12px;
}
.about p { font-size: 18px; color: var(--ink-2); max-width: 64ch; line-height: 1.7; }

/* Experience */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li {
  display: grid; grid-template-columns: 200px 1fr; gap: 4px 32px;
  padding: 28px 0; border-top: 1px solid var(--line);
}
.timeline > li:first-child { border-top: 0; padding-top: 0; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline .meta { grid-column: 1; grid-row: 1 / span 3; font-family: var(--mono); font-size: 13px; color: var(--ink-3); padding-top: 3px; }
.timeline .role { grid-column: 2; font-weight: 600; font-size: 19px; letter-spacing: -0.015em; }
.timeline .org { grid-column: 2; color: var(--ink-2); }
.timeline .duties { grid-column: 2; list-style: none; margin: 14px 0 0; padding: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.6; }
.timeline .duties li { position: relative; padding-left: 20px; margin-bottom: 8px; }
.timeline .duties li::before { content: "—"; position: absolute; left: 0; color: var(--ink-3); }
@media (max-width: 640px) {
  .timeline > li { grid-template-columns: 1fr; }
  .timeline .meta, .timeline .role, .timeline .org, .timeline .duties { grid-column: 1; grid-row: auto; }
  .timeline .meta { order: -1; padding: 0 0 4px; }
}

/* Tags */
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
}

/* Filter: segmented control */
.filter {
  display: inline-flex; gap: 2px; padding: 4px;
  background: var(--chip); border: 1px solid var(--line); border-radius: 999px;
}
.filter button {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 16px; border-radius: 999px;
  border: 0; background: transparent; color: var(--ink-2);
  cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease);
}
.filter button:hover { color: var(--ink); }
.filter button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* Project cards */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 40px 28px; }
.card { display: flex; flex-direction: column; color: inherit; }
.card:hover { text-decoration: none; }
.card[hidden] { display: none; }
.card .thumb {
  aspect-ratio: 4 / 3; background: var(--chip); overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--line);
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.card:hover .thumb img { transform: scale(1.045); }
.card .body { padding: 18px 2px 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.card p { margin: 0; font-size: 15px; color: var(--ink-2); }
.card .foot { margin-top: auto; padding-top: 4px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-family: var(--mono); color: var(--ink-3); }
.card .foot span:last-child { transition: transform .3s var(--ease), color .3s var(--ease); }
.card:hover .foot span:last-child { transform: translateX(4px); color: var(--accent); }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 36px; }
.skill-group h3 { font-size: 12px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 400; margin-bottom: 14px; }
.skill-list { list-style: none; margin: 0; padding: 0; }
.skill-list li { padding: 12px 0; border-top: 1px solid var(--line); }
.skill-name { font-weight: 550; letter-spacing: -0.01em; }
.skill-projects { display: block; font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.skill-projects a { color: var(--ink-2); }
.skill-projects a:hover { color: var(--accent); }

/* Certifications */
.certs { list-style: none; margin: 0; padding: 0; }
.certs li {
  padding: 18px 0; border-top: 1px solid var(--line);
  font-weight: 500; font-size: 17px; letter-spacing: -0.01em;
}

/* Changelog */
.changelog { list-style: none; margin: 0; padding: 0; }
.changelog li { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.changelog time { font-family: var(--mono); font-size: 13px; color: var(--ink-3); padding-top: 2px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 40px; color: var(--ink-3); font-size: 14px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Project page ---------- */
.project-hero { padding: 72px 0 40px; border-bottom: 1px solid var(--line); }
.back { font-size: 14px; color: var(--ink-3); display: inline-flex; gap: 6px; align-items: center; font-family: var(--mono); }
.back:hover { color: var(--ink); text-decoration: none; }
.project-hero h1 { font-size: clamp(38px, 6.5vw, 72px); font-weight: 700; letter-spacing: -0.045em; line-height: 1; margin: 22px 0 22px; max-width: 18ch; }
.project-meta { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; color: var(--ink-3); font-size: 14px; font-family: var(--mono); }
.project-meta .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.project-meta .btn { margin-left: auto; font-family: var(--font); }
@media (max-width: 760px) { .project-meta .btn { margin-left: 0; } }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-weight: 550; font-size: 14px;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); opacity: .9; }

.article { max-width: 740px; margin: 0 auto; padding: 56px 24px 96px; }
.article h2 { font-size: 28px; font-weight: 650; letter-spacing: -0.03em; margin: 56px 0 16px; }
.article h2:first-child { margin-top: 0; }
.article p, .article li { color: var(--ink-2); font-size: 17px; line-height: 1.7; }
.article ul, .article ol { padding-left: 1.3em; margin: 0 0 1em; }
.article li + li { margin-top: .5em; }
.article li strong, .article p strong { color: var(--ink); font-weight: 600; }
.article figure { margin: 28px 0; }
.article figure img {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); cursor: zoom-in;
}
.article figcaption { font-size: 13px; font-family: var(--mono); color: var(--ink-3); margin-top: 10px; text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 28px 0; }
.grid-2 figure { margin: 0; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
.parts li { margin-bottom: .9em; }
.parts .part { color: var(--ink); font-weight: 600; }
.parts .note { display: block; margin-top: 2px; }

.next-projects { border-top: 1px solid var(--line); margin-top: 64px; padding-top: 28px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 15px; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.9);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }

@media (max-width: 600px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .site-header .wrap { margin: 0 12px; padding: 0 6px 0 18px; }
  .hero { margin: -68px 0 0; border-radius: 0 0 24px 24px; padding: 140px 0 44px; min-height: min(64vh, 560px); }
  .article { padding: 40px 16px 72px; }
  .changelog li { grid-template-columns: 1fr; gap: 2px; }
}
