:root {
  --bg: #f6f4ef;
  --surface: #fffdf8;
  --ink: #18181a;
  --muted: #6b6a66;
  --line: #e2ded4;
  --accent: #00a19b;      /* petronas-ish teal */
  --poi: #e3d55a;         /* the Machine's box */
  --select: #ff4655;      /* a certain tactical shooter */
  /* SF everywhere: Apple devices get SF Pro / SF Mono; others fall back to their system UI font.
     system-ui stays first so canvas measurement in script.js parses the stack. */
  --serif: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111112;
    --surface: #18181a;
    --ink: #ecebe6;
    --muted: #9a9892;
    --line: #2a2a2d;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
::selection { background: var(--select); color: #fff; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

main, .foot { max-width: 1040px; margin: 0 auto; padding-inline: 20px; }

.meta { font: 12.5px/1.5 var(--mono); color: var(--muted); letter-spacing: .01em; margin: 0; }

/* nav */
/* Notion-style floating outline ("table of contents") */
:root { --toc-bg: #fff; --toc-border: rgb(0 0 0 / .08); --toc-ink: #37352f; --toc-muted: #787774; --toc-title: #2383e2;
  --toc-active: rgb(0 0 0 / .055); --toc-bar: rgb(0 0 0 / .14); --toc-bar-on: rgb(0 0 0 / .55); }
@media (prefers-color-scheme: dark) { :root { --toc-bg: #202020; --toc-border: rgb(255 255 255 / .09); --toc-ink: #ececec;
  --toc-muted: #a3a3a3; --toc-title: #529cca; --toc-active: rgb(255 255 255 / .07); --toc-bar: rgb(255 255 255 / .16); --toc-bar-on: rgb(255 255 255 / .7); } }
.toc { position: fixed; right: 14px; top: 50%; translate: 0 -50%; z-index: 10; outline: none; }
.toc__bars { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; padding: 12px 8px; }
.toc__bars i { display: block; height: 2px; border-radius: 2px; background: var(--toc-bar); width: 18px; transition: background .15s; }
.toc__bars i.l0 { width: 22px; } .toc__bars i.l2 { width: 12px; }
.toc__bars i.on { background: var(--toc-bar-on); }
.toc__card { position: absolute; right: 0; top: 50%; translate: 0 -50%; width: max-content; max-width: 300px; max-height: 82vh; overflow-y: auto;
  background: var(--toc-bg); border: 1px solid var(--toc-border); border-radius: 16px; padding: 18px 14px;
  box-shadow: 0 12px 32px rgb(0 0 0 / .22); display: flex; flex-direction: column; gap: 2px;
  opacity: 0; visibility: hidden; transition: opacity .14s, visibility .14s; }
.toc:hover .toc__card, .toc:focus-within .toc__card { opacity: 1; visibility: visible; }
.toc__card a { display: block; padding: 5px 10px; border-radius: 8px; font-size: 15px; line-height: 1.35;
  color: var(--toc-muted); text-decoration: none; }
.toc__card a:hover { color: var(--toc-ink); background: var(--toc-active); }
.toc__card a.l0 { color: var(--toc-title); font-weight: 500; margin-bottom: 2px; }
.toc__card a.l1 { padding-left: 14px; color: var(--toc-ink); }
.toc__card a.l2 { padding-left: 36px; }
.toc__card a[aria-current] { background: var(--toc-active); color: var(--toc-ink); }
.toc__card a.l0[aria-current] { color: var(--toc-title); }
@media (max-width: 860px) { .toc { right: 2px; } .toc__bars { padding: 10px 6px; } }

/* hero */
.hero { position: relative; padding: 96px 0 72px; text-align: center; }
.hero__name {
  position: relative; display: inline-block;
  font: 700 clamp(52px, 10vw, 88px)/1 var(--serif);
  letter-spacing: -.04em; margin: 0 0 52px; padding: 6px 10px;
  outline: none;
}
.hero__lede { font-size: 19px; max-width: 880px; margin: 0 auto; line-height: 1.55; text-wrap: balance; }
.hero__lede em { font-style: italic; }

/* POI: the Machine's dashed surveillance box, shown on hover/focus */
.poi {
  --w: 4px; --c: var(--poi);
  /* inset is a fallback; script.js fits the box to the glyph ink with an even gap */
  position: absolute; inset: -14px -22px; pointer-events: none; opacity: 0; transition: opacity .12s;
  /* --px/--py set by script.js so each edge holds a whole, odd number of dashes */
  --px: 28px; --py: 26px;
  --hx: repeating-linear-gradient(90deg, transparent 0 calc(var(--px) * .2), var(--c) 0 calc(var(--px) * .8), transparent 0 var(--px));
  --vy: repeating-linear-gradient(180deg, transparent 0 calc(var(--py) * .22), var(--c) 0 calc(var(--py) * .78), transparent 0 var(--py));
  background:
    var(--hx) top center / calc(100% - 64px) var(--w) no-repeat,
    var(--hx) bottom center / calc(100% - 64px) var(--w) no-repeat,
    var(--vy) left center / var(--w) calc(100% - 60px) no-repeat,
    var(--vy) right center / var(--w) calc(100% - 60px) no-repeat;
}
.poi i, .poi u, .poi s { position: absolute; border: 0 solid var(--c); }
/* thick rounded corner brackets */
.poi i { width: 24px; height: 24px; border-width: calc(var(--w) * 2); }
.poi i:nth-child(1) { top: -3px; left: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 9px; }
.poi i:nth-child(2) { top: -3px; right: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 9px; }
.poi i:nth-child(3) { bottom: -3px; left: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 9px; }
.poi i:nth-child(4) { bottom: -3px; right: -3px; border-left: 0; border-top: 0; border-bottom-right-radius: 9px; }
/* centre ticks, top and bottom */
.poi u { left: 50%; width: var(--w); height: 16px; background: var(--c); margin-left: calc(var(--w) / -2); }
.poi u:nth-of-type(1) { top: 0; }
.poi u:nth-of-type(2) { bottom: 0; }
/* centre ticks, left and right */
.poi s { top: 50%; width: 16px; height: var(--w); background: var(--c); margin-top: calc(var(--w) / -2); }
.poi s:nth-of-type(1) { left: 0; }
.poi s:nth-of-type(2) { right: 0; }
.poi b { position: absolute; left: calc(100% + 22px); top: 30%; color: var(--ink);
  font: 400 24px/1 "VT323", var(--mono); letter-spacing: .06em; }
.hero__name:hover .poi, .hero__name:focus-visible .poi { opacity: 1; }

/* sections */
.section { padding: 56px 0; scroll-margin-top: 24px; }
#rbc, #nrc, #ubc, .card { scroll-margin-top: 24px; }
.section__title { font: 700 32px/1.1 var(--serif); letter-spacing: -.025em; margin: 0 0 32px; }

/* experience: brand band, overlapping round logo, centred body */
.exp { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.exp__card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; text-align: center; }
.exp__band { height: 132px; padding-top: 34px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 78%, #000), var(--brand)); }
.exp__band h3 { font: 600 22px/1.15 var(--serif); letter-spacing: -.01em; color: #fff; margin: 0; padding-inline: 16px; }
.exp__logo { width: 96px; height: 96px; margin: -48px auto 0; border-radius: 50%; background: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 18px rgb(0 0 0 / .25); position: relative; }
.exp__logo img { width: 60%; height: 60%; object-fit: contain; }
.exp__body { padding: 18px 22px 26px; }
.exp__body h4 { font-size: 18px; font-weight: 600; margin: 0 0 6px; text-wrap: balance; }
.exp__summary { margin: 14px 0 10px; font-size: 15px; text-wrap: balance; }
.exp__body ul { text-align: left; margin: 0; padding-left: 18px; font-size: 14.5px; }
.exp__body li { margin: 6px 0; }
.exp__body li::marker { color: var(--accent); }

/* education: freestanding crest left, details right, rule under each entry */
.edu { display: grid; grid-template-columns: 120px 1fr; gap: 40px; }
.edu__crest { width: 100%; filter: drop-shadow(0 8px 14px rgb(0 0 0 / .35)); }
.edu h3 { font: 600 30px/1.15 var(--serif); letter-spacing: -.02em; margin: 0 0 12px; }
.edu__degree { font-size: 19px; font-weight: 500; margin: 0 0 6px; }
.edu__dates { margin: 0 0 10px; }
.edu__desc { margin: 0 0 8px; max-width: 70ch; }
.edu ul { margin: 0; padding-left: 22px; color: var(--muted); }
.edu li { margin: 4px 0; }

/* projects */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 22px 18px;
  display: flex; flex-direction: column; transition: border-color .15s; }
.card[hidden] { display: none; }
/* tech stack: plain logo + name; hover one and it lights up in its own neon, Shinjuku after dark */
.stack { position: relative; z-index: 1; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 6px; padding: 0; }
.stack li { display: inline-flex; align-items: center; gap: 6px; font: 500 13px/1.5 var(--sans); color: var(--muted);
  transition: color .2s, text-shadow .2s; }
.stack img { width: 14px; height: 14px; object-fit: contain; filter: grayscale(1) opacity(.65); transition: filter .2s; }
.stack li:hover { color: color-mix(in srgb, var(--n) 75%, var(--ink));
  text-shadow: 0 0 4px color-mix(in srgb, var(--n) 70%, transparent), 0 0 12px color-mix(in srgb, var(--n) 55%, transparent); }
.stack li:hover img { filter: drop-shadow(0 0 2px var(--n)) drop-shadow(0 0 6px var(--n)); }
.card:hover { border-color: var(--muted); }
.card h3 { font: 600 22px/1.2 var(--serif); letter-spacing: -.01em; margin: 8px 0 8px; }
.card > p:not(.meta) { margin: 0 0 14px; font-size: 15px; flex: 1; }
.card { position: relative; cursor: pointer; }
.card__open { all: unset; cursor: pointer; }
.card__open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card__open:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 3px; }

/* project compass dialog */
.chart { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink);
  padding: 26px 28px 20px; width: min(520px, calc(100vw - 32px)); text-align: center; box-shadow: 0 24px 60px rgb(0 0 0 / .3); }
.chart:focus { outline: none; }
.chart::backdrop { background: rgb(10 8 6 / .55); }
.chart__title { font: 600 20px/1.2 var(--serif); letter-spacing: -.01em; margin: 0 0 10px; }
.chart__row { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 5vw, 36px); }
.chart__opt { font-weight: 600; font-size: 16px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; min-width: 84px; }
.chart__opt:hover, .chart__opt.want { border-color: #8b1e1e; color: inherit; background: rgb(139 30 30 / .08); }
.chart__opt[hidden] { display: block; visibility: hidden; } /* keeps the compass centred */
.jack { width: clamp(130px, 34vw, 180px); flex: none; filter: drop-shadow(0 6px 10px rgb(0 0 0 / .25)); }
.jack__aim, .jack__needle { transform-origin: 60px 116px; }
.jack__aim { transition: rotate .7s cubic-bezier(.3, 1.7, .5, 1); }
.lost .jack__needle { animation: lost 3.2s ease-in-out infinite; }
@keyframes lost { 0% { rotate: 0deg } 20% { rotate: 150deg } 35% { rotate: 95deg } 55% { rotate: 290deg } 70% { rotate: 230deg } 100% { rotate: 360deg } }
.chart__hint { margin-top: 14px; font-style: italic; }
.more { display: block; margin: 28px auto 0; padding: 10px 22px; border-radius: 999px; cursor: pointer;
  background: none; color: var(--ink); border: 1px solid var(--line); font: 500 14px var(--sans); }
.more:hover { border-color: var(--accent); color: var(--accent); }

/* contact */
.contact__links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; font-size: 18px; margin: 0; }
.ico { display: inline-flex; color: var(--ink); }
.ico svg { width: 24px; height: 24px; }
.ico:hover { color: var(--accent); }

/* footer + car */
.foot { padding-top: 40px; padding-bottom: 28px; }
.foot__track { position: relative; height: 48px; border-bottom: 2px dashed var(--line); margin-bottom: 14px; overflow: hidden; }
.car { position: absolute; bottom: 0; left: 0; width: 150px; padding: 0; border: 0; background: none; cursor: pointer; }
.car img { display: block; width: 100%; }
.car.lap { animation: lap 1.6s cubic-bezier(.55,0,.35,1) forwards; }
@keyframes lap {
  0%   { transform: translateX(0); }
  49%  { transform: translateX(calc(var(--track) + 10px)); }
  50%  { transform: translateX(-160px); }
  100% { transform: translateX(0); }
}
.laps { position: absolute; right: 0; bottom: 8px; }
.laps .pb { color: #a855f7; }   /* purple sector */
.foot__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

@media (max-width: 860px) {
  .exp { grid-template-columns: 1fr; max-width: 520px; margin-inline: auto; }
  .edu { grid-template-columns: 72px 1fr; gap: 20px; }
  .edu h3 { font-size: 28px; }
}
@media (max-width: 560px) {
  .poi b { left: auto; right: 0; top: auto; bottom: calc(100% + 8px); font-size: 20px; } /* no room to the right */
  .grid { grid-template-columns: 1fr; }
  .nav nav { gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .car.lap { animation: none; }
  .jack__aim, .stack li, .stack img { transition: none; } .lost .jack__needle { animation: none; }
  .toc__card, .toc__bars i { transition: none; }
}
