/* ---------- Tokens ---------- */
:root {
  --bg: #0b0b08;
  --surface: #13130f;
  --surface-2: #1a1a15;
  --line: rgba(237, 237, 230, 0.09);
  --line-strong: rgba(237, 237, 230, 0.18);
  --text: #edede6;
  --muted: #a3a397;
  --accent: #adff2f;          /* the original site's chartreuse */
  --accent-ink: #0b0b08;
  --accent-soft: rgba(173, 255, 47, 0.1);

  --font-display: "Krona One", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 14px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

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

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 8px; font-weight: 600;
}
.skip:focus { top: 12px; }

.eyebrow, .label {
  font: 500 12px/1.4 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.accent { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font: 600 15px/1 var(--font-body);
  border: 1px solid var(--accent);
  transition: transform .25s var(--ease), background .25s, color .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--small { padding: 9px 16px; font-size: 13px; }
.btn__icon { width: 16px; height: 16px; color: var(--accent); transition: transform .5s var(--ease); }
.btn:hover .btn__icon { transform: rotate(90deg) scale(1.15); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 11, 8, .72);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.nav__brand { display: flex; align-items: center; gap: 10px; font: 400 14px/1 var(--font-display); }
.nav__mark { width: 20px; height: 20px; color: var(--accent); transition: transform .6s var(--ease); }
.nav__brand:hover .nav__mark { transform: rotate(180deg); }
.nav nav { margin-left: auto; }
.nav__links { display: flex; gap: 28px; font-size: 14px; color: var(--muted); }
.nav__links a { transition: color .2s; }
.nav__links a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(72px, 12vw, 140px) 0 clamp(64px, 9vw, 110px); overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto auto;
  width: 60vw; height: 60vw; max-width: 760px; max-height: 760px;
  background: radial-gradient(closest-side, rgba(173, 255, 47, .09), transparent 70%);
  pointer-events: none;
}
.hero__inner { position: relative; z-index: 1; }
.hero__name {
  position: relative; display: inline-block;
  margin: 22px 0 28px;
  font: 400 clamp(44px, 9vw, 108px)/1.02 var(--font-display);
  letter-spacing: -.02em;
}
.hero__sparkles {
  position: absolute; right: -0.9em; top: -0.35em;
  width: .7em; height: .74em; color: var(--accent);
  animation: float 6s ease-in-out infinite;
}
.hero__lede { max-width: 34ch; font-size: clamp(19px, 2.2vw, 23px); line-height: 1.5; color: var(--muted); }
.hero__lede em { font-style: normal; color: var(--text); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }

.hero__field { position: absolute; inset: 0; pointer-events: none; }
.twinkle {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--s); height: var(--s);
  color: var(--accent); opacity: .0;
  animation: twinkle 4.8s var(--d) ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.4) rotate(0deg); }
  50% { opacity: .85; transform: scale(1) rotate(45deg); }
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(6deg); }
}

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 112px) 0; border-top: 1px solid var(--line); }
.section--tight { padding: 56px 0 64px; }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 40px; }
.section__title {
  display: flex; align-items: center; gap: 14px;
  font: 400 clamp(22px, 3vw, 30px)/1.2 var(--font-display);
  letter-spacing: -.01em;
}
.section__mark { width: 22px; height: 22px; flex: none; color: var(--accent); }
.section__note { color: var(--muted); font-size: 15px; }

/* ---------- Experience ---------- */
.exp { margin-top: 24px; display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 32px; border-top: 1px solid var(--line); }
.exp__item {
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px 20px 22px 0;
  border-bottom: 1px solid var(--line);
}
.exp__role { font-size: 15px; line-height: 1.45; }
.exp__orgs { font: 400 13px/1.55 var(--font-mono); color: var(--accent); }
.exp__orgs small { font-size: inherit; color: var(--muted); }
.exp__orgs a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .3s var(--ease); }
.exp__orgs a:hover { background-size: 100% 1px; }

