/* Apercu Mono Pro (paid, Colophon): self-hosted, only Regular is used */
@font-face { font-family: 'Apercu Mono Pro'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/apercu-mono-pro-regular.woff2) format('woff2'); }
/* Geist Pixel Square (Vercel, OFL, fonts/geist-pixel-OFL.txt): only the 404 uses it */
@font-face { font-family: 'Geist Pixel'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/geist-pixel-square.woff2) format('woff2'); }

:root {
  --bg: #fcfcfd;
  --text: #47484f;
  --muted: #9697a1;
  --muted-strong: #6b6c75;
  --spring-soft: linear(0, 0.031, 0.108, 0.212, 0.328, 0.444, 0.555, 0.655, 0.742, 0.815, 0.875, 0.923, 0.959, 0.986, 1.005, 1.017, 1.024, 1.028, 1.028, 1.027, 1.025, 1.022, 1.018, 1.015, 1.012, 1.009, 1.007, 1.005, 1.003, 1.002, 1); /* ~3% overshoot: chess pieces, difficulty knob */
  --spring: linear(0, 0.029, 0.106, 0.212, 0.334, 0.462, 0.585, 0.7, 0.801, 0.886, 0.955, 1.009, 1.048, 1.074, 1.088, 1.094, 1.094, 1.088, 1.078, 1.067, 1.055, 1.043, 1.032, 1.022, 1.013, 1.006, 1.001, 0.997, 0.994, 0.992, 1); /* damped spring, ~9% overshoot: nav dock, chess page */
}

* { margin: 0; box-sizing: border-box; scrollbar-width: none; } /* no native scrollbars anywhere; scrolling itself still works */
*::-webkit-scrollbar { display: none; } /* Safari before 18.2 ignores scrollbar-width */

body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/normal Inter, sans-serif;
  padding: 120px 0 240px; /* bottom: 177px blur + 63px so the last line stays clear of it */
}

/* Page sections stack with 64px between them (Figma wrapper gap) */
main { display: flex; flex-direction: column; align-items: center; gap: 64px; }

.col {
  width: min(520px, 100% - 48px);
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.hello { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.mark { display: block; width: 31.8192px; height: 18.3059px; margin-left: -0.5px; } /* SVG root size; Figma offsets it 1.6% left */
.welcome { color: var(--muted); height: 17px; line-height: 17px; } /* fixed: CJK/Arabic fallback fonts must not push the intro down */
/* Language switch (welcome.js): letters leave upward, the next word's letters arrive from below */
.welcome [aria-hidden] span { display: inline-block; white-space: pre; }
.welcome.in [aria-hidden] span { animation: welcome-in 0.55s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--i) * 35ms) backwards; }
.welcome.out [aria-hidden] span { animation: welcome-out 0.28s cubic-bezier(0.6, 0, 0.8, 0.2) calc(var(--i) * 25ms) forwards; }
@keyframes welcome-in { from { opacity: 0; filter: blur(6px); translate: 0 6px; } }
@keyframes welcome-out { to { opacity: 0; filter: blur(6px); translate: 0 -6px; } }
@media (prefers-reduced-motion: reduce) {
  @keyframes welcome-in { from { opacity: 0; } }
  @keyframes welcome-out { to { opacity: 0; } }
}
.marker ::selection { background: transparent; } /* the highlighter stroke replaces it */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.intro { display: flex; flex-direction: column; gap: 16px; line-height: 1.4; }
.role { color: var(--muted); }
.bio { max-width: 410px; }
.contact { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; } /* Figma 64:987 */
.mail { display: inline-flex; align-items: center; padding: 4px 8px; border: 0; border-radius: 10px; background: var(--tag-bg); color: var(--text); font: inherit; cursor: pointer; }
/* Figma 64:1058: on hover the copy icon blurs in 10px right of the address and the pill widens with it */
.mail-icon { position: relative; width: 0; height: 16px; margin-left: 0; opacity: 0; filter: blur(4px); transition: width 0.3s ease, margin-left 0.3s ease, opacity 0.3s ease, filter 0.3s ease; }
.mail:hover .mail-icon, .mail:focus-visible .mail-icon, .mail.copied .mail-icon { width: 16px; margin-left: 10px; opacity: 1; filter: none; }
/* after copying, the copy icon blurs into a check for 1.5s */
.mail-icon img { position: absolute; inset: 0; transition: opacity 0.25s ease, filter 0.25s ease; }
.mail-icon .check, .mail.copied .mail-icon img:first-child { opacity: 0; filter: blur(3px); }
.mail.copied .mail-icon .check { opacity: 1; filter: none; }
/* Figma 64:1064: the address blurs into "Copied" (both stacked; JS animates the width) */
.mail-label { display: grid; min-width: 0; overflow: hidden; transition: width 0.3s ease; }
.mail-label > span { grid-area: 1 / 1; justify-self: start; white-space: nowrap; transition: opacity 0.25s ease, filter 0.25s ease; }
.mail-label .copied-text, .mail.copied .mail-label > span:first-child { opacity: 0; filter: blur(3px); }
.mail.copied .mail-label .copied-text { opacity: 1; filter: none; }

