/* Values from the Styles tab arrive as CSS variables on .feature-spotlight.
   Padding falls back to the theme section spacing when not set. */
.feature-spotlight {
  /* Own background so the section follows light/dark mode */
  background-color: var(--color-bg);
  position: relative;
  padding-top: var(--spot-pad-mobile-top, calc(var(--section-spacing) / 2));
  padding-bottom: var(--spot-pad-mobile-bottom, calc(var(--section-spacing) / 2));
  /* Fallback for browsers without overflow: clip */
  overflow: hidden;
}

@media (min-width: 768px) {
  .feature-spotlight {
    padding-top: var(--spot-pad-desktop-top, var(--section-spacing));
    padding-bottom: var(--spot-pad-desktop-bottom, var(--section-spacing));
  }
}

/* Clip sideways only, so the glow and floating cards never cause a horizontal
   scrollbar but the glow can still fade out above and below the section */
@supports (overflow: clip) {
  .feature-spotlight {
    overflow: visible;
    overflow-x: clip;
  }
}

/* ---------- Layout ---------- */
.feature-spotlight__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
}

/* Image width: the image column takes --spot-image-width of the row, the text
   gets the rest, so the image grows toward the text from its own side */
@media (min-width: 1024px) {
  .feature-spotlight--image-left .feature-spotlight__inner {
    grid-template-columns: minmax(0, var(--spot-image-width, 50%)) minmax(0, 1fr);
    gap: 5rem;
  }

  .feature-spotlight--image-right .feature-spotlight__inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--spot-image-width, 50%));
    gap: 5rem;
  }

  .feature-spotlight--image-right .feature-spotlight__media {
    order: 2;
  }
}

/* Bottom: centered text above a wide image */
.feature-spotlight--image-bottom .feature-spotlight__inner {
  justify-items: center;
}

.feature-spotlight--image-bottom .feature-spotlight__media {
  order: 2;
  width: 100%;
}

.feature-spotlight--image-bottom .feature-spotlight__content {
  max-width: 48rem;
  text-align: center;
}

.feature-spotlight--image-bottom .feature-spotlight__list {
  align-items: center;
}

@media (min-width: 1024px) {
  .feature-spotlight--image-bottom .feature-spotlight__media {
    width: var(--spot-image-width-bottom, 100%);
  }
}

/* ---------- Text ---------- */

.feature-spotlight__heading {
  font-size: var(--fs-h2);
  font-weight: 800;
  margin-bottom: 1.25rem;
  line-height: 1.2;
}

/* A Highlight color set in the Styles tab replaces the theme gradient */
.feature-spotlight__highlight {
  background: var(--spot-highlight, linear-gradient(135deg, var(--color-primary), var(--color-accent)));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.feature-spotlight__description {
  font-size: var(--fs-subheading);
  color: var(--color-body);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.feature-spotlight__list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0 0 2.5rem;
}

.feature-spotlight__list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

.feature-spotlight__icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background-color: var(--color-primary-tint);
  color: var(--color-primary);
}

/* ---------- Media ---------- */
.feature-spotlight__media,
.feature-spotlight__media-wrapper {
  position: relative;
  width: 100%;
}

.feature-spotlight__image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--spot-radius, 1.5rem);
  box-shadow: var(--spot-shadow);
}

.feature-spotlight__video-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--spot-radius, 1.5rem);
  background: linear-gradient(to right bottom, var(--color-primary-tint), color-mix(in srgb, var(--color-primary) 30%, var(--color-bg)));
  box-shadow: var(--spot-shadow);
  color: var(--color-muted);
}

.feature-spotlight__play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  border: none;
  border-radius: 50%;
  background-color: var(--color-card);
  color: var(--color-heading);
  box-shadow: 0 10px 25px var(--shadow-color);
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-spotlight__play:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.feature-spotlight__play--preview {
  cursor: default;
  opacity: 0.6;
}

.feature-spotlight__play svg {
  width: 2rem;
  height: 2rem;
  margin-left: 0.25rem;
}

