/* Layout idea: a white studio with soft colour washes. The toy lives on the left, words sit in floating cards on the right.
   Colours are sampled from the plushie: cocoa hair for ink, denim and peach for accents. */
:root {
  --paper: #ffffff;
  --mist: #f6f6f6;
  --ink: #000;
  --ink-soft: #6d645f;
  --denim: #3c6c99;
  --denim-soft: #e7eff7;
  --peach: #f2a068;
  --peach-soft: #fdeee3;
  --line: rgba(0, 0, 0, 0.08);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.05), 0 6px 18px rgba(0, 0, 0, 0.05);
  --shadow-m: 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 40px rgba(0, 0, 0, 0.07);
  --shadow-l: 0 2px 4px rgba(0, 0, 0, 0.03), 0 12px 28px rgba(0, 0, 0, 0.06), 0 40px 80px rgba(0, 0, 0, 0.09);
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Geist", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(20px, 5vw, 72px);
  --bar: 76px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--peach); outline-offset: 3px; border-radius: 12px; }

/* ---------- scroll progress line ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 4.5px; z-index: 30; pointer-events: none; }
.progress i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0); background: var(--ink); }

/* ---------- top bar + social overlay (always on top) ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  height: var(--bar);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 var(--gutter);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.pill {
  display: flex; align-items: center;
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow-s);
}
.brand {
  gap: 10px; padding: 5px 16px 5px 5px;
  font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.02em;
  text-decoration: none;
}
.brand .avatar { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; background: #fff; border: 1px solid #000; box-sizing: border-box; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.jump { padding: 5px; gap: 2px; }
.jump button {
  border: 0; background: none; cursor: pointer;
  padding: 7px 13px; border-radius: 999px;
  font-size: 14.5px; font-weight: 500; color: var(--ink-soft);
  transition: background 0.18s, color 0.18s;
}
.jump button:hover { color: var(--ink); background: var(--mist); }
.jump button.on { color: var(--paper); background: var(--ink); }
.social { gap: 4px; padding: 5px; }
.social a {
  position: relative;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  text-decoration: none;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}
.social svg { width: 18px; height: 18px; display: block; }
/* small label under each icon on hover and keyboard focus */
.social a::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 10px); left: 50%;
  transform: translate(-50%, -4px);
  padding: 4px 9px; border-radius: 8px;
  background: var(--ink); color: var(--paper);
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.16s, transform 0.16s;
}
.social a:hover::after, .social a:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.foot .social a::after { top: auto; bottom: calc(100% + 10px); transform: translate(-50%, 4px); }
.foot .social a:hover::after, .foot .social a:focus-visible::after { transform: translate(-50%, 0); }
.social a:hover { background: var(--ink); color: var(--paper); transform: translateY(-1px); }
.brand, .jump { transition: opacity 0.25s, visibility 0s; }
/* over the work section only the social overlay stays, so nothing sits on top of the heading */
.over-work .brand, .over-work .jump { opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0s 0.25s; }

