/* Dark-first. One wide column (max 1200px), a full-bleed hero with an animated
   field of storage-slot writes behind huge display type, then card grid,
   timeline and an oversized contact block. Light theme mirrors the tokens. */
:root {
  --bg: #0a0d12;
  --bg-2: #0f141b;
  --surface: #131a22;
  --surface-2: #192230;
  --fg: #eef1f5;
  --fg-2: #a9b3bf;
  --fg-3: #6b7683;
  --line: #222b36;
  --line-2: #2d3845;
  --accent: #f2b544;
  --accent-2: #ffd27a;
  --accent-ink: #f2b544;
  --field-dot: rgba(169, 179, 191, 0.10);
  --field-write: 242, 181, 68;

  --font-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f4f7;
    --bg-2: #eaedf1;
    --surface: #ffffff;
    --surface-2: #f6f7fa;
    --fg: #10151c;
    --fg-2: #4a5563;
    --fg-3: #7b8694;
    --line: #dde1e7;
    --line-2: #cbd1d9;
    --accent: #c47f0e;
    --accent-2: #e09a1f;
    --accent-ink: #9a6208;
    --field-dot: rgba(16, 21, 28, 0.10);
    --field-write: 196, 127, 14;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f4f7;
  --bg-2: #eaedf1;
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --fg: #10151c;
  --fg-2: #4a5563;
  --fg-3: #7b8694;
  --line: #dde1e7;
  --line-2: #cbd1d9;
  --accent: #c47f0e;
  --accent-2: #e09a1f;
  --accent-ink: #9a6208;
  --field-dot: rgba(16, 21, 28, 0.10);
  --field-write: 196, 127, 14;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.92;
  text-wrap: balance;
  font-variation-settings: "opsz" 96;
}
.h2 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  letter-spacing: -0.03em;
  line-height: 1;
  text-wrap: balance;
}

/* shared gutter */
.top, .hero-inner, .section, .foot {
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.hero-inner, .section, .top-inner { max-width: 1200px; margin-left: auto; margin-right: auto; }

/* ---------- top bar ---------- */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.8rem;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 30; background: var(--bg);
}
.brand {
  display: inline-flex; align-items: center; gap: 0.65rem;
  color: var(--fg); font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em;
}
.brand-mark { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.top-nav { display: flex; align-items: center; gap: clamp(0.9rem, 2.5vw, 1.75rem); }
.top-nav a { color: var(--fg-2); font-weight: 500; font-size: 0.95rem; transition: color 120ms; }
.top-nav a:hover { color: var(--fg); }
.top-ext { display: none; }
@media (min-width: 640px) { .top-ext { display: inline; } }
.top-cv {
  padding: 0.35rem 0.8rem; border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--fg) !important;
}
.top-cv:hover { border-color: var(--accent); }
@media (max-width: 560px) { .brand span:last-child { display: none; } }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; isolation: isolate; background: var(--bg); }
.hero-field {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
  mask-image: radial-gradient(120% 90% at 70% 40%, #000 35%, transparent 100%);
  -webkit-mask-image: radial-gradient(120% 90% at 70% 40%, #000 35%, transparent 100%);
}
.hero-inner {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: end;
  padding-block: clamp(3rem, 8vw, 7rem) clamp(3rem, 7vw, 6rem);
  overflow: visible;
}
@media (min-width: 900px) {
  .hero-inner { grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr); }
}
.hero-copy { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.kicker {
  margin: 0; display: inline-flex; align-items: center; gap: 0.6rem;
  font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(var(--field-write), 0.6);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(var(--field-write), 0.55); } 100% { box-shadow: 0 0 0 10px rgba(var(--field-write), 0); } }
.hero h1 { margin: 0; font-size: clamp(3.6rem, 12vw, 9.5rem); }
.hero-name { text-transform: uppercase; letter-spacing: -0.04em; line-height: 0.88; }
.alias { margin: 0.4rem 0 0; font-size: 0.9rem; letter-spacing: 0.06em; color: var(--fg-3); }
.role {
  margin: 0; font-weight: 600; font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  letter-spacing: -0.02em; color: var(--accent-ink);
}
.lede { margin: 0; max-width: 46ch; font-size: clamp(1.05rem, 1.6vw, 1.25rem); font-weight: 400; color: var(--fg-2); line-height: 1.55; }
.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.5rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.8rem 1.3rem; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--fg); font-weight: 600; font-size: 0.98rem;
  transition: border-color 140ms, background 140ms, transform 140ms;
}
.btn:hover { border-color: var(--fg-3); transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0a0d12; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.social { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.85rem; }
.social a { color: var(--fg-3); transition: color 120ms; }
.social a:hover { color: var(--accent-ink); }

.kiwi {
  position: relative; width: 100%; max-width: 412px; aspect-ratio: 216 / 223; justify-self: end; align-self: end;
  margin-bottom: calc(-1 * clamp(3rem, 7vw, 6rem) - 16px);   /* bleed off the hero's bottom edge */
  transform-origin: 50% 100%;
  animation: bob 1.9s ease-in-out infinite;
  will-change: transform;
}
.kiwi::before {
  content: ""; position: absolute; left: 10%; right: 10%; bottom: 6%; height: 18%;
  border-radius: 50%; z-index: 0;
  background: radial-gradient(50% 50% at 50% 50%, rgba(var(--field-write), 0.28), transparent 70%);
  filter: blur(14px);
}
/* 35 poses (7 columns x 5 rows) in one sprite sheet; script flips frames */
.kstack {
  position: absolute; inset: 0; z-index: 1;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.55));
  mask-image: linear-gradient(to bottom, #000 93%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 93%, transparent 100%);
}
.kf {
  position: absolute; inset: 0;
  background-image: url("/assets/kiwi-sheet.edd02bff.webp");
  background-size: 700% 500%; background-repeat: no-repeat;
  background-position: 50% 50%;       /* column 3, row 2: straight ahead */
  image-rendering: auto;
}
@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}
@media (max-width: 899px) { .kiwi { max-width: 300px; justify-self: start; } }
@media (prefers-reduced-motion: reduce) { .kiwi { animation: none; } }