/* ---------- Work cards ---------- */
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.card {
  position: relative; grid-column: span 2;
  display: flex; flex-direction: column; gap: 12px;
  padding: 28px 26px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .3s, transform .35s var(--ease), background .3s;
}
.card--feature { grid-column: span 3; padding: 36px 32px 38px; background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.card:hover { border-color: rgba(173, 255, 47, .45); transform: translateY(-3px); }
.card__meta { display: flex; justify-content: space-between; gap: 12px; padding-right: 32px; }
.tag { font: 500 11px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.year { font: 400 12px/1.4 var(--font-mono); color: var(--muted); }
.card__title { font: 600 19px/1.3 var(--font-body); letter-spacing: -.01em; padding-right: 28px; }
.card--feature .card__title { font: 400 clamp(20px, 2.2vw, 26px)/1.25 var(--font-display); }
.card__body { color: var(--muted); font-size: 15px; line-height: 1.6; }
.card--feature .card__body { font-size: 16px; max-width: 46ch; }
/* Whole card is clickable; inline links sit above the stretched link */
.card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card .inline { position: relative; z-index: 1; color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.card .inline:hover { color: var(--accent); text-decoration-color: var(--accent); }
.card__arrow {
  position: absolute; top: 26px; right: 24px;
  color: var(--muted); font-size: 18px;
  transition: transform .3s var(--ease), color .3s;
}
.card:hover .card__arrow { color: var(--accent); transform: translateX(4px); }

/* ---------- Web tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.tiles li { grid-column: span 2; }
.tiles li:nth-child(n+4) { grid-column: span 3; } /* 3 + 2 rows */
.tile {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 100%; padding: 24px;
  border: 1px solid var(--line); border-radius: var(--radius);
  font: 400 15px/1.3 var(--font-display);
  transition: border-color .3s, background .3s, color .3s;
}
.tile:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.tile__arrow { font-family: var(--font-body); transition: transform .3s var(--ease); }
.tile:hover .tile__arrow { transform: translate(3px, -3px); }

/* ---------- Writing rows ---------- */
.rows { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 120px 1fr auto; align-items: baseline; gap: 24px;
  padding: 24px 4px;
  border-bottom: 1px solid var(--line);
  transition: padding .3s var(--ease), color .3s;
}
.row__kind { font: 500 11px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.row__title { font-size: 19px; line-height: 1.4; }
.row__arrow { color: var(--muted); transition: transform .3s var(--ease), color .3s; }
.row:hover { padding-left: 14px; color: var(--accent); }
.row:hover .row__arrow { color: var(--accent); transform: translate(3px, -3px); }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(40px, 6vw, 96px); align-items: start; }
.sparkle-list { margin-top: 32px; display: grid; gap: 20px; }
.sparkle-list li {
  position: relative; padding-left: 36px;
  font-size: clamp(18px, 1.8vw, 21px); line-height: 1.5;
}
.sparkle-list li::before {
  content: ""; position: absolute; left: 0; top: .32em;
  width: 16px; height: 16px;
  background: var(--accent);
  -webkit-mask: url("assets/sparkle.svg") center / contain no-repeat;
          mask: url("assets/sparkle.svg") center / contain no-repeat;
}
.thinking { padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.chips li {
  padding: 9px 16px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: 14px;
}

/* ---------- Contact / footer ---------- */
.contact { position: relative; padding: clamp(80px, 12vw, 140px) 0 40px; border-top: 1px solid var(--line); overflow: hidden; }
.contact::before {
  content: ""; position: absolute; left: 50%; bottom: -40%;
  width: 900px; height: 600px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(173, 255, 47, .07), transparent 70%);
  pointer-events: none;
}
.contact .wrap { position: relative; }
.contact__title { margin: 18px 0 28px; font: 400 clamp(30px, 5.4vw, 60px)/1.12 var(--font-display); letter-spacing: -.02em; max-width: 16ch; }
.contact__email {
  display: inline-block;
  font: 400 clamp(17px, 2.4vw, 24px)/1.3 var(--font-mono);
  color: var(--accent);
  border-bottom: 1px solid rgba(173, 255, 47, .35);
  padding-bottom: 4px;
  word-break: break-all;
  transition: border-color .3s;
}
.contact__email:hover { border-color: var(--accent); }
.contact__links { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 36px; color: var(--muted); font-size: 15px; }
.contact__links a:hover { color: var(--text); }
/* ---------- Magic 8 ball ---------- */
.eightball {
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  margin-top: clamp(72px, 10vw, 120px);
  text-align: center;
}
.eightball__stage { position: relative; padding: 18px 36px 30px; }
.eightball__ball {
  position: relative; display: grid; place-items: center;
  width: 260px; height: 260px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .28), transparent 18%),
    radial-gradient(circle at 40% 35%, #34342c, #12120e 55%, #000 80%);
  box-shadow:
    0 0 0 1px rgba(173, 255, 47, .14),
    0 24px 50px -18px rgba(0, 0, 0, .9),
    0 0 70px -10px rgba(173, 255, 47, .16);
  transition: transform .3s var(--ease), box-shadow .3s;
}
.eightball__ball::after { /* floor shadow */
  content: ""; position: absolute; left: 18%; right: 18%; bottom: -28px; height: 14px;
  border-radius: 50%; background: rgba(0, 0, 0, .55); filter: blur(8px);
}
.eightball__ball:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(173, 255, 47, .35), 0 28px 50px -18px rgba(0, 0, 0, .9), 0 0 80px -6px rgba(173, 255, 47, .26); }
.eightball__ball:focus-visible { outline-offset: 6px; border-radius: 50%; }
.eightball__window {
  position: relative; display: grid; place-items: center;
  width: 144px; height: 144px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #12160c, #050604 75%);
  box-shadow: inset 0 4px 14px rgba(0, 0, 0, .9), 0 0 0 3px #1d1d18;
}
.eightball__eight {
  display: grid; place-items: center;
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--text); color: var(--bg);
  font: 400 68px/1 var(--font-display);
  transition: opacity .35s, transform .35s var(--ease);
}
.eightball__triangle {
  position: absolute; inset: 0;
  /* downward-pointing triangle, like the real thing */
  clip-path: polygon(50% 92%, 6% 16%, 94% 16%);
  background: var(--accent);
  opacity: 0; transform: scale(.6) rotate(-20deg);
  transition: opacity .45s var(--ease), transform .6s var(--ease);
}
.eightball__text {
  position: absolute; left: 0; right: 0; top: 21%; height: 68%;
  padding-top: 2px;
  font: 600 11px/1.18 var(--font-body);
  letter-spacing: .02em; text-transform: uppercase; text-align: center;
  color: var(--accent-ink);
}
/* Floats whose shapes follow the triangle's sides, so lines narrow as they go down */
.eightball__wrap-l,
.eightball__wrap-r { width: 50%; height: 100%; }
.eightball__wrap-l { float: left; shape-outside: polygon(0 0, 30% 0, 100% 100%, 0 100%); }
.eightball__wrap-r { float: right; shape-outside: polygon(100% 0, 70% 0, 0 100%, 100% 100%); }
.eightball.is-revealed .eightball__eight { opacity: 0; transform: scale(.8); }
.eightball.is-revealed .eightball__triangle { opacity: 1; transform: none; }
.eightball.is-shaking .eightball__ball { animation: shake .6s ease-in-out; }
.eightball.is-shaking .eightball__triangle { opacity: 0; transform: scale(.6) rotate(20deg); transition-duration: .2s; }
.eightball__spark {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--s); height: var(--s);
  color: var(--accent); opacity: .35;
  transition: opacity .3s;
}
.eightball.is-shaking .eightball__spark { animation: spark-pop .7s var(--d) ease-out; }
.eightball__hint { color: var(--muted); font-size: 14px; }

