/* ==========================================================
   Finish layer: depth, surfaces and the richer entrances.
   Loaded last. Values come from DESIGN.md.
   ========================================================== */
:root {
  /* Layered shadows: a hairline highlight on top, a tight contact shadow, then a soft ambient one */
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, .95) inset, 0 1px 1px rgba(12, 13, 16, .05), 0 3px 6px -2px rgba(12, 13, 16, .09), 0 10px 20px -10px rgba(12, 13, 16, .14);
  --shadow-md: 0 1px 0 rgba(255, 255, 255, .95) inset, 0 1px 2px rgba(12, 13, 16, .05), 0 8px 16px -6px rgba(12, 13, 16, .10), 0 28px 48px -24px rgba(12, 13, 16, .24);
  --shadow-lg: 0 1px 0 #fff inset, 0 2px 4px rgba(12, 13, 16, .05), 0 16px 28px -10px rgba(12, 13, 16, .15), 0 48px 80px -32px rgba(12, 13, 16, .32);
  --shadow-ink: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 1px 2px rgba(12, 13, 16, .35), 0 8px 16px -6px rgba(12, 13, 16, .38), 0 20px 32px -16px rgba(12, 13, 16, .42);
  --shadow-cobalt: 0 1px 0 rgba(255, 255, 255, .38) inset, 0 -1px 0 rgba(8, 20, 120, .45) inset, 0 1px 2px rgba(15, 31, 168, .45), 0 8px 18px -6px rgba(30, 58, 240, .52), 0 22px 40px -16px rgba(30, 58, 240, .58);
  --surface: linear-gradient(180deg, #fff, #F8F7F3);
  --edge: rgba(12, 13, 16, .09);
}

/* ---------- Basics ---------- */
a, button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.skip { position: fixed; left: 12px; top: 12px; z-index: 200; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 500; transform: translateY(-200%); }
.skip:focus-visible { transform: none; }

