@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/inter.woff2") format("woff2");
}

:root {
  --night: #020617;
  --slate: #0f172a;
  --slate-2: #1e293b;
  --teal: #14b8a6;
  --teal-deep: #0f766e;
  --teal-light: #5eead4;
  --text: #f1f5f9;
  --soft: #cbd5e1;
  --muted: #94a3b8;
  --amber: #fbbf24;
  --coral: #fb7185;
  --sky: #38bdf8;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--night);
  color: var(--text);
  scrollbar-color: #334155 var(--night);
  scrollbar-width: thin;
}
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--night); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; border: 2px solid var(--night); }
::-webkit-scrollbar-thumb:hover { background: #475569; }

body {
  position: relative;
  margin: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse 55% 60% at 72% 58%, rgba(20, 184, 166, .17), transparent 70%),
    radial-gradient(ellipse 40% 35% at 8% 4%, rgba(56, 189, 248, .08), transparent 70%),
    linear-gradient(180deg, var(--night) 0%, var(--night) 45%, var(--slate) 100%);
}

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

/* Night sky sits behind everything and never takes pointer input. */
.sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.stars circle { animation: twinkle 5s ease-in-out infinite; opacity: .55; }
.stars circle:nth-child(3n) { animation-delay: -1.6s; animation-duration: 6.5s; }
.stars circle:nth-child(3n+1) { animation-delay: -3.1s; animation-duration: 4.2s; }
.stars circle:nth-child(4n) { opacity: .3; }
.twinkles path { transform-box: fill-box; transform-origin: center; animation: sparkle 4.8s ease-in-out infinite; opacity: .7; }
.twinkles path:nth-child(2) { animation-delay: -1.2s; }
.twinkles path:nth-child(3) { animation-delay: -2.6s; }
.twinkles path:nth-child(4) { animation-delay: -3.7s; }
.shooting { opacity: 0; animation: shoot 13s ease-in 4s infinite; }

.top, .stage, .foot { position: relative; z-index: 1; }

.top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: clamp(.75rem, 3vh, 2rem) clamp(1.25rem, 5vw, 4.5rem) 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: clamp(1.7rem, 4.6vh, 2.6rem);
  letter-spacing: -.02em;
  border-radius: 10px;
}
.brand { --logo: clamp(44px, 7.5vh, 68px); }
.brand img { width: var(--logo); height: auto; display: block; }
/* The icon's antenna sits above the head, so the word is nudged down to centre on the face rather than the whole icon box. */
.brand span { line-height: 1; transform: translateY(calc(var(--logo) * .15)); }
.brand:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; }

.stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: clamp(.5rem, 2vh, 1.5rem) clamp(1.25rem, 5vw, 4.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto auto 1fr;
  grid-template-areas: ". lab" "copy lab" "actions lab" ". lab";
  column-gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
}

.copy { grid-area: copy; min-width: 0; }

h1 {
  margin: 0;
  font-weight: 850;
  font-size: clamp(2.6rem, min(4.6vw, 9.4vh), 5.4rem);
  line-height: 1;
  letter-spacing: -.045em;
  text-wrap: balance;
}
h1 .line { display: block; white-space: nowrap; }
.brew { color: var(--teal-light); display: inline-block; }
.brew span { display: inline-block; animation: simmer 2.8s ease-in-out infinite; }
.brew span:nth-child(2) { animation-delay: -.25s; }
.brew span:nth-child(3) { animation-delay: -.5s; }
.brew span:nth-child(4) { animation-delay: -.75s; }
.brew span:nth-child(5) { animation-delay: -1s; }
.brew span:nth-child(6) { animation-delay: -1.25s; }
.brew span:nth-child(7) { animation-delay: -1.5s; }
.dot { display: inline-block; color: var(--amber); animation: rise 3.6s ease-in-out infinite; }

.lede {
  margin: clamp(.7rem, 2.2vh, 1.4rem) 0 0;
  max-width: 30ch;
  color: var(--soft);
  font-size: clamp(1rem, min(1.5vw, 2.6vh), 1.3rem);
  line-height: 1.5;
}

