/*
 * CULTR ingredient formulary
 * Direction: tactile apothecary index with a true full-bleed footprint.
 * Shape rule: 18px structural surfaces, pill controls only.
 */

.figma-rebuild main > .ingredient-browser {
  order: 9;
}

.figma-rebuild main > .care-compare {
  order: 10;
}

.ingredient-browser {
  --ib-content-gutter: max(
    clamp(1.25rem, 3vw, 3rem),
    calc((100vw - 1180px) / 2 + 48px)
  );
  --ib-forest: oklch(31% .052 181);
  --ib-forest-deep: oklch(24% .043 181);
  --ib-forest-soft: oklch(40% .052 177);
  --ib-paper: oklch(98.5% .007 155);
  --ib-paper-muted: oklch(95.8% .012 153);
  --ib-sage: oklch(84% .047 155);
  --ib-ink: oklch(28% .021 176);
  --ib-muted: oklch(49% .022 176);
  --ib-line: oklch(77% .018 170 / .58);
  padding-block: clamp(5rem, 8vw, 8rem);
  color: var(--ib-ink);
  background:
    radial-gradient(circle at 88% 23%, oklch(91% .034 153 / .62), transparent 24rem),
    var(--ib-paper);
}

.ingredient-browser__inner {
  width: 100%;
  margin-inline: 0;
  padding-inline: 0;
}

.ingredient-browser__intro {
  width: min(100%, 1180px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 1.25rem 2rem;
  align-items: center;
  margin: 0 auto clamp(2rem, 4vw, 3.5rem);
  padding-inline:
    max(clamp(1.25rem, 5vw, 3rem), var(--safe-left))
    max(clamp(1.25rem, 5vw, 3rem), var(--safe-right));
}

.ingredient-browser__intro h2 {
  max-width: none;
  margin: 0;
  color: var(--ib-forest-deep);
  font-family: var(--font-brand);
  font-size: clamp(3.25rem, 4.4vw, 5.4rem);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .93;
  text-wrap: balance;
}

.ingredient-browser__intro p {
  grid-column: 1 / -1;
  max-width: 68ch;
  margin: 0;
  color: var(--ib-muted);
  font-size: clamp(1.1rem, 1.25vw, 1.3rem);
  line-height: 1.65;
}

.ingredient-browser__catalog-link {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  padding: .75rem 0;
  color: var(--ib-forest);
  border-bottom: 1px solid var(--ib-forest);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 220ms cubic-bezier(.16, 1, .3, 1), border-color 220ms cubic-bezier(.16, 1, .3, 1);
}

.ingredient-browser__catalog-link:hover {
  color: var(--ib-forest-soft);
  border-color: var(--ib-forest-soft);
}

.ingredient-browser__catalog-link:active {
  transform: translateY(1px);
}

.ingredient-browser__catalog {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--ib-paper);
  border-block: 1px solid var(--ib-line);
  border-inline: 0;
  border-radius: 0;
  box-shadow: 0 24px 64px oklch(24% .035 180 / .08);
}

