:root {
  /* Paper and ink */
  --eggshell: #fdfcfc;
  --taupe: #f5f3f1;
  --stone: #ebe8e4;
  --ink: #000000;
  --graphite: #44403b;
  --smoke: #777169;
  --ash: #a59f97;
  --ash-text: #857f77;
  --ash-small: #78726a;
  --title: #2b2f3a;
  --green: #4e784e;
  --pill-border: #e5e5e5;
  --card-ash: #9d978f;
  --plate: var(--taupe);
  --sand-top: #f8f4ec;
  --sand-bottom: #f3ecdf;
  --foot-bg: #efe6d3;
  --foot-line: #e2d6bd;
  --foot-ink: #8a7a5f;
  --sand-wall: #ebe8e4;
  color-scheme: light;

  --font-display: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --max: 1280px;
  --gutter: 64px;
  --section: 120px;
  --r-card: 20px;
  --r-large: 24px;
  --shadow: rgba(0, 0, 0, 0.4) 0 0 1px 0, rgba(0, 0, 0, 0.04) 0 1px 1px 0, rgba(0, 0, 0, 0.04) 0 2px 4px 0;
}

@media (max-width: 900px) {
  :root { --gutter: 32px; --section: 96px; }
}
@media (max-width: 560px) {
  :root { --gutter: 16px; --section: 72px; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--eggshell);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p, figure, blockquote { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 300; }
ul, ol { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--ink); color: var(--eggshell); }

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

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute; left: 12px; top: -40px; z-index: 100;
  background: var(--ink); color: var(--eggshell);
  padding: 8px 14px; border-radius: 9999px; font-size: 14px;
}
.skip:focus { top: 12px; }

/* ---------- Type ---------- */

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--smoke);
}
.mono b { font-weight: 400; color: var(--ink); }

.display {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: -0.035em;
  line-height: 0.98;
}

.h2 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(32px, 4.2vw, 52px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  max-width: 22ch;
}

.lede {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.22;
  letter-spacing: -0.015em;
}

.ash { color: var(--ash-text); }
.lede .ash, .card-top .ash, .hl-title .ash { color: var(--ash-small); }
.nowrap { white-space: nowrap; }
.h2, .hl-title, .card-top, .lede, .contact h2 { text-wrap: balance; }
.body, .xp-desc, .proj p { text-wrap: pretty; }
.body { color: var(--smoke); font-size: 16px; line-height: 1.6; }

/* ---------- Buttons ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border-radius: 9999px;
  border: 1px solid var(--pill-border);
  background: var(--eggshell);
  color: var(--ink);
  font: 500 14px/1 var(--font-body);
  letter-spacing: 0.01em;
  box-shadow: var(--shadow);
  transition: background-color .2s ease, transform .2s ease;
  white-space: nowrap;
}
.pill:active { transform: translateY(1px); }
@media (pointer: coarse) { .pill { height: 44px; } }
.pill--ink { background: var(--ink); color: var(--eggshell); border-color: var(--ink); }
.pill .arrow { font-family: var(--font-mono); font-size: 13px; }

.chip {
  display: inline-flex; align-items: center; min-height: 26px; padding: 5px 11px;
  border-radius: 9999px; background: color-mix(in srgb, var(--eggshell) 94%, transparent);
  box-shadow: var(--shadow);
  font: 400 11px/1.25 var(--font-mono); letter-spacing: 0.03em; text-transform: uppercase; color: var(--graphite);
  white-space: nowrap;
}

/* ---------- Header ---------- */

.top {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--eggshell) 86%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
}
.top .wrap {
  height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  font: 500 15px/1 var(--font-body);
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background:
    radial-gradient(circle, var(--ink) 0 1.6px, transparent 1.9px) 0 0 / 5.5px 5.5px,
    var(--eggshell);
  box-shadow: inset 0 0 0 1px var(--stone);
}
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 8px 12px; border-radius: 9999px;
  font-size: 14px; color: var(--graphite);
  transition: background-color .2s ease, color .2s ease;
}
.top-right { display: flex; align-items: center; gap: 14px; }
.clock { display: inline-flex; align-items: center; gap: 8px; }
.led {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}
@media (max-width: 900px) {
  .top .wrap { height: auto; flex-wrap: wrap; row-gap: 0; padding-top: 8px; }
  .nav {
    order: 3; gap: 6px;
    width: calc(100% + 2 * var(--gutter));
    margin: 0 calc(-1 * var(--gutter));
    padding: 4px var(--gutter) 10px;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a {
    flex: none; display: inline-flex; align-items: center;
    height: 34px; padding: 0 14px; font-size: 13px;
    background: var(--taupe);
  }
  html { scroll-padding-top: 116px; }
}
@media (max-width: 560px) { .clock { display: none; } }

/* ---------- Section scaffolding ---------- */

section { position: relative; }
.band { background: var(--taupe); }
.pad { padding: var(--section) 0; }

.sec-head {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 40px;
}
.sec-head a.mono { padding: 12px 0; margin: -12px 0; }
.ruler {
  flex: 1; height: 9px;
  background:
    linear-gradient(var(--stone), var(--stone)) left bottom / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--ash) 0 1px, transparent 1px 40px) left bottom / 100% 9px no-repeat,
    repeating-linear-gradient(90deg, var(--stone) 0 1px, transparent 1px 8px) left bottom / 100% 5px no-repeat;
}
.sec-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 48px;
  align-items: end;
  margin-bottom: 56px;
}
.sec-intro .body { max-width: 46ch; }
@media (max-width: 900px) {
  .sec-intro { grid-template-columns: 1fr; gap: 20px; margin-bottom: 40px; }
}

