/* 07 — Care plans (prefix cp-) */

.cp-section {
  margin-top: var(--space-section);
}

/* ---- centered head block ---- */

.cp-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.cp-title {
  max-width: 700px;
  text-wrap: balance;
}

.cp-sub {
  max-width: 520px;
  margin-top: 24px;
}

.cp-cta {
  margin-top: 32px;
}

/* ---- carousel ---- */

.cp-carousel {
  margin-top: 100px;
  width: 100%;
}

.cp-track {
  --cp-edge: max(var(--gutter), calc((100vw - var(--container-max)) / 2 + var(--gutter)));
  display: flex;
  gap: 32px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding-inline: var(--cp-edge);
  scroll-padding-inline: var(--cp-edge);
  /* breathing room so card hover-lift and focus rings aren't clipped */
  padding-block: 8px;
  cursor: grab;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.cp-track::-webkit-scrollbar {
  display: none;
}

.cp-track.cp-is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
  user-select: none;
}

.cp-track:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: var(--r-card-sm);
}

/* ---- cards ---- */

.cp-card {
  position: relative;
  flex: 0 0 auto;
  /* 9:16 — the format the videos actually ship in */
  width: min(360px, calc(100vw - 2 * var(--gutter) - 20px));
  aspect-ratio: 9 / 16;
  border-radius: var(--r-card-sm);
  overflow: hidden;
  scroll-snap-align: start;
  box-shadow: var(--shadow-soft);
  isolation: isolate;
}

.cp-media {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

/* ---- real footage ---- */

.cp-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.cp-video-surface {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none; /* JS-only control; .js root reveals it */
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: #ebebe4;
  cursor: pointer;
}

.js .cp-video-surface {
  display: flex;
}

.cp-video-surface:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: -4px;
}

.cp-video-surface__icon {
  display: none;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  padding-left: 4px; /* optically centre the triangle */
  border-radius: var(--r-pill);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.cp-video-surface.is-paused .cp-video-surface__icon {
  display: flex;
}

.cp-video-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: none; /* JS-only controls; .js root reveals them */
  gap: 8px;
}

.js .cp-video-controls {
  display: flex;
}

.cp-video-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-pill);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  color: #ebebe4;
  transition: transform var(--dur-fast) var(--ease-out);
}

.cp-video-toggle:hover {
  transform: scale(1.05);
}

.cp-video-toggle:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 2px;
}

.cp-video-toggle__sound-off {
  display: none;
}

.cp-video-sound.is-muted .cp-video-toggle__sound-on {
  display: none;
}

.cp-video-sound.is-muted .cp-video-toggle__sound-off {
  display: block;
}

/* varied warm gradient placeholders (raw hex allowed here only) */

.cp-media--gutter {
  background-image: radial-gradient(120% 90% at 80% 0%, rgba(255, 235, 200, 0.5), rgba(255, 235, 200, 0) 55%),
    linear-gradient(160deg, #c89a6b 0%, #a9713f 55%, #7e5630 100%);
}

.cp-media--kitchen {
  background-image: radial-gradient(110% 85% at 20% 5%, rgba(255, 248, 230, 0.55), rgba(255, 248, 230, 0) 60%),
    linear-gradient(155deg, #e8d3b5 0%, #c9a276 58%, #8f6b45 100%);
}

.cp-media--detector {
  background-image: radial-gradient(120% 90% at 75% 0%, rgba(255, 232, 214, 0.5), rgba(255, 232, 214, 0) 55%),
    linear-gradient(165deg, #e3b7a0 0%, #b97f62 55%, #8a5540 100%);
}

.cp-media--deck {
  background-image: radial-gradient(115% 85% at 25% 0%, rgba(250, 235, 205, 0.5), rgba(250, 235, 205, 0) 58%),
    linear-gradient(158deg, #d9b48a 0%, #a97c50 55%, #6e4e32 100%);
}

.cp-media--hvac {
  background-image: radial-gradient(120% 90% at 70% 5%, rgba(255, 253, 240, 0.55), rgba(255, 253, 240, 0) 60%),
    linear-gradient(162deg, #e6dcc3 0%, #b9ae8c 58%, #8c8266 100%);
}

/* ---- glass panel ---- */

.cp-panel {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 24px;
  z-index: 1;
  padding: 20px;
  border-radius: var(--r-tile);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.cp-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cp-icon {
  font-size: 20px;
  line-height: 1;
}

.cp-name {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink);
}

.cp-desc {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--ink);
  opacity: 0.72;
}

.cp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.cp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.cp-chip-glyph {
  font-size: 13px;
  line-height: 1;
  opacity: 0.7;
}

/* ---- motion & polish ---- */

@media (prefers-reduced-motion: no-preference) {
  .cp-card {
    transition: transform var(--dur-fast) var(--ease-out),
      box-shadow var(--dur-fast) var(--ease-out);
  }

  .cp-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
  }

  /* staggered entrance for the head block */
  .cp-sub.reveal {
    transition-delay: 60ms;
  }

  .cp-cta.reveal {
    transition-delay: 120ms;
  }

  .cp-carousel.reveal {
    transition-delay: 180ms;
  }
}

/* ---- responsive ---- */

@media (max-width: 767px) {
  .cp-carousel {
    margin-top: 64px;
  }

  .cp-track {
    gap: 20px;
  }

  .cp-panel {
    top: 16px;
    left: 16px;
    right: 16px;
    padding: 16px;
  }
}
