/* 04 Canvas: the homepage is a pannable design board, in black */
:root {
  --black: #000000;
  --white: #ffffff;
  --grey: #929292;          /* 6.9:1 on black */
  --line: #262626;
  --panel: #121212;
  --dot: #2e2e2e;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --pad: clamp(12px, 2vw, 24px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { background: var(--black); color: var(--white); -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
  background: var(--black);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
img { display: block; max-width: 100%; -webkit-user-drag: none; user-select: none; }
a { color: inherit; text-decoration: none; }
ol { list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }

/* ---------- Viewport + world ---------- */
.viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background-color: var(--black);
  background-image: radial-gradient(circle, var(--dot) 1.2px, transparent 1.3px);
  background-size: 24px 24px;
}
.viewport:focus-visible { outline-offset: -4px; }
.viewport.dragging { cursor: grabbing; }
.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  /* will-change is switched on by the script only while the board moves; leaving it on
     keeps the whole board as one GPU layer that has to redraw (and flash) on every hover */
}

/* ---------- Intro text layer ---------- */
.intro { position: absolute; padding: 24px 32px; }
.intro-name {
  font-size: 236px;
  font-weight: 600;
  font-variation-settings: "wdth" 80;
  line-height: 0.9;
  letter-spacing: -0.02em;
  white-space: nowrap;
  min-height: 0.9em;
}
.caret {
  display: inline-block;
  width: 6px;
  height: 0.72em;
  margin-left: 0.04em;
  background: var(--white);
  vertical-align: -0.02em;
  opacity: 0;
}
.intro-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  margin-top: 40px;
  font-size: 26px;
  line-height: 1.4;
}
.intro-role { font-weight: 600; }
.intro-text { color: var(--grey); max-width: 30em; }

/* Figma-style selection box */
.select-box {
  position: absolute;
  inset: 0;
  border: 2px solid var(--white);
  opacity: 0;
  pointer-events: none;
}
.select-box i {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--black);
  border: 2px solid var(--white);
}
.select-box i:nth-child(1) { left: -8px; top: -8px; }
.select-box i:nth-child(2) { right: -8px; top: -8px; }
.select-box i:nth-child(3) { left: -8px; bottom: -8px; }
.select-box i:nth-child(4) { right: -8px; bottom: -8px; }

/* ---------- Sections and frames ---------- */
.sec {
  position: absolute;
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}
.sec-title {
  position: absolute;
  left: 0;
  top: -44px;
  font-size: 22px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.sec-body { display: flex; flex-wrap: wrap; gap: 56px; align-items: flex-start; }

.frame {
  display: block;
  width: 560px;
  border: 0;
  background: none;
  text-align: left;
  cursor: inherit;
  position: relative;
}
.frame.group { display: flex; gap: 24px; width: auto; }
.phone { display: block; width: 190px; }
.label {
  display: block;
  font-size: 15px;
  color: var(--grey);
  margin-bottom: 8px;
  white-space: nowrap;
}
.art {
  display: block;
  position: relative;
  overflow: hidden;
  background: #0d0d0d;
  outline: 1px solid var(--line);
}
.art img { width: 100%; height: auto; }
.phone .art { border-radius: 14px; }

/* Hover and selection outlines are drawn in an overlay above the board (see .hover-box),
   so pointing at a frame never repaints the board itself */
.frame.is-selected .label { color: var(--white); }
.frame:focus-visible { outline: none; }
.frame:focus-visible .art { outline: 3px solid var(--white); outline-offset: 4px; }

/* Text sections */
.sec-text .sec-body { display: grid; gap: 18px; font-size: 22px; line-height: 1.5; color: var(--grey); }
.about-lede { color: var(--white); font-size: 52px; font-weight: 600; line-height: 1.02; letter-spacing: -0.02em; font-variation-settings: "wdth" 80; }
.steps { display: grid; margin-top: 8px; border-top: 1px solid var(--line); }
.steps li {
  display: grid;
  grid-template-columns: 36px 190px 1fr;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.steps b { font-weight: 400; font-size: 18px; }
.steps span { color: var(--white); }
.steps em { font-style: normal; font-size: 18px; }


.btn {
  display: inline-block;
  justify-self: start;
  background: var(--white);
  color: var(--black);
  border: 0;
  border-radius: 8px;
  padding: 12px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}
.btn:hover { background: #d6d6d6; }
.btn-lg { font-size: 20px; padding: 14px 24px; margin-top: 6px; }

/* ---------- Leon's cursor ---------- */
.leon {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: flex-start;
  pointer-events: none;
  transform-origin: 0 0;
  z-index: 5;
  opacity: 0;
  will-change: transform; /* its own small layer, so the drifting cursor never repaints the board */
}
.leon svg { flex: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.leon span {
  margin: 16px 0 0 -2px;
  background: var(--white);
  color: var(--black);
  font-size: 13px;
  font-weight: 600;
  padding: 2px 8px 3px;
  border-radius: 999px 999px 999px 4px;
}

/* ---------- Chrome ---------- */
.chrome-top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--pad);
  pointer-events: none;
}
.chrome-top > * { pointer-events: auto; }
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
}
.brand span { color: var(--grey); }
.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  transition: border-color 0.3s;
}
.chip:hover { border-color: var(--white); }