/* ---------- pinned 3D stage ---------- */
.track { position: relative; height: 450vh; }
.stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: var(--paper);
}
.backdrop { position: absolute; inset: 0; overflow: hidden; }
.dots {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.16) 1px, transparent 1.5px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 70% 68% at 50% 46%, #000 20%, transparent 76%);
  mask-image: radial-gradient(ellipse 70% 68% at 50% 46%, #000 20%, transparent 76%);
}
.word {
  position: absolute; left: 50%; top: 47%;
  transform: translate(-50%, -50%);
  font-family: var(--display); font-weight: 800; font-size: clamp(130px, 29vw, 540px);
  letter-spacing: -0.06em; line-height: 1; white-space: nowrap;
  padding: 0.04em 0.12em 0.14em;
  color: transparent;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.075), rgba(0, 0, 0, 0.02));
  -webkit-background-clip: text; background-clip: text;
  user-select: none;
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* shown while the two models download */
.loading {
  position: absolute; left: 50%; top: 32%; z-index: 2; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px 9px 12px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-s);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: opacity 0.4s, visibility 0s;
}
.loading i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
.loading b { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 3.2ch; text-align: right; }
.loading b:empty { display: none; }
.loading.done { opacity: 0; visibility: hidden; transition: opacity 0.4s, visibility 0s 0.4s; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel { position: absolute; z-index: 2; will-change: opacity, transform; }
.panel h2, .hero h1, .work-head h2 {
  font-family: var(--display); font-weight: 700; letter-spacing: -0.035em; line-height: 0.98;
  text-wrap: balance;
}

.hero { left: var(--gutter); bottom: clamp(36px, 8vh, 88px); max-width: min(44vw, 640px); }
.chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 14px 7px 12px; margin-bottom: 20px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-s);
  font-size: 14px; font-weight: 500;
}
.chip i { width: 8px; height: 8px; border-radius: 50%; background: #4fb477; box-shadow: 0 0 0 4px rgba(79, 180, 119, 0.18); }
.hero h1 { font-size: clamp(46px, 6.6vw, 104px); }
.hero p { margin-top: 16px; font-size: clamp(17px, 1.5vw, 20px); color: var(--ink-soft); max-width: 34ch; }

.hint {
  right: var(--gutter); bottom: clamp(36px, 8vh, 88px);
  display: flex; align-items: center; gap: 11px;
  padding: 9px 16px 9px 11px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-s);
  font-size: 14px; font-weight: 500;
}
.hint .mouse { width: 18px; height: 28px; border-radius: 10px; border: 1.5px solid currentColor; position: relative; }
.hint .mouse::after {
  content: ""; position: absolute; left: 50%; top: 5px; width: 3px; height: 6px; margin-left: -1.5px;
  border-radius: 2px; background: currentColor; animation: wheel 1.8s ease-in-out infinite;
}
@keyframes wheel { 0%, 100% { transform: translateY(0); opacity: 1; } 60% { transform: translateY(8px); opacity: 0; } }
/* touch screens: a finger that swipes up instead of the mouse */
.hint .swipe { display: none; position: relative; width: 22px; height: 28px; }
.hint .swipe svg { position: absolute; left: 0; top: 3px; width: 22px; height: 22px; animation: swipe 1.9s cubic-bezier(0.45, 0, 0.3, 1) infinite; }
.hint .swipe::before {                                 /* faint trail left behind the fingertip */
  content: ""; position: absolute; left: 9px; top: 2px; width: 2px; height: 16px; border-radius: 2px;
  background: linear-gradient(180deg, currentColor, transparent); opacity: 0;
  transform-origin: 50% 0; animation: trail 1.9s cubic-bezier(0.45, 0, 0.3, 1) infinite;
}
@keyframes swipe { 0% { transform: translateY(6px); opacity: 0.15; } 12% { opacity: 1; } 70% { transform: translateY(-5px); opacity: 1; } 92%, 100% { transform: translateY(-7px); opacity: 0.15; } }
@keyframes trail { 0%, 22% { transform: scaleY(0); opacity: 0; } 62% { transform: scaleY(1); opacity: 0.35; } 82%, 100% { transform: scaleY(1); opacity: 0; } }
@media (hover: none) and (pointer: coarse) {
  .hint .mouse { display: none; }
  .hint .swipe { display: block; }
}

/* floating cards on the right */
.side {
  left: 53%; right: var(--gutter); top: 52%;
  max-width: 540px;
  transform: translateY(calc(-50% + var(--shift, 0px)));
  opacity: 0;
  padding: clamp(26px, 2.6vw, 38px);
  background: rgba(255, 255, 255, 0.84);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line); border-radius: 32px;
  box-shadow: var(--shadow-l);
}
.side h2 { font-size: clamp(36px, 3.9vw, 58px); margin-bottom: 18px; }
.side p + p { margin-top: 12px; }
.side p { color: var(--ink-soft); }
.side p.lead { color: var(--ink); font-size: 19px; line-height: 1.5; }

.facts { margin-top: 22px; display: grid; gap: 8px; }
.facts div {
  display: grid; grid-template-columns: 104px 1fr; gap: 12px; align-items: center;
  padding: 10px 14px; border-radius: 14px; background: var(--mist); font-size: 15px;
}
.facts dt { color: var(--ink-soft); }
.facts dd { font-weight: 500; }

