/* Photos and shared cards for the Together, Avatar and Nutrition chapters. */
#together.scene--together {
  --scene-base: #261d17;
  --scene-low: #3b2c21;
  --scene-light: #e7bc91;
  --scene-image-height: 100%;
  --scene-image-x: 75%;
  --scene-image-y: 23%;
  --scene-wash: linear-gradient(90deg, #211a15 0%, rgba(33, 26, 21, .86) 29%, rgba(33, 26, 21, .08) 69%);
  padding-bottom: clamp(20px, 3vw, 42px);
  background: var(--scene-base);
}

#together .together-intro,
#together .community__grid {
  width: min(100%, 546px);
  margin-inline: 0;
}

#together .together-intro,
#avatar .avatar-intro {
  text-align: left;
  justify-items: start;
}

#together .together-intro .eyebrow,
#avatar .avatar-intro .eyebrow { padding-bottom: 0; }

#together .together-intro .eyebrow::after,
#avatar .avatar-intro .eyebrow::after { content: none; }

#together .community__grid { grid-template-columns: minmax(0, 1fr); }
#together .community__content { gap: 14px; }
#together .community__step {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

#together .community__panel {
  --card: #f7efe3;
  --line: rgba(74, 45, 29, .18);
  --ink: #241e19;
  --ink-2: #5e4c3c;
  --accent: #6e4932;
  --accent-soft: rgba(110, 73, 50, .12);
  --accent-2: #543722;
  --accent-ink: #fffaf2;
  color: var(--ink);
  color-scheme: light;
  box-shadow: 0 16px 42px rgba(18, 13, 10, .26);
}

#together .community__panel :focus-visible { outline-color: var(--accent); }
#together .community__choices button {
  background: rgba(37, 27, 20, .9);
  border-color: rgba(247, 227, 201, .42);
  color: #fffaf2;
}
#together .community__choices button[aria-pressed="true"] {
  background: #f7ead9;
  border-color: #f7ead9;
  color: #3b281e;
}

#avatar.scene--avatar {
  --scene-base: #291f23;
  --scene-low: #392a2b;
  --scene-light: #f1c6a0;
  --scene-image-height: min(100%, 980px);
  --scene-image-x: 63%;
  --scene-image-y: 35%;
  --scene-wash: linear-gradient(90deg, rgba(41, 31, 35, .77), rgba(41, 31, 35, .31) 59%, rgba(41, 31, 35, .05) 100%);
  background: linear-gradient(165deg, var(--scene-base) 28%, var(--scene-low) 68%, #30271e);
  padding-top: clamp(16px, 3vw, 38px);
  padding-bottom: clamp(20px, 3vw, 42px);
}

#avatar .avatar-intro {
  max-width: 690px;
  margin: clamp(32px, 7vw, 92px) 0 clamp(22px, 5vw, 68px);
}

#avatar .figure__sticky { isolation: isolate; }

.avatar-halo {
  position: absolute;
  z-index: -1;
  inset: 10% -7% 2%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 81%, rgba(252, 191, 128, .38), rgba(237, 157, 110, .13) 42%, transparent 70%);
}

#avatar .figure__step {
  filter: none;
  opacity: 1;
  transform: none;
  max-width: 100%;
}

#avatar .figure__step > p:not(.eyebrow) { color: #f1e4da; }
#avatar .figure__step .muted { color: #e1cdbd; }
#avatar .figure__tags span,
#avatar .figure__step .btn--ghost,
#avatar .figure__hint,
#avatar .figure__step .hair-badge {
  color: #fff5e9;
  background: #4e3839;
  border-color: #87635e;
  backdrop-filter: none;
}
#avatar .hair-badge figcaption { color: #fff5e9; }
#avatar .figure__dots li { background: #745955; }
#avatar .figure__dots li.is-active { background: #ffd3a8; }
#avatar .band__inner { color: #fffaf2; }
#avatar .figure__floor { opacity: .7; }
#avatar .figure__floor span { animation: none; }

#avatar .orbit li {
  color: #fff5e9;
  background: #4b3436;
  border-color: #92706b;
  animation: none;
  backdrop-filter: none;
  opacity: 1;
  transform: none;
}

#avatar .orbit li:nth-child(1) { left: -10%; top: 17%; }
#avatar .orbit li:nth-child(2) { right: -12%; top: 33%; }
#avatar .orbit li:nth-child(3) { left: -8%; top: 59%; }
#avatar .orbit li:nth-child(4) { right: -13%; top: 74%; }

.transfer-slot { width: min(100%, 234px); }
#together [data-transfer-source] { margin-left: auto; }

.together-handoff, .avatar-handoff {
  position: relative;
  isolation: isolate;
  margin-top: clamp(22px, 6vw, 76px);
}

