/* ---------- Tokens ---------- */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: rgba(9, 9, 11, 0.08);
  --border-strong: rgba(9, 9, 11, 0.16);
  --text: #09090b;
  --muted: #52525b;
  --subtle: #a1a1aa;
  --live: #10b981;
  --spot: rgba(9, 9, 11, 0.035);
  --glow: rgba(9, 9, 11, 0.05);
  --shadow: 0 1px 2px rgba(9, 9, 11, 0.04), 0 12px 32px -16px rgba(9, 9, 11, 0.1);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --max: 1080px;
  --r: 18px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --surface: #0f0f11;
    --surface-2: #18181b;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #fafafa;
    --muted: #a1a1aa;
    --subtle: #5c5c66;
    --live: #34d399;
    --spot: rgba(255, 255, 255, 0.045);
    --glow: rgba(255, 255, 255, 0.07);
    --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(70% 420px at 50% -120px, var(--glow), transparent 80%),
    var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--text); color: var(--bg); }

.i {
  width: 14px; height: 14px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}

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

/* Faint grid behind the hero */
.bg-grid {
  position: absolute;
  inset: 0 0 auto 0;
  height: 720px;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center top;
  mask-image: radial-gradient(ellipse 60% 70% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 0%, #000 20%, transparent 75%);
}

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font: 500 14px/1 var(--sans);
  letter-spacing: -0.005em;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease), opacity .2s;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { opacity: 0.88; }

.btn-secondary {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--surface); }

.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--border); }

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

.logo { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; }
.logo-mark {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.02em;
}

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a:not(.btn) {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  transition: color .2s, background .2s;
}
.nav-links a:not(.btn):hover { color: var(--text); background: var(--surface-2); }
.nav-links .btn { margin-left: 8px; }

/* ---------- Hero ---------- */
.hero { padding: clamp(72px, 14vh, 140px) 0 72px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-size: 13px;
  color: var(--muted);
}

a.pill { transition: color .2s, border-color .2s; }
a.pill .i { width: 12px; height: 12px; margin-left: -2px; transition: transform .25s var(--ease); }
a.pill:hover { color: var(--text); border-color: var(--border-strong); }
a.pill:hover .i { transform: translate(1px, -1px); }

.live-dot {
  position: relative;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--live);
}
.live-dot::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--live);
  animation: ping 2s var(--ease) infinite;
}

h1 {
  max-width: 12ch;
  font-size: clamp(48px, 8vw, 92px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

.role {
  margin-top: 18px;
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--muted);
}

.lede {
  margin-top: 16px;
  max-width: 48ch;
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.6;
  color: var(--muted);
  text-wrap: pretty;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }

/* ---------- Bento ---------- */
.bento {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "projects   projects   location"
    "projects   projects   stack"
    "experience experience contact";
}

.area-projects   { grid-area: projects; }
.area-location   { grid-area: location; }
.area-stack      { grid-area: stack; }
.area-experience { grid-area: experience; }
.area-contact    { grid-area: contact; }

.card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(420px circle at var(--x, 50%) var(--y, -200px), var(--spot), transparent 65%);
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.card:hover::before { opacity: 1; }

.card-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}

.label-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted);
  transition: color .2s;
}
.label-link:hover { color: var(--text); }
.label-link .i { width: 12px; height: 12px; }

/* Projects */
.projects { margin: 0 -12px; }
.projects > li + li { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }

.project {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 16px;
  padding: 18px 12px;
  border-radius: 12px;
  transition: background .25s var(--ease);
}
a.project:hover { background: var(--surface-2); }

.idx { font: 400 12px/1 var(--mono); color: var(--subtle); }

.project h3 { font-size: 16px; font-weight: 500; letter-spacing: -0.015em; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--live) 12%, transparent);
  color: var(--live);
  font: 500 11px/1.2 var(--mono);
  vertical-align: 2px;
}
.project p { margin-top: 3px; font-size: 14px; color: var(--muted); }

.tags { display: flex; gap: 6px; }
.tags li {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: 400 11px/1.2 var(--mono);
  color: var(--muted);
  white-space: nowrap;
}