.ingredient-browser__interaction-hint {
  margin: 0;
  padding: .7rem max(clamp(1.25rem, 3vw, 3rem), var(--safe-left));
  color: var(--ib-forest-soft);
  background: var(--ib-paper-muted);
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.ingredient-browser__categories {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  background: var(--ib-forest);
}

.ingredient-browser__categories::-webkit-scrollbar,
.ingredient-browser__ingredients::-webkit-scrollbar {
  display: none;
}

.ingredient-browser__category {
  position: relative;
  min-width: max-content;
  min-height: 70px;
  flex: 1 0 auto;
  padding: 1rem clamp(1.15rem, 2vw, 2rem);
  color: oklch(92% .012 157 / .76);
  background: transparent;
  border: 0;
  border-right: 1px solid oklch(88% .025 158 / .2);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 550;
  letter-spacing: .01em;
  transition: color 220ms cubic-bezier(.16, 1, .3, 1), background-color 220ms cubic-bezier(.16, 1, .3, 1);
}

.ingredient-browser__category:last-child {
  border-right: 0;
}

.ingredient-browser__category::after {
  content: "";
  position: absolute;
  right: 22%;
  bottom: 0;
  left: 22%;
  height: 3px;
  background: var(--ib-sage);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 260ms cubic-bezier(.16, 1, .3, 1);
}

.ingredient-browser__category:hover {
  color: var(--ib-paper);
  background: oklch(36% .052 181);
}

.ingredient-browser__category[aria-selected="true"] {
  color: var(--ib-paper);
}

.ingredient-browser__category[aria-selected="true"]::after {
  transform: scaleX(1);
}

.ingredient-browser__category:active {
  transform: translateY(1px);
}

.ingredient-browser[data-interaction-hint="active"] .ingredient-browser__category:not([aria-selected="true"]),
.ingredient-browser[data-interaction-hint="active"] .ingredient-browser__arrow:not(:disabled) {
  animation: ingredient-browser-nudge 6s cubic-bezier(.16, 1, .3, 1) infinite;
}

.ingredient-browser[data-interaction-hint="active"] .ingredient-browser__arrow:not(:disabled) {
  animation-delay: 420ms;
}

@keyframes ingredient-browser-nudge {
  0%, 100% { transform: translateY(0); }
  5% { transform: translateY(-3px); }
  10% { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .ingredient-browser[data-interaction-hint="active"] .ingredient-browser__category:not([aria-selected="true"]),
  .ingredient-browser[data-interaction-hint="active"] .ingredient-browser__arrow:not(:disabled) {
    animation: none;
  }
}

.ingredient-browser__category:focus-visible,
.ingredient-browser__ingredient:focus-visible,
.ingredient-browser__arrow:focus-visible,
.ingredient-browser__catalog-link:focus-visible {
  outline: 3px solid var(--ib-sage);
  outline-offset: -4px;
}

.ingredient-browser__stage {
  min-height: 440px;
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) minmax(18rem, 1.05fr) minmax(18rem, 1fr);
  gap: clamp(2rem, 3vw, 3rem);
  align-items: center;
  padding-block: clamp(2rem, 4vw, 3.75rem);
  padding-inline: var(--ib-content-gutter);
  background:
    linear-gradient(90deg, transparent 0 66%, oklch(94% .023 153 / .52) 66% 100%),
    var(--ib-paper);
}

.ingredient-browser__identity {
  align-self: start;
  padding-top: .25rem;
  transition: opacity 180ms cubic-bezier(.16, 1, .3, 1), transform 260ms cubic-bezier(.16, 1, .3, 1);
}

.ingredient-browser__section-label {
  margin: 0 0 1rem;
  color: var(--ib-forest-soft);
  font-size: .88rem;
  font-weight: 650;
  letter-spacing: .08em;
}

.ingredient-browser__identity h3 {
  max-width: 12ch;
  margin: 0;
  color: var(--ib-forest-deep);
  font-family: var(--font-brand);
  font-size: clamp(3rem, 3.35vw, 4rem);
  font-weight: 500;
  letter-spacing: -.048em;
  line-height: .98;
}

.ingredient-browser__stage[data-name-length="long"] .ingredient-browser__identity h3 {
  max-width: 14ch;
  font-size: clamp(2.05rem, 2.25vw, 2.55rem);
  letter-spacing: -.04em;
  line-height: 1.03;
}

.ingredient-browser__stage[data-name-length="extra-long"] .ingredient-browser__identity h3 {
  max-width: 18ch;
  font-size: clamp(1.75rem, 1.85vw, 1.95rem);
  letter-spacing: -.03em;
  line-height: 1.08;
}

.ingredient-browser__form {
  width: fit-content;
  max-width: 28ch;
  margin: 1.5rem 0 0;
  padding: .55rem .8rem;
  color: var(--ib-forest);
  background: var(--ib-paper-muted);
  border: 1px solid var(--ib-line);
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.25;
}

.ingredient-browser__description {
  align-self: stretch;
  display: grid;
  align-content: center;
  gap: .9rem;
  transition: opacity 180ms cubic-bezier(.16, 1, .3, 1), transform 260ms cubic-bezier(.16, 1, .3, 1);
}

.ingredient-browser__stage.is-changing .ingredient-browser__identity,
.ingredient-browser__stage.is-changing .ingredient-browser__description {
  opacity: .34;
  transform: translateY(6px);
}

.ingredient-browser__primary-detail {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ib-line);
}

.ingredient-browser__support-detail {
  display: grid;
  grid-template-columns: minmax(7rem, .7fr) minmax(0, 1.3fr);
  gap: 1rem;
  align-items: baseline;
  padding-bottom: .8rem;
  border-bottom: 1px solid var(--ib-line);
}

.ingredient-browser__description h4 {
  margin: 0 0 .5rem;
  color: var(--ib-forest-deep);
  font-size: 1rem;
  font-weight: 650;
}

