:root {
  --bg: #2414b8; --ink: #ffffff; --accent: #3ef2a0;
  --sans: Inter, "Helvetica Neue", Arial, sans-serif;
  --serif: Fraunces, Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; touch-action: pinch-zoom; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans);
  transition: background-color .8s ease, color .8s ease;
}

#gallery { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#edge { position: fixed; left: 0; top: 0; bottom: 0; width: 6px; z-index: 3; background: var(--accent); transition: background-color .8s ease; }
#a11y-list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#a11y-list:focus-within {
  position: fixed; top: 16px; left: 16px; z-index: 10; width: auto; height: auto; overflow: visible; clip: auto;
  padding: .75rem 1rem; background: #fff; color: #1b1b1f; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.3);
  font-size: .9rem;
}
#a11y-list ul { list-style: none; padding: 0; }
#a11y-list a { color: #1b1b1f; }
#a11y-list a:focus-visible { outline: 3px solid #2414b8; outline-offset: 2px; }

/* Header pills (same as the library) */
#hud {
  position: fixed; top: clamp(16px, 5vh, 48px); left: 50%; translate: -50% 0; z-index: 5;
  width: min(1100px, calc(100vw - 32px)); display: flex; justify-content: space-between; align-items: center; gap: 16px;
  pointer-events: none; color: #1b1b1f; font-family: var(--sans);
}
.hud-title { margin: 0; font-weight: 300; font-size: clamp(1.05rem, 2.1vw, 1.7rem); letter-spacing: -0.02em; white-space: nowrap; }
.hud-title strong { font-weight: 600; }
.hud-clock { display: flex; align-items: center; gap: .9rem; }
#clock-time { font-weight: 300; font-size: clamp(1.15rem, 2.4vw, 1.95rem); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hud-place { display: flex; flex-direction: column; white-space: nowrap; padding-left: .9rem; border-left: 1.5px solid rgba(27,27,31,.55); font-size: clamp(.68rem, .9vw, .82rem); line-height: 1.35; }
.liquid {
  position: relative; pointer-events: auto; border-radius: 999px; padding: clamp(.8rem, 1.6vw, 1.15rem) clamp(1.6rem, 3vw, 2.5rem);
  background: linear-gradient(135deg, rgba(255,255,255,.6), rgba(255,255,255,.28));
  border: 1px solid rgba(255,255,255,.85);
  backdrop-filter: blur(16px) saturate(1.7) brightness(1.04); -webkit-backdrop-filter: blur(16px) saturate(1.7) brightness(1.04);
  box-shadow: inset 0 1.5px 1px rgba(255,255,255,.95), inset 0 -2px 6px rgba(120,140,160,.18), inset 0 0 18px rgba(255,255,255,.35), 0 10px 30px rgba(30,40,60,.12);
}
.liquid::before {
  content: ""; position: absolute; left: 10%; right: 10%; top: 2px; height: 42%; border-radius: 999px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,255,255,.75), rgba(255,255,255,0));
}

/* Project text */
#project { position: fixed; left: clamp(28px, 7vw, 120px); top: 50%; translate: 0 -50%; width: min(38vw, 540px); z-index: 2; }
.logo { display: block; height: clamp(30px, 3.4vw, 46px); width: auto; margin-bottom: 1.6rem; }
.title {
  display: flex; flex-wrap: wrap; margin-bottom: 1.4rem;
  font-family: var(--serif); font-weight: 600; font-size: clamp(2.6rem, 5.2vw, 5.4rem); line-height: 1; letter-spacing: -0.025em;
  color: var(--accent); transition: color .8s ease;
}
.title.is-long { font-size: clamp(2.1rem, 3.7vw, 4rem); line-height: 1.04; }
.title .br { flex-basis: 100%; height: 0; }
.title .word { display: inline-flex; overflow: hidden; padding-bottom: .1em; margin-right: .22em; }
.title .ch { display: inline-block; will-change: transform; }
.summary { max-width: 38ch; margin-bottom: 2rem; font-size: clamp(1rem, 1.35vw, 1.2rem); line-height: 1.6; }
.open-link {
  position: relative; display: inline-flex; align-items: center; gap: .6rem; padding-bottom: 6px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: .85rem; letter-spacing: .14em; text-transform: uppercase;
}
.open-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform .35s ease, background-color .8s ease;
}
.open-link:hover::after, .open-link:focus-visible::after { transform: scaleX(1); }
.open-link span { color: var(--accent); transition: color .8s ease, translate .3s ease; }
.open-link:hover span { translate: 4px 0; }