/* ---------- marquee ---------- */
.marquee {
  display: flex; overflow: hidden; gap: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  flex: none; display: flex; align-items: center;
  padding-block: 0.9rem;
  animation: scroll 60s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  padding: 0 1.6rem; font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--fg-2); white-space: nowrap;
  position: relative;
}
.marquee-track span::after {
  content: ""; position: absolute; right: -3px; top: 50%; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); transform: translateY(-50%); opacity: 0.8;
}
@keyframes scroll { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee { mask-image: none; -webkit-mask-image: none; }
  .marquee-track { animation: none; flex-wrap: wrap; justify-content: center; row-gap: 0.4rem; }
  .marquee-track[aria-hidden="true"] { display: none; }
  .dot { animation: none; }
}

/* ---------- sections ---------- */
.section { padding-block: clamp(4rem, 9vw, 8rem); }
.section + .section { padding-top: 0; }
.section-head { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: clamp(2rem, 4vw, 3rem); max-width: 60ch; }
.section-sub { margin: 0; color: var(--fg-2); font-size: 1.1rem; }

/* domains: big editorial rows */
.domains { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.domain {
  display: grid; grid-template-columns: 1fr; gap: 0.6rem 3rem;
  padding-block: clamp(1.4rem, 3vw, 2.2rem); border-bottom: 1px solid var(--line);
  position: relative; transition: background 200ms;
}
@media (min-width: 820px) { .domain { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: start; } }
.domain::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: -1px; width: 3px;
  background: var(--accent); transform: scaleY(0); transform-origin: top; transition: transform 260ms ease;
}
.domain:hover::before { transform: scaleY(1); }
.domain-title {
  margin: 0; font-weight: 700; letter-spacing: -0.03em; line-height: 1;
  font-size: clamp(1.9rem, 4.2vw, 3.1rem); text-wrap: balance;
  transition: color 200ms, transform 260ms ease; padding-left: 0;
}
.domain:hover .domain-title { color: var(--accent-ink); transform: translateX(14px); }
.domain-body { display: flex; flex-direction: column; gap: 0.7rem; min-width: 0; max-width: 60ch; }
.domain-body p { margin: 0; color: var(--fg-2); font-size: clamp(1rem, 1.4vw, 1.1rem); line-height: 1.55; }
.domain-tech { font-size: 0.78rem !important; letter-spacing: 0.02em; color: var(--fg-3) !important; }