/* Floating cards: placed by the Content tab, moved by the parallax with
   "translate" so it combines with the entrance animation */
.feature-spotlight__card {
  position: absolute;
  z-index: 3;
  max-width: 280px;
  height: auto;
  padding: var(--spot-card-pad, 0);
  border-radius: var(--spot-card-radius, 1rem);
  background-color: var(--spot-card-bg, transparent);
  box-shadow: 0 15px 35px var(--shadow-color);
  transition: translate 0.2s ease-out;
}

.feature-spotlight--card-border .feature-spotlight__card {
  border: 1px solid var(--color-border);
}

@media (max-width: 767px) {
  .feature-spotlight__card {
    display: none;
  }
}

/* ---------- Background glow ---------- */
.feature-spotlight__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: var(--spot-glow-strength, 0.6);
}

.feature-spotlight__bg--fade {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 25%, #000 75%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 25%, #000 75%, transparent 100%);
}

.feature-spotlight__blob {
  position: absolute;
  border-radius: 50%;
  aspect-ratio: 1;
  will-change: transform;
}

.feature-spotlight__blob--1 {
  top: -10%;
  left: -10%;
  width: 60vw;
  max-width: 800px;
  background: radial-gradient(circle, color-mix(in srgb, var(--spot-glow-1, var(--color-primary)) 40%, transparent) 0%, transparent 65%);
}

.feature-spotlight__blob--2 {
  bottom: -20%;
  right: -10%;
  width: 55vw;
  max-width: 760px;
  background: radial-gradient(circle, color-mix(in srgb, var(--spot-glow-2, var(--color-accent)) 38%, transparent) 0%, transparent 65%);
}

.feature-spotlight__blob--3 {
  top: 25%;
  left: 40%;
  width: 40vw;
  max-width: 560px;
  background: radial-gradient(circle, color-mix(in srgb, var(--spot-glow-1, var(--color-primary)) 28%, transparent) 0%, transparent 65%);
}

@keyframes spotBlob1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(10%, 8%) scale(1.12); }
}

@keyframes spotBlob2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-12%, -8%) scale(1.1); }
}

@keyframes spotBlob3 {
  0%, 100% { transform: translate(0, 0) scale(0.9); }
  50% { transform: translate(-10%, 10%) scale(1.08); }
}

.feature-spotlight__bg--flow .feature-spotlight__blob--1 { animation: spotBlob1 20s ease-in-out infinite; }
.feature-spotlight__bg--flow .feature-spotlight__blob--2 { animation: spotBlob2 24s ease-in-out infinite; }
.feature-spotlight__bg--flow .feature-spotlight__blob--3 { animation: spotBlob3 17s ease-in-out infinite; }

/* ---------- Scroll-in animation ----------
   module.js adds .is-reveal-ready (hide) and then .is-inview (play) when the
   section enters the screen. Without JavaScript nothing is hidden. */
@keyframes spotRise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

