/*
 * Tide imagery layer. Load after styles.css, education.css, and fullsite.css.
 * Markup and asset selection remain owned by the page integration.
 * Images always occupy their own layout track, never a copy/CTA overlay.
 */

/* Principal care paths: full vials float above the existing dark waves. */
:is(.care-card, .priority-care-card).has-floating-product {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 20px;
  align-items: center;
  min-width: 0;
  min-height: 350px;
  padding: clamp(28px, 2.5vw, 38px);
  overflow: hidden;
  isolation: isolate;
}

:is(.care-card, .priority-care-card).has-floating-product > * {
  min-width: 0;
}

.priority-care-card.has-floating-product::before {
  content: '';
  position: absolute;
  inset: -4%;
  z-index: -2;
  background-image: var(--texture);
  background-size: cover;
  background-position: center;
  opacity: .75;
  transition: transform .65s ease;
  pointer-events: none;
}

.priority-care-card.has-floating-product::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(7, 22, 24, .95), rgba(7, 22, 24, .12));
  pointer-events: none;
}

.priority-care-card.peptide.has-floating-product {
  background-color: var(--deep);
}

.priority-care-card.peptide.has-floating-product::before {
  background-position: 70% 50%;
  opacity: 1;
}

.priority-care-card.peptide.has-floating-product::after {
  background: linear-gradient(90deg, rgba(4, 56, 56, .9), rgba(4, 56, 56, .08));
}

:is(.care-card, .priority-care-card).has-floating-product .care-card-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  align-self: stretch;
  min-width: 0;
}

:is(.care-card, .priority-care-card).has-floating-product h3 {
  max-width: 100%;
  margin-bottom: 14px;
  font-size: clamp(28px, 2.6vw, 38px);
  line-height: 1.18;
  text-wrap: balance;
  overflow-wrap: break-word;
}

:is(.care-card, .priority-care-card).has-floating-product p {
  max-width: 100%;
  margin-top: 0;
  color: #e5eeea;
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

:is(.care-card, .priority-care-card).has-floating-product .card-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  margin-top: 0;
  padding-top: 24px;
  color: var(--paper);
  line-height: 1.5;
  text-wrap: pretty;
}

:is(.care-card, .priority-care-card).has-floating-product .care-card-copy > .card-link {
  margin-top: auto;
}

:is(.care-card, .priority-care-card).has-floating-product .care-product-float {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 320px;
  justify-self: end;
  margin: 0;
  padding-block: 12px;
  pointer-events: none;
  transform-origin: 50% 60%;
  transition: transform .45s ease;
}

:is(.care-card, .priority-care-card).has-floating-product .care-product-float img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 300px;
  margin: 0;
  object-fit: contain;
  filter: drop-shadow(0 16px 12px rgba(0, 0, 0, .24));
  animation: tide-product-float 6s ease-in-out infinite;
  transition: filter .45s ease;
}

.priority-care-card.peptide.has-floating-product .care-product-float img,
.care-card.peptide.has-floating-product .care-product-float img {
  animation-delay: -3s;
}

@keyframes tide-product-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(8px) rotate(1deg); }
}

@media (hover: hover) and (pointer: fine) {
  :is(.care-card, .priority-care-card).has-floating-product:hover .care-product-float {
    transform: translateY(-2px) scale(1.035);
  }
  :is(.care-card, .priority-care-card).has-floating-product:hover .care-product-float img {
    filter: drop-shadow(0 23px 16px rgba(0, 0, 0, .32));
  }
  .priority-care-card.has-floating-product:hover::before {
    transform: scale(1.04);
  }
}

:is(a.care-card, a.priority-care-card).has-floating-product:focus-visible {
  outline: 3px solid var(--deep);
  outline-offset: 5px;
}

:is(.care-card, .priority-care-card).has-floating-product :is(a, button):focus-visible {
  outline: 3px solid var(--mist);
  outline-offset: 4px;
}