/* Contact chat (Figma 64:1086): bot bubbles left, the visitor's messages right, input pill centred 64px below */
.chat { width: min(520px, 100% - 48px); margin-top: 36px; display: flex; flex-direction: column; gap: 64px; line-height: 1.4; }
.chat-in { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; transition: height 0.45s cubic-bezier(0.22, 1, 0.36, 1); } /* JS pins and animates the height so the content below glides */
.bubble { max-width: 360px; padding: 8px 12px; border-radius: 16px 16px 16px 4px; background: var(--tag-bg); color: var(--text); transform-origin: bottom left; }
.bubble .mail-hl { color: var(--link); }
.bubble .legal-hint { opacity: 0.5; } /* GDPR notice before the first input; the link inherits the half-strength colour */
.bubble .legal-hint a { color: inherit; text-decoration: underline; }
.bubble.sent { align-self: flex-end; white-space: pre-line; overflow-wrap: anywhere; margin-top: 20px; border-radius: 16px 16px 4px 16px; background: #222329; color: var(--tag-bg); transform-origin: bottom right; }
/* input row (Figma 64:1087): blue pill, the send arrow pops in beside it once the address is valid */
.chat-out { display: flex; justify-content: center; align-items: center; }
.field { display: block; min-width: 0; max-width: calc(100% - 38px); padding: 8px 12px; border-radius: 23px; background: var(--link); }
.field input, .field textarea { display: block; resize: none; max-width: 100%; min-width: 1ch; field-sizing: content; padding: 0; border: 0; background: none; color: var(--tag-bg); caret-color: var(--tag-bg); font: inherit; line-height: 1.4; outline: none; }
.field input::placeholder, .field textarea::placeholder { color: rgb(233 233 233 / 0.75); }
@media (pointer: coarse) { .field input, .field textarea { font-size: 16px; } } /* iOS Safari zooms into inputs under 16px */
.field.invalid { animation: shake 0.35s; }
@keyframes shake { 25% { translate: -4px 0; } 50% { translate: 4px 0; } 75% { translate: -2px 0; } }
.send { display: grid; place-items: center; flex-shrink: 0; width: 0; height: 36px; margin-left: 0; padding: 0; border: 0; border-radius: 29px; background: var(--tag-bg); cursor: pointer; overflow: hidden;
  opacity: 0; filter: blur(4px); transform: scale(0.4); transition: width 0.3s ease, margin-left 0.3s ease, opacity 0.25s ease, filter 0.25s ease, transform 0.45s cubic-bezier(0.34, 1.25, 0.64, 1); }
.chat-out.valid .send { width: 36px; margin-left: 2px; opacity: 1; filter: none; transform: none; }
.send img { display: block; }
.favicon { display: grid; place-items: center; flex-shrink: 0; width: 0; height: 36px; margin-right: 0; border-radius: 29px; background: var(--tag-bg); overflow: hidden;
  opacity: 0; filter: blur(4px); transform: scale(0.4); transition: width 0.3s ease, margin-right 0.3s ease, opacity 0.25s ease, filter 0.25s ease, transform 0.45s cubic-bezier(0.34, 1.25, 0.64, 1); }
.chat-out.has-icon .favicon { width: 36px; margin-right: 2px; opacity: 1; filter: none; transform: none; }
.chat-out.has-icon .field { max-width: calc(100% - 76px); }
.favicon { position: relative; }
.favicon object { position: absolute; opacity: 0; pointer-events: none; } /* invisible probe */
.favicon img { display: block; width: 18px; height: 18px; object-fit: contain; border-radius: 4px; }
.chat-out { transition: opacity 0.35s ease, filter 0.35s ease, transform 0.35s ease, visibility 0s; } /* coming back: visible at once, then fade up */
.chat-out.done { visibility: hidden; opacity: 0; filter: blur(6px); transform: translateY(16px); transition: opacity 0.35s ease, filter 0.35s ease, transform 0.35s ease, visibility 0s 0.35s; }
.chat-out.closed { height: 0 !important; margin-top: -64px; transition: height 0.45s cubic-bezier(0.22, 1, 0.36, 1), margin-top 0.45s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s; } /* chat finished: the row and its 64px gap collapse */
/* pop-in: hidden only when JS runs it, scale up with a small overshoot */
.chat[data-js] .pop { opacity: 0; filter: blur(4px); transform: scale(0.8); transition: opacity 0.25s ease, filter 0.25s ease, transform 0.45s cubic-bezier(0.34, 1.25, 0.64, 1); } /* subtle overshoot, also used to pop back out */
.chat .pop.shown { opacity: 1; filter: none; transform: none; }
.chat-in > .gap { margin-top: 20px; } /* bot again after the visitor: 24px like between the sides */
@media (prefers-reduced-motion: reduce) { .chat[data-js] .pop, .send, .favicon { transform: none; } .field.invalid { animation: none; } }

/* Thinking loader, ported from affectui.com/r/thinking-loader ("plain" variant: no pill, just spinner + shimmering label) */
.ui-tl { --ui-tl-ease: cubic-bezier(0.22, 1, 0.36, 1); display: inline-flex; align-items: center; gap: 8px; color: var(--muted-strong); font-size: 14px; line-height: 1; transform-origin: left center; }
.ui-tl__icon { position: relative; flex: none; width: 15px; height: 15px; }
.ui-tl__icon svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ui-tl__spinner line { stroke: var(--text); stroke-width: 1.6; stroke-linecap: round; opacity: 0.18; animation: ui-tl-ray 800ms linear infinite; }
.ui-tl__text { position: relative; display: block; min-width: 0; height: 2.5em; padding: 0.6em 0; margin: -0.6em 0; overflow: hidden; transition: width 460ms var(--ui-tl-ease);
  mask-image: linear-gradient(transparent, #000 0.5em, #000 calc(100% - 0.5em), transparent); } /* rolling labels fade out at the soft top/bottom edge instead of being cut; negative margin keeps the layout */
.ui-tl__label { position: absolute; top: 0.6em; left: 0; line-height: 1.3em; white-space: nowrap; }
.ui-tl__label--in { animation: ui-tl-in 460ms var(--ui-tl-ease) both; }
.ui-tl__label--out { animation: ui-tl-out 320ms var(--ui-tl-ease) both; }
.ui-tl__shine::after { content: attr(data-text); content: attr(data-text) / ""; position: absolute; inset: 0; white-space: nowrap; color: transparent;
  background: linear-gradient(90deg, transparent 38%, rgb(255 255 255 / 0.82) 50%, transparent 62%) 100% 0 / 300% 100% no-repeat; -webkit-background-clip: text; background-clip: text; animation: ui-tl-sweep 1.8s linear infinite; pointer-events: none; }
@keyframes ui-tl-ray { 0% { opacity: 1; } 100% { opacity: 0.18; } }
@keyframes ui-tl-in { from { opacity: 0; transform: translateY(70%); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes ui-tl-out { from { opacity: 1; transform: none; filter: none; } to { opacity: 0; transform: translateY(-70%); filter: blur(3px); } }
@keyframes ui-tl-sweep { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@media (prefers-reduced-motion: reduce) {
  .ui-tl *, .ui-tl *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .ui-tl__spinner line { opacity: 0.6; } .ui-tl__shine::after { display: none; }
}

/* Signature + live clock at the end of the homepage (Figma 64:983 / 60:391): 100px apart like the other groups */
.sign { width: min(520px, 100% - 48px); margin-top: 36px; display: flex; flex-direction: column; gap: 84px; }
.sign img { display: block; }
.sign-end { display: flex; flex-direction: column; gap: 48px; }
.sign-socials { display: flex; align-items: center; gap: 12px; } /* icons are masks so one colour (#9697A1) fits all four */
.sign-socials a { display: block; background: #9697A1; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; transition: opacity 0.2s; }
.sign-socials a:hover { opacity: 0.6; }
.clock { display: flex; gap: 33px; font: 400 10px/normal "Apercu Mono Pro", ui-monospace, monospace; color: var(--muted); }

/* Featured work on the homepage: 622px grid */
.work { width: min(622px, 100% - 48px); }

/* Work page (/work): sections up to 1920px wide with 24px to the screen edge, scaled down with the window; gap and radius shrink along */
.case-page.work-page { gap: 96px; --g: clamp(4px, 0.833vw, 16px); }
.swipe, .work-projects { width: min(1872px, 100% - 48px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--g); }
.work-projects { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; } /* case studies always in pairs; fixed gap so the two captions never run together on phones */
.swipe { align-items: start; }
.swipe-col { display: flex; flex-direction: column; gap: var(--g); } /* filled shortest-first in work.astro, so the bottoms end close together */
.shot, .work-projects .thumb { border-radius: clamp(5px, 1.042vw, 20px); } /* 20px at 1920, scales down with the images */
.shot { display: block; width: 100%; height: auto; background: #ececec; }
.shot.embed { aspect-ratio: 16 / 10; border: 0; } /* project embed as a tile (Work page "Project embed" item) */
@media (max-width: 600px) { /* phones: everything in one column, screens back in Studio order (inline order on each .shot) */
  .swipe { display: flex; flex-direction: column; gap: 12px; }
  .swipe-col { display: contents; }
  .work-projects { grid-template-columns: 1fr; gap: 32px; }
  .shot, .work-projects .thumb { border-radius: 12px; }
}
.work-logos { width: min(520px, 100% - 48px); display: flex; flex-direction: column; gap: 16px; }
.logos-label { /* Figma 116:280: static highlight inside the text; fit-content so the gradient stops sit on the text like in Figma */
  align-self: center; width: fit-content; white-space: nowrap;
  font: 400 12px/1.6 "Apercu Mono Pro", ui-monospace, monospace;
  background: linear-gradient(90deg, var(--text) 46.638%, #888993 59.663%, var(--muted) 64.329%, var(--text) 69.772%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.work-sign { display: block; }

/* Featured projects */
.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 16px; /* rows, columns */
}
.project { display: flex; flex-direction: column; gap: 12px; color: inherit; text-decoration: none; }
.project .thumb { transition: filter 0.3s; }
a.project:hover .thumb { filter: brightness(0.96); } /* subtle feedback: the cards are links now */
.thumb { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 8px; background: #ececec; } /* one shape for every card (image, embed, placeholder), so they line up; other image formats get cropped */
.thumb.embed { border: 0; } /* HTML embed (Sanity "embed" field) */
.project a.project-text { color: inherit; text-decoration: none; }
.project-text { display: flex; flex-direction: column; gap: 4px; }
.project-head { display: flex; justify-content: space-between; gap: 16px; }
.project-head h2 { font: inherit; }
.year, .project p { color: var(--muted); }
.project p { line-height: 1.4; font-weight: 300; }
.projects .project p { font-weight: 400; } /* homepage cards only: details +100 (300 → 400) */
@media (max-width: 600px) {
  .projects { grid-template-columns: 1fr; }
}

/* Clients: text + 3 rotating logo slots (logos.js) */
.clients { width: min(520px, 100% - 48px); display: flex; flex-direction: column; gap: 40px; }
.clients-text, .clients > p { line-height: 1.4; }
.clients-text p + p { margin-top: 1.4em; }
.clients a { color: inherit; text-decoration: underline; text-decoration-color: rgb(71 72 79 / 0.5); text-underline-offset: 2px; } /* text colour, underline at half strength */
.logo-row { display: grid; grid-template-columns: repeat(3, 1fr); height: 80px; border: 1px solid var(--tag-bg); border-radius: 16px; } /* same card as .case-kpis (Figma 86:1502) */
/* Equal slots so swapped logos of any width never shift the row; logos centred in their cell */
.logo-slot { display: grid; align-items: center; justify-items: center; min-width: 0; }
.logo-slot + .logo-slot { border-left: 1px solid var(--tag-bg); }
.logo-row .logo { zoom: 0.75; } /* widest logo (150px) keeps ~30px air inside a 173px cell */
@media (max-width: 600px) {
  .logo-row .logo { zoom: 0.5; } /* ...and inside a third of a phone column */
}
.logo { grid-area: 1 / 1; background: #9697A1; -webkit-mask: var(--src) center / contain no-repeat; mask: var(--src) center / contain no-repeat; } /* same grey as .sign-socials */
/* Sequential: old logo accelerates away (0.42s), short pause, new one glides in and settles (delay 0.54s) */
.logo.leave { animation: logo-out 0.42s cubic-bezier(0.6, 0, 0.8, 0.2) forwards; }
.logo.enter { animation: logo-in 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.54s backwards; }
@keyframes logo-out { to { opacity: 0; filter: blur(10px); translate: 0 -24px; } }
@keyframes logo-in { from { opacity: 0; filter: blur(10px); translate: 0 24px; } }
@media (prefers-reduced-motion: reduce) {
  @keyframes logo-out { to { opacity: 0; } }
  @keyframes logo-in { from { opacity: 0; } }
}

/* Case study pages (projects/[slug].astro, Figma 58:225). Blocks sit 48px apart unless a rule below says otherwise. */
:root { --tag-bg: #e9e9e9; --link: #09f; }
.case-page { gap: 48px; }
.case-intro { width: min(520px, 100% - 48px); display: flex; flex-direction: column; gap: 24px; line-height: 1.4; }
.case-intro > p { position: relative; }
.case-intro mark { background: none; color: inherit; } /* the marker stroke is painted on top */
.case-head { display: flex; flex-direction: column; gap: 4px; }
.crumbs { display: flex; gap: 8px; font: 400 12px/1.4 "Apercu Mono Pro", ui-monospace, monospace; color: var(--muted); }
.crumbs a { color: inherit; text-decoration: none; }
.crumbs .current { color: var(--text); }
.case-head h1 { font: 400 16px/1.4 Inter, sans-serif; }
.case-overview { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.case-overview p:last-child { max-width: 450px; }
.case-overview .label { color: var(--muted); }
.case-main { width: min(622px, 100% - 48px); display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* Same image as the homepage thumb at 622/303 scale; the 4.1px radius is the thumb's 2px scaled up */
.case-hero { display: block; width: 100%; height: auto; border-radius: 16px; background: #d9d9d9; }
.case-hero.placeholder { aspect-ratio: 303 / 205; }
.case-hero.embed { aspect-ratio: 303 / 205; border: 0; background: #ececec; } /* HTML embed (Sanity "caseEmbed" field) */
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 0; list-style: none; }
.tag { display: block; padding: 4px 8px; border-radius: 6px; background: var(--tag-bg); color: var(--muted-strong); font-size: 12px; line-height: 1.4; text-decoration: none; }

.case { display: flex; flex-direction: column; align-items: center; font-size: 14px; line-height: 1.4; text-align: justify; hyphens: auto; }
.case > * { width: min(520px, 100% - 48px); }
.case > * + * { margin-top: 48px; }
.case > p + p { margin-top: 1.4em; } /* paragraphs of one text block: one empty line */
.case > h2 + * { margin-top: 12px; }
.case > h2 { display: flex; align-items: center; gap: 16px; font: 500 14px/1.4 Inter, sans-serif; text-align: left; }
.case > h2::after { content: ''; flex: 1; min-width: 24px; height: 1px; background: rgb(71 72 79 / 0.1); } /* line fills the rest of the 520px (Figma 68:1128) */
.case a, .legal a, .contact a, .bubble a { color: var(--link); }
:is(.case, .legal, .contact, .bubble, .crumbs) a:not(.tag) { text-decoration: none; } /* hover/focus paints the marker instead (Base.astro) */
.case a.tag { color: var(--muted-strong); text-decoration: none; } /* linked caption looks like a plain tag */
.contact a { color: inherit; } /* Figma: social links in text colour, only the underline marks them */
.case mark { background: none; color: inherit; } /* the marker stroke is painted on top */
.case ul { display: flex; flex-direction: column; gap: 4px; padding: 0; list-style: none; text-align: left; color: var(--muted-strong); }
.case li { display: flex; gap: 8px; }
.case li::before { content: "+"; color: var(--muted); }

/* Scroll ruler (components/case/ScrollRuler.astro): --k is 0..1, how close a tick is to the reading position */
.ruler { position: fixed; z-index: 20; top: 22vh; right: 24px; width: 14px; height: 56vh; cursor: pointer; touch-action: none; }
.ruler[hidden] { display: none; }
.ruler-ticks { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; height: 100%; overflow: hidden; }
.ruler-ticks i { --k: 0; flex-shrink: 0; width: calc(7px + 7px * var(--k)); height: 2px; border-radius: 1px;
  background: color-mix(in srgb, var(--link) calc(var(--k) * 100%), rgb(32 32 32 / 0.16)); transition: background 120ms linear, width 120ms cubic-bezier(0.22, 1, 0.36, 1); }
/* section names on hover; hiding waits a moment so the pointer can cross from the ticks to a label */
.ruler-label { position: absolute; right: 22px; translate: 0 -50%; padding: 2px 6px; border: 0; border-radius: 6px; background: var(--bg); color: var(--muted); font: 400 12px/1.4 Inter, sans-serif; white-space: nowrap; cursor: pointer;
  opacity: 0; visibility: hidden; transition: opacity 0.2s 0.15s, visibility 0s 0.35s, color 0.2s; }
.ruler:hover .ruler-label { opacity: 1; visibility: visible; transition: opacity 0.2s, visibility 0s, color 0.2s; }
.ruler-label.on, .ruler-label:hover { color: var(--text); }
@media (max-width: 760px) { .ruler { display: none; } } /* phones, and any window where it would overlap the 622px content */
@media (prefers-reduced-motion: reduce) { .ruler-ticks i, .ruler-label { transition: none; } }

/* Scroll dock (components/case/ScrollDock.astro): replaces the ruler where the ruler is hidden */
.dock { display: none; }
@media (max-width: 760px) {
  .dock { position: fixed; z-index: 20; top: max(12px, env(safe-area-inset-top)); left: 50%; display: flex; align-items: center; gap: 10px;
    max-width: calc(100% - 32px); padding: 10px 16px 10px 12px; border: 1px solid rgb(71 72 79 / 0.08); border-radius: 999px;
    background: rgb(252 252 253 / 0.8); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 4px 16px rgb(71 72 79 / 0.08);
    font: 400 14px/1.2 Inter, sans-serif; color: var(--text); pointer-events: none;
    opacity: 0; translate: -50% -8px; scale: 0.96; transition: opacity 0.3s, translate 0.4s cubic-bezier(0.22, 1, 0.36, 1), scale 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
  .dock.on { opacity: 1; translate: -50% 0; scale: 1; }
  .dock svg { flex-shrink: 0; rotate: -90deg; fill: none; stroke-width: 2; }
  .dock circle { stroke: var(--muted); opacity: 0.25; }
  .dock .dock-ring { stroke: var(--link); opacity: 1; stroke-dasharray: 1; stroke-linecap: round; }
  .dock span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) { .dock { transition: opacity 0.3s; } }
.case-quote { width: min(420px, 100% - 48px) !important; display: flex; flex-direction: column; gap: 8px; }
.case-quote figcaption { font: 400 12px/1.4 "Apercu Mono Pro", ui-monospace, monospace; color: var(--muted); }
.case-kpis { display: flex; border: 1px solid var(--tag-bg); border-radius: 16px; text-align: left; hyphens: none; } /* Figma 86:1502 (3) / 87:1521 (2) */
.case-kpis > div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 17px 23px; } /* +1px border = Figma's 18/24, whose stroke sits inside the frame */
.case-kpis > div + div { border-left: 1px solid var(--tag-bg); }
.case-kpis dt { font-weight: 500; }
.case-kpis dd { font-size: 13px; color: var(--muted); }
.case > .case-link { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 23px; border: 1px solid var(--tag-bg); border-radius: 16px; text-decoration: none; text-align: left; hyphens: none; transition: background 0.2s; } /* Figma 146:25, +1px border like .case-kpis */
.case > .case-link + :is(.case-code, .case-media), .case > .case-media + .case-link { margin-top: 16px; } /* a card next to the image or code it talks about reads as one group */
a.case-link:hover { background: rgb(233 233 233 / 0.35); }
.case-link-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; font-weight: 500; line-height: 1.4; color: var(--text); }
.case-link-cta { display: flex; align-items: center; gap: 4px; flex-shrink: 0; font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--muted); transition: color 0.2s; }
.case-link:hover .case-link-cta { color: var(--text); }
.case-link img { flex-shrink: 0; }
.case-code { padding: 16px 24px; border-radius: 12px; border: 1px solid rgb(0 0 0 / 0.05); background: #ececec; box-shadow: 0 2px 2px rgb(0 0 0 / 0.1); color: var(--muted-strong); font: 400 13px/1.6 "Geist Mono", ui-monospace, monospace; text-align: left; hyphens: none; white-space: pre-wrap; overflow-wrap: anywhere; } /* Figma 72:1133; no hyphens, they would read as code */
.case-code code { font: inherit; } /* browser default would switch <code> back to plain monospace */
.code-tabs { display: flex; flex-direction: column; gap: 12px; padding: 16px 0; overflow: hidden; white-space: normal; transition: height 0.45s cubic-bezier(0.22, 1, 0.36, 1); } /* Figma 194:2; JS pins and animates the height on a switch */
.code-tabs-bar { display: flex; gap: 24px; padding: 0 24px 12px; border-bottom: 1px solid rgb(0 0 0 / 0.05); }
.code-tabs [role=tab] { display: flex; align-items: center; gap: 4px; margin: -3px -10px; padding: 3px 10px; border: 0; border-radius: 999px; background: none; color: inherit; font: inherit; cursor: pointer; transition: background-color 0.2s; } /* margin cancels the pill padding: labels stay where Figma has them */
.code-tabs [role=tab] + [role=tab] { gap: 8px; } /* the 16px code icon gets more room than the 18px HTML logo, as in Figma */
.code-tabs [role=tab][aria-selected=true] { background: rgb(0 0 0 / 0.05); } /* pill marks the code that is shown */
.code-tabs pre { margin: 0; padding: 0 24px; white-space: pre-wrap; overflow-wrap: anywhere; animation: code-in 0.3s ease; } /* the new code blurs in while the box glides */
@keyframes code-in { from { opacity: 0; filter: blur(2px); } }
@media (prefers-reduced-motion: reduce) { .code-tabs, .code-tabs pre { transition: none; animation: none; } }
.case > .case-media.wide { width: min(622px, 100% - 48px); }
.case > .case-media.full { width: min(1006px, 100% - 48px); } /* wider than the text column, e.g. big interactive embeds */
iframe.case-embed { display: block; height: 150px; border: 0; } /* height until the frame reports its content */
/* Radii scale with the width like the homepage thumbs (2px at 303px) */
.case-media > img, .case-media > video { display: block; width: 100%; height: auto; border-radius: 12px; background: #d9d9d9; } /* Figma: 12px for all images in the text */
.case-media figcaption { display: flex; justify-content: center; margin-top: 8px; }
.case-media .tag:is(a):hover { color: var(--text); }
.case-media.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.case > .case-media + .case-media.pair { margin-top: 8px; } /* an image with a pair right below reads as one group: same 8px as inside the pair */
.case-media.pair > img { aspect-ratio: var(--ratio); object-fit: cover; }
@media (max-width: 600px) {
  .case-media.pair { grid-template-columns: 1fr; }
}
/* Legal pages (layouts/Legal.astro, Figma 82:1497): 520px column, blocks 26px apart */
.legal { gap: 26px; font-size: 14px; line-height: 1.4; }
.legal > * { width: min(520px, 100% - 48px); }
.legal header { display: flex; flex-direction: column; gap: 4px; }
.legal h1 { font: 500 14px/1.4 Inter, sans-serif; color: var(--muted-strong); }
.legal header p { font: 400 10px/1.4 "Apercu Mono Pro", ui-monospace, monospace; color: var(--muted); }
.legal :is(h2, h3, h4, strong) { font: inherit; font-weight: 500; }
.legal :is(h2, h3, h4) { margin-bottom: 4px; }
.legal :is(p, ul) + :is(p, ul, h4) { margin-top: 8px; } /* several paragraphs in one block (privacy) */
.legal .part { margin: 16px 0 -14px; font: 400 12px/1.4 "Apercu Mono Pro", ui-monospace, monospace; color: var(--muted); text-transform: uppercase; } /* privacy chapter label: more air above, 12px to its first block */
.legal ul { padding-left: 18px; }
/* End of a note (components/note/NoteEnd.astro, Figma 93:325): date + signature, 64px above the previous/next card */
.note-end { width: min(520px, 100% - 48px); display: flex; flex-direction: column; align-items: center; gap: 64px; }
.note-divider { display: block; width: 100%; height: 1px; }
.note-sign { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.note-sign p { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; line-height: 1.6; }
.note-sign p span + span { color: var(--muted); }
.signature { position: relative; width: 146px; height: 49px; overflow: hidden; }
.signature span { position: absolute; }
.signature img { display: block; width: 100%; height: 100%; }
/* End of a case study (components/case/CaseEnd.astro, Figma 93:325): divider, Project by, Credits to */
.case-end { width: min(520px, 100% - 48px); display: flex; flex-direction: column; align-items: center; gap: 48px; font-size: 13px; line-height: 1.6; text-align: center; }
.case-end-group { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); }
.case-end-group.credits { gap: 16px; }
.case-end-name { font-family: "Apercu Mono Pro", ui-monospace, monospace; color: var(--text); text-transform: uppercase; }
.case-end-name span { color: var(--muted); }
.case-end a { color: inherit; text-decoration: underline; text-decoration-color: var(--muted); text-underline-position: from-font; transition: text-decoration-color 0.2s; }
.case-end a:hover { text-decoration-color: var(--text); }
.case-end ul { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0; list-style: none; }
.case-end li { display: flex; align-items: center; gap: 8px; }
.case-end li > :is(img, i) { flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; background: #d9d9d9; object-fit: cover; }
.note-nav { width: 100%; display: flex; border: 1px solid var(--tag-bg); border-radius: 16px; overflow: hidden; } /* same card as .case-kpis */
.note-nav a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 17px 23px; color: var(--text); line-height: 1.4; text-decoration: none; }
.note-nav a + a { border-left: 1px solid var(--tag-bg); }
.note-nav span { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.note-nav strong { font-weight: 500; }
.note-nav .next { align-items: flex-end; text-align: right; }
.note-nav .next img { rotate: 180deg; }
/* Notes list (pages/blog/index.astro): no Figma design yet */
.notes-list { width: min(520px, 100% - 48px); display: flex; flex-direction: column; gap: 32px; padding: 0; list-style: none; }
.notes-list .pinned-end { margin-bottom: 24px; } /* last pinned note: bigger gap (56px) to the unpinned group */
.notes-list .crumbs { align-items: center; gap: 10px; }
.notes-list .pin { translate: 0 -3px; opacity: 0.5; } /* the icon's visual centre sits a little low next to the digits */
.notes-list a { display: flex; flex-direction: column; gap: 4px; color: var(--text); line-height: 1.4; text-decoration: none; }
.notes-list strong { font-weight: 500; }
.notes-list .excerpt { color: var(--muted-strong); }
.notes-empty { color: var(--muted); }
/* Case page entrance: each element blurs in from slightly below, one after another */
.stagger { animation: stagger-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--i, 0) * 90ms + var(--d0, 100ms)) backwards; } /* --d0: start offset (homepage after the loader) */
@keyframes stagger-in { from { opacity: 0; filter: blur(8px); translate: 0 12px; } }
@media (prefers-reduced-motion: reduce) {
  @keyframes stagger-in { from { opacity: 0; } }
}

/* Progressive blur: 6 stacked layers, each blurring one band twice as hard as the one above.
   Bands (not cumulative layers) so the blurs don't compound. Top edge = 0 blur. */
.fade {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 177px;
  pointer-events: none;
}
.fade i {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  mask-image: linear-gradient(transparent var(--from), #000 var(--on), #000 var(--off), transparent var(--to));
}
.fade i:nth-child(1) { --blur: 1px;  --from: 0%;    --on: 16.7%; --off: 33.3%; --to: 50%; }
.fade i:nth-child(2) { --blur: 2px;  --from: 16.7%; --on: 33.3%; --off: 50%;   --to: 66.7%; }
.fade i:nth-child(3) { --blur: 4px;  --from: 33.3%; --on: 50%;   --off: 66.7%; --to: 83.3%; }
.fade i:nth-child(4) { --blur: 8px;  --from: 50%;   --on: 66.7%; --off: 83.3%; --to: 100%; }
.fade i:nth-child(5) { --blur: 16px; --from: 66.7%; --on: 83.3%; --off: 100%;  --to: 101%; }
.fade i:nth-child(6) { --blur: 32px; --from: 83.3%; --on: 100%;  --off: 100%;  --to: 101%; }
/* Page colour on top, so the blur melts into the background */
.fade::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgb(252 252 253 / 0), var(--bg));
}

nav {
  position: fixed;
  left: 50%;
  bottom: 27px;
  transform: translateX(-50%);
  display: flex;
  font: 400 12px/1 Inter, sans-serif;
  white-space: nowrap;
  --s0: 1.6; --s1: 1.15; --s2: 1.05; /* hovered icon, direct neighbours, two away */
}
/* 8px padding on each side = 16px between icons (Figma 81:1258) and no dead gaps while hovering along the row.
   The icon always sits at x 8–32, so label, divider, dot and fan are placed from the left edge, not 50%.
   Items are links, except Socials (a div holding the fan of social links), hence nav > * instead of nav a. */
nav > * { position: relative; display: block; padding: 8px; color: var(--muted-strong); text-decoration: none; outline: none; }
nav > .split { padding-right: 24px; } /* the 32px gap around the divider stays hoverable */
nav > .split::after { content: ""; position: absolute; left: 47.5px; top: 12px; width: 1px; height: 16px; background: var(--muted); opacity: 0.5; transform-origin: bottom; transition: transform 0.6s var(--spring); }
/* Tolerance: the hovered item reaches a bit past its box (and over the grown icon), so it doesn't collapse 1px off the icon */
nav > :is(:hover, :focus-visible) { z-index: 1; }
nav > :hover::before { content: ""; position: absolute; inset: -16px -4px -6px; }
/* Dock effect: everything grows from its bottom edge, so the row's baseline stays put */
nav > * > img { display: block; transform-origin: bottom; transition: transform 0.6s var(--spring); }
nav > :is(:hover, :focus-visible) > img, nav > .socials:is(.open, :has(:focus-visible)) > img { transform: translateY(-2px) scale(var(--s0)); }
nav > :is(:hover, :focus-visible) + * > img, nav > :has(+ :is(:hover, :focus-visible)) > img { transform: translateY(-1px) scale(var(--s1)); }
nav > :is(:hover, :focus-visible) + * + * > img, nav > :has(+ * + :is(:hover, :focus-visible)) > img { transform: scale(var(--s2)); }
/* Dividers grow in height with the icons beside them */
nav > .split:is(:hover, :focus-visible)::after, nav > .split:has(+ :is(:hover, :focus-visible))::after { transform: scaleY(var(--s1)); }
nav > :is(:hover, :focus-visible) + .split::after, nav > .split:has(+ * + :is(:hover, :focus-visible))::after { transform: scaleY(var(--s2)); }
nav > * > span { position: absolute; bottom: calc(100% + 14px); left: 20px; translate: -50% 4px; opacity: 0; filter: blur(4px); pointer-events: none; transition: opacity 0.3s, filter 0.3s, translate 0.6s var(--spring); }
nav > :is(:hover, :focus-visible) > span, nav > .socials:is(.open, :has(:focus-visible)) > span { opacity: 1; filter: none; translate: -50% 0; }
/* Current page: dot 4px under the icon, hidden while any icon is hovered */
nav > * > i { position: absolute; left: 18.5px; bottom: 1px; width: 3px; height: 3px; border-radius: 50%; background: var(--muted); transition: opacity 0.2s; }
nav:has(> :is(:hover, :focus-visible), > .socials :focus-visible) > * > i { opacity: 0; }
/* Socials fan (Figma 81:1477): the links spring out of the icon onto a half circle, one after another.
   .fan sits on the icon's bottom centre; each link is centred on its --x/--y offset from there. */
nav .fan { position: absolute; left: 20px; bottom: 8px; }
nav .fan::before { content: ""; position: absolute; left: -72px; bottom: 28px; width: 144px; height: 76px; pointer-events: none; } /* hover bridge between icon and links */
nav .fan a {
  position: absolute; left: var(--x); bottom: var(--y); padding: 6px; outline: none;
  translate: calc(-50% - var(--x) * 0.6) calc(50% + var(--y) * 0.6); scale: 0.4; opacity: 0; filter: blur(4px); pointer-events: none;
  transition: translate 0.6s var(--spring), scale 0.6s var(--spring), opacity 0.25s, filter 0.25s;
}
nav .socials:is(:hover, .open, :has(:focus-visible)) .fan::before { pointer-events: auto; }
nav .socials:is(:hover, .open, :has(:focus-visible)) .fan a { translate: -50% 50%; scale: 1; opacity: 1; filter: none; pointer-events: auto; transition-delay: var(--d); }
nav .fan img { display: block; transition: transform 0.6s var(--spring); }
nav .fan a:is(:hover, :focus-visible) img { transform: scale(1.2); }
/* Press: smaller while held (quick), springs back on release (the normal transition) */
nav > :active:not(:has(.fan a:active)) > img { transform: translateY(-2px) scale(calc(var(--s0) - 0.1)); transition: transform 0.12s ease-out; }
nav .fan a:active img { transform: scale(1.17); transition: transform 0.12s ease-out; }
@media (prefers-reduced-motion: reduce) { nav img, nav > .split::after, nav .fan a { transition: none; } }
/* Sound switch (Base.astro, homepage only): top right of the 520px column, centred on logo + "welcome.".
   Both icons sit in one cell; the one for the current state (data-sound from the head script) is shown, the other blurs out. Half strength, full on hover. */
.toggles { position: absolute; z-index: 1; top: 127px; right: calc(max(24px, 50% - 260px) - 4px); display: flex; gap: 4px; } /* -4px: the icon, not its padding, lines up with the column */
.toggles button { display: grid; padding: 4px; border: 0; background: none; cursor: pointer; opacity: 0.5; transition: opacity 0.2s; -webkit-tap-highlight-color: transparent; }
.toggles button:is(:hover, :focus-visible) { opacity: 1; }
.toggles img { grid-area: 1 / 1; display: block; transition: opacity 0.3s ease, filter 0.3s ease, scale 0.45s var(--spring); }
html:not([data-sound="on"]) .toggles .sound .on, html[data-sound="on"] .toggles .sound .off { opacity: 0; filter: blur(3px); scale: 0.6; }
@media (prefers-reduced-motion: reduce) { .toggles img { transition: none; } }

/* Page loader (loader.js). Hidden unless the head script set .with-loader (first load, JS on). */
.loader { display: none; }
.with-loader .loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: var(--bg);
  animation: loader-in 0.25s ease-out backwards; /* not "both": a filled animation would block the .done fade */
  transition: opacity 0.5s ease;
}
.loader.done { opacity: 0; pointer-events: none; }
@keyframes loader-in { from { opacity: 0; } }
.loader-box { display: flex; flex-direction: column; gap: 5px; }
.bars { display: flex; gap: 2px; }
.bars i { width: 2px; height: 16px; background: #dbdbdb; }
.meta {
  display: flex;
  justify-content: space-between;
  font: 400 8px/normal "Apercu Mono Pro", ui-monospace, monospace;
  color: var(--muted);
}
.num { color: var(--muted-strong); }

/* Reveal after the loader: "welcome." first, the rest 1.6s later */
.with-loader .col > *, .with-loader main > section, .with-loader nav, .with-loader .toggles { opacity: 0; }
.with-loader .hello, .with-loader nav { translate: 0 8px; transition: opacity 0.7s ease, translate 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.revealed .col > *, .revealed main > section, .revealed nav, .revealed .toggles { opacity: 1; translate: none; }
.revealed nav { transition-delay: 1.6s; } /* intro and sections get .stagger at reveal instead (index.astro) */
@media (prefers-reduced-motion: reduce) {
  .with-loader .hello, .with-loader nav { translate: none; }
}

/* 404 (Figma 124:592): fixed to the viewport (ignores the body padding), content exactly centred; centred column, 32px between the number and the text, 24px to the pill */
html:has(.notfound) { overflow: hidden; }
.notfound ~ nav, .notfound ~ .fade { display: none; } /* 404 stays clean: no dock, no bottom blur */ /* nothing to scroll on the 404 */
.notfound { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 32px; padding: 24px; text-align: center; }
.nf-code { font: 500 96px/1 "Geist Pixel", ui-monospace, monospace; color: var(--tag-bg); font-variant-numeric: lining-nums tabular-nums; }
.nf-zero { position: relative; display: inline-block; color: transparent; } /* the 0 keeps its width, Lot sits in its place */
.nf-zero mascot-eyes { position: absolute; left: 50%; top: 50%; translate: -50% -50%; }
.nf-text { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.nf-text p { max-width: 220px; line-height: 1.3; color: #000; }
.nf-text p > span { color: rgb(0 0 0 / 0.5); }
.nf-back { padding: 6px 12px; border-radius: 28px; background: var(--tag-bg); color: #000; line-height: 1.3; text-decoration: none; }

/* Chess easter egg (pages/chess.astro): dark page, no dock and no bottom blur, board fills a phone's width.
   Figma 126:1615. Pieces are one-colour masks (public/chess/*.svg, Figma 168:226–248), tinted per side. */
html:has(main.chess) { --bg: #0f0f0f; --text: #e9e9e9; --muted: #8a8b94; --tag-bg: #232323; --sq-light: #181818; --sq-dark: #282828; --pc-w: #fcfcfd; --pc-b: #4e4e4e; color-scheme: dark; }
body:has(main.chess) { padding: 24px 0; }
.chess ~ nav, .chess ~ .fade { display: none; }
main.chess { min-height: calc(100svh - 48px); justify-content: center; gap: 24px; }
.chess-board { position: relative; display: grid; grid-template-columns: repeat(8, 1fr); width: min(100vw - 32px, 560px, 100svh - 140px); border-radius: 24px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.sq { position: relative; display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 0; --sq: var(--sq-light); background: var(--sq); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sq.dark { --sq: var(--sq-dark); }
.sq.last { background: rgb(0 153 255 / 0.2); }
.sq.last.from { animation: last-off 0.5s ease 0.5s forwards; } /* the square a piece left lets go of the blue soon; the target keeps it */
@keyframes last-off { to { background: var(--sq); } }
.sq:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.sq.to::after { content: ""; position: absolute; width: 20%; aspect-ratio: 1; border-radius: 50%; background: rgb(233 233 233 / 0.25); pointer-events: none; animation: chess-pop 0.4s var(--spring); } /* Figma: 16px dot on an 80px square */
.sq.hit::after { width: 84%; background: none; border: 3px solid rgb(233 233 233 / 0.25); }
/* Figma: every piece is 56px high on an 80px square, the widest (queen) 61px; the knight's SVG is 95.33% of that height, sitting on the base line */
.pc { width: 76.15%; height: 70%; background: var(--pc-w); -webkit-mask: var(--src) center bottom / auto 100% no-repeat; mask: var(--src) center bottom / auto 100% no-repeat; pointer-events: none; transition: scale 0.4s var(--spring-soft); }
.pc[data-p$="n"] { -webkit-mask-size: auto 95.33%; mask-size: auto 95.33%; }
.pc.b { background: var(--pc-b); }
.sq.sel .pc { scale: 1.15; }
.pc.drag { position: relative; z-index: 5; scale: 1.3; transition: none; }
.chess-end { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; background: rgb(0 0 0 / 0.5); color: var(--text); font: 500 20px/1.2 Inter, sans-serif; pointer-events: none; animation: chess-fade 0.3s ease-out; }
.chess-end[hidden] { display: none; }
.chess-bar { position: relative; display: flex; justify-content: center; gap: 8px; min-width: 292px; width: min(100vw - 32px, 560px, 100svh - 140px); } /* min: three centre buttons plus × and score */
.chess-btn { display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; background: var(--tag-bg); color: var(--text); font: 500 16px/1 Inter, sans-serif; cursor: pointer; transition: scale 0.45s var(--spring); }
@media (hover: hover) { .chess-btn:not(.score):hover { scale: 1.03; } }
.chess-btn:not(.score):active { scale: 0.9; transition-duration: 0.1s; } /* press dips, release springs back */
.chess-btn.level { display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 18px; }
.chess-btn.level i { width: 4px; height: 6px; border-radius: 2px; background: var(--text); }
.chess-btn.level i:nth-child(2) { height: 11px; } .chess-btn.level i:nth-child(3) { height: 16px; }
.chess-btn.level[data-level="1"] i:nth-child(n+2), .chess-btn.level[data-level="2"] i:nth-child(3) { opacity: 0.3; }
.chess-btn.score { position: absolute; right: 0; cursor: default; color: var(--muted); }
.chess-btn.home { position: absolute; left: 0; color: var(--muted); } /* same size and stroke as the restart icon, same grey as the score opposite */
/* Bounce: every interactive animation on the page uses --spring (style.css :root) */
@keyframes chess-pop { from { scale: 0; } }
@keyframes chess-fade { from { opacity: 0; } }
/* Page intro (also after the logo transition, pages/index.astro .chess-veil): the board scales in, then the buttons one by one,
   then the pieces line up (each gets --d in chess.astro). backwards fill only, so nothing is held after its run. */
.chess-veil { position: fixed; inset: 0; background: #0f0f0f; clip-path: circle(0 at 0 0); }
@keyframes chess-board-in { from { opacity: 0; scale: 0.88; } }
@keyframes chess-piece-in { from { opacity: 0; translate: 0 -12px; scale: 0.6; } }
.chess-board { animation: chess-board-in 0.9s var(--spring) 0.15s backwards; }
/* the squares fill in as a diagonal wave from a8 (--w = column + row, chess.astro), rounding into squares as they land */
@keyframes sq-in { from { opacity: 0; scale: 0.4; border-radius: 50%; } }
.sq { animation: sq-in 0.6s var(--spring-soft) calc(0.25s + var(--w) * 35ms) backwards; }
.chess-bar > :not(.chess-tip) { animation: chess-pop 0.6s var(--spring) backwards; }
.chess-bar > :nth-child(1) { animation-delay: 1s; } .chess-bar > :nth-child(2) { animation-delay: 1.15s; }
.chess-bar > :nth-child(3) { animation-delay: 1.3s; } .chess-bar > :nth-child(4) { animation-delay: 1.45s; } .chess-bar > :nth-child(5) { animation-delay: 1.6s; }
.pc.intro { animation: chess-piece-in 0.6s var(--spring-soft) backwards; animation-delay: var(--d); }
/* Way back (chess.astro home button → index.astro): black from the first paint until the script shrinks it into the logo; no loader */
.chess-cover::after { content: ''; position: fixed; inset: 0; z-index: 20; background: #0f0f0f; }
.from-chess .loader { display: none; }
/* Difficulty pill (pages/chess.astro): .lv sits in the bar's centre group in place of the level button and springs wider when open;
   the restart button folds away meanwhile. It stops short of the × and the score (52px + 8px gap each side, centred). */
@property --f { syntax: '<number>'; inherits: true; initial-value: 0.5; } /* knob position 0..1; registered so it can spring */
.lv {
  position: relative; flex-shrink: 0; width: 52px; height: 52px; border-radius: 26px; background: var(--tag-bg); transition: width 0.6s var(--spring); }
.lv-open .lv { width: min(300px, 100% - 128px); }
/* Hover label (chess.astro showTip): one pill under the bar; it glides between buttons and morphs its width (--x, --w), springing in and out */
.chess-tip { position: absolute; top: calc(100% + 10px); left: var(--x, 50%); width: var(--w, auto); height: 28px; display: grid; place-items: center; overflow: hidden; border-radius: 14px; background: var(--tag-bg); color: var(--text); font: 500 13px/1 Inter, sans-serif; translate: -50% -4px; scale: 0.85; opacity: 0; pointer-events: none;
  transition: left 0.5s var(--spring-soft), width 0.5s var(--spring-soft), opacity 0.2s, scale 0.4s var(--spring-soft), translate 0.4s var(--spring-soft); }
.chess-tip.show { opacity: 1; scale: 1; translate: -50% 0; }
.chess-tip.jump { transition: opacity 0.2s, scale 0.4s var(--spring-soft), translate 0.4s var(--spring-soft); }
.chess-tip > span { padding: 0 12px; white-space: nowrap; }
/* Hint button: the bulb breathes while the bot looks for a move, glows yellow while the hint is shown; the target square pulses */
.chess-btn.hint { transition: scale 0.45s var(--spring), width 0.5s var(--spring), margin 0.5s var(--spring), opacity 0.2s, color 0.3s; }
.chess-btn.hint.on { color: #ffd60a; }
.chess-btn.hint.busy svg { animation: hint-think 0.9s ease-in-out infinite; }
@keyframes hint-think { 50% { opacity: 0.35; } }
.sq.hint-from { background: rgb(255 214 10 / 0.2); } /* the hinted piece's square: yellow like the target, as .last does in blue */
.sq.hint::before { content: ""; position: absolute; inset: 14%; border-radius: 50%; background: rgb(255 214 10 / 0.18); pointer-events: none; animation: hint-pulse 1.4s ease-in-out infinite; }
@keyframes hint-pulse { 0%, 100% { scale: 0.7; opacity: 0.5; } 50% { scale: 1; opacity: 1; } }
.chess-btn.restart { transition: scale 0.45s var(--spring), width 0.5s var(--spring), margin 0.5s var(--spring), opacity 0.2s; }
.lv-open .chess-btn.hint, .lv-open .chess-btn.restart { width: 0; margin-left: -8px; opacity: 0; scale: 0.5; pointer-events: none; } /* -8px: the bar's gap */
.lv > .chess-btn.level { position: absolute; inset: 0; transition: opacity 0.15s 0.1s, scale 0.45s var(--spring); }
.lv-open .lv > .chess-btn.level { opacity: 0; pointer-events: none; transition: opacity 0.1s, scale 0.45s var(--spring); }
.lv-panel { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 14px; opacity: 0; visibility: hidden; transition: opacity 0.12s, visibility 0s 0.12s; }
.lv-open .lv-panel { opacity: 1; visibility: visible; transition: opacity 0.25s 0.15s, visibility 0s; }
.lv-track { --f: 0.5; position: relative; flex: 1; min-width: 0; height: 32px; border-radius: 16px; background: rgb(255 255 255 / 0.07); touch-action: none; cursor: pointer; transition: --f var(--travel, 0.5s) var(--glide, ease-in-out); } /* --glide: spring past the stop, or bounce off the bar's end (chess.astro glide) */
.lv-track.dragging { transition: none; }
.lv-track:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
/* green → red over the whole track, shown up to the knob (the clip follows --f) */
.lv-fill { position: absolute; inset: 0; border-radius: 16px; background: linear-gradient(90deg, #30d158, #ffd60a 50%, #ff453a); clip-path: inset(0 calc((1 - clamp(0, var(--f), 1)) * (100% - 32px)) 0 0 round 16px); }
.lv-dot { position: absolute; top: 50%; left: calc(16px + var(--k) * (100% - 32px)); width: 5px; height: 5px; border-radius: 50%; background: rgb(255 255 255 / 0.45); translate: -50% -50%; }
.lv-knob { position: absolute; top: 2px; left: calc(2px + clamp(0, var(--f), 1) * (100% - 32px)); /* clamped: the overshoot never carries it out of the bar */ width: 28px; height: 28px; border-radius: 14px; background: #fcfcfd; box-shadow: 0 2px 6px rgb(0 0 0 / 0.35); transition: scale 0.5s var(--spring); }
.dragging .lv-knob { transition: scale 0.1s ease-out; }
.lv-ripple { position: absolute; inset: 0; border: 2px solid #fcfcfd; border-radius: 50%; pointer-events: none; }
main.chess { overflow-x: clip; } /* the pill's overshoot never makes the page scroll sideways */
@media (prefers-reduced-motion: reduce) { .chess *, .chess *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; } }
