/* Real-time 3D layers replacing baked media (hero video, DNA frame
   sequence, capsule still). Models live in /models, logic in js/ggg-3d.js. */

model-viewer {
  contain: layout paint style;
}

model-viewer > .ggg-three-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---- Science hero: glass DNA over the dark hero ---- */
.ggg-hero-3d {
  background: radial-gradient(120% 90% at 70% 20%, #232c2a 0%, var(--green, #16231b) 58%, #10160f 100%);
}

.ggg-hero-3d .hero-dna {
  position: absolute;
  inset: -6% -4%;
  width: auto;
  height: auto;
  z-index: 0;
  pointer-events: none;
  --poster-color: transparent;
  --progress-bar-color: transparent;
  --progress-bar-height: 0px;
}

.hero-dna-mobile,
.impact-dna-sequence {
  display: none;
}

.ggg-hero-3d .hero-dna::part(default-progress-bar) {
  display: none;
}

.ggg-hero-3d .hero-shade {
  z-index: 1;
}

.ggg-hero-3d .hero-inner {
  position: relative;
  z-index: 2;
}

/* ---- Impact section: scroll-rotating DNA instead of 151 webp frames ---- */
.impact-dna {
  width: 100%;
  height: min(72vh, 640px);
  display: block;
  pointer-events: none;
  --poster-color: transparent;
  --progress-bar-color: transparent;
  --progress-bar-height: 0px;
}

.impact-dna::part(default-progress-bar) {
  display: none;
}

/* ---- Nutrient section: capsule opening scrubbed by scroll ---- */
.nutrient-capsule-3d {
  width: 100%;
  height: min(78vh, 680px);
  display: block;
  pointer-events: none;
  transform: translateY(var(--nutrient-y, 0px)) rotate(var(--nutrient-rotate, 0deg));
  will-change: transform;
  --poster-color: transparent;
  --progress-bar-color: transparent;
  --progress-bar-height: 0px;
}

.nutrient-capsule-3d::part(default-progress-bar) {
  display: none;
}

@media (max-width: 880px) {
  .impact-dna { height: 52vh; }
  .nutrient-capsule-3d { height: 100%; }
}

/* ---- intro end screen: bottle above, wordmark + CTA anchored below ---- */
.gut-intro-footer {
  justify-content: flex-end;
  padding-bottom: 8vh;
}

.gut-intro-panel .gut-intro-giant {
  font-size: clamp(48px, 7.4vw, 130px);
}

.gut-intro-cta {
  margin-top: clamp(30px, 5vh, 54px);
}

.gut-intro-fine {
  margin-top: clamp(20px, 3.4vh, 36px);
}

@media (max-width: 760px) {
  /* the live animated DNA now runs on phones too (66KB model); the photo
     below doubles as its instant poster and fades once the model is in */
  .ggg-hero-3d .hero-dna {
    display: block;
  }

  .hero-dna-mobile {
    position: absolute;
    inset: -4% -8%;
    z-index: 0;
    display: block;
    width: 116%;
    height: 108%;
    object-fit: cover;
    pointer-events: none;
    animation: ggg-mobile-dna-float 14s ease-in-out infinite alternate;
    will-change: transform;
    transition: opacity .6s ease;
  }

  .ggg-hero-3d .hero-dna.is-three-ready ~ .hero-dna-mobile {
    opacity: 0;
  }

  .ggg-hero-3d .hero-shade {
    background:
      linear-gradient(90deg, rgba(8, 16, 14, .5), rgba(8, 16, 14, .08) 58%, rgba(8, 16, 14, .28)),
      linear-gradient(180deg, rgba(8, 16, 14, .02), rgba(8, 16, 14, .5));
  }

  .impact-visual {
    min-height: 360px;
    background: #f4f2ed;
  }

  .impact-dna {
    display: none;
  }

  .impact-dna-sequence {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 360px;
    object-fit: contain;
    background: #f4f2ed;
    pointer-events: none;
    transform: translateZ(0);
  }

  .gut-intro-footer {
    padding-bottom: 6vh;
  }
}

@keyframes ggg-mobile-dna-float {
  from { transform: translate3d(0, -1.2%, 0) scale(1.04); }
  to { transform: translate3d(-1.8%, 1%, 0) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-dna-mobile { animation: none; }
}

/* ---- animated wireframe process icons (each has its own motion) ---- */
.ggg-principles article {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.ggg-icon {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
  opacity: 1;
  filter:
    brightness(0)
    saturate(100%)
    invert(94%)
    sepia(77%)
    saturate(761%)
    hue-rotate(28deg)
    brightness(108%)
    contrast(102%)
    drop-shadow(0 0 12px rgba(214, 253, 112, .08));
}

.ggg-icon--asset {
  animation: ggg-icon-breathe 4.8s ease-in-out infinite;
}

@keyframes ggg-icon-breathe {
  0%, 100% { transform: translateY(0); opacity: .82; }
  50% { transform: translateY(-3px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .ggg-icon--asset { animation: none; }
}



/* ---- full-page loading gate: site reveals only when assets are ready ---- */
.ggg-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white, #f8f7f5);
  transition: opacity .42s cubic-bezier(.16, 1, .3, 1), visibility .42s step-end;
}

/* The loader remains as a background warm-up sentinel, but must never cover
   the authored landing animation. `!important` is required because the
   component's display:flex rule otherwise overrides the HTML hidden state. */
.ggg-loader img {
  width: min(30vw, 220px);
  height: auto; /* the height ATTRIBUTE otherwise sticks and squashes the mark */
  /* crisp full-strength logo - the washed-out pulse read as "broken" */
}

/* the house lime sweep doubles as the loading cue */
.ggg-loader::after {
  content: "";
  position: absolute;
  top: calc(50% + 54px);
  left: 50%;
  width: 140px;
  height: 3px;
  transform: translateX(-50%);
  border-radius: 999px;
  background:
    linear-gradient(90deg, transparent 0 30%, #d6fd70 30% 70%, transparent 70%),
    #e7e6e2;
  background-size: 250% 100%, 100% 100%;
  background-repeat: no-repeat;
  animation: ggg-loader-sweep 1.15s cubic-bezier(.45, 0, .55, 1) infinite;
}

@keyframes ggg-loader-sweep {
  0% { background-position: 120% 0, 0 0; }
  100% { background-position: -85% 0, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ggg-loader::after { animation: none; background: #d6fd70; width: 90px; }
}

.ggg-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.ggg-loading {
  overflow: hidden;
}


/* ---- end screen: give the bottle a comfortable band ---- */
.gut-intro-footer {
  justify-content: flex-end;
  padding-bottom: 5vh;
}

.gut-intro-panel .gut-intro-giant {
  font-size: clamp(38px, 5.6vw, 96px);
}

.gut-intro-cta {
  margin-top: clamp(18px, 2.8vh, 30px);
}

.gut-intro-fine {
  margin-top: clamp(12px, 2vh, 22px);
}

/* Tree CTA sizing is owned by wellbase-gutgut.css so mobile can use the
   independent scroll-scrubbed video layout. */


/* scroll-driven accordion: keep the browser's scroll anchoring from
   yanking the page when an item above the viewport collapses */
.impact-section .accordion-list {
  overflow-anchor: none;
}

@media (max-width: 760px) {
  /* Instagram/Facebook in-app browsers animate their own chrome and report a
     changing lvh. The intro JS records one reliable viewport height for those
     browsers so the bottle canvas and its text layer stay on the same plane. */
  .ggg-inapp-webview .gut-intro-webgl {
    height: var(--ggg-inapp-vh, var(--app-vh, 100vh));
  }

  .ggg-inapp-webview .gut-intro {
    min-height: var(--ggg-inapp-intro-h, 576svh);
  }

  .ggg-inapp-webview .gut-intro-panel {
    min-height: var(--ggg-inapp-vh, var(--app-vh, 100vh));
  }

  /* Keep social-browser opening claims in their own top row. The bottle
     stays full size below them and the two lower claims keep their authored
     row above the microbiome sentence. */
  .ggg-inapp-webview .gut-intro-chip.chip-a,
  .ggg-inapp-webview .gut-intro-chip.chip-b {
    top: 3%;
    bottom: auto;
  }

  .ggg-inapp-webview .gut-intro-chip.chip-a {
    left: 0;
  }

  .ggg-inapp-webview .gut-intro-chip.chip-b {
    right: 0;
  }

  .gut-intro-stage {
    transition: opacity .3s cubic-bezier(.16, 1, .3, 1);
  }

  .gut-intro-content .gut-intro-side > .gut-intro-reveal {
    transition: opacity .3s cubic-bezier(.16, 1, .3, 1);
  }

  .gut-intro.gut-intro-closing .gut-intro-stage,
  .gut-intro.gut-intro-closing .gut-intro-content .gut-intro-side > .gut-intro-reveal {
    opacity: 0;
  }

  .ggg-inapp-webview .gut-intro-content {
    margin-top: calc(-1 * var(--ggg-inapp-vh, var(--app-vh, 100vh)));
  }

  .ggg-inapp-webview .gut-intro-lane {
    height: calc(var(--ggg-inapp-vh, var(--app-vh, 100vh)) - var(--gut-lane-top, 46svh));
  }

  .ggg-inapp-webview .gut-intro-lane .gut-intro-panel {
    height: var(--ggg-inapp-vh, var(--app-vh, 100vh));
  }

  .ggg-inapp-webview .gut-intro-footer {
    min-height: var(--ggg-inapp-footer-h, 76svh);
    --gut-footer-fit-compensation: var(--ggg-inapp-fit-comp, 10svh);
  }

  /* The phone ending is intentionally compact: the bottle settles while the
     wordmark and Buy action rise into the same viewport. */
  .gut-intro {
    min-height: 576vh;
    min-height: 576svh;
  }

  .gut-intro-footer {
    min-height: 76vh;
    min-height: 76svh;
    --gut-footer-fit-compensation: 10svh;
    /* Lower the closing wordmark, CTA and guarantee as one unit. The former
       22svh inset pushed the group into the bottle/capsule band on iPhones. */
    padding-bottom: max(12svh, calc(env(safe-area-inset-bottom) + 52px));
  }
}
