/* ─────────────────────────────────────────────────────────────────────────────
   Retractable long-content CARDS (public pages). Progressive enhancement:
   without JS the content is fully visible; the script collapses only genuinely
   long cards. Font-free CSS caret. Green-and-gold AESA tokens.
   ───────────────────────────────────────────────────────────────────────────── */
.retract {
  position: relative;
  transition: max-height 0.28s ease;
}
.retract.is-collapsed {
  overflow: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .retract { transition: none; }
}

/* Bottom fade over the clipped content (collapsed only). */
.retract__fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 88px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, var(--pt-surface-base, #ffffff) 88%);
}
.retract.is-expanded .retract__fade { display: none; }

/* In-card toggle. Absolute over the fade when collapsed; inline when expanded. */
.retract__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border: 1px solid var(--pt-green, #16a34a);
  border-radius: 999px;
  background: var(--pt-surface-base, #ffffff);
  color: var(--pt-green, #0f766e);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  z-index: 2;
}
.retract__toggle:hover {
  background: rgba(22, 163, 74, 0.08);
  border-color: var(--pt-gold, #d4af37);
  color: var(--pt-gold, #b8891f);
}
.retract__toggle:focus-visible {
  outline: 2px solid var(--pt-gold, #d4af37);
  outline-offset: 2px;
}
.retract.is-collapsed .retract__toggle {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
}
.retract.is-expanded .retract__toggle {
  position: static;
  display: inline-flex;
  margin: 12px 0 2px;
}

/* Font-free caret (rotates when expanded). */
.retract__caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.2s ease;
}
.retract.is-expanded .retract__caret { transform: rotate(180deg); }

/* Dark-theme surfaces — fade to the elevated surface. */
:root[data-theme="dark"] .retract__fade {
  background: linear-gradient(180deg, rgba(6, 20, 15, 0) 0%, var(--pt-surface-base, #06140f) 88%);
}
:root[data-theme="dark"] .retract__toggle {
  background: var(--pt-surface-base, #06140f);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .retract__fade {
    background: linear-gradient(180deg, rgba(6, 20, 15, 0) 0%, var(--pt-surface-base, #06140f) 88%);
  }
}