@keyframes shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  15% { transform: translate(-10px, 2px) rotate(-8deg); }
  30% { transform: translate(9px, -3px) rotate(7deg); }
  45% { transform: translate(-7px, 2px) rotate(-5deg); }
  60% { transform: translate(5px, -1px) rotate(4deg); }
  80% { transform: translate(-2px, 0) rotate(-1deg); }
}
@keyframes spark-pop {
  0% { opacity: .35; transform: scale(1) rotate(0); }
  45% { opacity: 1; transform: scale(1.5) rotate(45deg); }
  100% { opacity: .35; transform: scale(1) rotate(90deg); }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.footer__base {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: clamp(72px, 10vw, 120px); padding-top: 24px;
  border-top: 1px solid var(--line);
  font: 400 12px/1.4 var(--font-mono); color: var(--muted);
}
.footer__base a:hover { color: var(--accent); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .card, .card--feature { grid-column: span 3; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tiles li, .tiles li:nth-child(n+4) { grid-column: auto; }
  .tiles li:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .exp { grid-template-columns: repeat(2, 1fr); }
  .about { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav__links { display: none; }
  .nav__inner .btn--small { margin-left: auto; }
  .grid, .exp { grid-template-columns: 1fr; }
  .grid > .card { grid-column: auto; }
  .row { grid-template-columns: 1fr auto; gap: 6px 16px; }
  .row__kind { grid-column: 1 / -1; }
  .hero__sparkles { right: -0.55em; }
  .hero__field .twinkle:nth-child(n+3) { display: none; }
}
@media (max-width: 420px) {
  .tiles { grid-template-columns: 1fr; }
  .exp { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .twinkle { opacity: .6; }
  .reveal { opacity: 1; transform: none; }
}