/* Crop marks for printed-feeling frames */
.crop { position: relative; }
.crop::before, .crop::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border: 0 solid var(--ash); opacity: .8;
}
.crop::before { top: -10px; left: -10px; border-width: 1px 0 0 1px; }
.crop::after { bottom: -10px; right: -10px; border-width: 0 1px 1px 0; }

/* ---------- Print element ---------- */

.ht { position: relative; overflow: hidden; }
.ht > .ht-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- Hero ---------- */

.hero { padding: 64px 0 var(--section); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 64px;
  align-items: end;
}
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 36px; }
.status {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 32px; padding: 0 14px 0 12px;
  border-radius: 9999px; background: var(--taupe);
  box-shadow: inset 0 0 0 1px var(--stone);
  font: 500 13px/1 var(--font-body); color: var(--ink);
}
.contact-lede { margin-top: 28px; max-width: 30ch; font-size: clamp(20px, 2vw, 26px); }
.hero h1 { font-size: clamp(64px, 11vw, 156px); margin-left: -0.05em; }
.hero .lede { margin-top: 32px; max-width: 24ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 40px; }

.portrait {
  aspect-ratio: 4 / 5;
  border-radius: var(--r-large);
  background: var(--taupe);
}
.portrait .ht { position: absolute; inset: 0; border-radius: inherit; }

.spec {
  margin-top: 72px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--stone);
}
.spec > div {
  padding: 20px 24px 4px 0;
  border-right: 1px solid var(--stone);
  margin-right: 24px;
}
.spec > div:last-child { border-right: 0; margin-right: 0; }
.spec .mono { margin-bottom: 8px; }
.spec p { font-size: 15px; line-height: 1.45; }
.spec p span { color: var(--smoke); }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .portrait { max-width: 520px; }
  .spec { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec > div:nth-child(2) { border-right: 0; margin-right: 0; }
  .spec > div:nth-child(n+3) { border-top: 1px solid var(--stone); }
}
@media (max-width: 560px) {
  .hero { padding-top: 32px; }
  .spec { grid-template-columns: 1fr; }
  .spec > div { border-right: 0; margin-right: 0; border-top: 1px solid var(--stone); }
  .spec > div:first-child { border-top: 0; }
}

/* ---------- Stack cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  aspect-ratio: 392 / 520;
  padding: 26px 0 24px;
  border-radius: var(--r-card);
  background: var(--eggshell);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 0 26px;
}
.card-top {
  font-size: 18px; line-height: 1.28; letter-spacing: -0.005em;
  max-width: 28ch;
}
.card-img { min-height: 180px; background: var(--taupe); }
.card-title {
  padding: 0 24px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(44px, 4.6vw, 60px);
  line-height: 0.9;
  letter-spacing: -0.045em;
  color: var(--title);
}
.card-title.right { text-align: right; }
@media (max-width: 1000px) {
  .cards { grid-template-columns: 1fr; max-width: 520px; }
  .card { aspect-ratio: auto; }
  .card-img { min-height: 0; aspect-ratio: 4 / 3; }
}

/* ---------- Experience ---------- */

