/* ----------------------------------------------------------------
   Fonts
---------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Variable.woff2") format("woff2-variations"),
       url("../fonts/Inter-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Italic-Variable.woff2") format("woff2-variations"),
       url("../fonts/Inter-Italic-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Variable.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ----------------------------------------------------------------
   Design tokens
---------------------------------------------------------------- */
:root {
  --brand-violet: #8b5cf6;
  --brand-violet-deep: #6d28d9;
  --brand-orange: #f97316;
  --brand-orange-deep: #ea580c;

  --radius: 8px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --container: 1180px;
  --gutter: clamp(1rem, 4vw, 2rem);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* Dark (default) */
:root,
:root[data-theme="dark"] {
  --bg: #07070a;
  --bg-elev: #0d0d12;
  --surface: #111117;
  --surface-alt: #16161d;
  --surface-hover: #1b1b24;

  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);

  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;

  --accent: #a78bfa;
  --accent-2: #fb923c;
  --focus: #a78bfa;
  --danger: #f87171;
  --success: #4ade80;

  --grad-accent: linear-gradient(135deg, #a78bfa 0%, #fb923c 100%);
  --grad-accent-soft: linear-gradient(135deg, rgba(167, 139, 250, .18) 0%, rgba(251, 146, 60, .18) 100%);

  --orb-violet: radial-gradient(60% 60% at 50% 50%, rgba(139, 92, 246, .45) 0%, rgba(139, 92, 246, 0) 70%);
  --orb-orange: radial-gradient(60% 60% at 50% 50%, rgba(249, 115, 22, .35) 0%, rgba(249, 115, 22, 0) 70%);

  --grid-color: rgba(255, 255, 255, .035);

  --shadow-card: 0 1px 0 rgba(255,255,255,.04) inset, 0 24px 48px -32px rgba(0,0,0,.7);
  --shadow-lift: 0 30px 60px -30px rgba(139, 92, 246, .35);
}

/* Light */
:root[data-theme="light"] {
  --bg: #fbfbfd;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f5f5f7;
  --surface-hover: #ededf0;

  --border: rgba(9, 9, 11, .08);
  --border-strong: rgba(9, 9, 11, .16);

  --text: #09090b;
  --text-muted: #3f3f46;
  --text-subtle: #71717a;

  --accent: #7c3aed;
  --accent-2: #ea580c;
  --focus: #7c3aed;
  --danger: #b91c1c;
  --success: #15803d;

  --grad-accent: linear-gradient(135deg, #7c3aed 0%, #ea580c 100%);
  --grad-accent-soft: linear-gradient(135deg, rgba(124, 58, 237, .10) 0%, rgba(234, 88, 12, .10) 100%);

  --orb-violet: radial-gradient(60% 60% at 50% 50%, rgba(124, 58, 237, .20) 0%, rgba(124, 58, 237, 0) 70%);
  --orb-orange: radial-gradient(60% 60% at 50% 50%, rgba(234, 88, 12, .18) 0%, rgba(234, 88, 12, 0) 70%);

  --grid-color: rgba(9, 9, 11, .04);

  --shadow-card: 0 1px 0 rgba(255,255,255,.9) inset, 0 12px 28px -16px rgba(9,9,11,.12);
  --shadow-lift: 0 24px 50px -24px rgba(124, 58, 237, .35);
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "ss01", "ss03", "cv11", "kern";
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Ambient background: grid + fixed orbs */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: -1px -1px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    var(--orb-violet),
    var(--orb-orange);
  background-repeat: no-repeat;
  background-position: -10% -20%, 110% 20%;
  background-size: 70vw 70vw, 70vw 70vw;
  filter: blur(40px);
  z-index: 0;
}

main, .site-header, .site-footer { position: relative; z-index: 1; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: color .2s var(--ease);
}
a:hover { color: var(--accent); }

/* ----------------------------------------------------------------
   Typography
---------------------------------------------------------------- */
h1, h2, h3 {
  margin: 0 0 .5em;
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 600;
  font-feature-settings: "ss01", "ss03", "cv11", "kern";
}
h1 { font-size: clamp(2.5rem, 8vw, 6rem); letter-spacing: -0.045em; font-weight: 700; }
h2 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.04em; }
h3 { font-size: 1.125rem; letter-spacing: -0.015em; line-height: 1.3; }

p { margin: 0 0 1em; color: var(--text-muted); }

.italic-accent {
  font-style: italic;
  font-weight: 500;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mono {
  font-family: var(--font-mono);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 500;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--text);
  color: var(--bg);
  padding: .5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ----------------------------------------------------------------
   Header
---------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}
.brand {
  font-family: var(--font-sans);
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.brand:hover { color: var(--text); }
.brand-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--grad-accent);
  box-shadow: 0 0 16px 0 color-mix(in srgb, var(--accent) 60%, transparent);
}

