/* 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'); }

:root {
  --bg: #fcfcfd;
  --text: #47484f;
  --muted: #9697a1;
  --muted-strong: #6b6c75;
}

* { margin: 0; box-sizing: border-box; }

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.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: 1.3em; overflow: hidden; transition: width 460ms var(--ui-tl-ease); }
.ui-tl__label { position: absolute; top: 0; 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: 100px; }
.sign img { display: block; }
.clock { display: flex; gap: 33px; font: 400 10px/normal "Apercu Mono Pro", ui-monospace, monospace; color: var(--muted); }

/* Collapsible sections (folds.js): "+ LABEL" toggles the body; items blur in/out staggered */
.fold { display: flex; flex-direction: column; }
.work { width: min(622px, 100% - 48px); }
.fold.jobs { width: min(520px, 100% - 48px); }
.fold-toggle {
  display: flex;
  align-items: center;
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: 400 12px/1.4 "Apercu Mono Pro", ui-monospace, monospace;
  color: var(--muted);
  margin-left: calc((100% - min(520px, 100%)) / 2); /* label lines up with the 520px text column, also in the wider work grid */
}
/* Icon: two 7px bars. Closed = plus; open = both bars turned flat = minus */
.fold-icon { position: relative; width: 1ch; height: 1ch; margin-right: 1ch; }
.fold-icon::before, .fold-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 1px;
  background: currentColor;
  translate: -50% -50%;
  transition: rotate 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}
.fold-icon::after { rotate: 90deg; }
[aria-expanded="true"] > .fold-icon::before,
[aria-expanded="true"] > .fold-icon::after { rotate: 180deg; }

/* Height via 1fr ↔ 0fr, so no JS measuring. Closing: items leave first, then the height follows. */
.fold-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.6s cubic-bezier(0.65, 0, 0.35, 1); }
.fold.closed .fold-body { grid-template-rows: 0fr; transition-delay: 0.2s; }
.fold-inner { min-height: 0; overflow: hidden; }
.fold-inner > * { padding-top: 16px; } /* label gap, inside the clip so it collapses too */
.fold-item {
  transition: opacity 0.5s ease, filter 0.5s ease, translate 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--i, 0) * 70ms + 150ms);
}
.fold.closed .fold-item {
  opacity: 0;
  filter: blur(8px);
  translate: 0 10px;
  transition-duration: 0.35s;
  transition-timing-function: ease-in;
  transition-delay: calc((var(--n, 1) - 1 - var(--i, 0)) * 40ms);
}
@media (prefers-reduced-motion: reduce) {
  .fold.closed .fold-item { filter: none; translate: none; }
}

/* 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; }
.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; }
@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; }
.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 (147px) 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; position: relative; }
.logo span { position: absolute; }
.logo img { display: block; width: 100%; height: 100%; }
/* 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; } }
}

/* Jobs */
.job-list { display: flex; flex-direction: column; gap: 26px; }
.divider { display: block; width: 100%; height: 1px; }
.job { display: flex; flex-direction: column; gap: 12px; line-height: 1.4; }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 16px; }
.job-title { display: flex; gap: 16px; align-items: center; }
.job-title h3 { font: inherit; }
.job-role { color: var(--muted-strong); }
.job-date { font: 400 12px/1.4 "Apercu Mono Pro", ui-monospace, monospace; white-space: nowrap; }
.job p, .job a { color: var(--muted); }
.job p { font-weight: 300; }
.job a { align-self: flex-start; text-decoration: none; }

/* 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-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) */
/* Side notes (Figma 68:1130): handwritten note in the right margin with a bracket over the marked text / image */
.sn-note { font: 13px/1 "Just Me Again Down Here", cursive; color: var(--muted-strong); text-align: center; text-indent: 0; hyphens: none; }
.sn-bracket { display: none; }
@media (min-width: 900px) {
  .case > p, .case > ul, .case-media { position: relative; }
  .sn-note { position: absolute; left: calc(100% + 61px); width: 9px; height: 1.4em; } /* no top: stays on the line where the marked text starts */
  .case-media > .sn-note { top: 0; bottom: 0; height: auto; }
  .case-media:has(figcaption) > .sn-note { bottom: 33px; } /* image only, not the caption tag */
  .sn-bracket { display: block; width: 100%; height: 100%; }
  .sn-text { position: absolute; top: 50%; left: 14px; translate: 0 -50%; width: max-content; max-width: 120px; white-space: pre-line; } /* Figma: starts just right of the bracket, lines centred */
}
@media (max-width: 899px) {
  .sn .sn-note { margin: 0 6px; } /* no margin to sit in: the note sits inline before the marked text */
  .case-media > .sn-note { display: block; margin-top: 8px; }
}
.case a, .legal a, .contact a, .bubble a { color: var(--link); }
:is(.case, .legal, .contact, .bubble, .job, .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); }
.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-code { padding: 16px 24px; border-radius: 12px; background: #ececec; color: var(--muted-strong); font: 400 13px/1.6 "Apercu Mono Pro", 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 */
.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%; }
.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; }
.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 + 100ms) backwards; }
@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 */
  --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 */
}
/* 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: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: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, :has(:focus-visible)) .fan::before { pointer-events: auto; }
nav .socials:is(:hover, :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; } }

/* 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 {
  opacity: 0;
  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 { opacity: 1; translate: none; }
.revealed .intro, .revealed main > section, .revealed nav { transition-delay: 1.6s; }
@media (prefers-reduced-motion: reduce) {
  .with-loader .col > *, .with-loader main > section, .with-loader nav { translate: none; }
}
