/* ─── Design tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:          #f6f3ee;
  --panel-solid: #ffffff;
  --text:        #141414;
  --muted:       #57534e;
  --line:        rgba(20, 20, 20, 0.09);
  --shadow:      6px 6px 18px rgba(20, 20, 20, 0.07), -3px -3px 10px rgba(255,255,255,0.88), inset 0 1px 0 rgba(255,255,255,0.75);
  --shadow-soft: 0 10px 30px rgba(20, 20, 20, 0.05);
  --radius:      26px;
  --nav-height:  64px;
  --max-width:   1120px;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: rgba(20,20,20,0) transparent;
  transition: scrollbar-color 0.6s ease;
}

html.is-scrolling {
  scrollbar-color: rgba(20,20,20,0.2) transparent;
  transition: scrollbar-color 0.1s ease;
}

/* Webkit floating scrollbar — no track, just a floating thumb */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(20,20,20,0);
  border-radius: 999px;
  transition: background 0.6s ease;
}
html.is-scrolling::-webkit-scrollbar-thumb {
  background: rgba(20,20,20,0.2);
  transition: background 0.1s ease;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* Noise texture layer — subtle grain so glassmorphic blur has something to refract */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.038'/%3E%3C/svg%3E"),
    radial-gradient(circle at top, rgba(255, 255, 255, 0.92), transparent 40%),
    linear-gradient(180deg, #fbfaf8 0%, #f2eee8 100%);
  color: var(--text);
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ─── Skip link ──────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  z-index: 9999;
  background: #111;
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
}
.skip-link:focus { left: 12px; }

/* ─── Copy toast ─────────────────────────────────────────────────────────── */
.copy-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(20,20,20,0.88);
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
  backdrop-filter: blur(8px);
}
.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Sticky nav ─────────────────────────────────────────────────────────── */
#header-slot {
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header {
  /* Reduced blur from 22px → 8px so the frosted glass effect is visible
     against the noise texture beneath */
  backdrop-filter: blur(8px) saturate(160%);
  -webkit-backdrop-filter: blur(8px) saturate(160%);
  background: rgba(246, 243, 238, 0.78);
  border-bottom: 1px solid rgba(20, 20, 20, 0.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

/* ─── Brand ──────────────────────────────────────────────────────────────── */
.brand { display: grid; gap: 2px; flex-shrink: 0; }

.brand h1 {
  font-size: 1rem;
  margin: 0;
  letter-spacing: -0.04em;
  font-weight: 700;
  white-space: nowrap;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ─── Desktop nav pills ──────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(20, 20, 20, 0.06);
  box-shadow: var(--shadow-soft);
}

.nav a {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  outline: none;
  white-space: nowrap;
}

.nav a:hover {
  background: rgba(20, 20, 20, 0.06);
  color: var(--text);
  transform: translateY(-1px);
}

.nav a:focus-visible {
  box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.12);
  background: rgba(20, 20, 20, 0.06);
  color: var(--text);
}

.nav a.active {
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  box-shadow: 0 8px 18px rgba(20, 20, 20, 0.14);
}

/* ─── Hamburger (mobile only) ────────────────────────────────────────────── */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(20, 20, 20, 0.08);
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.menu-toggle:hover { background: rgba(20, 20, 20, 0.06); }

.menu-toggle svg {
  width: 18px;
  height: 18px;
  stroke: var(--text);
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
}

.menu-toggle .icon-close { display: none; }
.site-header.nav-open .menu-toggle .icon-open  { display: none; }
.site-header.nav-open .menu-toggle .icon-close { display: block; }

/* ─── Mobile nav drawer ──────────────────────────────────────────────────── */
.nav-drawer {
  display: none;
  flex-direction: column;
  padding: 10px 24px 16px;
  gap: 4px;
  border-top: 1px solid rgba(20, 20, 20, 0.06);
}

.nav-drawer a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 14px;
  transition: background 0.15s ease, color 0.15s ease;
  outline: none;
}

.nav-drawer a:hover,
.nav-drawer a:focus-visible {
  background: rgba(20, 20, 20, 0.05);
  color: var(--text);
}