.banner {
  position: relative;
  aspect-ratio: 21 / 8;
  border-radius: var(--r-card);
  background: var(--taupe);
  overflow: hidden;
  margin-bottom: 24px;
}
.banner .ht { position: absolute; inset: 0; }
.banner-cap { position: absolute; left: 16px; right: 16px; bottom: 16px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.banner-cap .credit { color: var(--smoke); }
@media (max-width: 560px) { .banner { aspect-ratio: 4 / 3; } }

.sub-head { margin: 64px 0 16px; }

.xp { border-top: 1px solid var(--stone); }
.xp-row {
  display: grid;
  grid-template-columns: 168px minmax(0, 1.1fr) minmax(0, 1.4fr) 168px;
  gap: 32px;
  padding: 24px 0;
  border-bottom: 1px solid var(--stone);
  align-items: center;
}
.plate {
  position: relative;
  height: 96px;
  border-radius: 16px;
  background: var(--plate);
  overflow: hidden;
}
.plate .ht { position: absolute; inset: 0; }
.xp-role {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px; line-height: 1.18; letter-spacing: -0.02em;
}
.xp-org { margin-top: 6px; font-size: 15px; color: var(--graphite); }
.xp-desc { font-size: 15px; line-height: 1.6; color: var(--smoke); }
.xp-when { text-align: right; }
@media (max-width: 1000px) {
  .xp-row { grid-template-columns: 132px minmax(0, 1fr); gap: 12px 24px; align-items: start; }
  .plate { height: 84px; grid-row: span 3; }
  .xp-when { text-align: left; }
}
@media (max-width: 560px) {
  .xp-row { grid-template-columns: 1fr; }
  .plate { grid-row: auto; height: 88px; max-width: 200px; }
}

/* ---------- Offline Base ---------- */

.feature {
  border-radius: var(--r-large);
  background: var(--taupe);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
}
.feature-copy { padding: 48px; display: flex; flex-direction: column; gap: 28px; }
.feature-copy .h2 { max-width: 16ch; }
.feature-figure {
  position: relative; margin: 12px; min-height: 420px;
  border-radius: 16px; background: var(--plate); box-shadow: var(--shadow);
}
.feature-figure .ht { position: absolute; inset: 0; border-radius: inherit; }
.products { border-top: 1px solid var(--stone); }
.products li {
  display: grid; grid-template-columns: 120px 1fr; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--stone);
  font-size: 15px;
}
.products li span:last-child { color: var(--smoke); }
@media (max-width: 900px) {
  .feature { grid-template-columns: 1fr; }
  .feature-copy { padding: 32px 24px; }
  .feature-figure { min-height: 0; aspect-ratio: 4 / 3; }
}

/* ---------- Highlights ---------- */

.hl-stack { display: grid; gap: 16px; }
.hl {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 48px;
  align-items: end;
  padding: 32px;
  border-radius: var(--r-card);
  background: var(--eggshell);
  box-shadow: var(--shadow);
}
.hl-main { display: flex; flex-direction: column; gap: 20px; }
.hl-title {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(26px, 2.8vw, 36px); line-height: 1.15; letter-spacing: -0.02em;
  max-width: 24ch;
}
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  column-gap: 12px;
  border-top: 1px solid var(--stone);
}
.stats > div { padding: 16px 0 0; }
.stats .num {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(28px, 2.7vw, 38px); line-height: 1; letter-spacing: -0.035em;
  white-space: nowrap;
}
.stats .mono { margin-top: 6px; }
@media (max-width: 900px) {
  .hl { grid-template-columns: 1fr; gap: 28px; padding: 24px; }
}

/* ---------- Projects ---------- */

.proj { border-top: 1px solid var(--stone); }
.proj li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--stone);
  align-items: baseline;
}
.proj h3 {
  font-family: var(--font-display); font-weight: 400;
  font-size: 22px; line-height: 1.2; letter-spacing: -0.02em;
}
.proj p { font-size: 15px; line-height: 1.6; color: var(--smoke); }
@media (max-width: 900px) {
  .proj li { grid-template-columns: 48px minmax(0, 1fr); gap: 8px 16px; }
  .proj li > p { grid-column: 2; }
}

/* ---------- Contact + sand ---------- */

.contact { padding: var(--section) 0 48px; }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 48px; align-items: end; }
.contact h2 { font-size: clamp(44px, 7vw, 104px); }
.contact-links { display: grid; border-top: 1px solid var(--stone); }
.contact-links a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0; border-bottom: 1px solid var(--stone);
  font-size: 17px;
  transition: padding .25s ease;
}
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }

