:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --fg: #1a1a18;
  --muted: #6b6b68;
  --subtle: #c8c7c0;
  --accent: #c2410c;
  --link: #1a1a18;
  --border: rgba(0,0,0,0.08);
  --mono: 'DM Mono', monospace;
  --sans: 'DM Sans', sans-serif;
  --maxw: 720px;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --surface: #1c1c1a;
    --fg: #e8e6df;
    --muted: #8a8880;
    --subtle: #3a3a36;
    --accent: #fb923c;
    --border: rgba(255,255,255,0.07);
    --link: #e8e6df;
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.65;
  font-weight: 300;
  padding: 0 1.25rem;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }

/* ─── LAYOUT ─── */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
}

/* ─── HEADER ─── */
header {
  padding: 3.5rem 0 2.5rem;
  opacity: 0;
  transform: translateY(-10px);
  animation: rise 0.7s ease forwards;
}

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.name {
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.name sup {
  font-family: var(--mono);
  font-size: 0.45em;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.05em;
  vertical-align: super;
  margin-left: 4px;
}

.tagline {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
  letter-spacing: 0.01em;
}

nav {
  display: flex;
  gap: 1.5rem;
  padding-top: 0.25rem;
  flex-shrink: 0;
}

nav a {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  transition: color 0.2s;
  position: relative;
}
nav a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
nav a:hover { color: var(--fg); }
nav a:hover::after { transform: scaleX(1); }
nav a.active { color: var(--fg); }
nav a.active::after { transform: scaleX(1); }

/* ─── DIVIDER ─── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ─── SECTIONS ─── */
section {
  padding: 3rem 0;
  opacity: 0;
  transform: translateY(16px);
  animation: rise 0.6s ease forwards;
}
section:nth-of-type(1) { animation-delay: 0.15s; }
section:nth-of-type(2) { animation-delay: 0.28s; }
section:nth-of-type(3) { animation-delay: 0.41s; }
section:nth-of-type(4) { animation-delay: 0.54s; }
section:nth-of-type(5) { animation-delay: 0.67s; }
section:nth-of-type(6) { animation-delay: 0.80s; }

section + section { border-top: 1px solid var(--border); }

.section-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

/* ─── PAGE HEADER (subpages) ─── */
.page-title {
  font-size: clamp(1.4rem, 3.5vw, 1.75rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  transition: color 0.2s, gap 0.2s;
}
.back-link:hover { color: var(--fg); gap: 9px; }

/* ─── ABOUT ─── */
.about-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  display: block;
}

.about-intro {
  font-size: 1.05rem;
  line-height: 1.75;
  max-width: 560px;
}

.about-intro strong {
  font-weight: 500;
}

.about-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  padding: 5px 12px;
  border: 1px solid var(--subtle);
  border-radius: 100px;
  color: var(--muted);
  transition: border-color 0.2s, color 0.2s;
}
.pill-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── PROJECTS ─── */
.projects-grid {
  display: grid;
  gap: 0.75rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.5rem;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.project-card:hover {
  border-color: var(--subtle);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.project-title {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.project-desc {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.5;
}

.project-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}

a.project-card { display: grid; }

/* ─── SEE MORE BUTTON ─── */
.btn-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  margin-top: 1.25rem;
  padding: 8px 16px;
  border: 1px solid var(--subtle);
  border-radius: 100px;
  color: var(--fg);
  transition: border-color 0.2s, color 0.2s, gap 0.2s;
}
.btn-more:hover {
  border-color: var(--accent);
  color: var(--accent);
  gap: 9px;
}
.btn-more svg { transition: transform 0.2s; flex-shrink: 0; }
.btn-more:hover svg { transform: translateX(2px); }

/* ─── OPEN SOURCE ─── */
.oss-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.oss-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.oss-list li:first-child { border-top: 1px solid var(--border); }

.oss-repo {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  display: block;
  margin-bottom: 2px;
}

.oss-status {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
  color: var(--muted);
  transition: border-color 0.2s, color 0.2s;
}
.oss-status:hover { border-color: var(--accent); color: var(--accent); }
.oss-status.merged { color: #2f9e44; border-color: #2f9e4440; }
.oss-status.merged:hover { border-color: #2f9e44; color: #2f9e44; }

.gh-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}
.gh-stats img {
  flex: 1 1 280px;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* ─── NOTES ─── */
.notes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.notes-list li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.notes-list li:first-child { border-top: 1px solid var(--border); }

.note-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  padding-top: 2px;
}

/* ─── CONTACT ─── */
.contact-line {
  font-size: 0.9rem;
}

.contact-line a {
  border-bottom: 1px solid var(--subtle);
  transition: border-color 0.2s;
}
.contact-line a:hover { border-color: var(--accent); }

/* ─── FOOTER ─── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 3rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ─── ANIMATIONS ─── */
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  header, section { animation: none; opacity: 1; transform: none; }
}

@media (max-width: 480px) {
  nav { gap: 1rem; }
  .header-inner { flex-direction: column; gap: 1rem; }
  .notes-list li { grid-template-columns: 80px 1fr; gap: 1rem; }
  .oss-list li { grid-template-columns: 1fr; align-items: flex-start; gap: 0.4rem; }
}
