/* Pet Our Bison */

@font-face {
  font-family: "Dela Gothic One";
  src: url("../assets/fonts/dela-gothic-one-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Dela Gothic One";
  src: url("../assets/fonts/dela-gothic-one-latin-ext-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Poppins";
  src: url("../assets/fonts/poppins-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #000;
  --ink: #e9e9e9;
  --green: #00fe00;
  --green-drop: rgba(0, 254, 0, 0.3);
  --display: "Dela Gothic One", "Arial Black", Impact, sans-serif;
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 64px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --intro: 1;
  --nudge: 0;
  --finale: 0;
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  overscroll-behavior: none;
}
body {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }

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

/* ---------- stage ---------- */
.stage { position: fixed; inset: 0; z-index: 1; overflow: hidden; background: var(--bg); }

.stage-canvas {
  display: block; width: 100%; height: 100%;
  touch-action: none; outline: none; cursor: default;
  opacity: 0; transition: opacity 1.4s ease;
}
.is-ready .stage-canvas { opacity: 1; }
.can-pet .stage-canvas { cursor: none; }
.stage-canvas:focus-visible { outline: 2px solid var(--ink); outline-offset: -10px; }

.stage-fallback {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  transition: opacity 0.6s ease;
}
/* the poster only downloads when WebGL is missing */
.no-webgl .stage-fallback { opacity: 1; background: var(--bg) url("../assets/poster.jpg") center 62% / cover no-repeat; }
.no-webgl .cursor-ring { display: none; }

/* keeps the type readable on the photograph */
.scrim, .scrim::before, .scrim::after { position: absolute; inset: 0; pointer-events: none; }
.scrim { z-index: 2; }
.scrim::before, .scrim::after { content: ""; }
.scrim::before {
  background: radial-gradient(70% 62% at 50% 50%, rgba(0, 0, 0, 0.56) 0%, rgba(0, 0, 0, 0.26) 58%, rgba(0, 0, 0, 0.06) 100%);
  opacity: max(var(--intro), calc(var(--nudge) * 0.8));
  transition: opacity 1s ease;
}
.scrim::after {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.18) 24%, rgba(0, 0, 0, 0) 40%);
  opacity: var(--finale);
  transition: opacity 0.9s ease;
}
.is-talking .scrim::after { opacity: 1; }

.cursor-ring {
  position: absolute; left: 0; top: 0; z-index: 4;
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid rgba(233, 233, 233, 0.92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18), 0 0 26px rgba(0, 254, 0, 0.22);
  pointer-events: none; opacity: 0;
  transition: opacity 0.25s ease, width 0.3s ease, height 0.3s ease, border-color 0.3s ease;
  will-change: transform;
}
.cursor-ring[data-visible="true"] { opacity: 0.92; }
.cursor-ring[data-ghost="true"] {
  width: 54px; height: 54px;
  border-color: rgba(233, 233, 233, 0.5);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 70%);
}

/* ---------- shared type and buttons ---------- */
.ui { position: fixed; inset: 0; z-index: 3; pointer-events: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 54px; padding: 14px 28px;
  border: 0; border-radius: 40px;
  background: var(--green); color: #000;
  font-family: var(--sans); font-weight: 600; font-size: 20px; line-height: 1.2;
  letter-spacing: 0.02em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
  box-shadow: 0 6px 0 var(--green-drop);
  cursor: pointer; pointer-events: auto; touch-action: manipulation;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--green-drop), 0 0 34px rgba(0, 254, 0, 0.32); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--green-drop); transition-duration: 0.06s; }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 6px; }

/* ---------- intro ---------- */
.intro {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(26px, 5vh, 52px);
  padding: calc(var(--safe-t) + 72px) calc(var(--safe-r) + var(--gutter)) calc(var(--safe-b) + 56px) calc(var(--safe-l) + var(--gutter));
  text-align: center;
  transition: opacity 0.55s ease, transform 0.8s cubic-bezier(0.3, 0, 0.2, 1), visibility 0s linear 0.8s;
}
.is-started .intro { opacity: 0; transform: scale(1.04); visibility: hidden; }
.is-started .intro .btn { pointer-events: none; }