@keyframes spotMediaIn {
  from { opacity: 0; transform: translateY(40px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes spotPop {
  from { opacity: 0; transform: translateY(16px) scale(0.92); }
  to { opacity: 1; transform: none; }
}

.feature-spotlight--animate.is-reveal-ready:not(.is-inview) .feature-spotlight__content > *,
.feature-spotlight--animate.is-reveal-ready:not(.is-inview) .feature-spotlight__media,
.feature-spotlight--animate.is-reveal-ready:not(.is-inview) .feature-spotlight__card {
  opacity: 0;
}

.feature-spotlight--animate.is-inview .feature-spotlight__content > * {
  animation: spotRise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.feature-spotlight--animate.is-inview .feature-spotlight__content > :nth-child(1) { animation-delay: 0.05s; }
.feature-spotlight--animate.is-inview .feature-spotlight__content > :nth-child(2) { animation-delay: 0.15s; }
.feature-spotlight--animate.is-inview .feature-spotlight__content > :nth-child(3) { animation-delay: 0.25s; }
.feature-spotlight--animate.is-inview .feature-spotlight__content > :nth-child(4) { animation-delay: 0.35s; }
.feature-spotlight--animate.is-inview .feature-spotlight__content > :nth-child(5) { animation-delay: 0.45s; }

.feature-spotlight--animate.is-inview .feature-spotlight__media {
  animation: spotMediaIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.feature-spotlight--animate.is-inview .feature-spotlight__card {
  animation: spotPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s both;
}

@media (prefers-reduced-motion: reduce) {
  .feature-spotlight__blob,
  .feature-spotlight--animate.is-inview .feature-spotlight__content > *,
  .feature-spotlight--animate.is-inview .feature-spotlight__media,
  .feature-spotlight--animate.is-inview .feature-spotlight__card {
    animation: none;
  }

  .feature-spotlight--animate.is-reveal-ready .feature-spotlight__content > *,
  .feature-spotlight--animate.is-reveal-ready .feature-spotlight__media,
  .feature-spotlight--animate.is-reveal-ready .feature-spotlight__card {
    opacity: 1;
  }
}

/* ---------- Video pop-up (built by module.js) ---------- */
.feature-spotlight-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.feature-spotlight-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.feature-spotlight-modal__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.feature-spotlight-modal__content--video {
  position: relative;
  width: 90%;
  max-width: 900px;
  background-color: #000000;
  border-radius: 0.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transform: scale(0.95) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-spotlight-modal.is-open .feature-spotlight-modal__content--video {
  transform: none;
}

.feature-spotlight-modal__close {
  position: absolute;
  top: -2.75rem;
  right: -0.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.feature-spotlight-modal__close:hover {
  color: #FFFFFF;
}

.feature-spotlight-modal__video-wrapper {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 0.5rem;
}

.feature-spotlight-modal__video-wrapper iframe,
.feature-spotlight-modal__video-wrapper video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Built-in device art: transparent, so no frame or shadow box ---------- */
.feature-spotlight__image--art {
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 30px 40px var(--shadow-color));
}

/* ---------- Analytics chart card (Media type: Analytics chart card) ---------- */
.feature-spotlight__chart {
  --chart-1: var(--spot-highlight, var(--color-primary));
  --chart-2: #10B981;
  --chart-3: #EC4899;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--color-border);
  border-radius: 1.25rem;
  background-color: var(--color-card);
  box-shadow: 0 24px 50px -24px var(--shadow-color);
}

.feature-spotlight__chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.feature-spotlight__chart-title {
  margin: 0;
  color: var(--color-heading);
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
}

.feature-spotlight__chart-subtitle {
  margin: 0.25rem 0 0;
  color: var(--color-muted);
  font-size: 0.8125rem;
}

.feature-spotlight__chart-period {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  color: var(--color-heading);
  font-size: 0.8125rem;
  font-weight: 500;
}

.feature-spotlight__chart-plot {
  position: relative;
  margin: 1.5rem 0;
  color: var(--chart-1);
}

.feature-spotlight__chart-plot svg {
  display: block;
  width: 100%;
  height: clamp(9rem, 22vw, 12rem);
  overflow: visible;
}

.feature-spotlight__chart-grid {
  fill: none;
  stroke: var(--color-border);
  stroke-dasharray: 4 6;
  vector-effect: non-scaling-stroke;
}

.feature-spotlight__chart-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.feature-spotlight__chart-line--2 {
  stroke: var(--chart-2);
  stroke-width: 2;
  opacity: 0.8;
}

/* Tooltip pinned to a point on the line (40% across, 61% down) */
.feature-spotlight__chart-dot {
  position: absolute;
  top: 61%;
  left: 40%;
  width: 0.875rem;
  height: 0.875rem;
  border: 3px solid var(--color-card);
  border-radius: 50%;
  background-color: var(--chart-1);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--chart-1) 20%, transparent);
  transform: translate(-50%, -50%);
}

.feature-spotlight__chart-tip {
  position: absolute;
  bottom: calc(39% + 1.25rem);
  left: 40%;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  background-color: var(--color-card);
  box-shadow: 0 12px 30px -12px var(--shadow-color);
  transform: translateX(-50%);
  white-space: nowrap;
}

.feature-spotlight__chart-tip-label {
  color: var(--color-muted);
  font-size: 0.75rem;
}

.feature-spotlight__chart-tip strong {
  color: var(--color-heading);
  font-size: 1rem;
}

.feature-spotlight__chart-up {
  color: #10B981;
  font-size: 0.75rem;
  font-weight: 600;
}

.feature-spotlight__chart-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.feature-spotlight__chart-metric {
  padding: 0.875rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 0.875rem;
}

.feature-spotlight__chart-metric dt {
  color: var(--color-muted);
  font-size: 0.75rem;
}

.feature-spotlight__chart-metric dd {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  margin: 0.25rem 0 0;
}

.feature-spotlight__chart-metric strong {
  grid-column: 1 / -1;
  color: var(--color-heading);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.feature-spotlight__chart-spark {
  width: 4rem;
  height: 1.5rem;
  fill: none;
  stroke: var(--spark, var(--chart-1));
  stroke-width: 2.5;
  stroke-linecap: round;
}

.feature-spotlight__chart-metric--2 { --spark: var(--chart-2); }
.feature-spotlight__chart-metric--3 { --spark: var(--chart-3); }

/* The line draws itself in when the section scrolls into view */
@keyframes spotChartDraw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

.feature-spotlight--animate.is-inview .feature-spotlight__chart-line:not(.feature-spotlight__chart-line--2) {
  stroke-dasharray: 1;
  animation: spotChartDraw 1.6s cubic-bezier(0.65, 0, 0.35, 1) 0.3s both;
}

@media (prefers-reduced-motion: reduce) {
  .feature-spotlight--animate.is-inview .feature-spotlight__chart-line {
    animation: none;
  }
}

/* ---------- App store buttons ---------- */
.feature-spotlight__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: -1rem 0 2.5rem;
}

.feature-spotlight__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 3.25rem;
  padding: 0.5rem 1.125rem 0.5rem 0.875rem;
  border: 1px solid #333;
  border-radius: 0.625rem;
  background-color: #000;
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-spotlight__badge span {
  display: flex;
  flex-direction: column;
}

.feature-spotlight__badge small {
  font-size: 0.6875rem;
  font-weight: 400;
}

.feature-spotlight__badge:hover,
.feature-spotlight__badge:focus-visible {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
}

/* ---------- Styles > Image: shadow and corners ---------- */
.feature-spotlight { --spot-shadow: 0 20px 40px var(--shadow-color); }
.feature-spotlight--shadow-soft { --spot-shadow: 0 12px 28px -10px var(--shadow-color); }
.feature-spotlight--shadow-strong { --spot-shadow: 0 30px 60px -10px var(--shadow-color), 0 12px 24px -12px var(--shadow-color); }
.feature-spotlight--shadow-none { --spot-shadow: none; }

/* Following the image's shape: a drop shadow around the visible pixels */
.feature-spotlight--shadow-shape .feature-spotlight__image {
  box-shadow: none;
  filter: drop-shadow(0 18px 28px var(--shadow-color));
}

.feature-spotlight--shadow-shape.feature-spotlight--shadow-soft .feature-spotlight__image {
  filter: drop-shadow(0 10px 18px var(--shadow-color));
}

.feature-spotlight--shadow-shape.feature-spotlight--shadow-strong .feature-spotlight__image {
  filter: drop-shadow(0 30px 40px var(--shadow-color));
}

/* Thumbnails taken from YouTube or Vimeo: a 16:9 frame */
.feature-spotlight__image--video {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background-color: var(--color-bg-alt);
}

/* First frame of an uploaded video, shown like an image */
video.feature-spotlight__image {
  display: block;
  pointer-events: none;
}

.feature-spotlight-modal__video-wrapper video {
  background-color: #000;
  object-fit: contain;
}
