:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-2: #161616;
  --ink: #f4f4f5;
  --muted: #8a8a8e;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #a78bfa;
  --ok: #34d399;
  --radius: 16px;
  --radius-sm: 12px;
  --max: 1120px;
  --pad: clamp(1rem, 4vw, 1.75rem);
  --cross: color-mix(in srgb, var(--ink) 35%, transparent);
  --font: "DM Sans", system-ui, sans-serif;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --ink: #141414;
  --muted: #667085;
  --line: rgba(20, 20, 20, 0.1);
  --accent: #6d28d9;
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: 5.5rem;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

/* Page shell — vertical side borders */
.shell {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  min-height: 100vh;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

/* Crosshair markers at border intersections */
.cross {
  position: absolute;
  z-index: 10;
  width: 11px;
  height: 11px;
  pointer-events: none;
  color: var(--cross);
  overflow: visible;
}

.cross-tl {
  top: -5.5px;
  left: -5.5px;
}

.cross-tr {
  top: -5.5px;
  right: -5.5px;
}

.cross-bl {
  bottom: -5.5px;
  left: -5.5px;
}

.cross-br {
  bottom: -5.5px;
  right: -5.5px;
}

/* Internal stats column junctions (desktop 4-col) */
.cross-stat {
  display: none;
}

@media (min-width: 640px) {
  .cross-stat {
    display: block;
  }

  .cross-stat-1-top { top: -5.5px; left: calc(25% - 5.5px); }
  .cross-stat-2-top { top: -5.5px; left: calc(50% - 5.5px); }
  .cross-stat-3-top { top: -5.5px; left: calc(75% - 5.5px); }
  .cross-stat-1-bot { bottom: -5.5px; left: calc(25% - 5.5px); }
  .cross-stat-2-bot { bottom: -5.5px; left: calc(50% - 5.5px); }
  .cross-stat-3-bot { bottom: -5.5px; left: calc(75% - 5.5px); }
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem var(--pad);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
}

.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.ghost-btn:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--ink) 25%, var(--line));
}

/* Hero */
.hero {
  display: grid;
  gap: 2rem;
  padding: clamp(2.5rem, 6vw, 4rem) var(--pad);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
  font-weight: 700;
}

.hero-role {
  margin: 0.7rem 0 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--muted);
}

.hero-lead {
  margin: 1rem 0 0;
  max-width: 38rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-solid {
  background: var(--ink);
  color: var(--bg);
}

.btn-outline {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.btn-outline:hover {
  background: var(--surface);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.1rem;
  margin-top: 1.35rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.hero-meta a:hover {
  color: var(--ink);
}

.hero-aside {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.avatar {
  margin: 0;
  width: min(220px, 70vw);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 12%;
}

.social-note {
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 16rem;
}

/* Stats */
.stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line);
}

.stat {
  padding: 1.35rem var(--pad);
}

.stat:nth-of-type(2n) {
  border-left: 1px solid var(--line);
}

.stat:nth-of-type(n + 3) {
  border-top: 1px solid var(--line);
}

.stat strong {
  display: block;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-plus {
  display: inline-block;
  margin-left: 0.02em;
  font-weight: 600;
  vertical-align: 0.08em;
  font-size: 0.78em;
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Sections */
.section {
  position: relative;
  padding: clamp(2.75rem, 7vw, 4.5rem) var(--pad);
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.03em;
}

.section-head p {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.text-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.text-link:hover {
  color: var(--ink);
}

/* Projects */
.project-grid {
  display: grid;
  gap: 1rem;
}

.project-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.project-card--link {
  display: block;
  color: inherit;
}

.project-card:hover {
  border-color: color-mix(in srgb, var(--ink) 22%, var(--line));
}

.project-card-arrow {
  color: var(--muted);
  font-size: 0.95rem;
}

.project-card--link:hover .project-card-arrow {
  color: var(--ink);
}

.project-media {
  height: 160px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}

.project-media--brand img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 18px;
}

.project-body {
  padding: 1.1rem 1.15rem 1.2rem;
}

.project-body h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.project-body h3 a {
  color: var(--muted);
  font-size: 0.95rem;
}

.project-body h3 a:hover {
  color: var(--ink);
}

.project-body > p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 1rem;
}

.project-meta > span {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
}

.tags,
.job-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tags span,
.job-tags span {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

/* Project detail */
.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 1.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.back-link:hover {
  color: var(--ink);
}

.project-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.project-detail-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.project-detail-brand img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.project-detail-head h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.project-detail-head h1 a {
  color: var(--muted);
  font-size: 0.85em;
}

.project-detail-head h1 a:hover {
  color: var(--ink);
}

.project-detail-role {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.project-detail-lead {
  margin: 1.5rem 0 0;
  max-width: 40rem;
  font-size: 1.15rem;
  line-height: 1.55;
  letter-spacing: -0.015em;
}

.project-detail-body {
  margin-top: 1.25rem;
  max-width: 42rem;
  display: grid;
  gap: 1rem;
}

.project-detail-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.shot-grid {
  display: grid;
  gap: 1.25rem;
}

.shot {
  margin: 0;
}

.shot img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.shot figcaption {
  margin-top: 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Experience — keep the card style the user liked */
.jobs {
  display: grid;
  gap: 0.9rem;
}

.job-card {
  padding: 1.2rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.2s ease;
}

.job-card:hover {
  border-color: color-mix(in srgb, var(--ink) 22%, var(--line));
}

.job-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.7rem;
}

.job-heading {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  flex: 1;
}

.job-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.job-company {
  margin: 0 0 0.15rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.job-company a {
  color: inherit;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.job-top h3 {
  margin: 0;
  font-size: clamp(1.02rem, 3.2vw, 1.2rem);
  letter-spacing: -0.02em;
}

.job-when {
  margin: 0;
  width: 100%;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.job-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.job-tags {
  margin-top: 0.9rem;
}

/* Stack */
.tech-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tech-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.86rem;
  font-weight: 600;
}

.tech-item img {
  width: 16px;
  height: 16px;
}

.tech-fallback {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 0.5rem;
  font-weight: 800;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
}

[data-theme="light"] img[src*="FFFFFF"],
[data-theme="light"] img[src*="ffffff"] {
  filter: invert(1);
}

/* Contact */
.contact-list {
  display: grid;
  gap: 0.65rem;
}

.contact-list a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.2s ease;
}

.contact-list a:hover {
  border-color: color-mix(in srgb, var(--ink) 22%, var(--line));
}

.contact-list span {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-list strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
  word-break: break-word;
}

/* Footer */
.site-footer {
  position: relative;
  padding: 2rem var(--pad) 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

.footer-brand {
  margin: 0 0 0.2rem;
  color: var(--ink);
  font-weight: 700;
}

.site-footer p {
  margin: 0;
}

/* Dock */
.dock {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  max-width: calc(100vw - 1.5rem);
  overflow-x: auto;
}

.dock a,
.dock-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.3rem;
  padding: 0 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.dock a:hover,
.dock-theme:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (min-width: 640px) {
  .job-when {
    width: auto;
  }

  .stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .stat:nth-of-type(n + 2) {
    border-left: 1px solid var(--line);
  }

  .stat:nth-of-type(n + 3) {
    border-top: none;
  }

  .contact-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1.35fr 0.65fr;
    align-items: center;
    gap: 2.5rem;
  }

  .hero-aside {
    justify-self: end;
  }

  .project-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .contact-list {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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