/* ── Design Tokens ─────────────────────────────────────── */
:root {
  --bg: #fafaf9;
  --bg-alt: #f5f5f4;
  --surface: #ffffff;
  --surface-2: #f0eeec;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text: #1c1917;
  --text-secondary: #44403c;
  --muted: #78716c;
  --accent: #1c1917;
  --accent-2: #57534e;
  --accent-color: #b45309;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.08);
  --font-sans: "Inter", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-serif: "Playfair Display", Georgia, "Noto Serif SC", serif;
  --max: 860px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.lead,
.card-title,
.card-sub,
.card-note,
.card-text,
.list,
.tags li {
  overflow-wrap: anywhere;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--text);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition), opacity var(--transition);
}

a:hover {
  color: var(--accent-color);
}

/* ── Skip Link ─────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  z-index: 1000;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ── Header ────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 249, 0.92);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text);
}

.logo:hover {
  color: var(--text);
  opacity: 0.7;
}

.nav {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 0.5rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition);
}

.nav-toggle:hover {
  border-color: var(--border-strong);
}

.nav-toggle-bar {
  width: 18px;
  height: 1.5px;
  background: var(--text);
  border-radius: 1px;
  transition: background var(--transition);
}

.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0rem;
  align-items: center;
  justify-content: flex-end;
}

.nav-menu a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.6rem;
  letter-spacing: 0.02em;
  transition: color var(--transition);
  position: relative;
}

.nav-menu a::after {
  content: "";
  position: absolute;
  bottom: 0.2rem;
  left: 0.6rem;
  right: 0.6rem;
  height: 1px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--transition);
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
  color: var(--text);
}

.nav-menu a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-cv-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-cv-icon {
  flex-shrink: 0;
  opacity: 0.7;
}

/* ── Header Actions ────────────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}

.lang-seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
  line-height: 1;
  transition: all var(--transition);
}

.lang-seg-btn:hover {
  color: var(--text);
}

.lang-seg-btn.is-active {
  background: var(--text);
  color: var(--bg);
}

/* ── Layout ────────────────────────────────────────────── */
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Hero ──────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 6rem 0 5rem;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: var(--bg);
  pointer-events: none;
}

.hero-inner {
  position: relative;
}

.hero-kicker {
  margin: 0 0 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-title {
  margin: 0 0 1.25rem;
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

.hero-sub {
  margin: 0 0 2rem;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border-strong);
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.chip:hover {
  border-color: var(--text);
  color: var(--text);
}

.chip-muted {
  color: var(--muted);
}

.chip-outline {
  background: transparent;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.5rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.88rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border: none;
}

.btn-primary:hover {
  background: var(--accent-2);
  color: var(--bg);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--text);
  color: var(--text);
}

.btn-accent {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.btn-accent:hover {
  border-color: var(--text);
  color: var(--text);
}

/* ── Sections ──────────────────────────────────────────── */
.section {
  padding: 4.5rem 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.subsection-title {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.lead {
  margin: 0;
  max-width: 44rem;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.8;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}

.card-feature {
  border-color: var(--border-strong);
}

.card-hover:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.card-note {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-style: italic;
}

.card-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.7;
}

/* ── Badges ────────────────────────────────────────────── */
.badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge-accent {
  color: var(--bg);
  background: var(--text);
  border-color: transparent;
}

.badge-inline {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Project Links ─────────────────────────────────────── */
.proj-link-row {
  margin: 0 0 0.65rem;
}

.proj-repo-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  transition: text-decoration-color var(--transition);
}

.proj-repo-link:hover {
  text-decoration-color: var(--text);
  color: var(--text);
}

/* ── Lists ─────────────────────────────────────────────── */
.list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.list li + li {
  margin-top: 0.4rem;
}

.list li::marker {
  color: var(--border-strong);
}

/* ── Timeline ──────────────────────────────────────────── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Grids ─────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-2 .card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

.grid-3 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 900px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card.compact {
  box-shadow: none;
  background: transparent;
  border-color: var(--border);
}

/* ── Honors ────────────────────────────────────────────── */
.honors-block {
  margin-top: 2.5rem;
}

.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tags li {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border-strong);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ── Skills ────────────────────────────────────────────── */
.skills-wrap {
  display: grid;
  gap: 2rem;
}

@media (min-width: 720px) {
  .skills-wrap {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}

.skill-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
}

.skill-pill {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border-strong);
  font-size: 0.78rem;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

/* ── Contact ───────────────────────────────────────────── */
.contact-section .lead {
  margin-bottom: 1.5rem;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ── Footer ────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  background: var(--bg);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-inner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-note {
  max-width: 40rem;
  opacity: 0.7;
  word-break: break-word;
}

/* ── Reveal Animation ──────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive: Mobile ────────────────────────────────── */
@media (max-width: 640px) {
  .container {
    padding: 0 1.25rem;
  }

  .header-inner {
    padding: 0.75rem 1.25rem;
  }

  .section {
    padding: 3rem 0;
  }

  .hero {
    padding: 4rem 0 3.5rem;
  }

  .hero-meta {
    gap: 0.35rem;
  }

  .hero-cta {
    gap: 0.5rem;
  }

  .btn {
    font-size: 0.85rem;
    padding: 0.55rem 1.1rem;
  }
}

/* ── Responsive: Nav Collapse ──────────────────────────── */
@media (max-width: 820px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    right: 1rem;
    top: calc(100% + 0.5rem);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-width: 200px;
    padding: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: none;
  }

  .nav-menu.is-open {
    display: flex;
  }

  .nav-menu a {
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
  }

  .nav-menu a::after {
    display: none;
  }

  .nav-menu a:hover {
    background: var(--bg-alt);
  }

  .nav {
    position: relative;
  }
}

/* ── Reduced Motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