.nav {
  display: none;
  gap: 1.5rem;
  align-items: center;
}
.nav a {
  color: var(--text-muted);
  font-size: .9375rem;
  font-weight: 450;
  position: relative;
  padding: .25rem 0;
}
.nav a:hover { color: var(--text); }

.lang-switch {
  display: inline-flex;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.lang-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  padding: 0 .75rem;
  font-family: var(--font-mono);
  font-size: .6875rem;
  line-height: 1;
  color: var(--text-subtle);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .06em;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface-alt);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: color .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-alt);
}
.theme-toggle svg { width: 15px; height: 15px; display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.header-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
}

@media (min-width: 860px) {
  .nav { display: flex; }
}

/* ----------------------------------------------------------------
   Sections
---------------------------------------------------------------- */
section {
  padding: clamp(4rem, 10vw, 8rem) 0;
  position: relative;
}

.section-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 2.5rem;
}
.section-head .mono {
  color: var(--text-subtle);
}
.section-head .mono::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: currentColor;
  margin-right: .75rem;
  vertical-align: middle;
}

/* ----------------------------------------------------------------
   Hero
---------------------------------------------------------------- */
.hero {
  padding-top: clamp(5rem, 12vw, 9rem);
  padding-bottom: clamp(4rem, 8vw, 7rem);
  min-height: 80vh;
  display: flex;
  align-items: center;
}
.hero .container { width: 100%; }

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .375rem .75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  margin-bottom: 1.75rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-muted);
  letter-spacing: .04em;
}
.hero-kicker .status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px 0 var(--success);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .6; transform: scale(.85); }
}

