:root {
  --bg: #0d0d0f;
  --surface: #17171a;
  --surface-2: #1f1f23;
  --border: #2a2a30;
  --fg: #f4f4f5;
  --muted: #9a9aa3;
  --blue: #F54E00;
  --grid-dot: rgba(255, 255, 255, 0.10);
  --chrome-bg: rgba(31, 31, 35, 0.72);
  --pill-on-bg: #ffffff;
  --pill-on-fg: #0d0d0f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --display: "Unbounded", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

:root[data-theme="light"] {
  --bg: #eeefe9;
  --surface: #ffffff;
  --surface-2: #e5e7e0;
  --border: #d0d1c9;
  --grid-dot: rgba(0, 0, 0, 0.13);
  --chrome-bg: rgba(255, 255, 255, 0.75);
  --fg: #111114;
  --muted: #62626b;
  --pill-on-bg: #111114;
  --pill-on-fg: #ffffff;
  --shadow: 0 10px 30px rgba(20, 20, 40, 0.14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: 120px;
}

/* ---------- Hero background ---------- */
.hero-bg {
  position: absolute;
  inset: 0 0 auto 0;
  height: 600px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}
.hero-bg canvas { width: 100%; height: 100%; display: block; }

/* ---------- Top bar ---------- */
.topbar {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
}
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  background: var(--surface-2);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border), var(--shadow);
}
.pill-location {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--chrome-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: var(--display);
  font-size: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}
.flag {
  width: 22px;
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(180deg, #fff 50%, #dc143c 50%);
}
.theme-toggle {
  justify-self: end;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--chrome-bg);
  color: var(--fg);
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.2s ease, background 0.2s ease;
}
.theme-toggle:hover { transform: rotate(15deg); background: var(--surface); }
.theme-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sun { display: none; }
:root[data-theme="light"] .icon-sun { display: block; }
:root[data-theme="light"] .icon-moon { display: none; }

/* ---------- Hero ---------- */
main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.hero {
  text-align: center;
  padding: 150px 0 56px;
}
.eyebrow {
  display: inline-block;
  margin: 0 0 18px;
  padding: 6px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--muted);
  font-family: var(--display);
  font-size: clamp(14px, 1.6vw, 18px);
}
.eyebrow b { color: var(--fg); font-weight: 400; border-bottom: 2px solid var(--blue); }
h1 {
  margin: 0 auto;
  max-width: 17ch;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(30px, 5.2vw, 62px);
  line-height: 1.14;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}
.tabs button {
  font-family: var(--display);
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.tabs button:hover { transform: translateY(-1px); }
.tabs button[aria-selected="true"] {
  background: var(--pill-on-bg);
  color: var(--pill-on-fg);
  border-color: var(--pill-on-bg);
}

:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* ---------- Work cards ---------- */
.panel { animation: rise 0.35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.card {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  overflow: hidden;
  margin-bottom: 24px;
}
.card-text { padding: 44px; display: flex; flex-direction: column; }
.card-meta {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}
.card-meta span { color: var(--accent); }
:root[data-theme="light"] .card-meta span { color: var(--fg); }
.card h2 {
  margin: 0 0 16px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.2;
}
.card p { margin: 0 0 12px; color: var(--muted); }
.card p.context { color: var(--fg); font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 20px; }
.tag {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
}
.card-visual {
  position: relative;
  min-height: 340px;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(120% 90% at 80% 0%, color-mix(in srgb, var(--accent) 42%, transparent), transparent 70%),
    color-mix(in srgb, var(--accent) 12%, var(--surface-2));
}
.viz {
  width: 100%;
  max-width: 520px;
  background: #101014;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.viz-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  font-size: 11px;
  color: #8b8b95;
}
.viz-bar i { width: 9px; height: 9px; border-radius: 50%; background: #3a3a42; }
.viz-bar span { margin-left: 8px; }
.viz svg { display: block; width: 100%; height: auto; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 36px;
}
.block h3 {
  margin: 0 0 20px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.block .tags { margin-top: 0; padding-top: 0; }
.block .tag { font-size: 13px; padding: 8px 14px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.about-grid .wide { grid-column: 1 / -1; }
.lede { margin: 0; font-size: clamp(17px, 1.7vw, 21px); line-height: 1.6; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.rows li:first-child { border-top: 0; padding-top: 0; }
.rows li:last-child { padding-bottom: 0; }
.rows strong { font-weight: 600; display: block; }
.rows small { color: var(--muted); font-size: 14px; }
.rows .right { color: var(--muted); font-family: var(--mono); font-size: 13px; white-space: nowrap; text-align: right; }

/* ---------- Dock ---------- */
.dock {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
}
.dock a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  min-width: 56px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.dock a:hover { transform: translateY(-3px); }
.dock a.primary {
  padding: 0 26px;
  background: var(--pill-on-bg);
  color: var(--pill-on-fg);
  border-color: var(--pill-on-bg);
  font-family: var(--display);
  font-size: 15px;
  white-space: nowrap;
}
.dock svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dock svg.solid { fill: currentColor; stroke: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .card { grid-template-columns: 1fr; }
  .card-text { padding: 28px; }
  .card-visual { min-height: 0; padding: 24px; }
  .skills-grid, .about-grid { grid-template-columns: 1fr; }
  .block { padding: 28px; }
  .hero { padding: 96px 0 44px; }
}
@media (max-width: 520px) {
  .topbar { padding: 16px; }
  main { padding: 0 16px; }
  .avatar, .theme-toggle { width: 44px; height: 44px; }
  .pill-location { font-size: 12px; padding: 8px 14px; }
  .tabs button { padding: 10px 18px; font-size: 14px; }
  .card, .block { border-radius: 22px; }
  .dock { gap: 6px; }
  .dock a { height: 50px; min-width: 50px; }
  .dock a.primary { padding: 0 18px; font-size: 13px; }
  .rows li { flex-direction: column; gap: 4px; }
  .rows .right { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