/* Lifestyle treatment heroes: proportional photography, not cropped bodies. */
.care-hero.has-lifestyle-hero .care-hero-grid,
.utility-hero.treatment-hero .utility-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: clamp(32px, 4.5vw, 64px);
  align-items: center;
}

.care-hero.has-lifestyle-hero .care-hero-grid > *,
.utility-hero.treatment-hero .utility-hero-grid > * {
  min-width: 0;
}

.care-hero.has-lifestyle-hero .care-hero-copy,
.utility-hero.treatment-hero .utility-hero-copy {
  min-width: 0;
  max-width: 720px;
}

.care-hero.has-lifestyle-hero h1,
.utility-hero.treatment-hero h1 {
  max-width: 17ch;
  font-size: clamp(46px, 4.9vw, 74px);
  line-height: 1.09;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.care-hero.has-lifestyle-hero .care-hero-intro,
.utility-hero.treatment-hero :is(.utility-intro, .utility-hero-intro, .intro) {
  max-width: 60ch;
  margin-top: 24px;
  color: #d9e4df;
  font-size: clamp(18px, 1.5vw, 21px);
  line-height: 1.6;
}

.care-hero.has-lifestyle-hero .breadcrumb,
.utility-hero.treatment-hero .breadcrumb {
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.care-hero.has-lifestyle-hero .care-hero-photo,
.utility-hero.treatment-hero .utility-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: 100%;
  max-width: 480px;
  height: clamp(380px, 42vw, 550px);
  max-height: 550px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(201, 226, 223, .13);
  border-radius: 6px;
  background: radial-gradient(ellipse at 50% 45%, #213b3b, var(--pine-dark) 90%);
}

.care-hero.has-lifestyle-hero .care-hero-photo img,
.utility-hero.treatment-hero .utility-photo img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
}

.care-hero.has-lifestyle-hero .hero-actions,
.utility-hero.treatment-hero .hero-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 28px;
}

.care-hero.has-lifestyle-hero .hero-actions :is(a, button),
.utility-hero.treatment-hero .hero-actions :is(a, button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  white-space: normal;
  text-align: center;
  overflow-wrap: break-word;
}

.care-hero.has-lifestyle-hero :is(a, button, summary):focus-visible,
.utility-hero.treatment-hero :is(a, button, summary):focus-visible {
  outline: 3px solid var(--mist);
  outline-offset: 4px;
}

/* Maya: human-scale portrait, intrinsic height, and no production captions. */
.provider-layout {
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 48px;
}

.provider-photo {
  width: 100%;
  max-width: 320px;
  margin: 0;
}

.provider-layout > img,
.provider-photo img {
  width: 100%;
  max-width: 320px;
  height: auto;
  max-height: none;
  object-fit: contain;
}

