/* ============================================================
   Channel orchestration — Apple-style scroll-lock journey
   ============================================================ */

.channel-orch {
  --co-card-w: 300px;
  --co-card-w-lg: 340px;
  --co-card-min-h: 300px;
  --co-card-min-h-lg: 340px;
  --co-gap: 20px;
  --co-gap-lg: 24px;
  --co-accent-green: #45BF69;
  --co-accent-dark-green: #0E602A;
  --co-accent-plum: #860C6E;
  --co-accent-coral: #FC7869;
  --co-text: #0C6029;
  --co-heading: #0E602A;
  --co-bg-card: #ffffff;
  --co-border: rgba(14, 96, 42, 0.08);
  --co-bullet: var(--co-accent-green);
}

/* ---------- Preheader pill (border + padding from Tailwind utility classes
   matching CONTENT_TYPES.CREATE macro — only colour overridden here) ---------- */
.channel-orch__preheader {
  color: var(--co-accent-dark-green);
}

/* ---------- Pin scroll mechanics ---------- */
.channel-orch__pin-outer {
  position: relative;
}

.channel-orch__pin-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

@media (min-width: 1024px) {
  .channel-orch.is-pinned .channel-orch__pin-inner {
    position: sticky;
    top: 0;
    height: 100vh;
    gap: 0;
    justify-content: center;
    padding-block: 32px;
  }
}

/* ---------- Header inside pin ---------- */
.channel-orch__head {
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .channel-orch.is-pinned .channel-orch__head {
    padding-bottom: 28px;
  }
}

/* ---------- Viewport (mobile = native scroll, desktop = hidden + JS-translated) ---------- */
.channel-orch__viewport {
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--co-accent-green) transparent;
  padding-bottom: 8px;
  display: flex;
  align-items: stretch;
}

.channel-orch__viewport::-webkit-scrollbar {
  height: 6px;
}

.channel-orch__viewport::-webkit-scrollbar-thumb {
  background: var(--co-accent-green);
  border-radius: 3px;
}

@media (min-width: 1024px) {
  .channel-orch.is-pinned .channel-orch__viewport {
    overflow: hidden;
    scroll-snap-type: none;
    padding-bottom: 0;
    align-items: center;
  }
}

/* ---------- Track ---------- */
.channel-orch__track {
  display: flex;
  gap: var(--co-gap);
  width: max-content;
  padding: 4px 24px 4px 24px;
  align-items: stretch;
  will-change: transform;
}

@media (min-width: 1024px) {
  .channel-orch__track {
    gap: var(--co-gap-lg);
    padding: 4px 48px;
    padding-left: max(48px, calc((100vw - 1192px) / 2));
    padding-right: max(48px, calc((100vw - 1192px) / 2));
  }

  .channel-orch.is-pinned .channel-orch__track {
    transition: none;
  }
}

/* ---------- Card (base) ---------- */
.co-card {
  flex: 0 0 auto;
  width: var(--co-card-w);
  min-height: var(--co-card-min-h);
  display: flex;
  flex-direction: column;
  background: var(--co-bg-card);
  border: 1px solid var(--co-border);
  border-radius: 20px;
  padding: 26px 22px;
  scroll-snap-align: start;
  position: relative;
  overflow: hidden;
  transition: transform 350ms cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 350ms ease,
    border-color 250ms ease;
}

@media (min-width: 1024px) {
  .co-card {
    width: var(--co-card-w-lg);
    min-height: var(--co-card-min-h-lg);
    padding: 28px 24px;
  }
}

.channel-orch.is-pinned .co-card.is-active {
  transform: translateY(-6px);
  box-shadow: 0 20px 48px rgba(14, 96, 42, 0.14);
}

/* ---------- Card variants ---------- */
.co-card--decision {
  border: 2px dashed var(--co-accent-plum);
  background: rgba(134, 12, 110, 0.03);
}

.co-card--escalation {
  border-color: rgba(252, 120, 105, 0.3);
  background: rgba(252, 120, 105, 0.04);
}

.co-card--outcome {
  background: var(--co-accent-dark-green);
  border-color: var(--co-accent-dark-green);
  color: #ffffff;
}

.co-card--outcome::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 0% 0%, rgba(69, 191, 105, 0.35) 0%, rgba(69, 191, 105, 0) 60%);
  pointer-events: none;
}

.co-card--outcome > * {
  position: relative;
}

/* ---------- Card content ---------- */
.co-card__num {
  font-family: "PolySans", "DM Sans", sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--co-accent-green);
  margin-bottom: 14px;
}

.co-card--outcome .co-card__num {
  color: rgba(255, 255, 255, 0.55);
}

.co-card__chip {
  align-self: flex-start;
  font-family: "RMNeue", "Inter", -apple-system, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  margin-bottom: 14px;
  border: 1px solid;
}

.co-card--accent-green {
  --co-bullet: var(--co-accent-green);
}

.co-card--accent-green .co-card__chip {
  color: var(--co-accent-dark-green);
  background: rgba(69, 191, 105, 0.1);
  border-color: rgba(69, 191, 105, 0.22);
}

.co-card--accent-dark-green {
  --co-bullet: var(--co-accent-dark-green);
}

.co-card--accent-dark-green .co-card__chip {
  color: var(--co-text);
  background: rgba(14, 96, 42, 0.06);
  border-color: rgba(14, 96, 42, 0.12);
}

.co-card--accent-plum {
  --co-bullet: var(--co-accent-plum);
}

.co-card--accent-plum .co-card__chip {
  color: var(--co-accent-plum);
  background: rgba(134, 12, 110, 0.06);
  border-color: rgba(134, 12, 110, 0.14);
}

.co-card--accent-coral {
  --co-bullet: var(--co-accent-coral);
}

