/* hueman.in landing page. One screen, no scrolling. Dark is the default theme. */

:root {
  --ink: #17171C;
  --paper: #F4F2EE;

  color-scheme: dark;
  --coral: #FF7A5C;
  --teal: #2EC4A6;
  --bg: var(--ink);
  --fg: var(--paper);
  --sub: #B7B5B0;
  --rule: rgba(244, 242, 238, .18);
  --leg: var(--paper);
  --leg-fg: var(--ink);
  --leg-sub: rgba(23, 23, 28, .7);
  --wash-a: rgba(255, 122, 92, .17);
  --wash-a0: rgba(255, 122, 92, 0);
  --wash-b: rgba(46, 196, 166, .16);
  --wash-b0: rgba(46, 196, 166, 0);

  --pad: clamp(16px, 2.6vw, 40px);
  --gap: clamp(20px, 3vw, 52px);

  --display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --out: cubic-bezier(.16, 1, .3, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --coral: #F0573A;
  --teal: #14A88C;
  --bg: var(--paper);
  --fg: var(--ink);
  --sub: #4F4F59;
  --rule: rgba(23, 23, 28, .16);
  --leg: var(--ink);
  --leg-fg: var(--paper);
  --leg-sub: rgba(244, 242, 238, .72);
  --wash-a: rgba(240, 87, 58, .2);
  --wash-a0: rgba(240, 87, 58, 0);
  --wash-b: rgba(20, 168, 140, .2);
  --wash-b0: rgba(20, 168, 140, 0);
}

/* The theme change is drawn as a circle opening from the toggle (see main.js) */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--display);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Two slow washes of the logo's colours behind everything */
body::before, body::after {
  content: "";
  position: fixed;
  z-index: 0;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
}
body::before {
  right: -24vmax;
  top: -30vmax;
  background: radial-gradient(closest-side, var(--wash-a), var(--wash-a0));
  animation: drift-a 22s ease-in-out infinite alternate;
}
body::after {
  left: -26vmax;
  bottom: -34vmax;
  background: radial-gradient(closest-side, var(--wash-b), var(--wash-b0));
  animation: drift-b 26s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate(-16vmax, 12vmax) scale(1.15); } }
@keyframes drift-b { to { transform: translate(18vmax, -10vmax) scale(.92); } }

#field { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }

.defs { position: absolute; }

a { color: inherit; text-decoration: none; }

.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */

.stage {
  --col: calc((100vw - 2 * var(--pad) - var(--gap)) * .49);
  position: relative;
  z-index: 1;
  height: 100%;
  padding: var(--pad);
  padding-bottom: max(var(--pad), env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 49fr) minmax(0, 51fr);
  gap: var(--gap);
}

.pitch {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(10px, 2dvh, 24px);
}

.pitch__body {
  align-self: center;
  display: grid;
  gap: clamp(12px, 3.2dvh, 34px);
}

/* ---------- Top bar: logo and theme toggle ---------- */

.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* The toggle is the logo's two eyes: the wink for dark, the open eye for light */
.theme {
  position: relative;
  flex: none;
  width: 56px;
  height: 32px;
  padding: 0;
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  background: none;
  color: inherit;
  cursor: pointer;
  transition: border-color .25s, transform .3s var(--spring);
  animation: fade-up .9s var(--out) .62s both;
}
.theme[hidden] { display: none; }
.theme__thumb {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  transition: transform .5s var(--spring);
}
:root[data-theme="light"] .theme__thumb { transform: translateX(23px); }
.theme svg { display: block; width: 100%; height: 100%; overflow: visible; }
.t-dot { fill: var(--coral); transform-box: fill-box; transform-origin: center; transform: scale(0); transition: transform .4s var(--spring); }
.t-arc { fill: none; stroke: var(--teal); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 26; transition: stroke-dashoffset .35s ease; }
:root[data-theme="light"] .t-dot { transform: scale(1); }
:root[data-theme="light"] .t-arc { stroke-dashoffset: 26; }
@media (hover: hover) { .theme:hover { border-color: var(--fg); } }
.theme:active { transform: scale(.94); }
.theme:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }

