/* ---------- Fonts ---------- */
@font-face {
  font-family: "Eloquia";
  src: url("/fonts/EloquiaDisplay-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Eloquia";
  src: url("/fonts/EloquiaDisplay-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
/* Pill fonts are subset to caps + digits (a few KB each).
   Archivo Narrow only loads on devices without Arial Narrow (phones, mostly). */
@font-face {
  font-family: "Archivo Narrow";
  src: url("/fonts/ArchivoNarrow-caps.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "PP Pangram Sans Rounded Compressed";
  src: url("/fonts/PPPangramSansRounded-CompressedExtrabold-caps.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --sky: #409ae4;          /* shown until the clouds image paints */
  --paper: #ffffff;
  --grey: #c9c9c9;         /* pill text */
  --grey-hover: #8f8f8f;

  --blue: #02bbff;         /* exit pill */
  --blue-light: #a8e6ff;
  --blue-deep: #0096d6;

  --font: "Eloquia", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-pill: "Arial Narrow", "Archivo Narrow", "Helvetica Neue Condensed", Arial, sans-serif;
  --font-exit: "PP Pangram Sans Rounded Compressed", "Arial Rounded MT Bold", "Eloquia", sans-serif;

  --fs-display: clamp(2.75rem, 8vw, 7rem);      /* wordmark */
  --fs-md: clamp(1rem, 0.9rem + 0.5vw, 1.25rem); /* footer */
  --pill-h: clamp(3rem, 1.6rem + 3.6vw, 5rem);
  --gutter: clamp(1.25rem, 3.5vw, 3rem);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--sky); }

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: var(--font);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Sky ----------
   Fixed layer instead of background-attachment: fixed (which is janky on iOS).
   The clouds are pre-blurred at high resolution (up to 3840 wide) with a fine grain so the
   soft gradients stay smooth on retina screens. AVIF first, WebP fallback.

   Drift: two copies of the same photo slide slowly to the right, half a cycle apart.
   The top copy fades in and out so that each copy only ever jumps back to its start
   while it is hidden. The result is an endless one-way drift with no seam, and while
   the copies overlap the clouds appear to gently change shape. Only transform and
   opacity animate, so it runs on the GPU. */
.sky {
  --sky-t: 50s;                     /* one full cycle */
  --drift: max(20vw, 258px);        /* distance travelled per cycle (0.4vw/s) */
  position: fixed; inset: 0; z-index: -1;
  overflow: hidden;
  background: var(--sky);
}
.sky__layer {
  position: absolute;
  top: 0; bottom: 0; right: 0;
  left: calc(var(--drift) * -1);    /* oversized to the left so the slide never shows an edge */
  background: center / cover no-repeat;
  animation: sky-drift var(--sky-t) linear infinite;
  will-change: transform;
}
.sky__layer--b {
  animation: sky-drift var(--sky-t) linear infinite, sky-fade var(--sky-t) ease-in-out infinite;
  animation-delay: calc(var(--sky-t) / -2), 0s;
  will-change: transform, opacity;
}
/* Background switch: <html data-bg="meadow"> or <html data-bg="clouds"> in index.html.
   Both photos get the same treatment (blur, fine grain, AVIF + WebP at 1280/2560/3840) and the
   same drift. Add ?bg=clouds or ?bg=meadow to the URL to preview the other one without deploying. */
html[data-bg="meadow"] .sky__layer {
  background-image: url("/images/meadow-blur-2560.webp");
  background-image: image-set(
      url("/images/meadow-blur-1280.avif") type("image/avif") 1x, url("/images/meadow-blur-2560.avif") type("image/avif") 2x,
      url("/images/meadow-blur-1280.webp") type("image/webp") 1x, url("/images/meadow-blur-2560.webp") type("image/webp") 2x);
}
@media (min-width: 701px) {
  html[data-bg="meadow"] .sky__layer {
    background-image: image-set(
      url("/images/meadow-blur-2560.avif") type("image/avif") 1x, url("/images/meadow-blur-3840.avif") type("image/avif") 2x,
      url("/images/meadow-blur-2560.webp") type("image/webp") 1x, url("/images/meadow-blur-3840.webp") type("image/webp") 2x);
  }
}
html[data-bg="clouds"] .sky__layer {
  background-image: url("/images/clouds-blur-v2-2560.webp");
  background-image: image-set(
      url("/images/clouds-blur-v2-1280.avif") type("image/avif") 1x, url("/images/clouds-blur-v2-2560.avif") type("image/avif") 2x,
      url("/images/clouds-blur-v2-1280.webp") type("image/webp") 1x, url("/images/clouds-blur-v2-2560.webp") type("image/webp") 2x);
}
@media (min-width: 701px) {
  html[data-bg="clouds"] .sky__layer {
    background-image: image-set(
      url("/images/clouds-blur-v2-2560.avif") type("image/avif") 1x, url("/images/clouds-blur-v2-3840.avif") type("image/avif") 2x,
      url("/images/clouds-blur-v2-2560.webp") type("image/webp") 1x, url("/images/clouds-blur-v2-3840.webp") type("image/webp") 2x);
  }
}
@keyframes sky-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(var(--drift), 0, 0); }
}
/* Top copy is solid while the bottom copy resets (0%/100%) and invisible while it resets itself (50%) */
@keyframes sky-fade {
  0%, 8%    { opacity: 1; }
  42%, 58%  { opacity: 0; }
  92%, 100% { opacity: 1; }
}
/* A little blue at the foot so the white © stays legible over cloud */
.sky::after {
  content: ""; position: absolute; z-index: 1; inset: auto 0 0 0; height: 22%;
  background: linear-gradient(to top, rgba(48, 140, 228, 0.6), rgba(48, 140, 228, 0));
}
html[data-bg="meadow"] .sky::after { /* green at the foot instead of blue, so the footer sits on grass */
  background: linear-gradient(to top, rgba(40, 110, 10, 0.5), rgba(40, 110, 10, 0));
}

/* ---------- Wordmark ---------- */
.top { padding: calc(var(--gutter) * 0.8) var(--gutter) 0; text-align: center; }

.wordmark {
  display: inline-block;
  font-size: var(--fs-display);
  font-weight: 900;
  line-height: 0.85;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  white-space: nowrap;
}
.wordmark__mark {
  font-size: 0.28em;
  font-weight: 400;
  line-height: 1;
  vertical-align: top;
  position: relative;
  top: -0.1em;
  margin-left: 0.15em;
  margin-right: -1em; /* keep BEAUTIFUL itself optically centred */
}

/* ---------- Pills ---------- */
.portfolio {
  display: grid;
  place-items: center;
  padding: calc(var(--gutter) * 1.5) var(--gutter);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0; /* pills touch on every side, as in the reference */
  /* One shadow for the whole cluster, so touching pills don't shade each other;
     keeps white pills readable over white cloud */
  filter: drop-shadow(0 1px 4px rgba(20, 90, 170, 0.16));
  max-width: calc(var(--pill-h) * 17);
}

.pill {
  display: inline-flex;
  align-items: center;
  height: var(--pill-h);
  padding: 0 calc(var(--pill-h) * 0.3);
  border-radius: calc(var(--pill-h) * 0.27);
  background: var(--paper);
  color: var(--grey);
  font-family: var(--font-pill);
  font-size: calc(var(--pill-h) * 0.7);
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  transition: transform 140ms ease, color 140ms ease, filter 140ms ease;
}

/* Exited companies: glossy blue tube */
.pill--exit {
  padding: calc(var(--pill-h) * 0.07) calc(var(--pill-h) * 0.42) 0; /* top nudge: this font sits high */
  border-radius: 999px;
  background: linear-gradient(180deg, var(--blue-light) 0%, #4dcfff 12%, var(--blue) 30%, var(--blue) 62%, var(--blue-deep) 100%);
  box-shadow:
    inset 0 calc(var(--pill-h) * 0.05) calc(var(--pill-h) * 0.05) rgba(255, 255, 255, 0.55),
    inset 0 calc(var(--pill-h) * -0.07) calc(var(--pill-h) * 0.09) rgba(0, 95, 160, 0.45);
  color: var(--blue-light);
  font-family: var(--font-exit);
  font-weight: 800;
  font-size: calc(var(--pill-h) * 0.78);
  letter-spacing: -0.01em;
}

/* Hover effects only where there is a real pointer: on touch screens :hover sticks after a tap */
@media (hover: hover) and (pointer: fine) {
  a.pill:hover { z-index: 1; transform: translateY(-0.06em) scale(1.03); color: var(--grey-hover); }
  a.pill--exit:hover { color: var(--paper); filter: brightness(1.07) saturate(1.1); }
}

/* Closed companies (shut down / ceased operations): faded pill, no hover effect */
.pill--closed { opacity: 0.5; }
@media (hover: hover) and (pointer: fine) {
  a.pill--closed:hover { transform: none; color: var(--grey); }
}

/* Exit pills: the name is swapped for a looping EXIT EXIT EXIT marquee.
   Desktop: on hover. Touch screens: a small script in index.html adds .is-exiting to all the
   blue pills together for 3 seconds at a time, with a soft crossfade.
   The label stays in the layout (just transparent) so the pill keeps its width. */
.pill--exit { overflow: hidden; }
.pill__marquee {
  position: absolute; inset: 0;
  display: flex;
  align-items: center;
  padding-top: calc(var(--pill-h) * 0.07); /* same nudge as the label */
  color: var(--paper);
  opacity: 0;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent);
}
.pill__track {
  display: flex;
  flex: none;
  white-space: pre;
  animation: exit-marquee 2.4s linear infinite paused;
}
.pill__track > span { flex: none; } /* each half ends in one space, so the loop seam is a single space too */
@keyframes exit-marquee { to { transform: translateX(-50%); } }

.pill--exit:focus-visible .pill__label,
.pill--exit.is-exiting .pill__label { opacity: 0; }
.pill--exit:focus-visible .pill__marquee,
.pill--exit.is-exiting .pill__marquee { opacity: 1; }
.pill--exit:focus-visible .pill__track,
.pill--exit.is-exiting .pill__track { animation-play-state: running; }
/* the scheduled swap on touch screens fades; the desktop hover swap stays instant */
.pill--exit.is-exiting .pill__label,
.pill--exit.is-exiting .pill__marquee,
.pill--exit.was-exiting .pill__label,
.pill--exit.was-exiting .pill__marquee { transition: opacity 400ms ease; }
.pill--exit.was-exiting .pill__track { animation-play-state: running; } /* keep scrolling while it fades out */

/* Hover only where a real pointer exists, so taps on phones go straight to the link */
@media (hover: hover) and (pointer: fine) {
  .pill--exit:hover .pill__label { opacity: 0; }
  .pill--exit:hover .pill__marquee { opacity: 1; }
  .pill--exit:hover .pill__track { animation-play-state: running; }
}
a.pill:active { transform: scale(0.98); }
a.pill:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }

/* ---------- Footer ---------- */
.footer {
  padding: 0 var(--gutter) calc(var(--gutter) * 0.8);
  text-align: center;
  font-size: var(--fs-md);
}

.footer__tagline { margin-left: 0.5em; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .pill { transition: none; }
  .pill__track { animation: none; }
  .sky__layer { animation: none; }
  .sky__layer--b { display: none; }
}