.intro-title {
  margin: 0;
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  color: var(--ink); line-height: 1.04; letter-spacing: 0.005em;
  text-shadow: 0 2px 34px rgba(0, 0, 0, 0.45);
}
.intro-kicker {
  display: block;
  font-size: clamp(22px, 3.7vw, 54px);
  color: transparent;
  -webkit-text-stroke: max(1px, 0.03em) var(--green);
  letter-spacing: 0.03em;
  text-shadow: none;
  margin-bottom: 0.18em;
}
.intro-main {
  display: block;
  font-size: clamp(44px, 8.6vw, 136px);
  max-width: 11ch;
  margin: 0 auto;
  text-wrap: balance;
}
.start-btn { font-size: clamp(18px, 1.5vw, 22px); padding: 16px 36px; }
.volume-hint {
  display: inline-flex; align-items: center; gap: 10px;
  margin: calc(clamp(26px, 5vh, 52px) * -0.45) 0 0;
  font-family: var(--sans); font-weight: 600; font-size: 14px; line-height: 1;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(233, 233, 233, 0.95);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}
.volume-hint svg { width: 22px; height: 22px; fill: none; stroke: var(--green); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.volume-hint .spk { fill: var(--green); stroke-width: 1.2; }
.volume-hint .wave-1 { animation: wave 1.6s ease-in-out infinite; }
.volume-hint .wave-2 { animation: wave 1.6s ease-in-out 0.25s infinite; }

.js .intro-kicker, .js .intro-main, .js .start-btn, .js .volume-hint { opacity: 0; }
.is-type-ready .intro-kicker { animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.05s both; }
.is-type-ready .intro-main { animation: rise 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both; }
.is-type-ready .start-btn { animation: pop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.3) 0.75s both; }
.is-type-ready .volume-hint { animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 1.15s both; }
@keyframes rise { from { opacity: 0; transform: translateY(0.4em); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.92); } to { opacity: 1; transform: none; } }

/* ---------- the nudge ---------- */
.nudge {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--safe-t) + 80px) calc(var(--safe-r) + var(--gutter)) calc(var(--safe-b) + 40px) calc(var(--safe-l) + var(--gutter));
  text-align: center;
  opacity: var(--nudge);
}
.nudge.is-gone { visibility: hidden; }
.nudge-line {
  margin: 0;
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(30px, 5.8vw, 92px); line-height: 1.06; letter-spacing: 0.005em;
  color: var(--ink);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.55);
  opacity: 0; transform: translateY(0.3em) scale(0.97);
  transition: opacity 0.4s ease, transform 0.65s cubic-bezier(0.2, 0.9, 0.25, 1.25);
  text-wrap: balance;
}
.nudge-line.is-on { opacity: 1; transform: none; }
.nudge-line + .nudge-line { margin-top: 0.12em; }
.nudge-go { color: var(--green); margin-top: 0.42em !important; }
.for-touch { display: none; }
.is-touch .for-touch { display: inline; }
.is-touch .for-desk { display: none; }