/* Pagination dots */
#dots { position: fixed; right: clamp(16px, 3vw, 40px); top: 50%; translate: 0 -50%; z-index: 3; display: flex; flex-direction: column; gap: 14px; padding: 0; list-style: none; }
#dots button {
  position: relative; display: block; width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: color-mix(in srgb, var(--ink) 35%, transparent); transition: transform .4s ease, background-color .4s ease;
}
#dots button::before { content: ""; position: absolute; inset: -8px; }
#dots button[aria-current="true"] { background: var(--accent); transform: scale(1.5); }


/* No-WebGL fallback */
#fallback-stack { display: none; }
body.no-webgl #gallery { display: none; }
body.no-webgl #fallback-stack {
  position: fixed; right: 10vw; top: 50%; translate: 0 -50%; z-index: 1; display: flex; flex-direction: column; gap: 16px; width: 32vw;
}
body.no-webgl #fallback-stack img {
  width: 100%; aspect-ratio: 16 / 10; object-fit: contain; padding: 6%; border-radius: 4px;
  background: color-mix(in srgb, var(--bg) 18%, #fff); box-shadow: 0 20px 50px rgba(0,0,0,.25); transform: perspective(900px) rotateY(-18deg);
}

@media (max-width: 700px) {
  #project { left: 28px; top: 132px; translate: none; width: calc(100vw - 56px); }
  .hud-title { font-size: .95rem; }
  #clock-time { font-size: 1.05rem; }
  .title { font-size: clamp(2.1rem, 10vw, 3.2rem); }
  .logo { height: 28px; margin-bottom: 1rem; }
  .summary { margin-bottom: 1.2rem; font-size: .95rem; }
  #dots { right: 12px; gap: 8px; }
  #dots button { width: 6px; height: 6px; }
  .liquid { padding: .65rem 1.25rem; }
  body.no-webgl #fallback-stack { left: 28px; right: 28px; top: auto; bottom: 24px; translate: none; width: auto; align-items: center; }
  body.no-webgl #fallback-stack img:nth-child(n+2) { display: none; }
  body.no-webgl #fallback-stack img { width: auto; max-width: 100%; max-height: 28vh; }
}
@media (prefers-reduced-motion: reduce) {
  body, .title, #edge, .open-link span { transition-duration: .3s; }
}

/* Avatar logo in the top-left pill, About button on the right */
.hud-title { display: flex; align-items: center; gap: .7rem; padding-left: clamp(.6rem, 1vw, .8rem); }
.avatar { width: clamp(30px, 2.6vw, 40px); height: auto; display: block; }
.hud-right { display: flex; align-items: center; gap: 12px; }
.about-btn {
  font: 600 clamp(.85rem, 1.1vw, 1rem) var(--sans); color: #1b1b1f; cursor: pointer; text-decoration: none; display: inline-block;
  padding: clamp(.8rem, 1.6vw, 1.15rem) clamp(1.2rem, 2vw, 1.8rem);
}
.about-btn:hover, .about-btn:focus-visible { background: linear-gradient(135deg, rgba(255,255,255,.85), rgba(255,255,255,.5)); }

@media (max-width: 700px) {
  .about-btn { padding: .65rem 1rem; }
}