.hero-name {
  margin: 0 0 1.25rem;
  background: linear-gradient(180deg, var(--text) 55%, color-mix(in srgb, var(--text) 50%, transparent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-summary {
  font-size: clamp(1.125rem, 1.8vw, 1.375rem);
  line-height: 1.45;
  color: var(--text);
  max-width: 44rem;
  margin-bottom: 2rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.hero-summary em {
  font-style: italic;
  font-weight: 500;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-proof {
  margin: 0;
  color: var(--text-subtle);
  font-size: .75rem;
  letter-spacing: .04em;
}
.hero-proof::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: currentColor;
  margin-right: .75rem;
  vertical-align: middle;
  opacity: .5;
}

/* ----------------------------------------------------------------
   About
---------------------------------------------------------------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 860px) {
  .about-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 4rem; }
}
.about-lede {
  font-size: clamp(1.375rem, 2.4vw, 1.875rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: var(--text);
  font-weight: 500;
}
.about-body p {
  color: var(--text-muted);
  font-size: 1.0625rem;
  line-height: 1.65;
}
.about-body p + p { margin-top: 1em; }

/* ----------------------------------------------------------------
   Cards grid
---------------------------------------------------------------- */
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad-accent);
  opacity: 0;
  transition: opacity .3s var(--ease);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.card:hover::before { opacity: .7; }
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}
.card-number {
  font-family: var(--font-mono);
  font-size: .6875rem;
  color: var(--text-subtle);
  letter-spacing: .1em;
  margin-bottom: 1rem;
  display: block;
}
.card h3 {
  margin-bottom: .5rem;
  color: var(--text);
}
.card p {
  margin: 0;
  font-size: .9375rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ----------------------------------------------------------------
   Stack
---------------------------------------------------------------- */
.stack-groups {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .stack-groups { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .stack-groups { grid-template-columns: repeat(3, 1fr); } }

.stack-group h3 {
  font-family: var(--font-mono);
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-subtle);
  margin-bottom: 1rem;
  font-weight: 500;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tag {
  display: inline-block;
  padding: .375rem .75rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.tag:hover {
  border-color: var(--border-strong);
  background: var(--surface-alt);
}

.stack-intro {
  max-width: 48rem;
  font-size: 1.0625rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

/* ----------------------------------------------------------------
   Experience timeline
---------------------------------------------------------------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.timeline-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: .25rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  position: relative;
}
.timeline-item:last-child { border-bottom: 1px solid var(--border); }

.timeline-period {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-subtle);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.timeline-role {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.3;
}
.timeline-company {
  font-size: .9375rem;
  color: var(--text-muted);
}

.timeline-footnote {
  margin-top: 2rem;
  font-size: .875rem;
  color: var(--text-subtle);
  font-style: italic;
}

/* Grouped item (Insoner) */
.timeline-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.timeline-company--lead {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
  margin-bottom: 1rem;
}
.timeline-subroles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.timeline-subrole {
  display: grid;
  grid-template-columns: 1fr;
  gap: .125rem;
  padding: .75rem 0;
  border-top: 1px dashed var(--border);
}
.timeline-subrole:first-child { border-top: 0; padding-top: 0; }
.timeline-subrole .timeline-period-sub {
  font-family: var(--font-mono);
  font-size: .6875rem;
  color: var(--text-subtle);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.timeline-subrole .timeline-role {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

@media (min-width: 720px) {
  .timeline-item {
    grid-template-columns: 12rem 1fr;
    align-items: baseline;
    gap: 2rem;
  }
  .timeline-item--group { align-items: start; }
  .timeline-subrole {
    grid-template-columns: 10rem 1fr;
    align-items: baseline;
    gap: 1.5rem;
  }
}

/* ----------------------------------------------------------------
   Contact
---------------------------------------------------------------- */
.contact-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: start;
}
@media (min-width: 860px) {
  .contact-wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 5rem; }
}

.contact-headline {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  font-weight: 600;
  margin: 0 0 1rem;
}
.contact-headline em {
  font-style: italic;
  font-weight: 500;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.contact-blurb {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 32rem;
  margin-bottom: 1.75rem;
}
.contact-elsewhere {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  font-size: .9375rem;
}
.contact-elsewhere a {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.contact-elsewhere a:hover { color: var(--text); }

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow-card);
  position: relative;
}

.form-field { display: flex; flex-direction: column; gap: .375rem; margin-bottom: 1rem; }
.form-field label {
  font-family: var(--font-mono);
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-subtle);
}
.form-field input,
.form-field textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem .875rem;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--focus) 60%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}
.form-field textarea { resize: vertical; min-height: 8rem; }
.form-field .error-msg {
  display: none;
  color: var(--danger);
  font-size: .8125rem;
  margin-top: .125rem;
}
.form-field.has-error .error-msg { display: block; }
.form-field.has-error input,
.form-field.has-error textarea { border-color: var(--danger); }

.hp-field {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .875rem 1.5rem;
  font-family: var(--font-sans);
  font-size: .9375rem;
  font-weight: 500;
  color: #fff;
  background: var(--grad-accent);
  background-size: 200% 100%;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-position .4s var(--ease), transform .2s var(--ease), box-shadow .3s var(--ease);
  min-height: 44px;
  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--accent) 60%, transparent);
  letter-spacing: -0.005em;
}
.btn:hover {
  background-position: 100% 0;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 16px 40px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.form-status { font-size: .9375rem; margin-top: 1rem; min-height: 1.4em; }
.form-status.success { color: var(--success); }
.form-status.error { color: var(--danger); }

.turnstile-wrap { margin-bottom: 1rem; }

/* ----------------------------------------------------------------
   Footer
---------------------------------------------------------------- */
.site-footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: .875rem;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}
.footer-links { display: flex; gap: 1.25rem; align-items: center; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }

/* ----------------------------------------------------------------
   Reduced motion
---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  body::after { display: none; }
}