.gesture {
  display: block; margin-top: clamp(18px, 3vh, 30px);
  color: var(--green); opacity: 0;
  transition: opacity 0.6s ease 0.5s;
}
.nudge-go.is-on + .gesture { opacity: 0.95; }
.gesture svg { display: block; margin: 0 auto; fill: none; stroke: currentColor; stroke-width: 2; }
.gesture-wheel { width: 26px; height: 40px; }
.gesture-wheel .wheel { fill: currentColor; stroke: none; animation: wheel 1.6s cubic-bezier(0.5, 0, 0.3, 1) infinite; }
.gesture-pinch { display: none !important; width: 84px; height: 36px; }
.gesture-pinch .finger { fill: rgba(0, 254, 0, 0.2); }
.gesture-pinch .arrow { stroke-linecap: round; stroke-linejoin: round; }
.finger-a, .arrow-a { animation: pinch-a 1.8s cubic-bezier(0.45, 0, 0.3, 1) infinite; }
.finger-b, .arrow-b { animation: pinch-b 1.8s cubic-bezier(0.45, 0, 0.3, 1) infinite; }
.is-touch .gesture-wheel { display: none; }
.is-touch .gesture-pinch { display: block !important; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(9px); opacity: 0; } 100% { transform: translateY(9px); opacity: 0; } }
@keyframes pinch-a { 0%, 15% { transform: translateX(0); opacity: 1; } 70% { transform: translateX(10px); opacity: 1; } 100% { transform: translateX(10px); opacity: 0; } }
@keyframes pinch-b { 0%, 15% { transform: translateX(0); opacity: 1; } 70% { transform: translateX(-10px); opacity: 1; } 100% { transform: translateX(-10px); opacity: 0; } }

/* ---------- progress while stepping back ---------- */
.progress {
  position: absolute; left: 0; right: 0;
  bottom: calc(var(--safe-b) + clamp(30px, 9vh, 100px));
  display: grid; justify-items: center;
  padding: 0 calc(var(--safe-r) + var(--gutter)) 0 calc(var(--safe-l) + var(--gutter));
  text-align: center;
}
.progress-line {
  grid-area: 1 / 1;
  margin: 0; max-width: 24ch;
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(22px, 2.9vw, 46px); line-height: 1.08; letter-spacing: 0.005em;
  color: var(--ink);
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.6);
  text-wrap: balance;
  opacity: 0; transform: translateY(14px) scale(0.98);
  transition: opacity 0.4s ease, transform 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.2);
}
.progress-line.is-on { opacity: 1; transform: none; }
.progress-line .go { display: block; color: var(--green); }
.progress .gesture { grid-area: 2 / 1; margin-top: 16px; }
.progress.is-idle .gesture { opacity: 0.95; transition-delay: 0s; }
.has-progress .scrim::after { opacity: 0.9; }

/* ---------- finale ---------- */
.finale {
  position: absolute; left: 0; right: 0;
  bottom: calc(var(--safe-b) + clamp(30px, 9vh, 100px));
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  padding: 0 var(--gutter);
  opacity: var(--finale);
  transform: translateY(calc((1 - var(--finale)) * 26px));
  visibility: hidden;
  transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.9s;
}
.is-finale .finale { visibility: visible; transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s; }
.is-farewell .finale { visibility: hidden; opacity: 0; transition: opacity 0.35s ease, visibility 0s linear 0.35s; }
.brand-logo { display: block; width: auto; height: auto; max-width: min(260px, 62vw); max-height: 96px; filter: drop-shadow(0 2px 18px rgba(0, 0, 0, 0.5)); }
.drink-btn { position: relative; font-size: clamp(18px, 1.6vw, 22px); padding: 17px 38px; }
.drink-btn::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; box-shadow: 0 0 0 0 rgba(0, 254, 0, 0.6);
}
/* a heartbeat and a ring of light, so the button can't be missed */
.is-finale .drink-btn { animation: beat 1.6s cubic-bezier(0.3, 0, 0.3, 1) 0.9s infinite; }
.is-finale .drink-btn::after { animation: ring 1.6s cubic-bezier(0.2, 0.6, 0.3, 1) 0.9s infinite; }
@keyframes beat {
  0%, 44%, 100% { transform: scale(1); }
  14% { transform: scale(1.08); }
  28% { transform: scale(0.99); }
}
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(0, 254, 0, 0.6); }
  60%, 100% { box-shadow: 0 0 0 24px rgba(0, 254, 0, 0); }
}
.is-finale .drink-btn:hover, .is-finale .drink-btn:active, .is-finale .drink-btn:focus-visible,
.is-finale .drink-btn:hover::after, .is-finale .drink-btn:active::after { animation: none; }