/* Header: logo + signature on the left edge of the project text, About on the right edge (by the dots) */
#hud {
  left: 0; right: 0; translate: none; width: auto;
  padding-left: clamp(28px, 7vw, 120px); padding-right: clamp(16px, 3vw, 40px);
}
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--ink); pointer-events: auto; transition: color .8s ease; }
.brand .avatar { width: clamp(40px, 3.4vw, 52px); }
.signature { display: flex; flex-direction: column; font-family: var(--serif); font-weight: 600; line-height: 1.02; font-size: clamp(.82rem, 1vw, .98rem); }
.signature em { font-style: italic; }
.sig-name { position: relative; color: var(--accent); font-size: 1.25em; transition: color .8s ease; }
.sig-name svg { position: absolute; left: 4%; top: 100%; width: 92%; height: .55em; overflow: visible; }
.sig-name path { fill: none; stroke: #62c4cc; stroke-width: 3.2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
@media (max-width: 700px) {
  #hud { padding-left: 28px; padding-right: 12px; }
}

/* Footer: slides up after the last project (turquoise, as on the About page) */
.site-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; color: #fff; background: #29c5c9;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 2rem 4rem;
  padding: clamp(2.5rem, 7vh, 5rem) clamp(28px, 7vw, 120px); border-radius: 28px 28px 0 0;
  box-shadow: 0 -20px 60px rgba(0,0,0,.18); transform: translateY(105%); transition: transform .9s cubic-bezier(.65,0,.35,1);
  font-family: var(--sans);
}
body.footer-open .site-footer { transform: none; }
.sf-title { font: 600 clamp(2.8rem, 6vw, 5.5rem)/1 var(--serif); letter-spacing: -0.02em; margin-bottom: 1.4rem; }
.sf-title em { display: block; }
.sf-about { display: inline-flex; gap: .5rem; padding: .7rem 1.2rem; border-radius: 999px; background: #fff; color: #9b34d8; text-decoration: none; font-weight: 600; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; transition: background .2s; }
.sf-links { display: grid; gap: 1.4rem; justify-items: start; padding-left: clamp(1.5rem, 4vw, 4rem); border-left: 4px solid #fff; }
.sf-email { display: inline-flex; align-items: center; gap: 1rem; color: #fff; text-decoration: none; font: 600 clamp(1.05rem, 1.6vw, 1.35rem) var(--serif); }
.sf-email:hover, .sf-email:focus-visible { text-decoration: underline; text-underline-offset: 5px; }
.sf-email svg { width: 28px; height: 28px; flex: none; }
.sf-socials { list-style: none; padding: 0; display: flex; gap: 14px; }
.sf-socials a { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: #fff; color: #29c5c9; transition: transform .25s, background .2s, color .2s; }
.sf-socials svg { width: 24px; height: 24px; }
.sf-about:hover, .sf-about:focus-visible, .sf-socials a:hover, .sf-socials a:focus-visible { background: #f1e3fd; }
.sf-socials a:hover, .sf-socials a:focus-visible { color: #9b34d8; }
.sf-socials a:hover { transform: translateY(-3px); }
@media (max-width: 700px) {
  .site-footer { grid-template-columns: 1fr; }
  .sf-links { padding-left: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) { .site-footer { transition-duration: .2s; } }

/* Hand-drawn arrow after "Let's", as on jexyla.com */
.doodle { display: inline-block; width: 1.7em; height: auto; margin-left: .2em; vertical-align: -.12em; overflow: visible; }
.doodle path { fill: none; stroke: #fff; stroke-width: 28; stroke-linecap: round; stroke-linejoin: round; }

/* Other projects: a purple sheet (the collage's #d646ff) that slides up after the last case study */
.others {
  position: fixed; inset: 0; z-index: 4; color: #fff; background: #d646ff;
  display: flex; flex-direction: column; gap: clamp(14px, 3vh, 30px);
  padding: clamp(96px, 14vh, 130px) clamp(24px, 6vw, 110px) clamp(22px, 4.5vh, 48px);
  transform: translateY(100%); transition: transform .9s cubic-bezier(.65,0,.35,1);
}
body.others-open .others { transform: none; }
.o-title { margin: 0; font: 600 clamp(2.2rem, 4.2vw, 5rem)/.95 var(--serif); letter-spacing: -0.02em; white-space: nowrap; }
.o-arrow { display: inline-block; width: 1.25em; height: auto; margin-left: .1em; vertical-align: .05em; overflow: visible; }
.o-arrow path { fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
/* The bento grid takes the shape of its pictures. Three columns, two pictures stacked in each. A tile's height is
   its picture's height at the column's width (--g = height / width), so nothing is cropped, and the whole grid keeps
   one overall proportion (--ar) that scales to fit the screen's width or height. */
.o-stage { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; }
.o-grid {
  --gap: clamp(10px, 1.5vw, 22px); --ar: 2.13;
  width: min(100cqw, calc(100cqh * var(--ar))); aspect-ratio: var(--ar);
  display: grid; grid-template-columns: .706fr .805fr .617fr; gap: var(--gap);
}
.o-col { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; min-width: 0; }
.o-tile { flex: var(--g) 1 0; margin: 0; min-height: 0; overflow: hidden; border-radius: clamp(12px, 1.4vw, 24px); background: #fff; box-shadow: 0 18px 40px rgba(80, 0, 110, .18); }
.o-tile img, .o-tile video { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.o-tile:hover img, .o-tile:hover video { transform: scale(1.04); }
/* Tiles rise in one after another as the sheet opens */
.o-title, .o-tile { opacity: 0; translate: 0 40px; transition: opacity .6s ease, translate .8s cubic-bezier(.2,.7,.2,1); }
body.others-open .o-title, body.others-open .o-tile { opacity: 1; translate: none; }
body.others-open .o-title { transition-delay: .35s; }
body.others-open .o-gousto { transition-delay: .45s; }
body.others-open .o-carwow { transition-delay: .5s; }
body.others-open .o-monzo { transition-delay: .55s; }
body.others-open .o-box { transition-delay: .6s; }
body.others-open .o-type { transition-delay: .65s; }
body.others-open .o-banking { transition-delay: .7s; }
/* Header reads white on the purple sheet */
body.others-open .brand, body.others-open .sig-name { color: #fff; }
@media (max-width: 700px) {
  .others { padding: 96px 18px 24px; overflow-y: auto; }
  .o-title { font-size: 2.4rem; }
  .o-stage { container-type: normal; display: block; flex: none; }
  .o-grid { width: 100%; aspect-ratio: auto; grid-template-columns: 1fr; }
  .o-col { display: contents; }
  .o-tile { flex: none; aspect-ratio: calc(1 / var(--g)); }
}
@media (prefers-reduced-motion: reduce) {
  .others { transition-duration: .2s; }
  .o-title, .o-tile { translate: none; transition: opacity .2s; transition-delay: 0s !important; }
}

/* A project without a case study yet hides its "Open case study" link */
.open-link[hidden] { display: none; }

/* Password dialog for locked case studies */
.lock-dialog {
  width: min(440px, calc(100vw - 32px)); margin: auto; padding: 44px 36px 32px; border: 0; border-radius: 28px; text-align: center;   /* margin: auto centres the modal (the global reset removes it) */
  background: #fff; color: #1b1b1f; box-shadow: 0 40px 100px rgba(30, 20, 60, .35); font-family: var(--sans);
}
.lock-dialog::backdrop { background: rgba(27, 20, 50, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lock-dialog[open] { animation: lock-in .35s cubic-bezier(.2,.8,.2,1); }
@keyframes lock-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.lock-close {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: #f1eefb; color: #1b1b1f; font-size: 1.4rem; line-height: 1; cursor: pointer; transition: background .2s;
}
.lock-close:hover, .lock-close:focus-visible { background: #e3daf7; }
.lock-logo { height: 28px; width: auto; margin: 0 auto 1.2rem; display: block; }
.lock-dialog h2 { font: 600 2rem/1.1 var(--serif); letter-spacing: -0.02em; margin: 0 0 .6rem; }
.lock-dialog p { margin: 0 0 1.4rem; line-height: 1.55; color: rgba(27,27,31,.68); }
.lock-dialog-form { display: flex; gap: 10px; }
.lock-dialog-form input {
  flex: 1; min-width: 0; padding: .9rem 1.2rem; border-radius: 999px; border: 2px solid rgba(106,63,216,.35); font: 400 1rem var(--sans);
}
.lock-dialog-form input:focus { outline: none; border-color: #6a3fd8; box-shadow: 0 0 0 4px rgba(106,63,216,.15); }
.lock-dialog-form button {
  padding: .9rem 1.4rem; border: 0; border-radius: 999px; background: #6a3fd8; color: #fff; font: 600 1rem var(--sans); cursor: pointer;
  transition: transform .2s, background .2s;
}
.lock-dialog-form button:hover, .lock-dialog-form button:focus-visible { transform: translateY(-2px); background: #5531b8; }
.lock-dialog-form button[disabled] { opacity: .6; cursor: progress; transform: none; }
.lock-dialog .lock-dialog-error { min-height: 1.4em; margin: .9rem 0 0; color: #c0262d; font-weight: 600; font-size: .95rem; }
.lock-dialog-form.shake { animation: lock-shake .4s; }
@keyframes lock-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