.toolbar {
  position: fixed;
  left: 50%;
  bottom: var(--pad);
  z-index: 20;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.8);
  max-width: calc(100vw - 2 * var(--pad));
}
.tb-group { display: flex; gap: 2px; }
.tb-group + .tb-group { padding-left: 6px; border-left: 1px solid var(--line); }
.toolbar button {
  border: 0;
  background: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.toolbar button:hover { background: #222; }
.toolbar button[aria-pressed="true"] { background: var(--white); color: var(--black); }
.tb-zoom button { min-width: 36px; font-variant-numeric: tabular-nums; }
#zoomFit { min-width: 64px; }

.inspector {
  position: fixed;
  right: var(--pad);
  top: 50%;
  z-index: 25;
  width: min(320px, calc(100vw - 2 * var(--pad)));
  transform: translateY(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.9);
}
.inspector[hidden] { display: none; }
.ins-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  color: var(--grey);
}
.ins-close:hover { background: #222; color: var(--white); }
.ins-cat { color: var(--grey); margin-bottom: 6px; }
.ins-name { font-size: 1.75rem; line-height: 1.05; font-weight: 600; letter-spacing: -0.015em; font-variation-settings: "wdth" 85; margin-bottom: 12px; padding-right: 28px; }
.ins-desc { color: var(--grey); margin-bottom: 20px; }

.hint {
  position: fixed;
  left: var(--pad);
  bottom: var(--pad);
  z-index: 15;
  color: var(--grey);
  font-size: 0.875rem;
  max-width: 17rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  pointer-events: none;
  transition: opacity 0.8s;
}
.hint.gone { opacity: 0; }

/* Pre-intro states */
.js .world { opacity: 0; }

@media (max-width: 860px) {
  .brand span { display: none; }
  /* The board starts zoomed out on phones, so the intro copy is set larger in world units */
  .intro-row { grid-template-columns: 1fr; gap: 16px; font-size: 44px; line-height: 1.3; max-width: 1040px; }
  .hint { bottom: 76px; right: var(--pad); max-width: none; }
  .toolbar { left: var(--pad); right: var(--pad); transform: none; overflow-x: auto; justify-content: space-between; }
  .inspector { top: auto; bottom: 76px; right: var(--pad); left: var(--pad); width: auto; transform: none; }
}

/* Fade used when moving between the board and a case study */
.page-fade { position: fixed; inset: 0; z-index: 200; background: var(--black); opacity: 0; pointer-events: none; }

/* Screen-space outlines for hover and selection, like a design tool's */
.hover-box,
.sel-box {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 5;
  pointer-events: none;
  display: none;
}
.hover-box { border: 1.5px solid rgba(255, 255, 255, 0.75); }
.sel-box { border: 2px solid var(--white); }
.sel-box i {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--black);
  border: 2px solid var(--white);
}
.sel-box i:nth-child(1) { left: -6px; top: -6px; }
.sel-box i:nth-child(2) { right: -6px; top: -6px; }
.sel-box i:nth-child(3) { left: -6px; bottom: -6px; }
.sel-box i:nth-child(4) { right: -6px; bottom: -6px; }

/* 'Latest work' badge with glitter (stars are added by sparkle.js).
   Only transform and opacity animate, each on its own layer, so the board never repaints. */
.latest {
  position: absolute;
  top: 12px;
  right: -18px;
  z-index: 4;
  display: inline-block;
  pointer-events: none;
  --spark-a: #ffffff;
  --spark-b: #ffd76a;
}
.latest-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  padding: 7px 15px 7px 11px;
  border-radius: 999px;
  background: var(--white);
  color: var(--black);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.12), 0 10px 30px -8px rgba(255, 215, 106, 0.6);
}
.latest-pill svg { width: 16px; height: 16px; fill: #e2a400; flex: none; }
.latest-pill::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -45%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 215, 106, 0.7), transparent);
  animation: latest-shine 3.4s ease-in-out infinite;
  will-change: transform;
}
@keyframes latest-shine {
  0%, 55% { transform: translateX(0); }
  100% { transform: translateX(420%); }
}
.spark {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  width: var(--sz);
  height: var(--sz);
  margin: calc(var(--sz) / -2) 0 0 calc(var(--sz) / -2);
  background: radial-gradient(circle, #ffffff 0 18%, var(--c) 42%);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  opacity: 0;
  will-change: transform, opacity;
  animation: spark var(--t) cubic-bezier(0.2, 0.7, 0.3, 1) var(--d) forwards;
}
@keyframes spark {
  0% { opacity: 0; transform: translate(0, 0) scale(0.2) rotate(0deg); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--r)); }
}
/* two twinkles that keep glinting at the badge's corners between bursts */
.latest::before,
.latest::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, #ffffff 0 18%, var(--spark-b) 42%);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  will-change: transform, opacity;
  animation: twinkle 2.4s ease-in-out infinite;
}
.latest::before { left: -10px; top: -12px; }
.latest::after { right: -8px; bottom: -12px; width: 15px; height: 15px; animation-delay: 1.2s; }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.2) rotate(0deg); }
  50% { opacity: 1; transform: scale(1) rotate(90deg); }
}
@media (prefers-reduced-motion: reduce) {
  .latest-pill::after { animation: none; display: none; }
  .latest::before, .latest::after { animation: none; opacity: 0.9; transform: none; }
  .spark { display: none; }
}