.together-handoff__photo { display: none; }

.avatar-handoff {
  min-height: 108px;
  display: grid;
  align-items: end;
}

.avatar-handoff::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -30px 0 -24px;
  background: radial-gradient(ellipse at 82% 90%, rgba(232, 175, 120, .38), rgba(232, 175, 120, .1) 38%, transparent 70%);
  pointer-events: none;
}
#avatar [data-transfer-destination] { margin-left: 0; }
#avatar [data-transfer-source] { margin-left: auto; }

#nutrition.scene--nutrition {
  padding-top: clamp(38px, 6vw, 76px);
}
#nutrition [data-transfer-destination] {
  grid-column: 1 / -1;
  margin-top: calc(-1 * clamp(19px, 3vw, 37px));
}

.transfer-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 227, 194, .55);
  border-radius: 15px;
  background: #4c3328;
  color: #fff5e7;
  box-shadow: 0 8px 24px rgba(13, 10, 10, .26);
  font: inherit;
  line-height: 1.2;
}
.transfer-card strong { display: block; font-weight: 650; }
.transfer-card small { display: block; margin-top: 3px; color: #f2d7ba; font-size: .78rem; }
.transfer-icon {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #f0cfaa;
  color: #3a271e;
  font-size: 1.12rem;
  font-weight: 650;
}

#avatar .transfer-arrival { background: #4e373c; }
.transfer-slot--progress .transfer-card { background: #4c402a; }
.transfer-flight {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 25;
  pointer-events: none;
  margin: 0;
  transform-origin: 0 0;
}
.transfer-flight[hidden] { display: none; }
.transfer-flight .transfer-object { width: 100%; height: 100%; }
.is-transferring > .transfer-object,
.is-transferring > .transfer-arrival,
.has-transfer-motion .is-transfer-pending > .transfer-arrival,
.has-transfer-motion .is-transfer-spent > .transfer-object { visibility: hidden; }

@media (min-width: 760px) {
  #avatar .figure__step {
    min-height: clamp(350px, 56svh, 620px);
    padding: clamp(22px, 4vw, 44px);
    margin-block: 5px;
    border-radius: 22px;
    border: 1px solid rgba(251, 219, 197, .13);
    background: rgba(42, 30, 34, .76);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .scenes-motion #avatar .figure__stage.is-ready .orbit li {
    animation: none;
    transition: translate .64s cubic-bezier(.2, .74, .23, 1), opacity .48s ease;
  }
  .has-avatar-reveal #avatar .figure__stage:not(.is-avatar-revealed) .orbit li {
    translate: var(--rise-x, 0px) 28px;
    opacity: 0;
  }
  #avatar .orbit li:nth-child(odd) { --rise-x: 42px; }
  #avatar .orbit li:nth-child(even) { --rise-x: -42px; }
  .has-avatar-reveal #avatar .avatar-halo {
    transform: scale(calc(.83 + var(--avatar-reveal, 0) * .2));
    opacity: calc(.63 + var(--avatar-reveal, 0) * .37);
    transform-origin: center 80%;
    transition: transform .82s ease, opacity .82s ease;
  }
  .scenes-motion #avatar .figure:not(.is-compact) .figure__step {
    translate: 22px 0;
    transition: translate .62s cubic-bezier(.2, .74, .23, 1), background-color .45s ease, border-color .45s ease;
  }
  .scenes-motion #avatar .figure:not(.is-compact) .figure__step.is-active,
  .scenes-motion #avatar .figure:not(.is-compact) .figure__step:focus-within {
    translate: 0;
    background: rgba(66, 44, 43, .88);
    border-color: rgba(251, 219, 197, .43);
  }
}