.co-card--accent-coral .co-card__chip {
  color: var(--co-accent-coral);
  background: rgba(252, 120, 105, 0.08);
  border-color: rgba(252, 120, 105, 0.18);
}

.co-card--outcome {
  --co-bullet: rgba(255, 255, 255, 0.85);
}

.co-card--outcome .co-card__chip {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.co-card__title {
  font-family: "PolySans", "DM Sans", sans-serif;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--co-heading);
  margin: 0 0 10px 0;
}

.co-card--outcome .co-card__title {
  color: #ffffff;
}

.co-card__body {
  font-family: "RMNeue", "Inter", -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--co-text);
  margin: 0 0 18px 0;
  flex: 1;
}

.co-card--outcome .co-card__body {
  color: rgba(255, 255, 255, 0.78);
}

.co-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.co-card__rule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "RMNeue", "Inter", -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  padding: 5px 10px 5px 8px;
  border-radius: 8px;
  background: rgba(14, 96, 42, 0.05);
  color: var(--co-text);
  border: 1px solid rgba(14, 96, 42, 0.08);
}

.co-card__rule::before {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--co-bullet);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--co-bullet) 18%, transparent);
}

@supports not (background: color-mix(in srgb, red, blue)) {
  .co-card__rule::before {
    box-shadow: 0 0 0 3px rgba(69, 191, 105, 0.18);
  }
}

.co-card--outcome .co-card__rule {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.18);
}

.co-card--outcome .co-card__rule::before {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16);
}

/* ---------- Foot (progress + hint) — only on desktop pinned ---------- */
.channel-orch__foot {
  display: none;
}

@media (min-width: 1024px) {
  .channel-orch.is-pinned .channel-orch__foot {
    display: block;
    flex-shrink: 0;
    padding-top: 28px;
  }
}

.channel-orch__progress-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 540px;
  margin: 0 auto;
}

.channel-orch__progress {
  flex: 1;
  height: 3px;
  background: rgba(14, 96, 42, 0.12);
  border-radius: 100px;
  overflow: hidden;
}

.channel-orch__progress-bar {
  height: 100%;
  width: 0%;
  background: var(--co-accent-dark-green);
  border-radius: inherit;
  transition: width 90ms linear;
}

.channel-orch__counter {
  font-family: "PolySans", "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--co-text);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.channel-orch__counter-sep {
  margin: 0 4px;
  opacity: 0.4;
}

/* Scroll hint — animates in on first pin, fades after user scrolls */
.channel-orch__hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-family: "RMNeue", "Inter", -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--co-text);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 400ms ease, transform 400ms ease;
  pointer-events: none;
}

.channel-orch.show-hint .channel-orch__hint {
  opacity: 0.65;
  transform: translateY(0);
}

.channel-orch__hint-arrow {
  display: inline-block;
  animation: co-hint-bounce 1.6s ease-in-out infinite;
}

@keyframes co-hint-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(4px);
  }
}

/* ---------- Principles grid ---------- */
.channel-orch__principles-wrap {
  margin-top: 56px;
}

@media (min-width: 1024px) {
  .channel-orch__principles-wrap {
    margin-top: 72px;
  }
}

.channel-orch__principles {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* Cards flex to fill the row based on how many are added.
   Mobile: 1 per row · Tablet: max 2 per row · Desktop: max 4 per row.
   Fewer cards stretch to fill the row evenly (1 → 100%, 2 → 50%, 3 → 33%, 4 → 25%). */
.channel-orch__principles .co-principle {
  flex: 1 1 100%;
  min-width: 0;
}

@media (min-width: 768px) {
  .channel-orch__principles .co-principle {
    flex-basis: calc(50% - 8px);
  }
}

@media (min-width: 1024px) {
  .channel-orch__principles .co-principle {
    flex-basis: calc(25% - 12px);
  }
}

.co-principle {
  background: var(--co-bg-card);
  border: 1px solid var(--co-border);
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}

.co-principle__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(69, 191, 105, 0.1);
  margin-bottom: 14px;
}

.co-principle__icon {
  display: block;
  max-width: 100%;
  max-height: 28px;
  width: auto;
  height: auto;
}

.co-principle__title {
  font-family: "PolySans", "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--co-heading);
  margin: 0 0 8px 0;
}

.co-principle__body {
  font-family: "RMNeue", "Inter", -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.55;
  color: var(--co-text);
  margin: 0;
}

/* ---------- Dark theme overrides ---------- */
.channel-orch.dark {
  --co-text: rgba(255, 255, 255, 0.7);
  --co-heading: #ffffff;
  --co-bg-card: rgba(255, 255, 255, 0.06);
  --co-border: rgba(255, 255, 255, 0.1);
}

.channel-orch.dark .channel-orch__progress {
  background: rgba(255, 255, 255, 0.14);
}

.channel-orch.dark .channel-orch__progress-bar {
  background: var(--co-accent-green);
}

.channel-orch.dark .co-card--accent-dark-green .co-card__chip,
.channel-orch.dark .co-card--accent-green .co-card__chip {
  color: #ffffff;
}

/* ---------- Reduced-motion fallback ---------- */
@media (prefers-reduced-motion: reduce) {
  .channel-orch__pin-inner {
    position: static !important;
    height: auto !important;
    gap: 32px;
  }
  .channel-orch__pin-outer {
    height: auto !important;
  }
  .channel-orch__viewport {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  .channel-orch__track {
    transform: none !important;
    transition: none;
  }
  .co-card,
  .channel-orch__hint-arrow,
  .channel-orch__progress-bar {
    transition: none !important;
    animation: none !important;
  }
  .channel-orch__foot {
    display: none !important;
  }
}