.ingredient-browser__description p {
  max-width: 52ch;
  margin: 0;
  color: var(--ib-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.ingredient-browser__support-detail h4 {
  margin: 0;
  font-size: .9rem;
  line-height: 1.35;
}

.ingredient-browser__support-detail p {
  font-size: .88rem;
  line-height: 1.48;
}

.ingredient-browser__description .ingredient-browser__education-note {
  margin-top: .2rem;
  color: oklch(51% .018 176);
  font-size: .82rem;
  line-height: 1.55;
}

.ingredient-browser__product {
  position: relative;
  width: min(100%, 34rem);
  min-height: 0;
  aspect-ratio: 1;
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  margin: 0;
  isolation: isolate;
  overflow: hidden;
  border-radius: 16px;
  background: var(--ib-paper-muted);
  translate: clamp(3rem, calc((100vw - 64rem) * .28), 18rem) 0;
  transform: scale(1.265);
  transform-origin: center;
}

.ingredient-browser__product img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: none;
  filter: none;
  mix-blend-mode: normal;
  transform: scale(1);
  transition: transform 420ms cubic-bezier(.16, 1, .3, 1);
}

.ingredient-browser__catalog:hover .ingredient-browser__product img {
  transform: scale(1.018);
}

.ingredient-browser__rail {
  min-height: 118px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  border-top: 1px solid var(--ib-line);
}

.ingredient-browser__ingredients {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.ingredient-browser__ingredient {
  min-width: clamp(11rem, 20vw, 15rem);
  min-height: 116px;
  flex: 1 0 auto;
  scroll-snap-align: start;
  padding: 1.35rem 1.5rem;
  color: var(--ib-muted);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--ib-line);
  cursor: pointer;
  text-align: left;
  transition: color 220ms cubic-bezier(.16, 1, .3, 1), background-color 220ms cubic-bezier(.16, 1, .3, 1);
}

.ingredient-browser__ingredient small {
  display: block;
  margin-bottom: .55rem;
  color: var(--ib-forest-soft);
  font-size: .78rem;
  font-weight: 650;
}

.ingredient-browser__ingredient span {
  display: block;
  max-width: 18ch;
  font-family: var(--font-brand);
  font-size: 1.35rem;
  line-height: 1.1;
}

.ingredient-browser__ingredient:hover {
  color: var(--ib-forest-deep);
  background: var(--ib-paper-muted);
}

.ingredient-browser__ingredient[aria-pressed="true"] {
  color: var(--ib-forest-deep);
  background: var(--ib-paper-muted);
  box-shadow: inset 0 -3px 0 var(--ib-forest);
}

.ingredient-browser__ingredient:active {
  transform: translateY(1px);
}

.ingredient-browser__arrow {
  min-width: 92px;
  min-height: 116px;
  padding: 1rem;
  color: var(--ib-forest);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: .84rem;
  font-weight: 650;
  transition: background-color 220ms cubic-bezier(.16, 1, .3, 1), color 220ms cubic-bezier(.16, 1, .3, 1);
}

.ingredient-browser__arrow:first-child {
  border-right: 1px solid var(--ib-line);
}

.ingredient-browser__arrow:last-child {
  border-left: 1px solid var(--ib-line);
}

.ingredient-browser__arrow:hover {
  color: var(--ib-paper);
  background: var(--ib-forest);
}

.ingredient-browser__arrow:active {
  transform: translateY(1px);
}

.ingredient-browser__quality {
  display: grid;
  grid-template-columns: minmax(14rem, .72fr) minmax(0, 1.28fr);
  gap: clamp(2rem, 4vw, 5rem);
  margin-top: 1.25rem;
  padding-block: clamp(1.75rem, 3vw, 2.75rem);
  padding-inline: var(--ib-content-gutter);
  color: var(--ib-paper);
  background: var(--ib-forest-deep);
  border-radius: 0;
}

.ingredient-browser__quality-copy h3 {
  max-width: 15ch;
  margin: 0;
  color: inherit;
  font-family: var(--font-brand);
  font-size: clamp(2rem, 2.8vw, 3rem);
  font-weight: 500;
  line-height: 1.02;
}

.ingredient-browser__quality-copy p {
  max-width: 44ch;
  margin: 1rem 0 0;
  color: oklch(91% .012 157 / .68);
  font-size: .88rem;
  line-height: 1.55;
}

.ingredient-browser__quality ul {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ingredient-browser__quality li {
  min-height: 94px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: .75rem clamp(.85rem, 1.5vw, 1.45rem);
  border-left: 1px solid oklch(88% .025 158 / .18);
}

.ingredient-browser__quality strong,
.ingredient-browser__quality span {
  display: block;
}

.ingredient-browser__quality strong {
  color: var(--ib-paper);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.3;
}

.ingredient-browser__quality span {
  margin-top: .45rem;
  color: var(--ib-sage);
  font-size: .82rem;
  line-height: 1.35;
}

.ingredient-browser__disclosure {
  width: min(100%, 1180px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  margin-inline: auto;
  padding:
    1.25rem max(clamp(1.25rem, 5vw, 3rem), var(--safe-right))
    0 max(clamp(1.25rem, 5vw, 3rem), var(--safe-left));
  color: var(--ib-muted);
}

/* The live staging navbar uses the finished logo artwork. Scale both resting
   and compact states by exactly 20% from the current staging dimensions. */
.figma-rebuild .logo img,
.figma-rebuild .logo svg {
  height: clamp(4.5rem, 5.76vw, 5.1rem);
}

.figma-rebuild header.scrolled .logo img,
.figma-rebuild header.scrolled .logo svg {
  height: clamp(3.9rem, 4.8vw, 4.2rem);
}

.ingredient-browser__disclosure p {
  max-width: 68ch;
  margin: 0;
  font-size: .82rem;
  line-height: 1.55;
}

.ingredient-browser__noscript {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--ib-paper-muted);
  border: 1px solid var(--ib-line);
  border-radius: 18px;
}

.ingredient-browser__noscript p {
  margin: 0 0 .75rem;
}

.ingredient-browser__noscript a {
  color: var(--ib-forest);
  font-weight: 650;
}

@media (max-width: 1080px) {
  .ingredient-browser__stage {
    grid-template-columns: minmax(13rem, .85fr) minmax(18rem, 1.15fr);
    background: var(--ib-paper);
  }

  .ingredient-browser__product {
    grid-column: 1 / -1;
    width: min(100%, 34rem);
    min-height: 0;
    border-top: 0;
    translate: none;
  }

  .ingredient-browser__product img {
    width: 100%;
  }

  .ingredient-browser__quality {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .ingredient-browser {
    padding-block: 4.5rem;
  }

  .ingredient-browser__intro {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .ingredient-browser__intro h2 {
    max-width: none;
    font-size: clamp(2.1rem, 9.5vw, 2.65rem);
  }

  .ingredient-browser__catalog-link {
    width: fit-content;
    order: 3;
  }

  .ingredient-browser__intro p {
    grid-column: auto;
    order: 2;
  }

  .ingredient-browser__category {
    min-height: 56px;
  }

  .ingredient-browser__stage {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem max(1.25rem, var(--safe-right)) 1.5rem max(1.25rem, var(--safe-left));
  }

  .ingredient-browser__identity h3 {
    max-width: 12ch;
    font-size: clamp(2.7rem, 13vw, 4.2rem);
  }

  .ingredient-browser__description {
    gap: 1.3rem;
  }

  .ingredient-browser__primary-detail {
    padding-bottom: 1.2rem;
  }

  .ingredient-browser__support-detail {
    grid-template-columns: 1fr;
    gap: .45rem;
    align-items: start;
    padding-bottom: 1.2rem;
  }

  .ingredient-browser__product {
    width: 100%;
    min-height: 0;
    margin-inline: 0;
    transform: none;
  }

  .ingredient-browser__product img {
    width: 100%;
  }

  .ingredient-browser__rail {
    grid-template-columns: 54px minmax(0, 1fr) 54px;
  }

  .ingredient-browser__arrow {
    min-width: 54px;
    padding: .5rem;
    color: transparent;
    font-size: 0;
  }

  .ingredient-browser__arrow::before {
    color: var(--ib-forest);
    font-size: 1.35rem;
  }

  .ingredient-browser__arrow:first-child::before {
    content: "‹";
  }

  .ingredient-browser__arrow:last-child::before {
    content: "›";
  }

  .ingredient-browser__arrow:hover::before {
    color: var(--ib-paper);
  }

  .ingredient-browser__ingredient {
    min-width: 11rem;
    padding-inline: 1rem;
  }

  .ingredient-browser__quality {
    padding: 1.5rem max(1.25rem, var(--safe-right)) 1.5rem max(1.25rem, var(--safe-left));
  }

  .ingredient-browser__quality ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ingredient-browser__quality li:nth-child(odd) {
    border-left: 0;
  }

  .ingredient-browser__quality li:nth-child(n + 3) {
    border-top: 1px solid oklch(88% .025 158 / .18);
  }

  .ingredient-browser__disclosure {
    grid-template-columns: 1fr;
    gap: .75rem;
  }

  .figma-rebuild .logo img,
  .figma-rebuild .logo svg {
    height: 4.35rem;
  }

  .figma-rebuild header.scrolled .logo img,
  .figma-rebuild header.scrolled .logo svg {
    height: 3.9rem;
  }
}

@media (max-width: 420px) {
  .ingredient-browser__quality ul {
    grid-template-columns: 1fr;
  }

  .ingredient-browser__quality li,
  .ingredient-browser__quality li:nth-child(odd) {
    min-height: 78px;
    border-top: 1px solid oklch(88% .025 158 / .18);
    border-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ingredient-browser *,
  .ingredient-browser *::before,
  .ingredient-browser *::after {
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }

  .ingredient-browser__product img,
  .ingredient-browser__catalog:hover .ingredient-browser__product img {
    transform: none;
  }
}
