/* Shared styles for every page: tokens, header, footer, starfield, reveal. */
:root {
  color-scheme: dark;
  --bg: #121417;
  --surface: #181B1F;
  --fg: #FDFDFD;
  --muted: rgba(253, 253, 253, 0.65);
  --faint: rgba(253, 253, 253, 0.42);
  --line: rgba(253, 253, 253, 0.14);
  --accent: #AEA8FE;
  --accent-2: #E3C8FF;
  --bg-rgb: 18, 20, 23;
  --star-rgb: 253, 253, 253;
  --font-serif: "Urbanist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sans: "Urbanist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 4.5vw, 72px);
}
/* light theme, switched by the header toggle (site.js) and restored before paint by the inline script in <head> */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF;
  --surface: #F5F5F5;
  --fg: #121417;
  --muted: rgba(18, 20, 23, 0.62);
  --faint: rgba(18, 20, 23, 0.4);
  --line: rgba(18, 20, 23, 0.12);
  --accent: #6D5DF5;
  --accent-2: #9B6DFF;
  --bg-rgb: 255, 255, 255;
  --star-rgb: 18, 20, 23;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 300; font-family: var(--font-serif); text-wrap: balance; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--fg); color: var(--bg); }

/* starfield */
#stars { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
html[data-theme="light"] #stars { display: none; }
/* cursor water ripples (assets/ripple.js), under the content */
#ripples { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.page { position: relative; z-index: 1; }
.wrap { max-width: 1440px; margin-inline: auto; padding-inline: var(--gutter); }

.label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* header */
header.top {
  position: sticky; top: 0; z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
  background: linear-gradient(to bottom, rgba(var(--bg-rgb), 0.92), rgba(var(--bg-rgb), 0.6) 70%, rgba(var(--bg-rgb), 0));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 72px; }
.id { display: flex; align-items: center; text-decoration: none; }
/* handwritten signature (assets/signature.png) used as a mask, so it takes the theme colour */
.logo {
  display: block; height: 44px; aspect-ratio: 633 / 250; background: var(--fg);
  -webkit-mask: url(signature.png) center / contain no-repeat; mask: url(signature.png) center / contain no-repeat;
  transition: opacity .2s;
}
.id:hover .logo { opacity: .75; }
nav.main { display: flex; align-items: center; gap: 28px; font-size: 14px; }
.theme-toggle {
  width: 38px; height: 38px; padding: 0; border-radius: 50%; cursor: pointer; flex: none;
  display: grid; place-items: center; background: transparent; color: var(--fg);
  border: 1px solid var(--line); transition: border-color .2s, color .2s;
}
.theme-toggle:hover { border-color: var(--fg); color: var(--fg); }
.theme-toggle svg { width: 18px; height: 18px; transition: transform .4s cubic-bezier(.2, .7, .2, 1); }
html[data-theme="light"] .theme-toggle svg { transform: rotate(180deg); }
nav.main a.link { text-decoration: none; color: var(--muted); transition: color .2s; }
nav.main a.link:hover { color: var(--fg); }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
  background: var(--fg); color: var(--bg); border-radius: 999px; text-decoration: none;
  font: 500 15px/1 var(--font-sans); border: 0; cursor: pointer; white-space: nowrap;
  transition: background .2s, transform .2s;
}
.pill:hover { background: color-mix(in srgb, var(--fg) 82%, var(--bg)); }
.pill svg { width: 14px; height: 14px; }
/* phones: keep Work and About visible, tighten spacing */
@media (max-width: 760px) {
  nav.main { gap: 14px; }
  .logo { height: 30px; }
  .theme-toggle { width: 34px; height: 34px; }
  nav.main .pill { height: 34px; padding: 0 14px; font-size: 14px; }
}
@media (max-width: 360px) {
  nav.main { gap: 10px; }
  .logo { height: 26px; }
  nav.main .pill { padding: 0 12px; font-size: 13px; }
}

/* sections */
section { padding-block: clamp(64px, 9vw, 140px); }
.sec-title { font-size: clamp(1.9rem, 3.5vw, 3.2rem); line-height: 1.05; letter-spacing: -0.03em; margin-bottom: clamp(32px, 4vw, 56px); }
.sec-title.center { text-align: center; }