/* ---------- Logo ---------- */

.logo { justify-self: start; display: block; width: clamp(104px, 12vw, 172px); border-radius: 6px; }
.logo svg { display: block; width: 100%; height: auto; overflow: visible; }
.logo .ink { fill: var(--fg); }

.logo .eye-dot, .u__eyes .eye-dot { fill: var(--coral); transform-box: fill-box; transform-origin: center; }
.logo .eye-arc, .u__eyes .eye-arc {
  fill: none; stroke: var(--teal); stroke-width: 46.1; stroke-linecap: round;
  transform-box: fill-box; transform-origin: center bottom;
}

.is-winking .eye-dot { animation: dot-blink .56s ease-in-out; }
.is-winking .eye-arc { animation: arc-hop .56s var(--out); }
@keyframes dot-blink { 0%, 100% { scale: 1 1; } 42%, 58% { scale: 1.16 .22; } }
@keyframes arc-hop { 0%, 100% { translate: 0 0; } 40% { translate: 0 -20%; scale: 1.12 1.12; } }

/* ---------- Headline ---------- */

h1 {
  margin: 0;
  font-weight: 800;
  /* Optical size is pinned so the line width is the same multiple of font-size at every size */
  font-optical-sizing: none;
  font-variation-settings: "opsz" 96;
  font-size: clamp(30px, min(calc(var(--col) / 7.5), 13dvh), 136px);
  line-height: .97;
  letter-spacing: -.035em;
}

.line {
  display: block;
  overflow: clip;
  overflow-clip-margin: .02em;
  padding-top: .2em;
  margin-top: -.2em;
  padding-bottom: .06em;
  margin-bottom: -.06em;
}
.line__in {
  display: block;
  white-space: nowrap;
  animation: rise 1s var(--out) both;
  animation-delay: calc(.12s + var(--d) * .09s);
}
@keyframes rise { from { transform: translateY(115%); } }

.u { position: relative; display: inline-block; }
.u__eyes {
  position: absolute;
  left: -.015em;
  right: -.015em;
  width: calc(100% + .03em);
  bottom: .625em;
  height: auto;
  overflow: visible;
}

/* ---------- Lede and contact ---------- */

.lede {
  margin: 0;
  max-width: 34em;
  font-weight: 450;
  font-size: clamp(16px, min(1.5vw, 2.7dvh), 23px);
  line-height: 1.38;
  letter-spacing: -.005em;
  color: var(--sub);
  animation: fade-up .9s var(--out) .42s both;
}

.reach {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  animation: fade-up .9s var(--out) .52s both;
}
@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } }

.reach__note { font-family: var(--mono); font-size: clamp(12px, 1vw, 14px); color: var(--sub); }

.cta {
  --bgc: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: clamp(11px, 1.8dvh, 17px) clamp(18px, 1.8vw, 26px);
  border-radius: 999px;
  background: var(--bgc);
  color: var(--bg);
  font-weight: 700;
  font-size: clamp(15px, 1.4vw, 21px);
  letter-spacing: -.01em;
  transition: background-color .3s, transform .4s var(--spring);
}
.cta__roll { position: relative; display: block; overflow: hidden; line-height: 1.25; }
.cta__roll span { display: block; transition: transform .45s var(--out); }
.cta__roll::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  transform: translateY(105%);
  transition: transform .45s var(--out);
}
.cta__arrow { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--spring); }

@media (hover: hover) {
  .cta:hover { --bgc: var(--coral); color: var(--ink); transform: translateY(-2px); }
  .cta:hover .cta__roll span { transform: translateY(-105%); }
  .cta:hover .cta__roll::after { transform: translateY(0); }
  .cta:hover .cta__arrow { transform: translate(2px, -2px); }
}
.cta:active { transform: scale(.97); }