.actions {
  grid-area: actions;
  align-self: start;
  margin-top: clamp(1.2rem, 4vh, 2.4rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem 1.1rem;
}
.stir {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  min-height: 48px;
  padding: .7rem 1.5rem .7rem 1.25rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal-light), var(--teal));
  color: #042f2e;
  font: 700 1rem/1 var(--font);
  letter-spacing: -.01em;
  cursor: pointer;
  box-shadow: 0 10px 30px -10px rgba(20, 184, 166, .7), inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: transform .2s cubic-bezier(.2, .7, .2, 1), box-shadow .2s ease;
}
.stir svg { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.stir:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -12px rgba(20, 184, 166, .85), inset 0 1px 0 rgba(255, 255, 255, .45); }
.stir:hover svg { transform: rotate(90deg) scale(1.1); }
.stir:active { transform: translateY(0) scale(.97); }
.stir:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; }
.hint { margin: 0; color: var(--muted); font-size: .9rem; }

.lab {
  grid-area: lab;
  margin: 0;
  width: clamp(260px, min(44vw, 100svh - 12.5rem), 660px);
  align-self: center;
}
.scene { display: block; width: 100%; height: auto; overflow: visible; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* Scene motion. Transform origins use view-box units so rotations pivot at real joints. */
.aura { transform-box: fill-box; transform-origin: center; animation: breathe 4.5s ease-in-out infinite; }
.pool { animation: glowpulse 4.5s ease-in-out infinite; }

.wisp { opacity: 0; transform-box: fill-box; transform-origin: 50% 100%; animation: steam 4.8s ease-out infinite; }
.w2 { animation-delay: -1.6s; }
.w3 { animation-delay: -3.2s; }

.ico { transform-box: fill-box; transform-origin: center; opacity: 0; animation: brew 12.6s cubic-bezier(.4, .1, .4, 1) infinite; }
.i1 { --mx: -36px; --ex: -14px; --r: -12deg; --sx: -44px; --sy: -128px; }
.i2 { --mx: 30px;  --ex: 54px;  --r: 16deg;  --sx: 50px;  --sy: -92px; }
.i3 { --mx: -22px; --ex: -60px; --r: 10deg;  --sx: -76px; --sy: -58px; }
.i4 { --mx: 46px;  --ex: 22px;  --r: -14deg; --sx: 16px;  --sy: -176px; }
.i5 { --mx: -42px; --ex: 30px;  --r: 22deg;  --sx: 70px;  --sy: -160px; }
.i6 { --mx: 20px;  --ex: -42px; --r: -8deg;  --sx: -40px; --sy: -196px; }
.i7 { --mx: -10px; --ex: 64px;  --r: 12deg;  --sx: 4px;   --sy: -60px; }
.i2 { animation-delay: -1.8s; }
.i3 { animation-delay: -3.6s; }
.i4 { animation-delay: -5.4s; }
.i5 { animation-delay: -7.2s; }
.i6 { animation-delay: -9s; }
.i7 { animation-delay: -10.8s; }

.wave.front { animation: wave 2.6s linear infinite; }
.wave.back { animation: wave 3.8s linear infinite reverse; }
.liquid { transform-box: view-box; transform-origin: 356px 352px; }

.b { opacity: 0; animation: bubble 3.2s ease-in infinite; }
.b1 { --w: -4px; animation-delay: -.4s; }
.b2 { --w: 5px; animation-delay: -1.5s; animation-duration: 2.6s; }
.b3 { --w: -6px; animation-delay: -2.2s; animation-duration: 3.8s; }
.b4 { --w: 3px; animation-delay: -.9s; animation-duration: 2.9s; }
.b5 { --w: 6px; animation-delay: -2.8s; }
.b6 { --w: -3px; animation-delay: -1.9s; animation-duration: 3.5s; }
.fizz circle { opacity: 0; }

.rod, .arm-r { transform-box: view-box; transform-origin: 216px 346px; animation: stir 3.2s ease-in-out infinite; }

.felix { transform-box: view-box; transform-origin: 160px 420px; }
.head { transform-box: view-box; transform-origin: 160px 310px; animation: bob 6.4s ease-in-out infinite; }
.halo { transform-box: fill-box; transform-origin: center; animation: antenna 2.4s ease-in-out infinite; }
.eyes { transform-box: fill-box; transform-origin: center; animation: blink 5.6s ease-in-out infinite; }
.pupil { transform: translate(6px, 3px); transition: transform .18s ease-out; }
.happy, .smile { opacity: 0; transition: opacity .2s ease; }
.mouth, .eyes > circle { transition: opacity .2s ease; }
.cheek { opacity: .7; transition: opacity .3s ease; }
.led { animation: led 1.8s steps(1, end) infinite; }
.led2 { animation-delay: .6s; }
.led3 { animation-delay: 1.2s; }
.jar-spark { transform-box: fill-box; transform-origin: center; animation: sparkle 3.4s ease-in-out infinite; }

.burst > * { opacity: 0; transform-box: fill-box; transform-origin: center; }
.p1 { --bx: -58px; --by: -70px; --br: 120deg; }
.p2 { --bx: 46px;  --by: -84px; --br: -30deg; }
.p3 { --bx: -18px; --by: -112px; --br: 0deg; }
.p4 { --bx: 72px;  --by: -40px; --br: 90deg; }
.p5 { --bx: -76px; --by: -24px; --br: 0deg; }
.p6 { --bx: 16px;  --by: -126px; --br: 160deg; }

/* A stir: faster stirring, a slosh, a fizz, a burst of little wins and a very pleased robot. */
.is-stirring .rod, .is-stirring .arm-r { animation: stir-fast .45s ease-in-out 5; }
.is-stirring .liquid { animation: slosh 1.1s ease-in-out 2; }
.is-stirring .fizz circle { animation: fizz 1s ease-in 2; }
.is-stirring .fizz circle:nth-child(2n) { animation-delay: .15s; }
.is-stirring .fizz circle:nth-child(3n) { animation-delay: .3s; }
.is-stirring .burst > * { animation: burst 1.5s cubic-bezier(.2, .7, .3, 1) .25s both; }
.is-stirring .burst > :nth-child(2n) { animation-delay: .35s; }
.is-stirring .burst > :nth-child(3n) { animation-delay: .45s; }
.is-stirring .felix { animation: hop .5s cubic-bezier(.3, .7, .4, 1) 2; }
.is-stirring .eyes > circle, .is-stirring .pupil { opacity: 0; }
.is-stirring .happy, .is-stirring .smile { opacity: 1; }
.is-stirring .mouth { opacity: 0; }
.is-stirring .cheek { opacity: 1; }
.is-stirring .halo { animation: antenna .4s ease-in-out 6; }
.is-stirring .aura { animation: flare 2.4s ease-out; }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .4rem 2rem;
  padding: clamp(.65rem, 1.8vh, 1.1rem) clamp(1.25rem, 5vw, 4.5rem);
  border-top: 1px solid rgba(148, 163, 184, .14);
  font-size: .82rem;
  color: var(--muted);
}
.foot p { margin: 0; }
.foot a { color: var(--text); text-decoration: none; border-radius: 4px; }
.foot a:hover { text-decoration: underline; }
.foot a:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