/* ---------- the goodbye ---------- */
.caption {
  position: absolute; left: 0; right: 0;
  bottom: calc(var(--safe-b) + clamp(44px, 12vh, 130px));
  margin: 0 auto; padding: 0 var(--gutter);
  max-width: 15ch;
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(30px, 8.2vw, 76px); line-height: 1.05; letter-spacing: 0.005em;
  color: var(--ink); text-align: center;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.6);
  text-wrap: balance;
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.45s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.is-talking .caption { opacity: 1; transform: none; }

.curtain {
  position: fixed; inset: 0; z-index: 30;
  background: #000; opacity: 0; pointer-events: none;
  transition: opacity 0.6s ease;
}
.is-leaving .curtain { opacity: 1; pointer-events: auto; }

/* ---------- sound ---------- */
.sound-toggle {
  position: fixed; z-index: 20;
  top: calc(var(--safe-t) + clamp(14px, 2.2vw, 30px));
  right: calc(var(--safe-r) + clamp(14px, 2.2vw, 30px));
  display: grid; place-items: center;
  width: 48px; height: 48px; padding: 0;
  border: 1.5px solid rgba(233, 233, 233, 0.5); border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--ink);
  cursor: pointer; touch-action: manipulation;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
}
.sound-toggle:hover { border-color: var(--green); color: var(--green); }
.sound-toggle:active { transform: scale(0.94); }
.sound-toggle:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.sound-toggle svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.sound-toggle .spk { fill: currentColor; stroke-width: 1.2; }
.sound-toggle .wave, .sound-toggle .cross { transition: opacity 0.2s ease; }
.sound-toggle .cross { opacity: 0; }
.sound-toggle[aria-pressed="false"] .wave { opacity: 0; }
.sound-toggle[aria-pressed="false"] .cross { opacity: 1; }
.is-started .sound-toggle[aria-pressed="true"] .wave-2 { animation: wave 2.2s ease-in-out infinite; }
@keyframes wave { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.is-leaving .sound-toggle { opacity: 0; transition: opacity 0.4s ease; }

/* ---------- screen shapes ---------- */
@media (min-aspect-ratio: 23/20) {
  /* landscape goodbye: the bison faces left, the line sits in the open space */
  .caption {
    left: calc(var(--safe-l) + var(--gutter)); right: auto; top: 50%; bottom: auto;
    width: min(42vw, 660px); max-width: none; margin: 0; padding: 0;
    font-size: clamp(34px, 4.6vw, 84px);
    text-align: left; transform: translateY(calc(-50% + 18px));
  }
  .is-talking .caption { transform: translateY(-50%); }
  .is-talking .scrim::after { opacity: 0; }
  .is-talking .scrim::before {
    opacity: 1;
    background: radial-gradient(60% 75% at 18% 50%, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.2) 55%, rgba(0, 0, 0, 0) 85%);
  }
}

@media (max-width: 640px) {
  .btn { font-size: 18px; }
  .start-btn, .drink-btn { padding: 16px 30px; }
  .intro-main { font-size: clamp(40px, 12.4vw, 64px); }
  .intro-kicker { font-size: clamp(19px, 5.6vw, 28px); }
  .nudge-line { font-size: clamp(28px, 9.2vw, 46px); }
}

@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .intro { gap: 20px; padding-top: calc(var(--safe-t) + 56px); padding-bottom: calc(var(--safe-b) + 24px); }
  .intro-main { font-size: min(8.6vw, 15vh); }
  .intro-kicker { font-size: min(3.7vw, 7vh); }
  .nudge-line { font-size: min(5.8vw, 11vh); }
  .finale { bottom: calc(var(--safe-b) + 22px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .js .intro-kicker, .js .intro-main, .js .start-btn { opacity: 1; }
}