/* ---------- Ticker ---------- */

.ticker {
  min-width: 0;
  overflow: hidden;
  padding-top: clamp(8px, 1.4dvh, 14px);
  border-top: 1px solid var(--rule);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  animation: fade-up .9s var(--out) .62s both;
}
.ticker__track { display: flex; width: max-content; animation: slide 30s linear infinite; }
.ticker:hover .ticker__track { animation-play-state: paused; }
.ticker ul { display: flex; align-items: center; margin: 0; padding: 0; list-style: none; }
.ticker li {
  display: flex;
  align-items: center;
  font-family: var(--mono);
  font-size: clamp(12px, 1vw, 14px);
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
}
/* Separators alternate between the logo's open eye and its wink */
.ticker li::after {
  content: "";
  width: .55em;
  height: .55em;
  margin: 0 1.3em;
  border-radius: 50%;
  background: var(--coral);
}
.ticker li:nth-child(even)::after {
  width: .78em;
  height: .36em;
  margin-top: -.1em;
  border: .15em solid var(--teal);
  border-bottom: 0;
  border-radius: .5em .5em 0 0;
  background: none;
}
@keyframes slide { to { transform: translateX(-50%); } }

/* ---------- The face: two portraits over a big u ---------- */

.face {
  min-width: 0;
  min-height: 0;
  height: 100%;
  container-type: size;
  display: grid;
  place-items: center;
}

.fit {
  /* Everything inside is sized from --w, so the face always fits its box. */
  --w: min(100cqw, calc(100cqh / 1.14));
  --u: calc(var(--w) / 100);
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 1.14);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  container-type: inline-size;
}

.person {
  position: relative;
  display: grid;
  justify-items: center;
  gap: calc(var(--u) * 1.6);
  outline: none;
}
.person--shyam { --c: var(--coral); --clip: url(#leg-left); margin-right: -.5px; }
.person--karan { --c: var(--teal); --clip: url(#leg-right); margin-left: -.5px; }

.eye {
  --lx: 0;
  --ly: 0;
  position: relative;
  display: block;
  width: calc(var(--u) * 47.5);
  aspect-ratio: 1;
  animation: eye-in 1s var(--spring) .55s both;
  transform-origin: 50% 50%;
}
.person--karan .eye { animation-delay: .72s; }
@keyframes eye-in { from { transform: scale(.14); } }

.eye__body {
  position: absolute;
  inset: 0;
  display: block;
  transition: transform .5s var(--spring);
  transform-origin: 50% 62%;
}

.eye__disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--c);
  transform: translate(calc(var(--lx) * -2.2%), calc(var(--ly) * -2.2%));
}

/* The clip reaches above the disc so heads can break out of the circle */
.eye__clip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: -20%;
  overflow: hidden;
  border-radius: 0 0 50% 50% / 0 0 41.67% 41.67%;
  animation: photo-in .5s ease-out .78s both;
}
.person--karan .eye__clip { animation-delay: .95s; }
@keyframes photo-in { from { opacity: 0; } }

/* Opening frame is the logo itself: a dot and a wink, which then open into the two portraits */
.person--karan .eye__disc { animation: photo-in .16s linear .8s both; }
.intro .eye__wink { animation: arc-intro 1s linear both; }
@keyframes arc-intro { 0%, 76% { opacity: 1; } 92%, 100% { opacity: 0; } }

.eye__clip img {
  position: absolute;
  display: block;
  left: 50%;
  bottom: -3%;
  width: 118%;
  height: auto;
  max-width: none;
  margin-left: -59%;
  user-select: none;
  transform: translate(calc(var(--lx) * 3.2%), calc(var(--ly) * 2%)) rotate(calc(var(--lx) * 1.6deg));
  transform-origin: 50% 90%;
  transition: scale .55s var(--spring);
}

/* Dark hair would vanish into the dark background where heads leave the disc,
   so in dark mode each portrait gets a soft halo in its own eye colour */
:root:not([data-theme="light"]) .eye__clip img {
  filter: drop-shadow(0 0 calc(var(--u) * 1.3) color-mix(in srgb, var(--c) 62%, transparent));
}

/* The wink: the portrait shuts into the logo's teal arc, then opens again */
.eye__wink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 0;
  pointer-events: none;
}
.eye__wink path { fill: none; stroke: var(--teal); stroke-width: 30; stroke-linecap: round; }

