/* Homepage: curved case study slider. Loaded only on the front page and /for/company/ pages.
   Everything is prefixed hs- (and colours --hs-*) so it can't collide with portfolio.css, whose
   --ink drives the company popups and games. */

body.hs-home {
  --hs-card-ratio: 1; /* width ÷ height: 1 = square, 0.8 = 4:5 portrait */
  --hs-card-w: calc(.85 * min(48vw, 640px, calc((100svh - 380px) * var(--hs-card-ratio)))); /* never taller than the space above the headline */
  --hs-gap: 1vw;
  --hs-curve: 10deg; /* how much each card turns away from the one before it; 0 = flat */
  --hs-ease: cubic-bezier(.2, .7, .1, 1);
  height: 100%;
  overflow: hidden;
  color: var(--hs-ink);
  background: var(--hs-bg);
  transition: background-color .9s var(--hs-ease), color .9s var(--hs-ease);
  -webkit-font-smoothing: antialiased;
}
/* The company headline takes more room than the counter, so leave a little more space above the title */
body.hs-home.is-personalised { --hs-card-w: calc(.85 * min(48vw, 640px, calc((100svh - 450px) * var(--hs-card-ratio)))); }

.hs-brand {
  position: fixed; top: 32px; left: 48px; z-index: 20;
  font: 600 13px/1 "Poppins", sans-serif; letter-spacing: .14em; text-transform: uppercase;
  color: var(--hs-ink);
  transition: color .9s var(--hs-ease), opacity .2s;
}
.hs-brand:hover { opacity: .7; }

/* Stage + track */
.hs-stage {
  position: relative; height: 100svh; height: 100dvh; overflow: hidden;
  display: grid; grid-template-rows: 1fr auto; grid-template-columns: minmax(0, 1fr);
  padding-top: 84px;
  perspective: 1400px; /* gives the curve its depth */
  user-select: none; -webkit-user-select: none;
}
.hs-rail {
  align-self: center;
  display: flex; flex-direction: column; gap: 28px;
  transform-style: preserve-3d; /* pass the stage's perspective through to the cards */
}

/* "Case Studies 01 / 05" */
.hs-counter {
  display: flex; justify-content: center; align-items: baseline; gap: .55em;
  margin: 0;
  font: 500 13.8px/1.3 "Poppins", sans-serif; letter-spacing: .16em; text-transform: uppercase;
  color: var(--hs-ink); font-variant-numeric: tabular-nums;
  transition: color .9s var(--hs-ease);
}
.hs-counter__label { opacity: .7; }
.hs-counter__num { display: inline-flex; }
.hs-counter__num .hs-digit { display: inline-grid; overflow: hidden; } /* clips the rolling digits */
.hs-counter__num .hs-digit > span { grid-area: 1 / 1; }
.hs-counter__total { opacity: .5; }

/* Personalised headline ("Jay x Hudl. This could be good.") in place of the counter */
.hs-company {
  width: auto; max-width: none; margin: 0; padding: 0 24px;
  font-size: clamp(24px, 2.6vw, 40px); line-height: 1.05; letter-spacing: -.045em;
  text-align: center; color: var(--hs-ink);
  transition: color .9s var(--hs-ease);
}

.hs-track {
  position: relative;
  display: flex; gap: var(--hs-gap);
  padding-left: calc(50vw - var(--hs-card-w) / 2);
  cursor: grab; will-change: transform;
  transform-style: preserve-3d;
  touch-action: pan-y;
}
.hs-track.is-dragging { cursor: grabbing; }

.hs-card {
  position: relative;
  flex: 0 0 var(--hs-card-w);
  aspect-ratio: var(--hs-card-ratio);
  overflow: hidden; border-radius: 6px;
  background: rgba(0, 0, 0, .15);
  transform: scale(.86);
  transition: transform .8s var(--hs-ease);
}
.hs-card.is-active { transform: scale(1); }
.hs-card:focus-visible { outline: 3px solid var(--hs-ink); outline-offset: 4px; }
.hs-card img, .hs-card object {
  display: block; width: 100%; height: 100%;
  object-fit: contain; pointer-events: none;
}

/* Title block */
.hs-meta { text-align: center; padding: 0 24px 5vh; }
.hs-kicker {
  margin: 0 0 18px;
  font: 500 13.8px/1 "Poppins", sans-serif; letter-spacing: .16em; text-transform: uppercase;
  color: var(--hs-fg); opacity: .8;
  transition: color .9s var(--hs-ease);
}
.hs-title {
  width: auto; max-width: none; margin: 0;
  font-family: "Poppins", sans-serif; font-weight: 600;
  font-size: clamp(42px, 8.25vw, 126px); line-height: .95; letter-spacing: -.055em;
  color: var(--hs-fg); white-space: nowrap;
  transition: color .9s var(--hs-ease);
}
.hs-title .hs-ch {
  display: inline-block;
  transform: translateY(40%); opacity: 0;
  animation: hs-rise .7s var(--hs-ease) forwards;
}
@keyframes hs-rise { to { transform: none; opacity: 1; } }

.hs-cta {
  display: inline-block; margin-top: 22px; padding-bottom: 4px;
  font: 500 14px/1 "Poppins", sans-serif;
  color: var(--hs-ink); border-bottom: 1px solid currentColor;
  transition: color .9s var(--hs-ease);
}
.hs-cta span { display: inline-block; transition: transform .3s var(--hs-ease); }
.hs-cta:hover span { transform: translateX(4px); }

@media (max-width: 720px) {
  body.hs-home, body.hs-home.is-personalised { --hs-card-w: 66.3vw; --hs-gap: 2.5vw; }
  .hs-brand { top: 22px; left: 16px; }
  .hs-meta { padding-bottom: 12vh; }
  body.is-personalised .hs-meta { padding-bottom: calc(12vh + 90px); } /* keep the link clear of the brand object in the corner */
  .hs-title { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  body.hs-home, .hs-stage *, .hs-brand { transition-duration: .01s !important; animation-duration: .01s !important; }
}