/* Supporting options: preserve every edge of transparent or opaque imagery. */
.supporting-product {
  background: linear-gradient(135deg, #f7f7ef 0%, #eef3ec 60%, var(--paper) 100%);
}

.supporting-product-grid {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.supporting-product-grid > * { min-width: 0; }

.supporting-product-media {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: clamp(16px, 2vw, 28px);
  border-radius: 6px;
  background: radial-gradient(ellipse at center, #ffffff 0%, #f5f6ee 65%, #e9efE7 100%);
}

.supporting-product-media img {
  display: block;
  width: 100%;
  max-width: 460px;
  height: auto;
  max-height: 460px;
  margin: 0;
  object-fit: contain;
  object-position: center;
}

.supporting-product-copy { max-width: 680px; }
.supporting-product-copy .eyebrow { margin-bottom: 13px; color: var(--deep); }
.supporting-product-copy h2 { font-size: clamp(35px, 3.8vw, 54px); overflow-wrap: break-word; }
.supporting-product-copy > p { margin-top: 20px; color: #475653; font-size: 18px; line-height: 1.7; }

.supporting-product-copy .clinical-note {
  max-width: 100%;
  margin-top: 24px;
  padding-left: 18px;
  border-left: 2px solid var(--teal);
  color: #475653;
  font-size: 16px;
  line-height: 1.7;
}

.supporting-product-copy .card-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  margin-top: 20px;
  padding-block: 9px;
  color: var(--deep);
  overflow-wrap: break-word;
}

.supporting-product-copy a:hover { text-decoration: underline; text-underline-offset: 4px; }
.supporting-product-copy :is(a, button):focus-visible { outline: 3px solid var(--deep); outline-offset: 4px; }

/* Only lead-care lower frames become text-only; homepage lifestyle is untouched. */
.care-lifestyle .lifestyle-frame { grid-template-columns: minmax(0, 1fr); }
.care-lifestyle .lifestyle-copy { width: 100%; max-width: 900px; padding: 48px; }

/* Collapse pairs before narrower columns can compromise card copy. */
@media (max-width: 1000px) {
  .care-grid:has(> .has-floating-product),
  .priority-care-grid:has(> .has-floating-product) {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  /* display:contents exposes only these hero copies to the photo-ordering grid. */
  .care-hero.has-lifestyle-hero .care-hero-grid,
  .utility-hero.treatment-hero .utility-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'eyebrow' 'title' 'photo' 'intro' 'actions';
    gap: 20px;
    align-items: start;
  }

  .care-hero.has-lifestyle-hero .care-hero-copy,
  .utility-hero.treatment-hero .utility-hero-copy { display: contents; }

  .care-hero.has-lifestyle-hero .care-hero-copy > .eyebrow,
  .utility-hero.treatment-hero .utility-hero-copy > .eyebrow {
    grid-area: eyebrow;
    margin: 0;
  }

  .care-hero.has-lifestyle-hero .care-hero-copy > h1,
  .utility-hero.treatment-hero .utility-hero-copy > h1 {
    grid-area: title;
    max-width: 18ch;
    font-size: clamp(36px, 8.8vw, 54px);
  }

  .care-hero.has-lifestyle-hero .care-hero-photo,
  .utility-hero.treatment-hero .utility-photo {
    grid-area: photo;
    justify-self: start;
    height: clamp(260px, 65vw, 300px);
    max-height: 300px;
    margin-block: 4px;
  }

  .care-hero.has-lifestyle-hero .care-hero-copy > .care-hero-intro,
  .utility-hero.treatment-hero .utility-hero-copy > :is(.utility-intro, .utility-hero-intro, .intro) {
    grid-area: intro;
    margin: 0;
    font-size: 18px;
  }

  .care-hero.has-lifestyle-hero .care-hero-copy > .hero-actions,
  .utility-hero.treatment-hero .utility-hero-copy > .hero-actions {
    grid-area: actions;
    margin: 4px 0 0;
  }

  .provider-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .provider-photo,
  .provider-layout > img { max-width: min(300px, 80vw); }
  .provider-photo img { max-width: 100%; height: auto; max-height: none; }

  .supporting-product-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .supporting-product-media { max-width: 520px; justify-self: center; }
  .supporting-product-copy { max-width: 100%; }
  .care-lifestyle .lifestyle-copy { padding: 32px; }
}

@media (max-width: 580px) {
  :is(.care-card, .priority-care-card).has-floating-product {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr);
    gap: 12px;
    min-height: 350px;
    padding: 26px 22px;
  }

  :is(.care-card, .priority-care-card).has-floating-product h3 {
    font-size: clamp(24px, 6.7vw, 32px);
    margin-bottom: 14px;
  }

  :is(.care-card, .priority-care-card).has-floating-product p {
    font-size: 16px;
    line-height: 1.6;
  }

  :is(.care-card, .priority-care-card).has-floating-product .care-product-float {
    padding-block: 12px;
    max-width: 180px;
  }

  .care-hero.has-lifestyle-hero,
  .utility-hero.treatment-hero { padding-block: 26px 40px; }

  .care-hero.has-lifestyle-hero .breadcrumb,
  .utility-hero.treatment-hero .breadcrumb { margin-bottom: 26px; }

  .care-hero.has-lifestyle-hero .care-hero-copy > .care-hero-intro,
  .utility-hero.treatment-hero .utility-hero-copy > :is(.utility-intro, .utility-hero-intro, .intro) {
    font-size: 17px;
  }

  .care-hero.has-lifestyle-hero .hero-actions,
  .utility-hero.treatment-hero .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .care-hero.has-lifestyle-hero .hero-actions :is(a, button),
  .utility-hero.treatment-hero .hero-actions :is(a, button) { min-height: 44px; }

  .provider-layout { gap: 26px; }
  .provider-photo { max-width: min(300px, 80vw); }

  .supporting-product-media { max-width: 360px; padding: 20px; }
  .supporting-product-media img { max-width: 320px; max-height: 360px; height: auto; }
  .supporting-product-copy > p { font-size: 17px; }
  .supporting-product-copy .clinical-note { font-size: 16px; padding-left: 16px; }
  .care-lifestyle .lifestyle-copy { padding: 28px 22px; }
}

/* On small phones, the product sits beside the title; prose spans both tracks. */
@media (max-width: 389px) {
  :is(.care-card, .priority-care-card).has-floating-product {
    grid-template-rows: auto auto;
    gap: 18px 10px;
    align-content: center;
    align-items: center;
    padding-inline: 20px;
  }

  :is(.care-card, .priority-care-card).has-floating-product .care-card-copy { display: contents; }

  :is(.care-card, .priority-care-card).has-floating-product .care-card-copy > h3 {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    font-size: clamp(23px, 6.5vw, 25px);
  }

  :is(.care-card, .priority-care-card).has-floating-product .care-product-float {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    padding-block: 10px;
  }

  :is(.care-card, .priority-care-card).has-floating-product .care-card-copy > p {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  :is(.care-card, .priority-care-card).has-floating-product .care-card-copy > .card-link {
    grid-column: 1 / -1;
    margin: 0;
    padding-top: 6px;
  }

  /* Optional overview labels retain a track rather than overlapping the title. */
  :is(.care-card, .priority-care-card).has-floating-product .care-card-copy > :is(.eyebrow, .care-number) {
    grid-column: 1 / -1;
    grid-row: 1;
    margin: 0;
  }

  :is(.care-card, .priority-care-card).has-floating-product:has(.care-card-copy > :is(.eyebrow, .care-number)) .care-card-copy > h3,
  :is(.care-card, .priority-care-card).has-floating-product:has(.care-card-copy > :is(.eyebrow, .care-number)) .care-product-float {
    grid-row: 2;
  }

  :is(.care-card, .priority-care-card).has-floating-product:has(.care-card-copy > :is(.eyebrow, .care-number)) .care-card-copy > p {
    grid-row: 3;
  }
}

/* Disable owned animation AND hover transforms, not just animation duration. */
@media (prefers-reduced-motion: reduce) {
  :is(.care-card, .priority-care-card).has-floating-product,
  :is(.care-card, .priority-care-card).has-floating-product::before,
  :is(.care-card, .priority-care-card).has-floating-product::after,
  :is(.care-card, .priority-care-card).has-floating-product *,
  :is(.care-card, .priority-care-card).has-floating-product *::before,
  :is(.care-card, .priority-care-card).has-floating-product *::after,
  :is(.care-hero.has-lifestyle-hero, .utility-hero.treatment-hero, .supporting-product, .provider-layout, .care-lifestyle),
  :is(.care-hero.has-lifestyle-hero, .utility-hero.treatment-hero, .supporting-product, .provider-layout, .care-lifestyle)::before,
  :is(.care-hero.has-lifestyle-hero, .utility-hero.treatment-hero, .supporting-product, .provider-layout, .care-lifestyle)::after,
  :is(.care-hero.has-lifestyle-hero, .utility-hero.treatment-hero, .supporting-product, .provider-layout, .care-lifestyle) *,
  :is(.care-hero.has-lifestyle-hero, .utility-hero.treatment-hero, .supporting-product, .provider-layout, .care-lifestyle) *::before,
  :is(.care-hero.has-lifestyle-hero, .utility-hero.treatment-hero, .supporting-product, .provider-layout, .care-lifestyle) *::after {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}