.is-winking .eye__body { animation: shut .62s cubic-bezier(.65, 0, .35, 1); }
.is-winking .eye__wink { animation: show-arc .62s linear; }
@keyframes shut {
  0%, 100% { transform: none; opacity: 1; }
  30%, 66% { transform: scale(.94, .03); opacity: 0; }
}
@keyframes show-arc {
  0%, 22%, 76%, 100% { opacity: 0; transform: scale(.9, .3); }
  32%, 66% { opacity: 1; transform: none; }
}

/* A strip over the join, so the two halves of the u never show a hairline */
.fit::before {
  content: "";
  position: absolute;
  z-index: 1;
  pointer-events: none;
  left: 50%;
  bottom: 0;
  width: 4px;
  height: calc(var(--u) * 19);
  margin-left: -2px;
  background: var(--leg);
  animation: fade-up 1s var(--out) .38s both;
}

/* Each leg of the u is one person's link */
.leg {
  position: relative;
  display: block;
  width: 100%;
  height: calc(var(--u) * 56);
  clip-path: var(--clip);
  background: var(--leg);
  color: var(--leg-fg);
  overflow: hidden;
  transition: color .28s ease .1s;
  animation: leg-in 1s var(--out) .3s both;
}
.person--karan .leg { animation-delay: .38s; }
@keyframes leg-in { from { transform: translateY(14%); opacity: 0; } }

/* Colour pours down from the eye on hover */
.leg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--c);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .5s var(--out);
}

.leg__txt {
  position: absolute;
  top: calc(var(--u) * 2.8);
  left: calc(var(--u) * 3.2);
  width: calc(var(--u) * 33.5);
  display: grid;
  gap: calc(var(--u) * .9);
}
.person--karan .leg__txt { left: calc(var(--u) * 14.2); }

.leg strong {
  font-weight: 800;
  font-size: max(16px, calc(var(--u) * 4.3));
  line-height: 1;
  letter-spacing: -.025em;
}
.role {
  font-weight: 600;
  font-size: max(11.5px, calc(var(--u) * 2.45));
  line-height: 1.22;
}
.line-up {
  font-weight: 450;
  font-size: max(11.5px, calc(var(--u) * 2.3));
  line-height: 1.3;
  color: var(--leg-sub);
  transition: color .3s;
}
.url {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  margin-top: calc(var(--u) * .9);
  font-family: var(--mono);
  font-weight: 500;
  font-size: max(10.5px, calc(var(--u) * 2.05));
  white-space: nowrap;
}
.url svg { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--spring); }

.amp {
  position: absolute;
  left: 50%;
  bottom: calc(var(--u) * 22.5);
  translate: -50% 0;
  font-weight: 800;
  font-size: calc(var(--u) * 13);
  line-height: 1;
  color: var(--fg);
  pointer-events: none;
  transition: transform .6s var(--spring), color .3s;
  animation: fade-up .8s var(--out) 1.05s both;
}

.person:is(:hover, :focus-visible) .leg::before { transform: scaleY(1); }
.person:is(:hover, :focus-visible) .leg { color: var(--ink); }
.person:is(:hover, :focus-visible) .line-up { color: rgba(23, 23, 28, .78); }
.person:is(:hover, :focus-visible) .url svg { transform: translate(3px, -3px); }
.person:is(:hover, :focus-visible) .eye__body { transform: scale(1.045); }
.person:is(:hover, :focus-visible) .eye__clip img { scale: 1.07; }