/* footer */
footer.foot { padding-top: clamp(48px, 7vw, 96px); padding-bottom: 32px; }
.foot-cta {
  --fill-a: #5B8CFF; --fill-b: #8FB4FF; /* hover fill colours */
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px;
  margin-top: 20px; text-decoration: none;
}
.foot-title {
  font-family: var(--font-serif); font-weight: 300; line-height: 1; letter-spacing: -0.04em;
  font-size: clamp(2.6rem, 6.4vw, 5.76rem);
  /* hover: blue fill sweeps across the text from left to right with a soft, feathered edge.
     At rest the visible window is 60–100% (all text colour), on hover 0–40% (all lilac). */
  background: linear-gradient(90deg, var(--fill-a) 0%, var(--fill-b) 40%, var(--fg) 60%, var(--fg) 100%);
  background-size: 250% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  transition: background-position .7s cubic-bezier(.22, .61, .36, 1); /* starts at once, settles softly */
}
/* light theme: the pale blue would wash out on white, so the fill is a deeper shade of it */
html[data-theme="light"] .foot-cta { --fill-a: #1F5EFF; --fill-b: #3B82F6; }
.foot-cta:is(:hover, :focus-visible) .foot-title { background-position: 0 0; }
.foot-arrow {
  width: clamp(40px, 6vw, 88px); height: clamp(40px, 6vw, 88px); align-self: start;
  transition: transform .4s cubic-bezier(.22, .61, .36, 1), color .5s cubic-bezier(.22, .61, .36, 1);
}
.foot-cta:hover .foot-arrow, .foot-cta:focus-visible .foot-arrow { transform: translate(6px, -6px); color: var(--fill-a); }
.foot-mail {
  display: inline-flex; align-items: center; gap: 12px; margin-top: clamp(20px, 3vw, 32px); padding: 0;
  background: none; border: 0; color: var(--fg); font: 400 15px/1.4 var(--font-sans); cursor: copy; text-align: left;
}
.foot-mail-hint {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
  opacity: 0; transform: translateX(-4px); transition: opacity .2s, transform .2s; white-space: nowrap;
}
.foot-mail:hover .foot-mail-hint, .foot-mail:focus-visible .foot-mail-hint, .foot-mail.copied .foot-mail-hint { opacity: 1; transform: none; }
.foot-mail.copied .foot-mail-hint { color: var(--fg); border-color: var(--fg); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.foot-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px;
  margin-top: clamp(48px, 6vw, 80px); padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.foot-bottom { align-items: center; }
.foot-link { color: var(--muted); text-decoration: none; transition: color .2s; }
.foot-link:hover, .foot-link[aria-current="page"] { color: var(--fg); }

/* text links: thin underline that grows from the left on hover (same as "View case study") */
nav.main a.link, .foot-link { position: relative; padding-bottom: 3px; }
nav.main a.link::after, .foot-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
nav.main a.link:hover::after, nav.main a.link:focus-visible::after,
.foot-link:hover::after, .foot-link:focus-visible::after { transform: scaleX(1); }
nav.main a.link[aria-current="page"] { color: var(--fg); }
nav.main a.link[aria-current="page"]::after { transform: scaleX(1); }
.socials { display: flex; flex-wrap: wrap; gap: 8px; }
.socials a {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--fg); text-decoration: none; font-size: 12px;
  transition: border-color .2s, color .2s;
}
.socials a:hover { border-color: var(--fg); color: var(--fg); }
.socials svg { width: 12px; height: 12px; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
/* back to top */
.to-top {
  position: fixed; right: clamp(16px, 2.5vw, 32px); bottom: calc(clamp(16px, 2.5vw, 32px) + env(safe-area-inset-bottom, 0px)); z-index: 20;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: var(--fg);
  background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .6);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .3s, transform .3s cubic-bezier(.2, .7, .2, 1), visibility .3s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
/* wide screens: centre the button in the right margin, outside the content grid */
@media (min-width: 1200px) {
  .to-top { right: calc((max(var(--gutter), (100% - 1440px) / 2 + var(--gutter)) - 44px) / 2); }
}
.to-top > svg { grid-area: 1 / 1; }
.to-top-ring { width: 44px; height: 44px; transform: rotate(-90deg); }
.to-top-ring circle { fill: none; stroke-width: 2; }
.to-top-ring .track { stroke: var(--line); }
.to-top-ring .bar { stroke: var(--fg); stroke-linecap: round; }
.to-top-arrow { width: 16px; height: 16px; transition: transform .25s; }
.to-top:hover .to-top-arrow { transform: translateY(-2px); }

/* "View case study" link with an underline that grows on hover of its card */
.work-cta {
  position: relative; display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding-bottom: 4px;
  font-size: 15px; font-weight: 500; color: var(--fg);
}
.work-cta svg { width: 14px; height: 14px; transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.work-cta::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
:is(.work, .next):is(:hover, :focus-visible) .work-cta::after { transform: scaleX(1); }
:is(.work, .next):is(:hover, :focus-visible) .work-cta svg { transform: translateX(4px); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .foot-arrow, .foot-mail-hint { transition: none; }
  .foot-title { transition: none; }
  .to-top, .to-top-arrow { transition: none; }
  nav.main a.link::after, .foot-link::after { transition: none; }
  .work-cta svg, .work-cta::after { transition: none; }
}

/* theme switch: the new theme is revealed through four curtains (clip-path set in site.js);
   the default cross-fade is turned off so only the curtains move */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
