/* ==========================================================================
   VETRADENT 02 · patterns.css
   Shared block patterns used across templates.
   ========================================================================== */

/* ---------- spinning text badge ---------- */
.vd-badge { position: relative; aspect-ratio: 1; width: 7rem; filter: drop-shadow(0 12px 18px rgb(53 23 71 / .3)); }
.vd-badge__ring { width: 100%; height: 100%; animation: vd-spin 16s linear infinite; }
.vd-badge__ring circle { fill: var(--wp--preset--color--accent); }
.vd-badge__ring text { font-family: var(--wp--preset--font-family--body); font-size: 17px; font-weight: 800; letter-spacing: .08em; fill: var(--wp--preset--color--primary); }
.vd-badge__icon { position: absolute; inset: 0; margin: auto; width: 38%; height: auto; }
.vd-badge:hover .vd-badge__ring { animation-duration: 4s; }

/* ---------- find-your-fit CTA ---------- */
.cta-fit { padding: var(--wp--preset--spacing--70) 0 0; overflow-x: clip; }
.cta-fit__card {
  position: relative; overflow: visible; width: calc(100% - 2 * clamp(.5rem, 2vw, 1.5rem)); max-width: 760px; margin-inline: auto;
  padding: var(--wp--preset--spacing--80) var(--wp--preset--spacing--50) var(--wp--preset--spacing--70);
  text-align: center; display: grid; justify-items: center; gap: 1.1rem;
  background:
    radial-gradient(30rem 20rem at 100% 0%, rgb(255 220 0 / .25), transparent 60%),
    radial-gradient(30rem 20rem at 0% 100%, rgb(160 130 187 / .45), transparent 60%),
    var(--wp--preset--color--primary);
}
@media (min-width: 80rem) { .cta-fit__card { margin-inline: auto; } }
.cta-fit__title { color: #fff; font-size: var(--wp--preset--font-size--xx-large); max-width: 15ch; }
.cta-fit__text { color: rgb(255 255 255 / .85); max-width: 32rem; margin: 0; }
.cta-fit__peek { position: absolute; height: 6.5rem; width: auto; pointer-events: none; }
.cta-fit__peek.is-a { left: .35rem; top: -2rem; rotate: -14deg; }
.cta-fit__peek.is-b { right: .5rem; bottom: -2.25rem; rotate: 12deg; }
@media (min-width: 64rem) { .cta-fit__peek { height: 10rem; } .cta-fit__peek.is-a { left: -3rem; } .cta-fit__peek.is-b { right: -2rem; } }

/* ---------- disease stages (scrollytelling) ---------- */
.stages { padding: var(--wp--preset--spacing--80) var(--wp--preset--spacing--50); }
.stages__track { max-width: var(--wp--custom--layout--wide); margin-inline: auto; }
.stages__head { display: grid; gap: 1rem; justify-items: center; text-align: center; margin-bottom: var(--wp--preset--spacing--60); }
.stages__title { font-size: var(--wp--preset--font-size--x-large); max-width: 18ch; }
.stages__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.stage { display: grid; gap: .75rem; }
.stage__frame { position: relative; margin: 0; border-radius: 1.75rem; overflow: hidden; background: #efeff0; box-shadow: var(--wp--preset--shadow--soft); }
.stage__frame img:first-child { width: 100%; }
.stage__label {
  display: flex; align-items: center; gap: .65rem; margin: 0;
  font-family: var(--wp--preset--font-family--body); font-weight: 700;
  color: var(--wp--preset--color--primary);
}
.stage__num {
  display: grid; place-items: center; flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: var(--wp--preset--color--accent); color: var(--wp--preset--color--ink); font-size: .75rem; font-weight: 800;
}
.stage__expletive { position: absolute; width: 20%; right: 5%; top: 6%; }
.stages__rail { display: none; }

@media (prefers-reduced-motion: no-preference) {
@supports (animation-timeline: view()) {
  html:not(.no-heavy-scrolly) .stages { height: 340svh; padding: 0; view-timeline-name: --stages; }
  html:not(.no-heavy-scrolly) .stages__track {
    position: sticky; top: 0; height: 100svh; max-width: none;
    display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 1.25rem;
    padding: 6.5rem 1rem calc(var(--wp--custom--dock--height) + 2rem);
  }
  html:not(.no-heavy-scrolly) .stages__head { margin: 0; position: relative; z-index: 2; }
  html:not(.no-heavy-scrolly) .stages__list { position: relative; display: block; min-height: 0; overflow: hidden; }
  html:not(.no-heavy-scrolly) .stage {
    position: absolute; inset: 0; align-content: center; justify-items: center; gap: 1rem;
    max-height: 100%; box-sizing: border-box; padding-block: .25rem;
    animation: stage-mid linear both; animation-timeline: --stages;
    animation-range: contain calc(var(--s) * 33.333%) contain calc(var(--s) * 33.333% + 33.333%);
  }
  html:not(.no-heavy-scrolly) .stage:first-child { animation-name: stage-first; }
  html:not(.no-heavy-scrolly) .stage:last-child { animation-name: stage-last; }
  html:not(.no-heavy-scrolly) .stage__frame { width: min(100%, 36rem); max-height: min(42svh, 18rem); }
  html:not(.no-heavy-scrolly) .stage__frame img:first-child {
    width: 100%; height: 100%; object-fit: cover;
    animation: stage-zoom linear both; animation-timeline: --stages;
    animation-range: contain calc(var(--s) * 33.333%) contain calc(var(--s) * 33.333% + 33.333%);
  }
  html:not(.no-heavy-scrolly) .stage__label {
    font-family: var(--wp--preset--font-family--body); font-weight: 700;
    font-size: clamp(0.95rem, 0.85rem + 0.45vw, 1.2rem); line-height: 1;
  }
  html:not(.no-heavy-scrolly) .stage__num { width: 3rem; height: 3rem; font-family: var(--wp--preset--font-family--body); font-size: .9rem; }
  html:not(.no-heavy-scrolly) .stage__expletive { animation: stage-expletive linear both; animation-timeline: --stages; animation-range: contain 80% contain 92%; }
  html:not(.no-heavy-scrolly) .stages__rail { display: block; justify-self: center; width: min(70%, 22rem); height: 6px; border-radius: 999px; background: var(--wp--preset--color--lilac); overflow: hidden; }
  html:not(.no-heavy-scrolly) .stages__rail i { display: block; height: 100%; background: var(--wp--preset--color--primary); transform-origin: 0 50%; animation: stages-rail linear both; animation-timeline: --stages; animation-range: contain 0% contain 100%; }
  @media (min-width: 64rem) {
    html:not(.no-heavy-scrolly) .stages__track {
      grid-template-rows: auto minmax(0, 1fr) auto; row-gap: 1.75rem;
      max-width: var(--wp--custom--layout--wide); margin-inline: auto;
      padding: 9.5rem 2.5rem 3rem;
    }
    html:not(.no-heavy-scrolly) .stages__title { max-width: 28ch; }
    html:not(.no-heavy-scrolly) .stage__frame { width: min(100%, 36rem, (100svh - 34rem) * 1.5); max-height: min(48svh, calc(100svh - 26rem)); }
  }
}
}
@keyframes stage-mid {
  0% { opacity: 0; translate: 0 14%; scale: .9; }
  22%, 78% { opacity: 1; translate: none; scale: 1; }
  100% { opacity: 0; translate: 0 -12%; scale: .95; }
}
@keyframes stage-first { 0%, 78% { opacity: 1; translate: none; scale: 1; } 100% { opacity: 0; translate: 0 -12%; scale: .95; } }
@keyframes stage-last { 0% { opacity: 0; translate: 0 14%; scale: .9; } 22%, 100% { opacity: 1; translate: none; scale: 1; } }
@keyframes stage-zoom { from { scale: 1.18; } to { scale: 1; } }
@keyframes stage-expletive { from { scale: 0; rotate: -40deg; } to { scale: 1; rotate: 8deg; } }
@keyframes stages-rail { from { transform: scaleX(0); } }

/* ---------- Biotrate toggle ---------- */
.biotrate {
  display: grid; gap: 2rem; align-items: center;
  max-width: var(--wp--custom--layout--wide); margin-inline: auto;
  padding: var(--wp--preset--spacing--70) var(--wp--preset--spacing--50);
}
.biotrate__copy { display: grid; gap: 1.1rem; justify-items: start; }
.biotrate__logo { width: 9.5rem; }
.biotrate__title { font-size: var(--wp--preset--font-size--x-large); }
/* Chantal draws ® at cap size on the baseline. Body face, smaller and raised, so both marks read as superscripts. */
.biotrate__title sup {
  font-family: var(--wp--preset--font-family--body);
  font-size: .42em;
  font-weight: 700;
  line-height: 1;
  vertical-align: baseline;
  position: relative;
  top: -.85em;
}
.biotrate__switch {
  position: relative; isolation: isolate; display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 30rem;
  padding: .35rem; border-radius: 999px; background: var(--wp--preset--color--lavender);
}
.no-js .biotrate__switch { display: none; }
.biotrate__switch button {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer;
  padding: .75rem .5rem; border-radius: 999px; font-weight: 700; font-size: var(--wp--preset--font-size--x-small); line-height: 1.2;
  color: var(--wp--preset--color--primary); transition: color .35s;
}
.biotrate__switch button[aria-selected="true"] { color: #fff; }
.biotrate__thumb {
  position: absolute; z-index: 0; top: .35rem; bottom: .35rem; left: .35rem; width: calc(50% - .35rem);
  border-radius: 999px; background: var(--wp--preset--color--primary);
  transition: translate .6s var(--wp--custom--ease--spring);
}
.biotrate[data-active="softens"] .biotrate__thumb { translate: 100% 0; }
.biotrate__media { display: grid; gap: 1.25rem; justify-items: center; }
.biotrate__panels { display: grid; gap: 1rem; width: 100%; }
.biotrate__panel { position: relative; margin: 0; border-radius: 1.75rem; overflow: hidden; background: #efeff0; box-shadow: var(--wp--preset--shadow--soft); }
.biotrate__panel img { width: 100%; }
html.js .biotrate__panels { grid-template-areas: "stack"; }
html.js .biotrate__panel {
  grid-area: stack; opacity: 0; scale: .92; rotate: -3deg; pointer-events: none;
  transition: opacity .45s, scale .7s var(--wp--custom--ease--spring), rotate .7s var(--wp--custom--ease--spring);
}
html.js .biotrate__panel.is-active { opacity: 1; scale: 1; rotate: 0deg; pointer-events: auto; }
@media (min-width: 64rem) {
  .biotrate { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 4rem; }
}

/* ---------- ingredients ---------- */
.ingredients {
  display: grid; gap: 2rem; max-width: var(--wp--custom--layout--wide); margin-inline: auto;
  padding-inline: var(--wp--preset--spacing--50);
}
.ingredients__head { display: grid; gap: 1rem; justify-items: start; }
.ingredients__title { font-size: var(--wp--preset--font-size--x-large); max-width: 24ch; }
.ingredient summary { font-size: clamp(1.1rem, 1.4vw, 1.35rem); font-family: var(--wp--preset--font-family--body); font-weight: 700; }
.ingredient__dot { flex: none; width: 1rem; height: 1rem; border-radius: 50%; background: var(--wp--preset--color--accent); box-shadow: 0 0 0 5px rgb(255 220 0 / .25); }
.ingredient__dot.is-b { background: var(--wp--preset--color--wisteria); box-shadow: 0 0 0 5px rgb(160 130 187 / .25); }
.ingredient__dot.is-c { background: var(--wp--preset--color--plum); box-shadow: 0 0 0 5px rgb(129 45 140 / .2); }
.ingredient__label { display: block; margin-bottom: .25rem; font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--wp--preset--color--secondary); }
.ingredients__also { margin: 1rem 0 0; padding: 1rem 1.25rem; border-radius: 1.25rem; background: var(--wp--preset--color--lilac); font-size: var(--wp--preset--font-size--small); }
@media (min-width: 64rem) {
  .ingredients { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 4rem; align-items: start; }
  .ingredients__head { position: sticky; top: 7rem; }
}

/* ---------- swipe rail (scroll-snap; grid on desktop per template) ---------- */
.vd-rail {
  --rail-w: min(72vw, 18rem);
  list-style: none; margin: 0; display: grid; grid-auto-flow: column; grid-auto-columns: var(--rail-w); gap: 1rem;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none;
  padding: 1.5rem calc(50vw - var(--rail-w) / 2);
}
.vd-rail::-webkit-scrollbar { display: none; }
.vd-rail > * { scroll-snap-align: center; }
.vd-rail:focus-visible { outline: 3px solid var(--wp--preset--color--secondary); outline-offset: -3px; }
.vd-rail-dots { display: flex; justify-content: center; align-items: center; gap: .15rem; }
.vd-rail-dots button {
  position: relative; width: 1.5rem; height: 1.5rem; padding: 0; border: 0; border-radius: 999px;
  background: transparent; cursor: pointer;
}
.vd-rail-dots button::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: .55rem; height: .55rem;
  translate: -50% -50%; border-radius: 999px; background: var(--wp--preset--color--lilac);
  transition: width .4s var(--wp--custom--ease--spring), background .3s;
}
.vd-rail-dots button[data-active] { width: 2.2rem; }
.vd-rail-dots button[data-active]::before { width: 1.6rem; background: var(--wp--preset--color--primary); }
.vd-rail-nav { display: flex; gap: .5rem; }
.vd-rail-nav button {
  width: 3rem; height: 3rem; border-radius: 50%; border: 2px solid var(--wp--preset--color--primary); background: #fff; cursor: pointer;
  color: var(--wp--preset--color--primary); font-weight: 700; transition: background .25s, color .25s, transform .4s var(--wp--custom--ease--spring);
}
.vd-rail-nav button:hover { background: var(--wp--preset--color--primary); color: #fff; transform: scale(1.08); }

/* ---------- spec dialog ---------- */
.spec-dialog__body { display: grid; gap: 1.5rem; }
.spec-dialog__media { position: relative; margin: 0 0 1.5rem; }
.spec-dialog__hero { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 1.5rem; }
#spec-powder .spec-dialog__hero { object-position: 48% 82%; }
#spec-spray .spec-dialog__hero { object-position: 82% 42%; }
#spec-chews .spec-dialog__hero { object-position: 30% 40%; }
.spec-dialog__sticker {
  position: absolute; left: -.25rem; bottom: -1.75rem;
  height: 72%; width: auto; max-width: 52%; object-fit: contain; rotate: -8deg;
}
#spec-powder .spec-dialog__sticker { height: 52%; max-width: 40%; }
#spec-chews .spec-dialog__sticker { height: 54%; max-width: 42%; }
#spec-toothpaste .spec-dialog__sticker {
  bottom: -2.25rem;
  height: auto;
  width: 78%;
  max-width: none;
}
.spec-dialog__copy { display: grid; gap: 1rem; justify-items: start; align-content: start; }
.spec-dialog__title {
  font-size: clamp(2.4rem, 1.1rem + 5vw, 3.6rem);
  line-height: .95;
  max-width: 14ch;
}
.spec-dialog__points { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.spec-dialog__points li { display: flex; gap: .75rem; align-items: flex-start; }
.spec-dialog__points img { flex: none; width: 1.75rem; height: 1.75rem; }
.spec-dialog__note {
  margin: 0; max-width: 40ch;
  display: flex; align-items: center; gap: .65rem;
  font-size: .85rem; line-height: 1.35; font-weight: 500;
  color: color-mix(in oklab, var(--wp--preset--color--foreground) 72%, transparent);
}
.spec-dialog__vohc {
  flex: none; width: 4.75rem; height: auto;
  background: #fff; border-radius: .4rem;
  box-shadow: 0 1px 3px rgb(53 23 71 / .12);
}
.spec-dialog__specs { margin: 0; width: 100%; display: grid; border-radius: 1.25rem; overflow: hidden; border: 1.5px solid var(--wp--preset--color--lilac); }
.spec-dialog__specs div { display: grid; gap: .15rem; padding: .85rem 1.1rem; }
.spec-dialog__specs div + div { border-top: 1.5px solid var(--wp--preset--color--lilac); }
.spec-dialog__specs div:nth-child(odd) { background: var(--wp--preset--color--lavender); }
.spec-dialog__specs dt { font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--wp--preset--color--secondary); }
.spec-dialog__specs dd { margin: 0; font-size: var(--wp--preset--font-size--small); }
.spec-size-table {
  margin: .65rem 0 0;
  width: 100%;
  max-width: 16rem;
  border-collapse: collapse;
  font-size: inherit;
}
.spec-size-table th,
.spec-size-table td {
  padding: .15rem 0;
  text-align: left;
  vertical-align: baseline;
}
.spec-size-table th {
  font-weight: 700;
  padding-right: 1.25rem;
  white-space: nowrap;
}
.spec-size-table td { font-variant-numeric: tabular-nums; }
.spec-dialog__specs dd:has(.spec-size-table) { align-self: start; }
.spec-dialog__actions { width: auto; justify-content: flex-start; }
.spec-dialog__done {
  padding: .7rem 1.4rem; border-radius: 999px; border: 1.5px solid var(--wp--preset--color--primary);
  background: transparent; color: var(--wp--preset--color--primary); font: inherit; font-weight: 700; text-transform: capitalize; cursor: pointer;
}
.spec-dialog__done:hover { background: var(--wp--preset--color--primary); color: #fff; }
@media (min-width: 48rem) {
  .spec-dialog__body {
    grid-template-columns: .9fr 1.1fr;
    grid-template-areas:
      "media copy"
      "specs specs";
    align-items: start;
    gap: 1.5rem 2.25rem;
    padding-top: 2.5rem;
  }
  .spec-dialog__media { grid-area: media; margin-bottom: 1.75rem; }
  .spec-dialog__copy { grid-area: copy; }
  .spec-dialog__specs { grid-area: specs; }
  .spec-dialog__hero { aspect-ratio: 4 / 5; max-height: 22rem; }
  .spec-dialog__sticker { height: 68%; max-width: 58%; }
  #spec-powder .spec-dialog__sticker { height: 48%; max-width: 44%; }
  #spec-chews .spec-dialog__sticker { height: 50%; max-width: 44%; }
  #spec-toothpaste .spec-dialog__sticker {
    bottom: -2.5rem;
    height: auto;
    width: 84%;
    max-width: none;
  }
  .spec-dialog__title { font-size: clamp(2.6rem, 1.4rem + 2.8vw, 3.8rem); max-width: none; }
  .spec-dialog__specs div { grid-template-columns: 11rem 1fr; gap: 1rem; align-items: baseline; }
}