.person--shyam:is(:hover, :focus-visible) ~ .amp { transform: rotate(-14deg); color: var(--coral); }
.person--karan:is(:hover, :focus-visible) ~ .amp { transform: rotate(14deg); color: var(--teal); }

/* Keyboard focus ring. The legs are clipped, so the ring goes on the eye. */
.person:focus-visible .eye__disc { outline: 3px solid var(--fg); outline-offset: 4px; }
.logo:focus-visible, .cta:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }

@media (hover: none) {
  .person:active .leg::before { transform: scaleY(1); }
  .person:active .leg { color: var(--ink); }
}

/* When the u gets small, drop the sentence and keep name, role and link */
@container (max-width: 500px) {
  .line-up { display: none; }
  .leg__txt { top: calc(var(--u) * 3.2); gap: calc(var(--u) * 1.2); }
}
@container (max-width: 400px) {
  .url { font-size: 10px; }
  .leg__txt { left: calc(var(--u) * 2.6); width: calc(var(--u) * 35); }
  .person--karan .leg__txt { left: calc(var(--u) * 13); }
}

@container (max-width: 310px) {
  .leg strong { font-size: 14.5px; }
  .role { font-size: 10.5px; }
  .url { font-size: 9px; }
  .url svg { display: none; }
  .leg__txt { top: calc(var(--u) * 2.6); gap: calc(var(--u) * 1); }
}

/* ---------- Short landscape screens ---------- */

@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  .ticker, .reach__note { display: none; }
  .pitch { grid-template-rows: auto minmax(0, 1fr); }
  .lede { font-size: 14px; }
}
@media (max-height: 430px) and (min-aspect-ratio: 1/1) {
  .lede { display: none; }
}

/* ---------- Tall screens: stack everything ---------- */

@media (max-aspect-ratio: 1/1) {
  .stage {
    --col: calc(100vw - 2 * var(--pad));
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "logo reach theme"
      "h1   h1    h1"
      "lede lede  lede"
      "face face  face"
      "tick tick  tick";
    gap: clamp(10px, 1.7dvh, 22px) 12px;
  }
  .pitch, .pitch__body, .bar { display: contents; }
  .logo { grid-area: logo; align-self: center; width: clamp(84px, 24vw, 120px); }
  .theme { grid-area: theme; align-self: center; }
  .reach { grid-area: reach; }
  h1 { grid-area: h1; font-size: clamp(28px, min(calc(var(--col) / 7.5), 9.6dvh), 128px); }
  .lede { grid-area: lede; max-width: none; font-size: clamp(15px, min(2.5vw, 2.2dvh), 22px); }
  .face { grid-area: face; }
  .ticker { grid-area: tick; }
  .reach__note { display: none; }
  .cta { padding: 9px 14px; font-size: 14px; gap: 7px; }
}
@media (max-aspect-ratio: 1/1) and (max-width: 400px) {
  .cta__arrow { display: none; }
  .cta { padding: 9px 12px; font-size: 13px; }
  .stage { column-gap: 8px; }
}
@media (max-aspect-ratio: 1/1) and (max-height: 720px) {
  .ticker { display: none; }
  .stage { grid-template-rows: auto auto auto minmax(0, 1fr); }
}
@media (max-aspect-ratio: 1/1) and (max-height: 600px) {
  .lede { display: none; }
}

/* ---------- Very small viewports (or heavy zoom): let it scroll rather than clip ---------- */

@media (max-height: 340px), (max-width: 300px) {
  body { overflow: auto; height: auto; }
  .stage { height: auto; min-height: 100%; }
  .face { min-height: 320px; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }
  .ticker__track { flex-wrap: wrap; width: auto; }
  .ticker ul[aria-hidden] { display: none; }
  .ticker ul { flex-wrap: wrap; row-gap: 4px; }
}