/* work cards */
.work-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.work-grid-single { grid-template-columns: 1fr !important; }
@media (min-width: 720px) { .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .work-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card {
  position: relative; display: flex; flex-direction: column; gap: 0.75rem; min-width: 0;
  padding: 1.75rem 1.6rem 1.6rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms;
}
.card:hover { transform: translateY(-3px); border-color: var(--line-2); background: var(--surface-2); }
.card-feature { grid-column: 1 / -1; display: grid; gap: 2rem; align-items: start; }
@media (min-width: 900px) { .card-feature { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); padding: 2.25rem 2.25rem 2.1rem; } }
.card-feature::after {
  content: ""; position: absolute; inset: -1px; border-radius: 21px; pointer-events: none;
  background: radial-gradient(60% 80% at 100% 0%, rgba(var(--field-write), 0.14), transparent 70%);
}
.card-top { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
.card-meta { margin: 0; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-3); }
.card-title { margin: 0; font-weight: 700; font-size: 1.5rem; letter-spacing: -0.025em; line-height: 1.1; }
.card-feature .card-title { font-size: clamp(2.2rem, 4vw, 3rem); }
.card-title a { color: var(--fg); }
.card-title a::after { content: " ↗"; font-weight: 400; color: var(--fg-3); font-size: 0.7em; vertical-align: 0.15em; }
.card-title a:hover { color: var(--accent-ink); }
.card-text { margin: 0; color: var(--fg-2); font-size: 1rem; line-height: 1.55; }
.card-text a { color: var(--fg); border-bottom: 1px solid var(--line-2); }
.card-text a:hover { color: var(--accent-ink); border-color: var(--accent); }
.card-tags { margin: auto 0 0; padding-top: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.74rem; }
.card-tags > * { padding: 0.25rem 0.6rem; border-radius: 999px; border: 1px solid var(--line-2); color: var(--fg-2); white-space: nowrap; }
.card-tags a { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.card-tags a:hover { border-color: var(--accent); }

.terminal {
  position: relative; z-index: 1; margin: 0; min-width: 0;
  padding: 1.1rem 1.2rem; border-radius: 14px;
  background: #0a0d12; color: #c4ccd6; border: 1px solid var(--line-2);
  font-size: 0.78rem; line-height: 1.6; overflow-x: auto; white-space: pre;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.t-prompt { color: #6b7683; }
.t-ok { color: #5fd29a; }
.t-acc { color: var(--accent-2); }
.t-dim { color: #6b7683; }

/* experience: company rows with logos */
.xp { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.xp-row {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 1.25rem;
  padding-block: 1.4rem; border-bottom: 1px solid var(--line);
  transition: background 160ms;
}
.xp-logo { width: 56px; height: 56px; border-radius: 14px; object-fit: contain; background: var(--surface-2); padding: 6px; border: 1px solid var(--line); }
.xp-body { min-width: 0; }
.xp-body h3 { margin: 0; font-weight: 700; font-size: clamp(1.35rem, 2.4vw, 1.75rem); letter-spacing: -0.025em; line-height: 1.15; }
.xp-body h3 a { color: var(--fg); }
.xp-body h3 a:hover { color: var(--accent-ink); }
.xp-role { margin: 0.15rem 0 0; color: var(--fg-2); font-size: 1rem; }
.xp-when { margin: 0; font-size: 0.85rem; color: var(--fg-3); white-space: nowrap; }
@media (max-width: 520px) {
  .xp-row { grid-template-columns: 48px minmax(0, 1fr); }
  .xp-logo { width: 48px; height: 48px; }
  .xp-row .xp-when { grid-column: 2; }
}

.edu {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 1.25rem;
  margin-top: clamp(2rem, 4vw, 3rem); padding: 1.1rem 1.25rem;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
}
.edu-logo { width: 64px; height: 64px; object-fit: contain; }
.edu-degree { margin: 0; font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; }
.edu-school { margin: 0.15rem 0 0; color: var(--fg-2); font-size: 0.95rem; }
@media (max-width: 520px) { .edu { grid-template-columns: 56px minmax(0, 1fr); } .edu .xp-when { grid-column: 2; } }

/* contact */
.contact {
  display: flex; flex-direction: column; gap: 1.25rem; align-items: flex-start;
  border-top: 1px solid var(--line);
}
.contact-title { margin: 0; font-size: clamp(2.6rem, 8vw, 6rem); }
.contact .lede { font-size: 1.15rem; }
.contact-main {
  margin-top: 0.5rem; font-size: clamp(2rem, 6vw, 4.5rem); font-weight: 800;
  color: var(--fg); letter-spacing: -0.04em; line-height: 1; overflow-wrap: anywhere;
  border-bottom: 3px solid var(--accent); padding-bottom: 0.1em; transition: color 140ms;
}
.contact-main:hover { color: var(--accent-ink); }
.contact-sub { margin: 0.25rem 0 0; font-size: 0.8rem; color: var(--fg-3); display: flex; flex-wrap: wrap; gap: 0.3rem 0.5rem; }
.contact-sub a { color: var(--fg-3); }
.contact-sub a:hover { color: var(--accent-ink); }

/* footer */
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem;
  padding-block: 1.25rem 1.75rem; border-top: 1px solid var(--line);
  font-size: 0.75rem; color: var(--fg-3);
}
.foot a { color: var(--fg-3); }
.foot a:hover { color: var(--fg); }
