/* Ashley's Bar demo: 3D bottle stage */
.zb-stage {
  position: relative;
  height: calc(var(--zb-stage-steps, 5) * var(--zb-step-height, 100vh));
  min-height: 100svh;
  color: var(--color-foreground);
}
.zb-stage__sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

/* Giant outlined background word */
.zb-stage__words {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.zb-stage__word {
  grid-area: 1 / 1;
  font-family: var(--font-heading--family);
  font-size: clamp(110px, 24vw, 420px);
  line-height: .8;
  letter-spacing: .02em;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1.5px rgb(var(--color-foreground-rgb) / .13);
  opacity: 0;
  transform: translateY(6%) scale(.96);
  transition: opacity .8s ease, transform 1s cubic-bezier(.2, .8, .2, 1);
}
.zb-stage__word.is-active { opacity: 1; transform: none; }

/* 3D canvas fills the stage */
.zb-stage__canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: grab;
  touch-action: pan-y;
}
.zb-stage__canvas:active { cursor: grabbing; }
.zb-stage__canvas canvas { display: block; width: 100% !important; height: 100% !important; }
.zb-stage__loading {
  position: absolute;
  left: 72%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: rgb(var(--color-foreground-rgb) / .6);
  transition: opacity .6s ease;
}
.zb-stage.is-ready .zb-stage__loading { opacity: 0; }
.zb-stage__spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgb(var(--color-foreground-rgb) / .15);
  border-top-color: var(--zb-accent, var(--color-foreground));
  animation: zb-stage-spin 1s linear infinite;
}
@keyframes zb-stage-spin { to { transform: rotate(360deg); } }

/* Side gutters: follow the theme's page margin, with more room on large screens */
.zb-stage {
  --zb-gutter: max(var(--page-margin, 40px), clamp(24px, 6vw, 112px), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --zb-max: 1600px;
}

/* Copy */
.zb-stage__content {
  position: relative;
  width: 100%;
  max-width: var(--zb-max);
  margin-inline: auto;
  padding-inline: var(--zb-gutter);
  z-index: 2;
  height: 100%;
  display: flex;
  align-items: center;
  padding-top: var(--header-height, 72px);
  padding-bottom: 110px;
  box-sizing: border-box;
  pointer-events: none;
}
.zb-stage__copy {
  width: min(560px, 52%);
  pointer-events: auto;
}
.zb-stage__copy > .zb-stage__step { display: none; }
.zb-stage__copy > .zb-stage__step.is-active { display: block; }
.zb-stage__step.is-active > * { animation: zb-stage-in .8s cubic-bezier(.2, .8, .2, 1) both; }
.zb-stage__step.is-active > *:nth-child(2) { animation-delay: .07s; }
.zb-stage__step.is-active > *:nth-child(3) { animation-delay: .14s; }
@keyframes zb-stage-in { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
.zb-stage__eyebrow {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgb(var(--color-foreground-rgb) / .7);
}
.zb-stage__eyebrow::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 10px;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--zb-accent, var(--color-foreground));
}
.zb-stage__heading {
  margin: 0;
  font-family: var(--font-heading--family);
  font-size: clamp(56px, 8vw, 132px);
  line-height: .9;
  text-transform: uppercase;
}
.zb-stage__heading em {
  font-family: var(--zb-accent-font, Georgia, serif);
  font-style: italic;
  font-weight: 500;
  text-transform: none;
  color: var(--zb-accent, var(--color-foreground));
}
.zb-stage__text {
  margin: 24px 0 0;
  max-width: 460px;
  font-size: 18px;
  line-height: 1.6;
  color: rgb(var(--color-foreground-rgb) / .75);
}
.zb-stage__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}
.zb-stage__note {
  margin: 16px 0 0;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgb(var(--color-foreground-rgb) / .55);
}

/* Bottom bar: step tabs + turn controls */
.zb-stage__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(22px, env(safe-area-inset-bottom, 0px));
  max-width: var(--zb-max);
  margin-inline: auto;
  padding-inline: var(--zb-gutter);
  box-sizing: border-box;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  gap: 24px;
}
.zb-stage__tabs {
  flex: 1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 12px;
}
.zb-stage__tab {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: baseline;
  min-height: 44px;
  padding: 14px 0 10px;
  background: none;
  border: 0;
  border-top: 1px solid rgb(var(--color-foreground-rgb) / .2);
  color: rgb(var(--color-foreground-rgb) / .55);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: color .3s ease;
}
.zb-stage__tab.is-active, .zb-stage__tab:hover { color: var(--color-foreground); }
.zb-stage__tab-num { font-size: 11px; letter-spacing: .1em; }
.zb-stage__tab-fill {
  position: absolute;
  left: 0;
  top: -1px;
  height: 2px;
  width: 100%;
  transform-origin: left;
  transform: scaleX(var(--fill, 0));
  background: var(--zb-accent, var(--color-foreground));
}
.zb-stage__controls { display: flex; gap: 8px; }
.zb-stage__ctrl {
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgb(var(--color-foreground-rgb) / .3);
  background: rgb(var(--color-background-rgb) / .5);
  color: var(--color-foreground);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color .2s ease, transform .2s ease;
}
.zb-stage__ctrl:hover { border-color: var(--zb-accent, var(--color-foreground)); transform: translateY(-1px); }
.zb-stage__ctrl:focus-visible, .zb-stage__tab:focus-visible { outline: 2px solid var(--zb-accent, var(--color-foreground)); outline-offset: 3px; }
.zb-stage__hint {
  position: absolute;
  width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}

/* Fallback when 3D can't load: keep the copy, hide the empty canvas */
.zb-stage.is-failed .zb-stage__canvas { display: none; }
.zb-stage.is-failed .zb-stage__copy { width: min(720px, 100%); }

/* Phones: copy on top, bottle below */
@media screen and (max-width: 749px) {
  .zb-stage { --zb-gutter: max(20px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)); }
  .zb-stage__content { align-items: flex-start; padding-top: calc(var(--header-height, 64px) + 20px); }
  .zb-stage__copy { width: 100%; }
  .zb-stage__heading { font-size: clamp(44px, 13vw, 72px); }
  .zb-stage__text { font-size: 15px; margin-top: 14px; }
  .zb-stage__actions { margin-top: 18px; }
  .zb-stage__actions .button { padding-inline: 20px; }
  .zb-stage__note { display: none; }
  .zb-stage__tabs { display: none; }
  .zb-stage__bar { justify-content: center; }
  .zb-stage__loading { left: 50%; top: 72%; }
  .zb-stage__word { font-size: 34vw; align-self: end; margin-bottom: 18vh; }
}

@media (prefers-reduced-motion: reduce) {
  .zb-stage__word, .zb-stage__step.is-active > * { transition: none; animation: none; }
}