.skills { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.skills li { padding: 16px; border-radius: 20px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.skills .ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 12px; background: #f9f9f9; color: var(--ink); }
.skills svg { width: 20px; height: 20px; }
.skills h3 { font-family: var(--display); font-weight: 650; font-size: 18.5px; letter-spacing: -0.02em; line-height: 1.2; }
.skills p { margin-top: 5px; font-size: 14.5px; line-height: 1.45; }

/* ---------- My work: a sheet that pins while the cards slide sideways ---------- */
.work-track { --sheet-r: 44px; position: relative; z-index: 3; margin-top: calc(-1 * var(--sheet-r)); background: var(--mist); border-radius: var(--sheet-r) var(--sheet-r) 0 0; }
.work {
  position: sticky; top: 0;
  height: 100vh; height: 100svh; min-height: 420px;
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 80%;        /* the card row takes 4/5 of the screen height */
}
.work-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  padding: var(--bar) var(--gutter) 12px;
  min-height: 0;
}
.work-title { display: flex; align-items: baseline; gap: 14px; }
.work-head h2 { font-size: clamp(34px, 5vw, 68px); }
.count { padding: 4px 11px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 13.5px; font-weight: 500; color: var(--ink-soft); white-space: nowrap; transform: translateY(-0.5em); }
.work-tools { display: flex; align-items: center; gap: 14px; padding-bottom: 6px; }
.work-tools p { font-size: 14.5px; color: var(--ink-soft); }
.arrows { display: flex; gap: 6px; }
.arrows button {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow-s);
  display: grid; place-items: center; cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s, color 0.18s;
}
.arrows button:hover { transform: translateY(-1px); box-shadow: var(--shadow-m); background: var(--ink); color: var(--paper); }
.arrows button:disabled { opacity: 0.35; cursor: default; transform: none; box-shadow: var(--shadow-s); background: var(--paper); color: var(--ink); }
.arrows svg { width: 18px; height: 18px; }

.rail-wrap { position: relative; min-width: 0; min-height: 0; }
.rail {
  height: 100%;
  display: flex; gap: clamp(16px, 2vw, 28px);
  padding: 10px var(--gutter) 50px;
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-end { flex: 0 0 1px; }
.card {
  position: relative;
  flex: 0 0 clamp(280px, 36vw, 540px);
  display: flex; flex-direction: column;
  min-height: 0; padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 30px;
  box-shadow: var(--shadow-m);
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.3s;
}
/* cards with a link: the title link stretches over the whole card, so a click anywhere opens it */
.card.has-link { cursor: pointer; }
.card.has-link:hover { transform: translateY(-5px); box-shadow: var(--shadow-l); }
.card-link { color: inherit; text-decoration: none; outline: none; }
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card:has(.card-link:focus-visible) { outline: 3px solid var(--peach); outline-offset: 4px; }
.shot { position: relative; flex: 1 1 auto; min-height: 0; border-radius: 21px; overflow: hidden; background: var(--mist); }
.shot img, .shot svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
.card.has-link:hover .shot img, .card.has-link:hover .shot svg { transform: scale(1.04); }
.shot span {
  position: absolute; left: 12px; top: 12px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.88); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 500; color: var(--ink-soft);
}
.card-body { flex: 0 0 auto; padding: 18px 16px 14px; display: grid; gap: 8px; }
.card-body h3 { font-family: var(--display); font-weight: 650; font-size: 23px; letter-spacing: -0.025em; line-height: 1.15; }
.card-body p { font-size: 15.5px; line-height: 1.5; color: var(--ink-soft); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { padding: 3px 10px; border-radius: 999px; background: var(--mist); font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.card-foot .open { padding: 7px 14px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 600; white-space: nowrap; }

.meter { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 22px; height: 4px; border-radius: 4px; background: rgba(0, 0, 0, 0.08); overflow: hidden; }
.meter i { display: block; height: 100%; width: 100%; border-radius: 4px; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0.2); }

/* ---------- footer: one compact card on the same light grey as My work ---------- */
footer { position: relative; z-index: 3; background: var(--mist); padding: 4px var(--gutter) 22px; }
.foot {
  display: flex; align-items: center; justify-content: space-between; gap: 18px 28px; flex-wrap: wrap;
  padding: 20px 20px 20px 26px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow-m);
}
.foot-text h2 { font-family: var(--display); font-weight: 700; font-size: clamp(22px, 2.3vw, 28px); letter-spacing: -0.03em; line-height: 1.1; }
.foot-text p { margin-top: 4px; font-size: 15px; color: var(--ink-soft); }
.foot-text .mail { color: var(--ink); font-weight: 500; }
/* email links: underlined on hover, like the other links */
a.mail { color: var(--ink); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color 0.18s; }
a.mail:hover, a.mail:focus-visible { text-decoration-color: currentColor; }
.foot-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.foot .social { background: var(--mist); box-shadow: none; }
.to-top {
  display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; white-space: nowrap;   /* the label always stays on one line */
  padding: 10px 16px 10px 13px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-size: 14.5px; font-weight: 600; text-decoration: none;
  transition: transform 0.18s, box-shadow 0.18s;
}
.to-top svg { width: 17px; height: 17px; flex: 0 0 auto; }
.to-top:hover { transform: translateY(-1px); box-shadow: var(--shadow-m); }
.fine { display: flex; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap; padding: 14px 6px 0; font-size: 13.5px; color: var(--ink-soft); }

