:root {
  --bg: #16161a;
  --bg-soft: #1e1e24;
  --surface: #1c1c22;
  --ink: #f0ede8;
  --ink-soft: #d2cec6;
  --muted: #a09b93;
  --faint: #7e796f;
  --line: #2e2e36;
  --line-strong: #f0ede8;
  --accent: #ff4da6;
  --accent-soft: rgba(255, 77, 166, 0.14);
  --radius: 0px;
  --shadow: 0 1px 0 rgba(0,0,0,0.2);
  --container: 1240px;
  --font-display: 'Archivo', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f2ee;
  --bg-soft: #eceae5;
  --surface: #fbfaf8;
  --ink: #171717;
  --ink-soft: #3d3d3a;
  --muted: #686762;
  --faint: #8a8882;
  --line: #d8d4cd;
  --line-strong: #171717;
  --accent: #ff2d8a;
  --accent-soft: rgba(255, 45, 138, 0.1);
  --shadow: 0 1px 0 rgba(23,23,23,0.04);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, h4 { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg);
  padding: 0.75rem 1rem; z-index: 1000; font-family: var(--font-mono); font-size: 0.75rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.container {
  width: min(calc(100% - 2rem), var(--container));
  margin-inline: auto;
}
.section-border { border-bottom: 1px solid var(--line); }
.section { padding: 5.5rem 0; }

.hud-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.hud-index { color: var(--accent); }
.accent { color: var(--accent); }

/* HEADER */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 72px; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.75rem; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em;
}
.brand-name { display: block; font-size: 0.95rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.brand-alias { display: block; font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); letter-spacing: 0.04em; }
.site-nav { display: flex; align-items: center; gap: 0.25rem; }
.site-nav a {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0.65rem 0.9rem; color: var(--ink-soft);
  border: 1px solid transparent; transition: color .2s, border-color .2s, background .2s;
}
.site-nav a:hover, .site-nav a:focus-visible { color: var(--ink); border-color: var(--line); background: var(--surface); }
.site-nav .nav-cta { border-color: var(--ink); color: var(--ink); }
.site-nav .nav-cta:hover { background: var(--ink); color: var(--bg); }
.nav-toggle {
  display: none; width: 44px; height: 44px; border: 1px solid var(--line); align-items: center; justify-content: center;
  flex-direction: column; gap: 7px;
}
.nav-toggle span:not(.sr-only) { display: block; width: 20px; height: 1.5px; background: var(--ink); transition: transform .2s, opacity .2s; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid var(--line); color: var(--ink-soft);
  background: transparent; transition: color .2s, border-color .2s, background .2s;
  margin-left: 0.25rem;
}
.theme-toggle:hover, .theme-toggle:focus-visible { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  padding: 0.85rem 1.2rem; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid var(--ink);
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface); border-color: var(--ink); }

/* HERO */
.hero { padding: 5rem 0 4.5rem; background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 3rem; align-items: start;
}
.hero-title {
  margin-top: 1.25rem;
  font-size: clamp(2.8rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-weight: 700;
  max-width: 11ch;
}
.hero-title .line { display: block; }
.hero-lead {
  margin-top: 1.75rem; max-width: 62ch; font-size: 1.02rem; color: var(--ink-soft);
}
.hero-lead strong { color: var(--ink); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.7rem;
  border: 1px solid var(--line); background: var(--surface);
  font-family: var(--font-mono); font-size: 0.67rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
}
.meta-chip i { color: var(--ink-soft); font-size: 0.7rem; }
.meta-chip-open { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.meta-chip-open i { color: var(--accent); font-size: 0.45rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.hero-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0; margin-top: 3rem;
  border: 1px solid var(--line); background: var(--surface);
}
.stat { padding: 1.25rem 1.25rem; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat-value { display: block; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.stat-label { display: block; margin-top: 0.45rem; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.hero-aside { display: flex; flex-direction: column; gap: 1rem; }
.portrait-card { border: 1px solid var(--line); background: var(--surface); }
.portrait-top, .portrait-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1rem;
}
.portrait-top { border-bottom: 1px solid var(--line); }
.portrait-bottom { border-top: 1px solid var(--line); }
.status-dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 4px var(--accent-soft); flex-shrink: 0; }
.portrait { width: 100%; height: 280px; object-fit: cover; object-position: center top; filter: grayscale(100%) contrast(1.02); }
.portrait-name { font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; }
.portrait-role { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.2rem; }
.icon-link {
  width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line);
  color: var(--ink); transition: all .2s;
}
.icon-link:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.activity-card, .note-card {
  padding: 1.1rem 1.25rem; border: 1px solid var(--line); background: var(--bg-soft);
}
.activity-card p:last-child, .note-card p:last-child { margin-top: 0.65rem; font-size: 0.9rem; color: var(--ink-soft); }
.activity-chart {
  display: block; width: 100%; height: auto; margin-top: 0.85rem;
  border: 1px solid var(--line); background: var(--surface); padding: 0.5rem;
}
.activity-card .card-link {
  display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.85rem;
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); transition: color .2s;
}
.activity-card .card-link:hover { color: var(--accent); }

/* SECTION HEAD */
.section-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: end;
  margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line);
}
.section-title {
  margin-top: 1rem; font-size: clamp(2rem, 4.8vw, 3.8rem); line-height: 0.98; letter-spacing: -0.04em; font-weight: 700;
  max-width: 12ch;
}
.section-desc { color: var(--muted); max-width: 58ch; font-size: 0.98rem; justify-self: end; }

