/* CSMBAC progressive disclosure — motion + light tokens, soft-close, themes */

:root {
  --pd-ease-spring: cubic-bezier(0.22, 1.15, 0.36, 1);
  --pd-duration-open: 560ms;
  --pd-duration-close: 420ms;
  --pd-duration-soft: 520ms;
  --pd-teaser-opacity: 0.58;
  --pd-teaser-max-height: 42vh;
  --pd-accent-glow: color-mix(in srgb, var(--accent, #34d399) 72%, transparent);
  --pd-accent-sheen: color-mix(in srgb, var(--accent, #34d399) 48%, transparent);
  --pd-rim: rgba(255, 255, 255, 0.14);
  --pd-trigger-bg: rgba(255, 255, 255, 0.04);
  --pd-trigger-border: rgba(255, 255, 255, 0.14);
  /* Fallbacks if website-packages-shared tokens are absent */
  --page-gutter: clamp(1.25rem, 3.5vw, 2rem);
  --content-max: 980px;
}

body:not(.theme-dark) {
  --pd-trigger-bg: rgba(15, 23, 42, 0.04);
  --pd-trigger-border: rgba(15, 23, 42, 0.14);
  --pd-rim: rgba(15, 23, 42, 0.12);
  --pd-accent-glow: color-mix(in srgb, var(--accent, #10b981) 62%, transparent);
  --pd-accent-sheen: color-mix(in srgb, var(--accent, #10b981) 40%, transparent);
}

/* Top-level accordion groups share silo content width + page gutters */
.pd-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-sizing: border-box;
  width: min(var(--content-max), calc(100% - 2 * var(--page-gutter)));
  max-width: 100%;
  margin: 1.5rem auto 1.75rem;
  padding-inline: 0;
  overflow-anchor: none;
}

.pd-group__title {
  margin: 0 0 0.25rem;
  padding: 0 0.15rem;
  font-size: clamp(1.15rem, 2.6vw, 1.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text-main, #ededed);
}

.pd-group__title-icon {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  margin: -0.15rem 0.3rem 0;
  padding: 0;
  vertical-align: middle;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--accent, #34d399) 55%, transparent);
  background: color-mix(in srgb, var(--accent, #34d399) 14%, transparent);
  color: var(--accent, #34d399);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background var(--pd-duration-open) ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s ease;
}

.pd-group__title-icon:hover {
  border-color: color-mix(in srgb, var(--accent, #34d399) 75%, transparent);
  background: color-mix(in srgb, var(--accent, #34d399) 22%, transparent);
  transform: translateY(-1px);
}

.pd-group__title-icon:focus-visible {
  outline: 2px solid var(--accent, #34d399);
  outline-offset: 2px;
}

.pd-group__lede {
  margin: 0 0 0.65rem;
  padding: 0 0.15rem;
  max-width: 48ch;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-muted, #a1a1aa);
}

/* Nested groups (FAQ items inside a wrap) stay full width of parent */
.pd-group .pd-group,
.silo-section .pd-group,
.pd-panel .pd-group,
.pd-faq-wrap .pd-group,
.pd-buy-band .pd-group {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.pd-item {
  overflow-anchor: none;
  border: 1px solid var(--pd-trigger-border);
  border-radius: 14px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 42%, transparent 100%),
    var(--pd-trigger-bg);
  overflow: hidden;
  /* Closed: no fixed max-height — avoid clipping multi-line triggers on mobile */
  max-height: none;
  box-sizing: border-box;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: opacity var(--pd-duration-soft) var(--pd-ease-spring),
    max-height var(--pd-duration-soft) var(--pd-ease-spring),
    box-shadow var(--pd-duration-open) ease,
    background var(--pd-duration-open) ease,
    transform 0.22s ease,
    border-color 0.22s ease;
}

/* Desktop hover lift/glow - gated so touch does not sticky-hover */
@media (hover: hover) and (pointer: fine) {
  .pd-item:hover {
    border-color: color-mix(in srgb, var(--accent, #34d399) 48%, var(--pd-trigger-border));
    box-shadow:
      0 14px 32px rgba(0, 0, 0, 0.36),
      0 0 0 1px color-mix(in srgb, var(--accent, #34d399) 28%, transparent),
      0 0 22px color-mix(in srgb, var(--accent, #34d399) 18%, transparent),
      inset 0 1px 0 rgba(255, 255, 255, 0.09);
    transform: translateY(-2px) scale(1.01);
  }

  .pd-item:hover > .pd-heading .pd-trigger::after {
    transform: scale(1.1);
    box-shadow: 0 0 14px color-mix(in srgb, var(--accent, #34d399) 50%, transparent);
    background: color-mix(in srgb, var(--accent, #34d399) 22%, transparent);
  }

  .pd-item.is-open:hover {
    transform: translateY(-1px) scale(1.006);
  }
}

.pd-item:not(.is-open) > .pd-panel {
  display: none !important;
}

.pd-item.is-open {
  max-height: none;
  opacity: 1;
  border-color: color-mix(in srgb, var(--accent, #34d399) 50%, transparent);
  background: color-mix(in srgb, var(--accent, #34d399) 6%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent, #34d399) 28%, transparent),
    0 0 28px color-mix(in srgb, var(--accent, #34d399) 22%, transparent);
}

.pd-item.is-soft-closed {
  /* Soft-close journey retired — treat as closed if class remains on old HTML */
  opacity: 1;
  max-height: none;
}

.pd-item.is-soft-closed .pd-panel {
  overflow: visible;
  pointer-events: auto;
  mask-image: none;
}

.pd-heading {
  margin: 0;
  font-size: inherit;
  overflow-anchor: none;
}

.pd-trigger {
  width: 100%;
  text-align: left;
  padding: 1.05rem 1.25rem;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  font-size: clamp(1.02rem, 2.6vw, 1.22rem);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  box-sizing: border-box;
}

.pd-trigger::after {
  content: "+";
  display: inline-grid;
  flex: 0 0 1.55rem;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  margin-top: 0.05rem;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--accent, #34d399) 55%, transparent);
  background: color-mix(in srgb, var(--accent, #34d399) 14%, transparent);
  color: var(--accent, #34d399);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  opacity: 1;
  transition: transform var(--pd-duration-open) var(--pd-ease-spring),
    background var(--pd-duration-open) ease,
    box-shadow var(--pd-duration-open) ease;
}

.pd-item.is-open > .pd-heading .pd-trigger::after {
  content: "\00d7";
  background: color-mix(in srgb, var(--accent, #34d399) 28%, transparent);
  border-color: color-mix(in srgb, var(--accent, #34d399) 85%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent, #34d399) 45%, transparent);
}

.pd-trigger:focus-visible {
  outline: 2px solid var(--accent, #34d399);
  outline-offset: 2px;
}

.pd-panel {
  padding: 0.45rem 1.35rem 1.35rem;
  box-sizing: border-box;
  line-height: 1.7;
  overflow-anchor: none;
}

/* Nested page sections inside PD (homepage + silo wraps) — avoid double huge padding */
.pd-panel > .section {
  padding: 0.4rem 0 0.65rem;
  max-width: none;
  width: 100%;
  margin: 0;
}

.pd-panel .section-header {
  margin: 0 0 1.15rem;
}

.pd-panel .section-header h2 {
  display: none;
}

/* Hide duplicate gallery H2 when title already lives on the accordion trigger */
.pd-panel .sample-gallery > h2,
.pd-panel section.sample-gallery > h2,
.pd-panel > .silo-section.sample-gallery > h2 {
  display: none;
}

.pd-panel .section-header p {
  margin: 0;
  color: var(--text-muted, #94a3b8);
  font-size: 0.98rem;
  line-height: 1.55;
}

.pd-panel > :first-child {
  margin-top: 0;
}

.pd-panel > :last-child {
  margin-bottom: 0;
}

.pd-panel > h2,
.pd-panel > h3,
.pd-panel > h4 {
  margin: 1rem 0 0.55rem;
  line-height: 1.28;
  letter-spacing: 0;
}

.pd-panel > p {
  margin: 0 0 0.95rem;
}

/* Silo sections inside PD — restore title/paragraph rhythm (often bunched) */
.pd-panel .silo-section {
  margin: 0;
  padding: 0.25rem 0 0.5rem;
}
.pd-panel .silo-section > h2,
.pd-panel .silo-section > h3 {
  margin: 0 0 0.85rem;
  line-height: 1.28;
}
.pd-panel .silo-section > p {
  margin: 0 0 1.05rem;
  line-height: 1.7;
}
.pd-panel .silo-section > p:last-child {
  margin-bottom: 0;
}
.pd-panel .silo-section > ul,
.pd-panel .silo-section > ol {
  margin: 0.5rem 0 1.05rem;
  padding-left: 1.25rem;
}

.pd-panel > ul,
.pd-panel > ol {
  margin: 0.75rem 0 1.15rem;
  padding-left: 1.35rem;
}

.pd-panel > ul {
  list-style-position: outside;
}

.pd-panel > ul > li,
.pd-panel > ol > li {
  margin: 0;
}

.pd-panel > ul > li + li,
.pd-panel > ol > li + li {
  margin-top: 0.5rem;
}

.pd-panel li + li {
  margin-top: 0.5rem;
}

.pd-panel p,
.pd-panel li {
  overflow-wrap: anywhere;
}

/* Nested cards / grids inside accordion panels — restore title + paragraph rhythm */
.pd-panel .package-detail-card h3,
.pd-panel .package-info-grid article h3,
.pd-panel .package-contact-routes h3,
.pd-panel .package-detail-card h4 {
  margin: 0 0 0.75rem;
  line-height: 1.3;
}

.pd-panel .package-detail-card p,
.pd-panel .package-info-grid article p,
.pd-panel .package-contact-routes p {
  margin: 0 0 1rem;
  line-height: 1.65;
}

.pd-panel .package-detail-card p:last-child,
.pd-panel .package-info-grid article p:last-child,
.pd-panel .package-contact-routes p:last-child {
  margin-bottom: 0;
}

.pd-panel .package-detail-card p + p,
.pd-panel .package-info-grid article p + p,
.pd-panel .package-contact-routes p + p {
  margin-top: 0.85rem;
}

.pd-panel .package-info-grid,
.pd-panel .package-detail-grid {
  gap: 1.25rem;
  margin-top: 0.25rem;
}

.pd-panel .package-info-grid article,
.pd-panel .package-detail-card {
  padding: 1.25rem 1.2rem;
}

.pd-panel .package-info-grid article ul,
.pd-panel .package-detail-card ul,
.pd-panel .package-detail-card ol {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
}

.pd-panel[hidden] {
  display: none !important;
}

.pd-buy-band {
  box-sizing: border-box;
  width: min(var(--content-max), calc(100% - 2 * var(--page-gutter)));
  max-width: 100%;
  border: 1px solid var(--pd-trigger-border);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  /* Preserve vertical rhythm AND horizontal centering (do not use margin shorthand) */
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 0 0 1px var(--pd-accent-sheen);
}

.pd-faq-wrap {
  box-sizing: border-box;
  padding-top: 0.15rem;
}

.pd-faq-wrap .pd-item {
  margin-bottom: 0.55rem;
}

.pd-faq-wrap .pd-item:last-child {
  margin-bottom: 0.15rem;
}

/* Nested FAQ question triggers — smaller than section titles */
.pd-faq-wrap .pd-item > .pd-heading .pd-trigger {
  font-size: clamp(0.92rem, 2.8vw, 1.05rem);
  font-weight: 600;
  line-height: 1.35;
  padding: 0.75rem 1rem;
}

@media (max-width: 768px) {
  .pd-group {
    width: min(var(--content-max), calc(100% - 2 * var(--page-gutter)));
    margin-top: 1rem;
    margin-bottom: 1rem;
    gap: 0.65rem;
  }

  .pd-trigger {
    padding: 0.85rem 1rem;
    font-size: clamp(0.95rem, 3.6vw, 1.05rem);
  }

  .pd-panel {
    padding: 0 1.1rem 1.25rem;
  }

  .pd-panel > ul,
  .pd-panel > ol {
    padding-left: 1.2rem;
  }

  .pd-buy-band {
    width: min(var(--content-max), calc(100% - 2 * var(--page-gutter)));
    padding: 1.05rem 1.1rem;
  }

  .pd-faq-wrap .pd-item {
    margin-bottom: 0.65rem;
  }

  .pd-faq-wrap .pd-item > .pd-heading .pd-trigger {
    font-size: clamp(0.88rem, 3.4vw, 0.98rem);
    padding: 0.7rem 0.9rem;
  }

  /* Mobile IO entrance - opacity/transform only (no layout shift) */
  @keyframes pd-trigger-enter {
    from {
      opacity: 0;
      transform: translateY(12px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .pd-js .pd-item.pd-enter-pending > .pd-heading .pd-trigger {
    opacity: 0;
    transform: translateY(12px);
  }

  .pd-js .pd-item.pd-enter-visible > .pd-heading .pd-trigger {
    animation: pd-trigger-enter 0.55s var(--pd-ease-spring) both;
    animation-delay: calc(var(--pd-enter-delay, 0) * 1ms);
  }
}

/* Motion tokens (enter) — must NOT be killed by .is-open; distances sized to be obvious */
@keyframes pd-slide-up-in { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes pd-slide-down-in { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
@keyframes pd-slide-left-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes pd-slide-right-in { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@keyframes pd-fade-up-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pd-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pd-scale-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes pd-bounce-drop-in { 0% { opacity: 0; transform: translateY(-16px); } 70% { transform: translateY(4px); } 100% { opacity: 1; transform: none; } }
@keyframes pd-spin-soft-in { from { opacity: 0; transform: rotate(-2.5deg) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pd-blur-focus-in { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: none; } }
@keyframes pd-rise-in { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes pd-expand-in { from { opacity: 0; transform: scaleY(0.9); transform-origin: top; } to { opacity: 1; transform: none; } }
@keyframes pd-settle-in { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes pd-fade-out { from { opacity: 1; } to { opacity: 0; } }

.pd-panel.pd-anim-in.pd-anim--slide-up-in { animation: pd-slide-up-in var(--pd-duration-open) var(--pd-ease-spring) both; }
.pd-panel.pd-anim-in.pd-anim--slide-down-in { animation: pd-slide-down-in var(--pd-duration-open) var(--pd-ease-spring) both; }
.pd-panel.pd-anim-in.pd-anim--slide-left-in { animation: pd-slide-left-in var(--pd-duration-open) var(--pd-ease-spring) both; }
.pd-panel.pd-anim-in.pd-anim--slide-right-in { animation: pd-slide-right-in var(--pd-duration-open) var(--pd-ease-spring) both; }
.pd-panel.pd-anim-in.pd-anim--fade-up-in { animation: pd-fade-up-in var(--pd-duration-open) var(--pd-ease-spring) both; }
.pd-panel.pd-anim-in.pd-anim--fade-in { animation: pd-fade-in var(--pd-duration-open) ease both; }
.pd-panel.pd-anim-in.pd-anim--scale-in { animation: pd-scale-in var(--pd-duration-open) var(--pd-ease-spring) both; }
.pd-panel.pd-anim-in.pd-anim--bounce-drop-in { animation: pd-bounce-drop-in calc(var(--pd-duration-open) + 80ms) var(--pd-ease-spring) both; }
.pd-panel.pd-anim-in.pd-anim--spin-soft-in { animation: pd-spin-soft-in var(--pd-duration-open) var(--pd-ease-spring) both; }
.pd-panel.pd-anim-in.pd-anim--blur-focus-in { animation: pd-blur-focus-in var(--pd-duration-open) ease both; }
.pd-panel.pd-anim-in.pd-anim--rise-in { animation: pd-rise-in var(--pd-duration-open) var(--pd-ease-spring) both; }
.pd-panel.pd-anim-in.pd-anim--expand-in { animation: pd-expand-in var(--pd-duration-open) var(--pd-ease-spring) both; }
.pd-panel.pd-anim-in.pd-anim--settle-in { animation: pd-settle-in 260ms ease both; }
.pd-panel.pd-anim-out { animation: pd-fade-out var(--pd-duration-close) ease both; }

/* Light layer — inset/glow inside overflow:hidden clip so owners actually see it */
.pd-item.pd-light-active.pd-light--glow {
  box-shadow: inset 0 0 36px var(--pd-accent-glow), inset 0 0 0 2px color-mix(in srgb, var(--accent, #34d399) 45%, transparent);
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--accent, #34d399) 22%, transparent), transparent 70%);
}
.pd-item.pd-light-active.pd-light--sheen {
  /* Strong sheen on every theme — sales-agents/silos are dark without .theme-dark */
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent, #34d399) 62%, transparent), color-mix(in srgb, var(--accent, #34d399) 22%, transparent) 40%, transparent 74%);
  border-color: color-mix(in srgb, var(--accent, #34d399) 95%, transparent);
  box-shadow: inset 0 0 52px color-mix(in srgb, var(--accent, #34d399) 58%, transparent), inset 0 0 0 2px color-mix(in srgb, var(--accent, #34d399) 85%, transparent);
}
.pd-item.pd-light-active.pd-light--edge-lit {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent, #34d399) 75%, transparent), inset 0 0 28px var(--pd-accent-glow);
}
.pd-item.pd-light-active.pd-light--rim {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent, #34d399) 55%, transparent), inset 0 0 18px var(--pd-accent-sheen);
}
.pd-item.pd-light-active.pd-light--pulse {
  animation: pd-light-pulse 1100ms ease 1;
}
.pd-item.pd-light-settled {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #34d399) 32%, transparent), inset 0 0 14px color-mix(in srgb, var(--accent, #34d399) 12%, transparent);
  transition: box-shadow var(--pd-duration-soft) ease, background var(--pd-duration-soft) ease;
}
body:not(.theme-dark) .pd-item.pd-light-settled {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #10b981) 36%, transparent), inset 0 0 12px color-mix(in srgb, var(--accent, #10b981) 10%, transparent);
}

@keyframes pd-light-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #34d399) 20%, transparent); }
  50% { box-shadow: inset 0 0 40px var(--pd-accent-glow), inset 0 0 0 2px color-mix(in srgb, var(--accent, #34d399) 70%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
  .pd-item,
  .pd-panel,
  .pd-trigger,
  .pd-trigger::after {
    transition: none !important;
    animation: none !important;
  }
  .pd-item:hover,
  .pd-item.is-open:hover {
    transform: none;
  }
  .pd-item:hover > .pd-heading .pd-trigger::after {
    transform: none;
    box-shadow: none;
  }
  .pd-js .pd-item.pd-enter-pending > .pd-heading .pd-trigger,
  .pd-js .pd-item.pd-enter-visible > .pd-heading .pd-trigger {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  .pd-item.is-soft-closed { opacity: 1; max-height: none; }
  .pd-item.pd-light-active { animation: none !important; box-shadow: inset 0 0 0 1px var(--pd-rim); }
}

/* cache-bust 20260725-42 - trigger hover lift + mobile IO entrance */