.nav-drawer a.active {
  background: rgba(20, 20, 20, 0.08);
  color: var(--text);
  font-weight: 600;
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero-section {
  max-width: var(--max-width);
  margin: 20px auto 0;
  padding: 0 24px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.82), rgba(255,255,255,0.68)),
    radial-gradient(circle at top right, rgba(20,20,20,0.04), transparent 30%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  border-radius: 32px;
  padding: 36px 40px;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 32px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(20,20,20,0.06));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -150px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20,20,20,0.06), transparent 68%);
  pointer-events: none;
}

.hero-card h2 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.06em;
  max-width: 12ch;
}

.hero-card > p {
  margin: 0;
  max-width: 66ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.68;
}

.hero-meta {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ─── Pills ──────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(20, 20, 20, 0.08);
  color: var(--text);
  font-size: 0.9rem;
  box-shadow: 0 6px 14px rgba(20, 20, 20, 0.04);
  /* Reset button styles */
  font-family: inherit;
  cursor: default;
}

.pill span {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.82rem;
}

/* Interactive pills: email (copy) and cert (link) */
.pill-interactive {
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  text-decoration: none;
}

.pill-interactive:hover {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(20, 20, 20, 0.09);
  transform: translateY(-1px);
}

.pill-interactive:focus-visible {
  outline: 2px solid rgba(20,20,20,0.3);
  outline-offset: 2px;
}

.pill-interactive:active {
  transform: translateY(0);
}

/* Small copy icon that appears on the email pill */
.pill-interactive .pill-icon {
  width: 13px;
  height: 13px;
  stroke: var(--muted);
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
  opacity: 0.6;
}

/* ─── Page shell ─────────────────────────────────────────────────────────── */
.page-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ─── Sections ───────────────────────────────────────────────────────────── */
.section { margin-top: 32px; padding-top: 8px; }

.card-anchor {
  scroll-margin-top: calc(var(--nav-height) + 24px);
}

/* Indent heading text to align with card content (cards have 26px internal padding) */
.section-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  padding-left: 26px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
}

.section-body {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px;
}

.section-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

/* ─── Cards / Jobs / Education ───────────────────────────────────────────── */
.stack { display: grid; gap: 16px; }

.card, .job, .education-item {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 26px;
}

.card h3, .job h3, .education-item h3 {
  margin: 0 0 6px;
  font-size: 1.06rem;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.meta { margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; }

.card ul, .job ul, .education-item ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.card li, .job li, .education-item li {
  margin: 8px 0;
  line-height: 1.58;
}

/* ─── Grids ──────────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }

/* Fixed 2x2 for the 4 project cards */
.cards-grid { grid-template-columns: repeat(2, 1fr); }

/* 4 skill cards in a row on desktop */
.skills-grid { grid-template-columns: repeat(4, 1fr); }

/* ─── Skill pills ────────────────────────────────────────────────────────── */
.skill-card strong {
  display: block;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.skill-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(20,20,20,0.04);
  border: 1px solid rgba(20,20,20,0.07);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.5;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  max-width: var(--max-width);
  margin: 16px auto 0;
  padding: 0 24px 40px;
}

.footer-card {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding-top: 18px;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-card a:hover { color: var(--text); }

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Skills drop to 2 columns before they get too narrow */
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav { display: none; }
  .menu-toggle { display: flex; }
  .site-header.nav-open .nav-drawer { display: flex; }

  .hero-card { padding: 24px 22px; border-radius: 24px; }
  .hero-card h2 { font-size: clamp(1.9rem, 8vw, 2.8rem); }
  .hero-meta { gap: 8px; }
  .pill { font-size: 0.85rem; padding: 8px 12px; }

  .cards-grid, .skills-grid { grid-template-columns: 1fr; }

  .page-shell { padding: 0 16px 48px; }
  .hero-section { padding: 0 16px; }
  .site-footer { padding: 0 16px 32px; }
  .section { margin-top: 24px; }
  .card, .job, .education-item { padding: 18px 20px; }
  .section-heading { padding-left: 20px; }
}

@media (max-width: 480px) {
  .brand p { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .nav a, .nav-drawer a, .pill-interactive { transition: none; transform: none; }
}