@keyframes twinkle { 0%, 100% { opacity: .2; } 50% { opacity: .85; } }
@keyframes sparkle { 0%, 100% { opacity: .25; transform: scale(.6) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(45deg); } }
@keyframes shoot {
  0% { opacity: 0; transform: translate(1120px, 60px) rotate(160deg); }
  2% { opacity: 1; }
  7% { opacity: 0; transform: translate(780px, 190px) rotate(160deg); }
  100% { opacity: 0; transform: translate(780px, 190px) rotate(160deg); }
}
@keyframes simmer { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-.05em); } }
@keyframes rise {
  0%, 55% { transform: translateY(0) scale(1); opacity: 1; }
  80% { transform: translateY(-.55em) scale(1.25); opacity: 0; }
  81% { transform: translateY(.15em) scale(.4); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes glowpulse { 0%, 100% { opacity: .22; } 50% { opacity: .4; } }
@keyframes flare { 0% { transform: scale(1); opacity: 1; } 30% { transform: scale(1.2); } 100% { transform: scale(1); opacity: .85; } }
@keyframes steam {
  0% { opacity: 0; transform: translateY(10px) scaleX(.7); }
  30% { opacity: .3; }
  100% { opacity: 0; transform: translateY(-70px) scaleX(1.35); }
}
@keyframes brew {
  0% { opacity: 0; transform: translate(0, 4px) scale(.25) rotate(0); }
  10% { opacity: 1; transform: translate(0, -14px) scale(.7) rotate(0); }
  45% { opacity: 1; transform: translate(var(--mx), -96px) scale(1) rotate(var(--r)); }
  78% { opacity: .9; }
  100% { opacity: 0; transform: translate(var(--ex), -198px) scale(.8) rotate(calc(var(--r) * -1)); }
}
@keyframes wave { to { transform: translateX(-40px); } }
@keyframes bubble {
  0% { opacity: 0; transform: translate(0, 0) scale(.6); }
  15% { opacity: .9; }
  85% { opacity: .9; }
  100% { opacity: 0; transform: translate(var(--w), -66px) scale(1.1); }
}
@keyframes fizz {
  0% { opacity: 0; transform: translateY(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-72px); }
}
@keyframes stir { 0%, 100% { transform: rotate(-2.2deg); } 50% { transform: rotate(2.2deg); } }
@keyframes stir-fast { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes slosh {
  0%, 100% { transform: rotate(0) translateY(0); }
  25% { transform: rotate(-7deg) translateY(-4px); }
  75% { transform: rotate(6deg) translateY(-2px); }
}
@keyframes bob { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-2.5deg); } 60% { transform: rotate(1.5deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-10px); } }
@keyframes antenna { 0%, 100% { opacity: .45; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.25); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
@keyframes led { 0% { opacity: 1; } 33% { opacity: .25; } }
@keyframes burst {
  0% { opacity: 0; transform: translate(0, 0) scale(.2) rotate(0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--bx), var(--by)) scale(1.8) rotate(var(--br)); }
}

/* Stacked layout for phones and portrait tablets: headline, scene, then the button. */
@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  body {
    background:
      radial-gradient(ellipse 90% 45% at 50% 58%, rgba(20, 184, 166, .17), transparent 70%),
      radial-gradient(ellipse 60% 30% at 0% 0%, rgba(56, 189, 248, .08), transparent 70%),
      linear-gradient(180deg, var(--night) 0%, var(--night) 45%, var(--slate) 100%);
  }
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas: "copy" "lab" "actions";
    align-content: center;
    justify-items: center;
    row-gap: clamp(.5rem, 2.6svh, 2.2rem);
    text-align: center;
  }
  .copy { align-self: auto; }
  h1 { font-size: clamp(1.9rem, min(10.4vw, 5.6svh), 4.2rem); }
  .lede { margin: clamp(.4rem, 1.4svh, 1rem) auto 0; font-size: clamp(.92rem, min(4vw, 2.3svh), 1.25rem); max-width: 34ch; }
  .lab { width: min(88vw, 100svh - 24rem, 560px); }
  .actions { margin-top: 0; flex-direction: column; gap: .4rem; }
  .stir { min-height: 46px; padding: .6rem 1.3rem .6rem 1.1rem; font-size: .95rem; }
  .hint { font-size: .8rem; }
  .foot { flex-direction: column; align-items: center; text-align: center; gap: .1rem; font-size: .72rem; }
}

@media (max-width: 380px) {
}

/* Reduced motion: a calm still of the lab with a few little wins already floating in the steam. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .ico { opacity: .95; transform: translate(var(--sx), var(--sy)) scale(.9); }
  .b { opacity: .8; transform: translateY(-30px); }
  .wisp { opacity: .2; }
  .stars circle { opacity: .5; }
  .stir:hover { transform: none; }
  .stir:hover svg { transform: none; }
}