.sand {
  position: relative;
  height: clamp(260px, 34vw, 440px);
  background: linear-gradient(to bottom, var(--eggshell), var(--sand-top) 60%, var(--sand-bottom));
  cursor: crosshair;
  touch-action: pan-y;
  touch-action: pan-y pinch-zoom;
  overflow: hidden;
}
.sand canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  image-rendering: pixelated;
}
.sand-cap {
  position: absolute; left: 0; right: 0; top: 20px; z-index: 1;
  pointer-events: none;
}
.sand-cap .wrap { display: flex; justify-content: space-between; gap: 16px; }
.sand-cap .mono { white-space: nowrap; }
.hint-touch { display: none; }
@media (hover: none) {
  .hint-hover { display: none; }
  .hint-touch { display: inline; }
}
@media (max-width: 360px) { .sand-cap .chain-long { display: none; } }
.foot {
  background: var(--foot-bg);
  border-top: 1px solid var(--foot-line);
}
.foot .wrap {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-top: 18px; padding-bottom: 22px;
}
.foot .mono { color: var(--foot-ink); }

/* ---------- Hover (pointer devices only, so taps never leave styles stuck) ---------- */

@media (hover: hover) {
  a.mono:hover { color: var(--ink); }
  .status:hover { background: var(--stone); }
  .pill:hover { background: var(--taupe); }
  .pill--ink:hover { background: var(--graphite); }
  .nav a:hover { background: var(--taupe); color: var(--ink); }
  .banner-cap .credit:hover { color: var(--ink); }
  .proj h3 a:hover { color: var(--smoke); }
  .contact-links a:hover { padding-left: 8px; }
  .contact-links a:hover .mono { color: var(--ink); }
}
.contact-links a:active { background: var(--taupe); }

/* ---------- Dark theme ---------- */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --eggshell: #121110;
    --taupe: #1b1a18;
    --stone: #2c2a27;
    --ink: #f3f0eb;
    --graphite: #cfc9c1;
    --smoke: #a39d94;
    --ash: #7a746c;
  --ash-text: #958f86;
  --ash-small: #a09a91;
    --ash-text: #958f86;
    --ash-small: #a09a91;
    --title: #ece8e2;
    --green: #7fb07f;
    --pill-border: #34312d;
    --card-ash: #8a847b;
    --plate: #ece7df;
    --sand-top: #17140f;
    --sand-bottom: #1d1810;
    --foot-bg: #221c13;
    --foot-line: #33291b;
    --foot-ink: #b8a27c;
    --sand-wall: #2a2620;
    --shadow: rgba(0, 0, 0, 0.6) 0 0 0 1px, rgba(255, 255, 255, 0.04) 0 1px 0 0 inset;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --eggshell: #121110;
  --taupe: #1b1a18;
  --stone: #2c2a27;
  --ink: #f3f0eb;
  --graphite: #cfc9c1;
  --smoke: #a39d94;
  --ash: #7a746c;
  --ash-text: #958f86;
  --ash-small: #a09a91;
  --title: #ece8e2;
  --green: #7fb07f;
  --pill-border: #34312d;
  --card-ash: #8a847b;
  --plate: #ece7df;
  --sand-top: #17140f;
  --sand-bottom: #1d1810;
  --foot-bg: #221c13;
  --foot-line: #33291b;
  --foot-ink: #b8a27c;
  --sand-wall: #2a2620;
  --shadow: rgba(0, 0, 0, 0.6) 0 0 0 1px, rgba(255, 255, 255, 0.04) 0 1px 0 0 inset;
  color-scheme: dark;
}

/* Theme toggle */
.theme-btn {
  width: 40px; height: 40px; padding: 0; justify-content: center;
  box-shadow: none; background: transparent; border-color: var(--stone);
}
.theme-btn svg { width: 16px; height: 16px; }
.theme-btn .moon { display: none; }
:root[data-resolved-theme="dark"] .theme-btn .sun { display: none; }
:root[data-resolved-theme="dark"] .theme-btn .moon { display: block; }
@media (pointer: coarse) { .theme-btn { width: 44px; height: 44px; } }

/* ---------- Phone tuning ---------- */

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

@media (max-width: 560px) {
  .hero-meta { margin-bottom: 24px; }
  .hero .lede { margin-top: 24px; }
  .hero-cta { margin-top: 28px; }
  .hero-grid { gap: 40px; }
  .portrait { aspect-ratio: 1 / 1; }
  .feature-figure { aspect-ratio: 2 / 1; }

  .xp-row { grid-template-columns: 96px minmax(0, 1fr); gap: 12px 16px; align-items: center; }
  .plate { grid-row: auto; height: 64px; max-width: none; border-radius: 12px; }
  .xp-row > .xp-desc, .xp-row > .xp-when { grid-column: 1 / -1; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .products li { grid-template-columns: 1fr; gap: 2px; }
  .proj li > p { grid-column: 1 / -1; }
}

@media (max-width: 360px) {
  .top .wrap { column-gap: 12px; }
  .top-right { gap: 8px; }
  .top .pill:not(.theme-btn) { padding: 0 14px; }
}
