/* =============================================
   INGREDIENT CARDS — Animated collapsible sections
   Each section has its own color identity, icon,
   smooth JS-driven animation, and hover effects.
   ============================================= */

/* ── Per-section color tokens ────────────────────────────────────────────── */
.ing-card--intro      { --ic-grad-a:#2d6a3f; --ic-grad-b:#4da870; --ic-border:#5aaa6a; --ic-bg:#eef8f1; }
.ing-card--benefits   { --ic-grad-a:#0b5e48; --ic-grad-b:#1a9b7a; --ic-border:#22b890; --ic-bg:#e5f8f2; }
.ing-card--tcm        { --ic-grad-a:#7a1515; --ic-grad-b:#c42e2e; --ic-border:#c0392b; --ic-bg:#fef0f0; }
.ing-card--recipe     { --ic-grad-a:#7a3f00; --ic-grad-b:#c06800; --ic-border:#d4842a; --ic-bg:#fff5e6; }
.ing-card--disclaimer { --ic-grad-a:#1a3670; --ic-grad-b:#2b5ab8; --ic-border:#4a7dd4; --ic-bg:#edf3fc; }

/* ── Card shell ──────────────────────────────────────────────────────────── */
.ing-card {
  margin: 0 0 0.85rem 0;
  border-radius: 14px;
  border: 1.5px solid rgba(0,0,0,0.08);
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(0,0,0,0.07);
  transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
  /* stagger entrances via JS-added class */
  opacity: 0;
  transform: translateY(18px);
}
.ing-card.ic-entered {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.45s ease, transform 0.45s ease,
              box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Lift + glow on hover (closed card) */
.ing-card:not(.is-open):hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.14);
  transform: translateY(-4px);
  border-color: var(--ic-border);
}
.ing-card.is-open {
  box-shadow: 0 6px 24px rgba(0,0,0,0.11);
  border-color: var(--ic-border);
}

/* ── Toggle button (coloured header) ─────────────────────────────────────── */
.ing-card__toggle {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 15px 20px;
  border: none;
  cursor: pointer;
  text-align: left;
  background: linear-gradient(135deg, var(--ic-grad-a), var(--ic-grad-b));
  color: #fff;
  position: relative;
  overflow: hidden;
  transition: filter 0.25s ease;
  -webkit-appearance: none;
  appearance: none;
}
.ing-card__toggle:hover  { filter: brightness(1.1); }
.ing-card__toggle:active { filter: brightness(0.95); }
.ing-card__toggle:focus-visible {
  outline: 3px solid rgba(255,255,255,0.7);
  outline-offset: -3px;
}

/* Shine sweep on hover */
.ing-card__toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.18) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.55s ease;
  pointer-events: none;
}
.ing-card__toggle:hover::before { transform: translateX(100%); }

/* Click ripple */
.ic-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transform: scale(0);
  animation: icRipple 0.55s linear forwards;
  pointer-events: none;
}
@keyframes icRipple {
  to { transform: scale(4); opacity: 0; }
}

/* ── Icon badge ──────────────────────────────────────────────────────────── */
.ing-card__icon {
  font-size: 1.35rem;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.22);
  border-radius: 10px;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1),
              background 0.3s ease;
}
.ing-card__toggle:hover .ing-card__icon,
.ing-card.is-open .ing-card__icon {
  transform: scale(1.18) rotate(-8deg);
  background: rgba(255,255,255,0.35);
}
/* Idle float */
@keyframes icFloat {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.ing-card:not(.is-open) .ing-card__icon { animation: icFloat 4s ease-in-out infinite; }
.ing-card:not(.is-open):hover .ing-card__icon,
.ing-card.is-open .ing-card__icon       { animation: none; }

/* ── Title + subtitle wrapper ────────────────────────────────────────────── */
.ing-card__title-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ing-card__title {
  font-size: 1.04rem;
  font-weight: 700;
  letter-spacing: 0.25px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.18);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Subtitle — shown only when card is closed */
.ing-card__subtitle {
  font-size: 0.78rem;
  font-weight: 400;
  font-style: italic;
  color: rgba(255,255,255,0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  transition: opacity 0.25s ease, max-height 0.25s ease;
  max-height: 1.4em;
  opacity: 1;
}

.ing-card.is-open .ing-card__subtitle {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
}

/* ── Chevron pulse — nudges right when card is closed to invite a click ──── */
@keyframes icChevronNudge {
  0%,100% { transform: translateX(0); }
  50%     { transform: translateX(4px); }
}
.ing-card:not(.is-open) .ing-card__chevron {
  animation: icChevronNudge 1.8s ease-in-out infinite;
}
.ing-card:not(.is-open):hover .ing-card__chevron,
.ing-card.is-open .ing-card__chevron {
  animation: none;
}

/* ── Chevron ─────────────────────────────────────────────────────────────── */
.ing-card__chevron {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1),
              background 0.3s ease;
}
.ing-card__chevron::before {
  content: '';
  display: block;
  width: 9px;
  height: 9px;
  border-right: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.35s ease;
}
.ing-card.is-open .ing-card__chevron {
  transform: rotate(180deg);
  background: rgba(255,255,255,0.38);
}

/* ── Body — CSS grid height animation ────────────────────────────────────── */
.ing-card__body {
  display: grid;
  grid-template-rows: 0fr;
  background: var(--ic-bg);
  border-left: 5px solid var(--ic-border);
  transition: grid-template-rows 0.42s cubic-bezier(0.4,0,0.2,1);
}
.ing-card.is-open .ing-card__body {
  grid-template-rows: 1fr;
}

/* overflow:hidden required for 0fr clipping */
.ing-card__body-inner { overflow: hidden; }

/* The actual content area with padding */
.ing-card__content {
  padding: 22px 26px 24px;
}

/* ── Section-specific body typography ────────────────────────────────────── */

/* Intro */
.ing-card--intro .ing-card__content p  { color: #2a3d2e; line-height: 1.8; }
.ing-card--intro .ing-card__content em { color: #3d6645; }

/* Intro: keep image float */
.ing-card--intro .ingredient-image {
  float: right;
  margin: 0.25rem 0 1.2rem 1.8rem;
  width: 26%;
  max-width: 210px;
  min-width: 110px;
}
.ing-card--intro .ingredient-image img {
  width: 100%;
  height: auto;
  max-height: 210px;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.14);
}
.ing-card--intro .ingredient-text { overflow: hidden; }

/* Benefits */
.ing-card--benefits .ing-card__content h3 {
  color: #0b5e48;
  font-size: 1.08rem;
  margin: 0 0 0.9rem 0;
}
.ing-card--benefits .ing-card__content li {
  color: #1a3d32;
  line-height: 1.75;
  margin-bottom: 0.45rem;
  padding-left: 0.2rem;
}
.ing-card--benefits .ing-card__content strong { color: #0b5e48; }
.ing-card--benefits .ing-card__content ul { padding-left: 1.5rem; }

/* TCM */
.ing-card--tcm .ing-card__content h3 {
  color: #7a1515;
  font-size: 1.08rem;
  margin: 0 0 0.9rem 0;
}
.ing-card--tcm .ing-card__content p  { color: #3d1515; line-height: 1.78; }
.ing-card--tcm .ing-card__content em { color: #9b2626; font-style: italic; }
.ing-card--tcm .ing-card__content li {
  color: #3d1515;
  line-height: 1.72;
  margin-bottom: 0.4rem;
}
.ing-card--tcm .ing-card__content strong { color: #7a1515; }
.ing-card--tcm .ing-card__content ul { padding-left: 1.5rem; }
/* Subtle parchment texture feel */
.ing-card--tcm .ing-card__body {
  background: linear-gradient(160deg, #fef5f5 0%, #fdf0f0 100%);
}

/* Recipe */
.ing-card--recipe .ing-card__content h3,
.ing-card--recipe .ing-card__content h4 {
  color: #7a3f00;
  font-size: 1.05rem;
  margin: 1rem 0 0.5rem 0;
}
.ing-card--recipe .ing-card__content h3:first-child,
.ing-card--recipe .ing-card__content h4:first-child { margin-top: 0; }
.ing-card--recipe .ing-card__content p  { color: #3d2000; line-height: 1.78; }
.ing-card--recipe .ing-card__content strong { color: #7a3f00; }
.ing-card--recipe .ing-card__content ul,
.ing-card--recipe .ing-card__content ol { padding-left: 1.5rem; }
.ing-card--recipe .ing-card__content li {
  color: #3d2000;
  line-height: 1.72;
  margin-bottom: 0.4rem;
}

/* Disclaimer */
.ing-card--disclaimer .ing-card__content,
.ing-card--disclaimer .ingredient-disclaimer,
.ing-card--disclaimer .ingredient-disclaimer p {
  color: #1a2d5c;
  font-size: 0.95rem;
  line-height: 1.75;
}
.ing-card--disclaimer .ingredient-disclaimer { margin: 0; }
.ing-card--disclaimer .ingredient-disclaimer a {
  color: #2b5ab8;
  font-weight: 600;
}
.ing-card--disclaimer .ingredient-disclaimer a:hover { color: #1a3670; }
.ing-card--disclaimer .ingredient-disclaimer strong { color: #1a3670; }

/* ── Suppress duplicate h3 headings ──────────────────────────────────────── */
/* The card header already labels each section; the stored h3 is redundant */
.ing-card--benefits .ing-card__content > h3:first-child,
.ing-card--tcm      .ing-card__content > h3:first-child {
  display: none;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ing-card__toggle { padding: 13px 16px; gap: 10px; }
  .ing-card__icon   { width: 34px; height: 34px; font-size: 1.2rem; }
  .ing-card__title  { font-size: 0.97rem; }
  .ing-card__content{ padding: 16px 18px 18px; }
  .ing-card--intro .ingredient-image {
    float: none;
    width: 100%;
    max-width: 100%;
    margin: 0 0 1rem 0;
  }
}