/* ---------- phones: toy on top, words in a sheet below ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .jump { display: none; }
  .brand .brand-name { display: none; }
  .brand { padding: 5px; }
  .word { top: 36%; font-size: 33vw; }
  .hero { bottom: 78px; right: var(--gutter); max-width: none; }
  .chip { margin-bottom: 14px; }
  .hero p { margin-top: 10px; }
  .hint { left: var(--gutter); right: auto; bottom: 24px; padding: 7px 14px 7px 9px; }
  .hint .mouse { width: 16px; height: 24px; }
  .side {
    left: 12px; right: 12px; top: auto; bottom: 12px; max-width: none;
    transform: translateY(var(--shift, 0px));
    padding: 18px 16px 16px; border-radius: 26px;
    background: rgba(255, 255, 255, 0.92);
  }
  .side h2 { font-size: 30px; margin-bottom: 10px; }
  .side p { font-size: 15.5px; }
  .side p.lead { font-size: 16.5px; }
  .facts { display: none; }
  .skills { gap: 8px; }
  .skills li { padding: 11px 12px; border-radius: 16px; }
  .skills .ico { width: 30px; height: 30px; border-radius: 10px; margin-bottom: 8px; }
  .skills svg { width: 16px; height: 16px; }
  .skills h3 { font-size: 15.5px; }
  .skills p { font-size: 13px; line-height: 1.4; }
  .work-track { --sheet-r: 30px; }
  .work-tools p, .count { display: none; }
  .card { flex-basis: 82vw; border-radius: 26px; padding: 8px; }
  .shot { border-radius: 19px; }
  .card-body { padding: 14px 12px 12px; }
  .foot { padding: 18px; border-radius: 22px; }
  .foot-actions { width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  /* phones: a round arrow button, the same height as the social icons next to it */
  .to-top { width: 50px; height: 50px; padding: 0; justify-content: center; border-radius: 50%; }
  .to-top svg { width: 20px; height: 20px; }
  .to-top-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* short screens: keep the text sheet small enough to leave the toy visible */
@media (max-width: 760px) and (max-height: 740px) { .side p.extra, .skills p { display: none; } }
@media (min-width: 761px) and (max-height: 680px) {
  .side h2 { font-size: 34px; margin-bottom: 12px; }
  .facts, .skills p { display: none; }
  .skills li { padding: 12px; }
}

/* ---------- if WebGL is unavailable, fall back to a plain readable page ---------- */
.no3d .track { height: auto; }
.no3d .stage { position: static; height: auto; overflow: visible; padding: calc(var(--bar) + 40px) var(--gutter) 60px; display: grid; gap: 40px; }
.no3d #scene, .no3d .hint, .no3d .word, .no3d .loading { display: none; }
.no3d .panel { position: static; opacity: 1 !important; transform: none !important; max-width: 600px; }
.no3d .side p.extra, .no3d .skills p { display: block; }
.no3d .facts { display: grid; }

@media (prefers-reduced-motion: reduce) {
  .hint .mouse::after, .hint .swipe svg { animation: none; }
  .loading i { animation-duration: 2.4s; }
  .hint .swipe::before { display: none; }
  .social a, .social a::after, .arrows button, .card, .shot img, .shot svg, .jump button, .to-top { transition: none; }
}