.arrow { color: var(--subtle); transition: transform .3s var(--ease), color .3s; }
.project:hover .arrow { color: var(--text); transform: translate(2px, -2px); }

/* Location */
.area-location {
  min-height: 280px;
  padding: 0;
  overflow: hidden;
}

.area-location .card-label {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  margin: 0;
  padding: 18px 20px;
  pointer-events: none;
}

.loc-tz {
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--subtle);
}

.map {
  position: absolute;
  inset: 36px 8px 64px;
  z-index: 0;
  display: grid;
  place-items: center;
}

.us-wire {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
}

.loc-meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  margin: 0;
  padding: 16px 20px 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
.loc-city { font-size: 16px; font-weight: 500; letter-spacing: -0.015em; }
.loc-sub { font-size: 13px; color: var(--muted); }
.loc-aside { display: grid; gap: 4px; justify-items: end; text-align: right; }
.coords, .clock {
  font: 400 12px/1.35 var(--mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.coords { color: var(--subtle); }

/* Stack */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 13px;
  color: var(--muted);
  transition: color .2s, border-color .2s;
}
.chips li:hover { color: var(--text); border-color: var(--border-strong); }

/* Experience */
.roles li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}
.roles li:first-child { padding-top: 0; }
.roles li:last-child { padding-bottom: 0; }
.roles li + li { border-top: 1px solid var(--border); }
.roles h3 { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.roles p { font-size: 14px; color: var(--muted); }
.years { font: 400 12px/1 var(--mono); color: var(--subtle); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Contact */
.contact-body h3 { font-size: 22px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; }
.contact-body p { margin-top: 8px; font-size: 14px; color: var(--muted); }

.contact-actions { margin-top: auto; padding-top: 24px; display: grid; gap: 10px; }

.email {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  transition: border-color .2s;
}
.email:hover { border-color: var(--border-strong); }
.email-text { font: 400 13px/1 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-hint { font-size: 12px; color: var(--subtle); transition: color .2s; }
.email.copied .email-hint { color: var(--live); }

.socials { display: flex; gap: 8px; }
.socials a {
  display: grid; place-items: center;
  flex: 1;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  transition: color .2s, border-color .2s, background .2s;
}
.socials a:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.socials svg { width: 16px; height: 16px; }

/* ---------- Footer ---------- */
.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 96px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--border);
  font: 400 12px/1 var(--mono);
  color: var(--subtle);
}

/* ---------- Motion ---------- */
@keyframes ping {
  0%   { transform: scale(1); opacity: 0.6; }
  80%, 100% { transform: scale(3); opacity: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: reveal .9s var(--ease) both; }
  .hero .reveal:nth-child(2) { animation-delay: .06s; }
  .hero .reveal:nth-child(3) { animation-delay: .12s; }
  .hero .reveal:nth-child(4) { animation-delay: .18s; }
  .hero .reveal:nth-child(5) { animation-delay: .24s; }
  .bento .reveal:nth-child(1) { animation-delay: .30s; }
  .bento .reveal:nth-child(2) { animation-delay: .36s; }
  .bento .reveal:nth-child(3) { animation-delay: .42s; }
  .bento .reveal:nth-child(4) { animation-delay: .48s; }
  .bento .reveal:nth-child(5) { animation-delay: .54s; }

  @keyframes reveal {
    from { opacity: 0; transform: translateY(12px); filter: blur(6px); }
    to   { opacity: 1; transform: none; filter: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot::after, .ping::after { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "projects   projects"
      "location   stack"
      "experience experience"
      "contact    contact";
  }
}

@media (max-width: 640px) {
  .container, .nav-inner { padding-left: 16px; padding-right: 16px; }
  .nav-links a:not(.btn) { display: none; }
  .logo-name { display: none; }

  .hero { padding-bottom: 48px; }

  .bento {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "projects" "location" "stack" "experience" "contact";
  }
  .card { padding: 20px; }

  .project { grid-template-columns: 24px minmax(0, 1fr) 16px; row-gap: 10px; }
  .project .tags { grid-column: 2; grid-row: 2; }
  .project .arrow { grid-column: 3; grid-row: 1; }

  .roles li { flex-direction: column; gap: 4px; }
  .foot { margin-top: 64px; }
}