/* PROJECTS */
.project-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1.25rem;
}
.project-card {
  border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column;
  transition: border-color .25s, transform .25s;
  position: relative;
}
.project-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform .3s ease; z-index: 2;
}
.project-card:hover { border-color: var(--muted); transform: translateY(-2px); }
.project-card:hover::before { transform: scaleX(1); }
.project-body { padding: 1.4rem; display: flex; flex-direction: column; flex: 1; }
.project-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.85rem; }
.project-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line);
}
.project-meta .hud-label { font-size: 0.64rem; }
.project-index {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em;
  color: var(--accent);
}
.project-links { display: flex; gap: 0.5rem; }
.project-links a {
  width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line);
  color: var(--ink-soft); transition: all .2s; font-size: 0.88rem;
}
.project-links a:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.project-title { font-size: 1.55rem; line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; }
.project-desc { margin-top: 0.85rem; color: var(--ink-soft); font-size: 0.94rem; line-height: 1.65; }
.project-activity {
  margin-top: 1.25rem; padding: 1rem; border: 1px solid var(--line); background: var(--bg);
}
.project-activity p { margin-top: 0.5rem; font-size: 0.86rem; color: var(--muted); line-height: 1.6; }
.project-footer {
  margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.project-stats { display: flex; gap: 1rem; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.project-stats span { display: inline-flex; align-items: center; gap: 0.4rem; }
.project-topics { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.topic {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.3rem 0.45rem; border: 1px solid var(--line); color: var(--muted); background: var(--bg);
}

/* EXPERIENCE */
.experience-list { border: 1px solid var(--line); background: var(--surface); }
.exp-item {
  display: grid; grid-template-columns: minmax(220px, 280px) minmax(0,1fr); gap: 2rem;
  padding: 2rem; border-bottom: 1px solid var(--line);
}
.exp-item:last-child { border-bottom: 0; }
.exp-period {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink); line-height: 1.6;
}
.exp-location { margin-top: 0.6rem; font-size: 0.88rem; color: var(--muted); }
.exp-role { font-size: 1.4rem; line-height: 1.2; letter-spacing: -0.03em; font-weight: 700; }
.exp-company {
  margin-top: 0.35rem; font-family: var(--font-mono); font-size: 0.72rem; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.exp-highlights { margin-top: 1.1rem; display: grid; gap: 0.55rem; }
.exp-highlights li {
  position: relative; padding-left: 1.1rem; color: var(--ink-soft); font-size: 0.94rem;
}
.exp-highlights li::before {
  content: ""; position: absolute; left: 0; top: 0.72em; width: 0.5rem; height: 1px; background: var(--accent);
}

/* STACK */
.stack-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1rem; }
.stack-card { border: 1px solid var(--line); background: var(--surface); padding: 1.5rem; min-height: 100%; }
.stack-card .hud-label { color: var(--ink); margin-bottom: 1rem; }
.stack-card ul { display: grid; gap: 0.6rem; }
.stack-card li {
  padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 0.93rem;
}
.stack-card li:last-child { padding-bottom: 0; border-bottom: 0; }

/* CONTACT */
.contact-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 2rem; align-items: start; }
.contact-lead { margin-top: 1.25rem; max-width: 58ch; color: var(--ink-soft); font-size: 1rem; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.contact-panel { border: 1px solid var(--line); background: var(--surface); }
.contact-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); font-size: 0.94rem;
}
.contact-row:last-child { border-bottom: 0; }
.contact-row .hud-label { font-size: 0.66rem; }
.availability { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 600; }
.availability .status-dot { width: 7px; height: 7px; box-shadow: none; }

/* FOOTER */
.site-footer { padding: 2rem 0; color: var(--muted); font-size: 0.85rem; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.footer-note { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; }

/* RESPONSIVE */
@media (max-width: 1024px) {
  .hero-grid, .section-head, .contact-grid { grid-template-columns: 1fr; }
  .section-desc { justify-self: start; }
  .hero-title { max-width: 12ch; }
  .stack-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none; position: absolute; top: calc(100% + 1px); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 1rem;
    flex-direction: column; align-items: stretch;
  }
  .site-nav.open { display: flex; }
  .site-nav a { width: 100%; }
  .site-nav .theme-toggle { width: 100%; justify-content: flex-start; padding: 0.65rem 0.9rem; margin-left: 0; height: auto; }
  .project-grid { grid-template-columns: 1fr; }
  .exp-item { grid-template-columns: 1fr; gap: 0.75rem; padding: 1.5rem; }
}
@media (max-width: 640px) {
  .section { padding: 4rem 0; }
  .hero { padding: 3.5rem 0 3rem; }
  .hero-stats { grid-template-columns: 1fr; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .stack-grid { grid-template-columns: 1fr; }
  .project-body { padding: 1.2rem; }
  .project-title { font-size: 1.35rem; }
  .contact-row { flex-direction: column; align-items: flex-start; }
  .btn { width: 100%; }
  .hero-actions, .contact-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

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