@media (max-width: 759px) {
  #together.scene--together {
    --scene-image-height: clamp(340px, 92vw, 510px);
    --scene-image-x: 50%;
    --scene-image-y: 23%;
    --scene-wash: linear-gradient(0deg, rgba(23, 16, 12, .22), transparent 75%);
    padding-top: clamp(244px, 69vw, 360px);
  }
  #avatar.scene--avatar {
    --scene-image-height: min(100%, 740px);
    --scene-image-x: 56%;
    --scene-image-y: center;
    --scene-wash: linear-gradient(180deg, rgba(41, 31, 35, .71), transparent 57%);
  }
  #avatar .avatar-intro { margin-bottom: 16px; }
  #avatar .figure.is-compact .figure__step { background: #3f2c2f; border-color: #735657; }
  #avatar .figure__sticky { background: none; }
  #avatar .orbit li:nth-child(1) { left: -4%; }
  #avatar .orbit li:nth-child(2) { right: -5%; }
  #avatar .orbit li:nth-child(3) { left: -3%; }
  #avatar .orbit li:nth-child(4) { right: -7%; top: 78%; }
  .together-handoff {
    display: grid;
    align-items: end;
    min-height: clamp(140px, 42vw, 210px);
    margin-top: 16px;
  }
  .together-handoff__photo {
    display: block;
    position: absolute;
    inset: 0 calc(-1 * var(--gutter-r)) -18px calc(-1 * var(--gutter));
    overflow: hidden;
    z-index: -1;
  }
  .together-handoff__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 70%;
  }
  .together-handoff__photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #261d17, rgba(38, 29, 23, .13) 40%, rgba(38, 29, 23, .15) 63%, #261d17);
  }
  #nutrition[data-scene] { padding-top: clamp(242px, 63vw, 405px); }
  #nutrition [data-transfer-destination] {
    position: absolute;
    inset: clamp(20px, 8vw, 48px) auto auto var(--gutter);
    margin-top: 0;
  }
  #nutrition .split--photo { position: static; }
}

@media (forced-colors: active) {
  #together.scene--together, #avatar.scene--avatar { background: Canvas; }
  .avatar-halo, .transfer-slot { display: none; }
}

/* The transfer wrapper tracks its anchors. Its child adds a separate perspective and depth. */
.transfer-flight { perspective: 740px; }
.transfer-depth {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform:
    translateZ(calc(82px * var(--flight-depth, 0)))
    rotateY(calc(28deg * var(--flight-yaw, 0)))
    rotateX(calc(20deg * var(--flight-pitch, 0)));
}
.transfer-depth::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(238, 186, 130, .48);
  border-radius: 15px;
  background: #32231d;
  box-shadow: 0 6px #30201b, 0 12px 24px rgba(0, 0, 0, .4);
  opacity: var(--flight-depth, 0);
  transform: translateZ(-9px);
}
.transfer-depth > .transfer-object {
  position: relative;
  width: 100%;
  height: 100%;
  transform: translateZ(1px);
}
.transfer-depth > .transfer-object::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(124deg, rgba(255, 234, 209, .22), transparent 55%);
  opacity: var(--flight-depth, 0);
}

.avatar-platform {
  position: absolute;
  z-index: -1;
  inset: auto 9% -1%;
  aspect-ratio: 3.4;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(ellipse, rgba(255, 211, 159, .24), rgba(255, 211, 159, .05) 57%, transparent 68%);
  border: 1px solid rgba(255, 215, 171, .4);
}
.avatar-platform::after {
  content: "";
  position: absolute;
  inset: 10% 4%;
  border: 1px solid rgba(255, 214, 177, .4);
  border-radius: 50%;
}

#avatar [data-avatar-pop] {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  perspective: 540px;
  pointer-events: none;
}
#avatar [data-avatar-pop] span {
  display: block;
  padding: 8px 14px;
  border: 1px solid #92706b;
  border-radius: 999px;
  color: #fff5e9;
  background: #4b3436;
  box-shadow: 0 5px 12px rgba(22, 13, 15, .32);
}

@media (prefers-reduced-motion: no-preference) {
  .has-avatar-reveal #avatar [data-avatar-pop="0"] { --pop-index: 0; --pop-direction: 1; }
  .has-avatar-reveal #avatar [data-avatar-pop="1"] { --pop-index: 1; --pop-direction: -1; }
  .has-avatar-reveal #avatar [data-avatar-pop="2"] { --pop-index: 2; --pop-direction: 1; }
  .has-avatar-reveal #avatar [data-avatar-pop="3"] { --pop-index: 3; --pop-direction: -1; }

  .has-avatar-reveal #avatar [data-avatar-pop] span {
    --pop: clamp(0, calc(var(--avatar-depth, 0) * 1.8 - .24 * var(--pop-index)), 1);
    --emerge: calc(1 - var(--pop));
    opacity: var(--pop);
    transform:
      translate3d(calc(30px * var(--emerge) * var(--pop-direction)), calc(20px * var(--emerge)), calc(-145px * var(--emerge)))
      rotateY(calc(48deg * var(--emerge) * var(--pop-direction)));
  }
  .has-avatar-reveal #avatar .figure__stage:focus-within [data-avatar-pop] span {
    --pop: 1;
  }
  .has-avatar-reveal #avatar .avatar-platform {
    transform: scale(calc(.8 + var(--avatar-reveal, 0) * .2));
    opacity: calc(.3 + var(--avatar-reveal, 0) * .7);
    transition: transform .72s ease, opacity .72s ease;
  }
}

@media (max-width: 759px) {
  #avatar [data-avatar-pop] span { padding: 6px 10px; }
}