/* fine paper grain over the whole page */
body::after { content: ""; position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------- Buttons: tactile, with real depth ---------- */
.btn { transition: scale 160ms var(--ease-out), translate 250ms var(--ease-out), background-color 200ms ease, color 200ms ease, border-color 200ms ease, box-shadow 250ms ease; }
.btn-ink { background: linear-gradient(180deg, #30323B, #0C0D10); box-shadow: var(--shadow-ink); }
.btn-cobalt { background: linear-gradient(180deg, #4D66FF, #1E3AF0 62%, #1931D2); box-shadow: var(--shadow-cobalt); }
.btn-line, .go.btn, .resume { background: var(--surface); border: 1px solid var(--edge); box-shadow: var(--shadow-sm); }
.chip { background: var(--surface); border-color: var(--edge); box-shadow: var(--shadow-sm); transition: scale 160ms var(--ease-out), background-color 220ms ease, color 220ms ease, border-color 220ms ease, box-shadow 250ms ease; }
.chip.on { background: linear-gradient(180deg, #30323B, #0C0D10); border-color: var(--ink); box-shadow: var(--shadow-ink); }
.copy { background: var(--surface); border-color: var(--edge); box-shadow: var(--shadow-sm); }
.seg { box-shadow: var(--shadow-sm); }
.seg-pill { background: linear-gradient(180deg, #30323B, #0C0D10); box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 4px 8px -2px rgba(12, 13, 16, .4); }
.sim-read { box-shadow: var(--shadow-sm); }

/* ---------- Header: nav as a floating pill ---------- */
.links { gap: 2px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .62); border: 1px solid var(--edge); box-shadow: var(--shadow-sm); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); }
.links a { padding: 6px 14px; border-radius: 999px; transition: color 200ms ease, background-color 200ms ease; }
.links a::after { display: none; }
.links a.on { background: var(--ink); color: var(--paper); }
.pop { background: var(--surface); border-color: var(--edge); box-shadow: var(--shadow-lg); }

/* ---------- Cards ---------- */
.tile, .lead article, .ways a, .kit, .roles li, .qd { background: var(--surface); border-color: var(--edge); box-shadow: var(--shadow-md); }
.feat li, .mods button { background: var(--surface); border-color: var(--edge); box-shadow: var(--shadow-sm); }
.viz { border-color: var(--edge); box-shadow: var(--shadow-lg); }
[data-tilt].hot { box-shadow: var(--shadow-lg); }
.ways a.hot { box-shadow: var(--shadow-lg); }
.mods button.on { background: linear-gradient(180deg, #4D66FF, #1E3AF0 62%, #1931D2); border-color: var(--cobalt); box-shadow: var(--shadow-cobalt); }
.sheet { box-shadow: 0 1px 2px rgba(12, 13, 16, .06), 0 10px 18px -8px rgba(12, 13, 16, .18), 0 28px 44px -22px rgba(12, 13, 16, .34); }
@media not ((hover: hover) and (pointer: fine)) { .glare { display: none; } }   /* the light that follows the pointer is mouse-only */

/* ---------- Avatar in the corner: straight on the page, no disc behind it ---------- */
.dock { background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible; width: clamp(64px, calc(var(--pad) - 8px), 116px); height: clamp(64px, calc(var(--pad) - 8px), 116px); right: 6px; }
.dock canvas { filter: drop-shadow(0 10px 12px rgba(12, 13, 16, .22)); }

/* ---------- Hero ---------- */
.hero { position: relative; }
.hero::before { content: ""; position: absolute; right: -4%; top: 6%; width: 60%; aspect-ratio: 1; border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(30, 58, 240, .13), rgba(30, 58, 240, .045) 55%, transparent); }
.hello { display: inline-flex; align-items: center; gap: 0; margin-bottom: 26px; padding: 8px 16px 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--edge); box-shadow: var(--shadow-sm); font-size: 14px; font-weight: 500; letter-spacing: -.01em; color: var(--ink); }
.hello::before { content: ""; flex: none; margin-right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--cobalt); box-shadow: 0 0 0 3px rgba(30, 58, 240, .16); }
.js .hello { opacity: 0; scale: .92; transition: opacity 500ms ease, scale 700ms var(--ease-out); }
.js .loaded .hello { opacity: 1; scale: 1; }
.hello .vc { display: inline-block; white-space: pre; will-change: transform; }

h1 { font-size: clamp(64px, 10.4vw, 164px); line-height: .9; letter-spacing: -.062em; }
h1 .line { overflow: visible; padding-bottom: 0; margin-bottom: 0; }
h1 .hc { display: inline-block; white-space: pre; }
main { overflow-x: clip; }
.js h1 .line > span { transform: none; }
.js h1 .hc { opacity: 0; translate: 0 55%; rotate: 9deg; filter: blur(16px); transform-origin: 0 100%;
  transition: opacity 800ms ease, translate 1200ms var(--ease-out), rotate 1200ms var(--ease-out), filter 1000ms ease; transition-delay: calc(var(--c) * 55ms + 650ms); }
.js .loaded h1 .hc { opacity: 1; translate: none; rotate: 0deg; filter: none; }

.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 620px; margin-top: 34px; perspective: 1200px; }
.roles li { display: grid; gap: 3px; padding: 14px 16px 16px; border: 1px solid var(--edge); border-radius: 18px; }
.roles .mono { font-size: 11px; color: var(--cobalt); }
.roles b { font-size: clamp(17px, 1.55vw, 22px); font-weight: 500; letter-spacing: -.035em; line-height: 1.15; }
.roles li > span:last-child { font-size: 12.5px; line-height: 1.3; color: var(--ink-2); }
.lede { margin-top: 24px; }
.hero-cta { margin-top: 26px; }
.hero-meta { justify-content: space-between; }

/* ---------- Richer entrances ---------- */
/* text: rises further and sharpens out of a blur */
.js [data-reveal] { translate: 0 30px; filter: blur(10px); transition: opacity 800ms ease, translate 1100ms var(--ease-out), filter 900ms ease; transition-delay: calc(var(--i, 0) * 80ms); }
.js [data-reveal].in { translate: none; filter: none; }
.js .sec-head[data-reveal], .js .proj-copy[data-reveal], .js .viz[data-reveal] { filter: none; }
.js .proj-copy > * { translate: 0 30px; filter: blur(10px); transition: opacity 750ms ease, translate 1000ms var(--ease-out), filter 850ms ease; }
.js .proj-copy.in > * { filter: none; }

/* cards: swing up from below in 3D */
.tiles, .lead, .ways, .exp { perspective: 1400px; }
.js .tile[data-reveal], .js .lead article[data-reveal], .js .ways a[data-reveal], .js .roles li[data-reveal], .js .kit[data-reveal] {
  opacity: 0; translate: 0 64px; rotate: x -28deg; scale: .88; filter: blur(8px); transform-origin: 50% 100%;
  transition: opacity 800ms ease, translate 1200ms var(--ease-out), rotate 1200ms var(--ease-out), scale 1200ms var(--ease-out), filter 900ms ease, background-color 300ms ease, color 300ms ease, border-color 200ms ease, box-shadow 300ms ease;
  transition-delay: calc(var(--i, 0) * 95ms); }
.js .tile[data-reveal].in, .js .lead article[data-reveal].in, .js .ways a[data-reveal].in, .js .roles li[data-reveal].in, .js .kit[data-reveal].in { opacity: 1; translate: none; rotate: none; scale: none; filter: none; }

/* small cards inside a project pop in one after another */
.js .proj-copy:not(.in) .feat li, .js .proj-copy:not(.in) .mods button { opacity: 0; }
.js .proj-copy.in .feat li, .js .proj-copy.in .mods button { animation: card-pop 800ms var(--ease-out) both; }
@keyframes card-pop { from { opacity: 0; transform: translateY(22px) scale(.84); } to { opacity: 1; transform: none; } }
.js .proj-copy.in :is(.feat li, .mods button):nth-child(1) { animation-delay: 320ms; }
.js .proj-copy.in :is(.feat li, .mods button):nth-child(2) { animation-delay: 390ms; }
.js .proj-copy.in :is(.feat li, .mods button):nth-child(3) { animation-delay: 460ms; }
.js .proj-copy.in :is(.feat li, .mods button):nth-child(4) { animation-delay: 530ms; }
.js .proj-copy.in :is(.feat li, .mods button):nth-child(5) { animation-delay: 600ms; }
.js .proj-copy.in :is(.feat li, .mods button):nth-child(6) { animation-delay: 670ms; }

/* rows slide in from the side */
.js .index li[data-reveal] { translate: -48px 0; filter: none; transition: opacity 600ms ease, translate 1000ms var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms); }
.js .index li[data-reveal].in { translate: none; }
.js .tl li[data-reveal] { translate: 48px 0; }
.js .tl li[data-reveal].in { translate: none; }

/* ---------- Timeline: a glowing line with a bright head; fx.js sends particles into it ---------- */
.tl-line { width: 2px; left: 147.5px; border-radius: 2px; }
.tl-line b { border-radius: 2px; background: linear-gradient(180deg, var(--cobalt), #5A71FF); }
.tl-head { position: absolute; left: 50%; top: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; border: 2.5px solid var(--cobalt); box-shadow: 0 0 0 4px rgba(30, 58, 240, .14), 0 0 20px 2px rgba(30, 58, 240, .75); will-change: transform; }
.tl li.on::before { box-shadow: 0 0 0 4px rgba(30, 58, 240, .14), 0 0 14px rgba(30, 58, 240, .6); }

/* ---------- Footer control ---------- */
.motion-toggle { font-size: 13px; font-weight: 500; color: var(--ink); padding: 6px 12px; margin: -6px 0; border-radius: 999px; border: 1px solid var(--edge); background: var(--surface); box-shadow: var(--shadow-sm); transition: scale 160ms var(--ease-out); }
.motion-toggle:active { scale: .97; }
.still .orbit .dash, .still .scroll-hint svg, .still .qd-a::after { animation-play-state: paused; }

/* ---------- Hover (real pointers only) ---------- */
@media (hover: hover) and (pointer: fine) {
  .btn-ink:hover { background: linear-gradient(180deg, #3C3F4A, #17181D); translate: 0 -1px; }
  .btn-cobalt:hover { background: linear-gradient(180deg, #6077FF, #2B46F6 62%, #1E3AF0); translate: 0 -1px; box-shadow: 0 1px 0 rgba(255, 255, 255, .38) inset, 0 -1px 0 rgba(8, 20, 120, .45) inset, 0 2px 3px rgba(15, 31, 168, .45), 0 12px 24px -6px rgba(30, 58, 240, .6), 0 30px 50px -18px rgba(30, 58, 240, .65); }
  .btn-line:hover, .go.btn:hover, .resume:hover { background: #fff; translate: 0 -1px; box-shadow: var(--shadow-md); }
  .chip:not(.on):hover { box-shadow: var(--shadow-md); }
  .links a:not(.on):hover { background: rgba(12, 13, 16, .06); }
  .feat li:hover { box-shadow: var(--shadow-md); }
  .mods button:not(.on):hover { box-shadow: var(--shadow-md); }
}

/* ---------- Tablet and phone ---------- */
@media (max-width: 900px) {
  .dock { width: 84px; height: 84px; right: 4px; }
  .hero::before { right: -20%; top: 0; width: 110%; }
  .roles { max-width: none; }
}
@media (max-width: 640px) {
  .dock { width: 72px; height: 72px; }
  h1 { font-size: clamp(60px, 19vw, 96px); }
  .roles { gap: 8px; margin-top: 26px; }
  .roles li { padding: 12px 12px 13px; border-radius: 16px; }
  .roles b { font-size: 16px; }
  .roles li > span:last-child { font-size: 11.5px; }
  .tl-line { left: 3.5px; }
  .hero-meta span:first-child { display: inline; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal], .js .proj-copy > *, .js h1 .hc { translate: none !important; rotate: none !important; scale: none !important; filter: none !important; }
  .js .proj-copy.in .feat li, .js .proj-copy.in .mods button { animation: none; }
  .js .hello { scale: 1; }
  .tl-head { display: none; }
}


/* ==========================================================
   Round 4: hexagon backdrop, contact cards, toolkit rings,
   one-screen phone hero, and the review fixes.
   ========================================================== */
:root { --ink-3: #6E7078; }                       /* darker so small grey text passes contrast */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
h1, h2, h3, .tagline { text-wrap: balance; }
p { text-wrap: pretty; }
.brand, .scroll-hint, .foot a { display: inline-flex; align-items: center; min-height: 28px; }

/* ---------- Backdrop: a faint grey hexagon lattice, strongest top right, fading out ---------- */
body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='48.5' viewBox='0 0 84 48.5'%3E%3Cpath d='M0 24.25 14 0h28l14 24.25L42 48.5H14zM56 24.25h28' fill='none' stroke='%230C0D10' stroke-opacity='.075' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 84px 48.5px;
  -webkit-mask-image: radial-gradient(120% 90% at 78% 12%, #000 0%, rgba(0, 0, 0, .55) 45%, rgba(0, 0, 0, .22) 100%);
  mask-image: radial-gradient(120% 90% at 78% 12%, #000 0%, rgba(0, 0, 0, .55) 45%, rgba(0, 0, 0, .22) 100%); }

/* ---------- Contact: three cards rise over a blurred page ---------- */
.reach-over { position: fixed; inset: 0; z-index: 300; visibility: hidden; pointer-events: none; overscroll-behavior: contain; transition: visibility 0s 220ms; }
.reach-over[data-open] { visibility: visible; pointer-events: auto; transition: visibility 0s; }
.reach-scrim { position: absolute; inset: 0; background: rgba(244, 243, 239, .62); -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2); opacity: 0; transition: opacity 220ms ease; }
.reach-over[data-open] .reach-scrim { opacity: 1; transition: opacity 350ms ease; }
.reach-stack { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: min(460px, 100% - 32px); display: grid; gap: 12px; }
.reach-card, .reach-close { opacity: 0; translate: 0 56px; scale: .95; transition: opacity 160ms ease, translate 180ms var(--ease-out), scale 180ms var(--ease-out), box-shadow 250ms ease, background-color 200ms ease; }
.reach-over[data-open] :is(.reach-card, .reach-close) { opacity: 1; translate: none; scale: 1; transition: opacity 380ms ease, translate 600ms var(--ease-out), scale 600ms var(--ease-out), box-shadow 250ms ease, background-color 200ms ease; transition-delay: calc(var(--k) * 75ms + 60ms), calc(var(--k) * 75ms + 60ms), calc(var(--k) * 75ms + 60ms), 0ms, 0ms; }
.reach-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 84px; padding: 18px 20px 18px 22px; background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-outer); box-shadow: var(--shadow-lg); }
.reach-card > div { display: grid; gap: 2px; min-width: 0; }
.reach-card .pop-label { font-size: 12px; color: var(--ink-3); }
.reach-card .pop-value { font-size: 17px; font-weight: 500; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reach-card .ext { flex: none; width: 36px; height: 36px; padding: 11px; border-radius: 50%; border: 1px solid var(--edge); color: var(--ink); background: #fff; transition: translate 250ms var(--ease-out), background-color 200ms ease, color 200ms ease; }
.reach-card .copy { height: 40px; padding: 0 16px; font-size: 13px; }
.reach-close { justify-self: center; margin-top: 8px; }
@media (hover: hover) and (pointer: fine) {
  a.reach-card:hover { background: #fff; }
  a.reach-card:hover .ext { translate: 2px -2px; background: var(--ink); color: var(--paper); }
}

/* ---------- Experience: the timeline takes the row, the toolkit becomes four turning rings ---------- */
.exp { grid-template-columns: minmax(0, 1fr); }
.tl-wrap { max-width: 920px; }
.sub-head { margin: clamp(48px, 7vw, 88px) 0 4px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 500; color: var(--ink-2); }
.rings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ring { position: relative; aspect-ratio: 1 / .8; }
.ring canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring ul { position: absolute; inset: 0; }
.ring-label { position: absolute; left: 0; right: 0; top: 6%; display: grid; gap: 1px; text-align: center; pointer-events: none; }
.ring-label b { font-size: clamp(17px, 1.5vw, 21px); font-weight: 500; letter-spacing: -.03em; }
.ring-label span { font-size: 12px; color: var(--ink-3); }
.ring-item { position: absolute; left: 50%; top: 50%; padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; background: var(--surface); border: 1px solid var(--edge); box-shadow: var(--shadow-sm); will-change: transform; }
.ring-blue { position: absolute; inset: -1px; border-radius: inherit; opacity: 0; background: linear-gradient(180deg, #4D66FF, #1E3AF0 62%, #1931D2); box-shadow: var(--shadow-cobalt); }
.ring-item span { position: relative; }

/* ---------- Cards lift a little under the mouse ---------- */
@media (hover: hover) and (pointer: fine) {
  .tile:hover, .lead article:hover, .roles li:hover { border-color: rgba(12, 13, 16, .14); }
}

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  .rings { grid-template-columns: 1fr 1fr; row-gap: 20px; }
}

/* ---------- Phone: the whole first screen (avatar, greeting, headline, three roles) fits without scrolling ---------- */
@media (max-width: 640px) {
  .hero { min-height: 0; padding-top: 72px; row-gap: 0; }
  .hero-stage { max-width: min(60vw, 28svh, 280px); }
  .hello { margin: 8px 0 12px; padding: 6px 14px 6px 10px; font-size: 13px; }
  h1 { font-size: clamp(44px, min(18.5vw, 10svh), 92px); }
  .roles { margin-top: clamp(12px, 2.2svh, 24px); gap: 6px; }
  .roles li { padding: 9px 10px 10px; border-radius: 14px; }
  .roles b { font-size: 15px; }
  .roles li > span:last-child { font-size: 11px; line-height: 1.25; }
  .lede { margin-top: 28px; }
  .hero-meta { margin-top: 28px; }
  /* the résumé button waits until you start scrolling, so it never covers the role cards */
  .resume { transition: opacity 250ms ease, translate 350ms var(--ease-out), scale 160ms var(--ease-out); }
  .at-top .resume { opacity: 0; translate: 0 14px; pointer-events: none; }
  .btn, .chip { min-height: 44px; }
  .seg button { height: 38px; }
  .reach-stack { top: auto; bottom: max(20px, env(safe-area-inset-bottom)); translate: -50% 0; }
  .reach-card { min-height: 76px; padding: 14px 16px 14px 18px; }
  .reach-card .pop-value { font-size: 16px; }
  .ring-item { font-size: 11px; padding: 5px 9px; }
  .ring-label b { font-size: 16px; }
  .ring-label span { font-size: 11px; }
  .rings { gap: 4px; row-gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .reach-card, .reach-close { translate: none; scale: 1; }
  .at-top .resume { translate: none; }
}

/* phone: give the ring titles their own space */
@media (max-width: 640px) {
  .ring { aspect-ratio: 1 / .92; }
  .ring-label { top: 0; }
  .ring-label span { display: none; }
}
