/* Features flip deck - exact deck from prompt, scoped to #features so the rest of the landing page is untouched */
#features, #features * { box-sizing: border-box; }

#features {
  --ink: #111827;
  --muted: #6b7280;
  --line: #ececf3;
  --card: #ffffff;
  --violet: #7c3aed;
  --green: #10b981;
  --orange: #f59e0b;
  --blue: #3b82f6;
  --lav: #f6f6fb;
}

#features.features { background: var(--lav); padding: 88px 24px; }
#features .wrap { max-width: 1120px; margin: 0 auto; }
#features .feat-head { text-align: center; max-width: 720px; margin: 0 auto 40px; }
#features .feat-eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: var(--violet); margin: 0 0 12px; }
#features .feat-head h2 { font-size: clamp(28px, 4vw, 44px); line-height: 1.1; margin: 0 0 14px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
#features .feat-head p { font-size: 18px; color: var(--muted); margin: 0; }

/* ===== FLIP DECK ===== */
#features .deck-stage { max-width: 1040px; margin: 0 auto; position: relative; }
#features .deck { position: relative; width: 100%; min-height: 520px; z-index: 1; perspective: 2000px; }
@media (max-width: 880px) {
  #features .deck { min-height: 760px; }
}

/* pinned mode: stage is exactly one viewport, the deck fills the space
   between header and controls so a whole card is always fully visible */
#features.deck-scrub .deck-stage {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 12px;
  box-sizing: border-box;
}
#features.deck-scrub .feat-head { flex: 0 0 auto; margin-bottom: 14px; }
#features.deck-scrub .feat-head p { font-size: 16px; }
#features.deck-scrub .deck {
  flex: 1 1 auto;
  min-height: 0;
  width: min(1000px, 92vw);
  margin: 4px auto;
  max-height: 660px;
}
#features.deck-scrub .deck-ctrls { flex: 0 0 auto; margin-top: 14px; }
#features.deck-scrub { padding-top: 0; padding-bottom: 0; }

/* decorative blank card-backs for depth (never real cards, so no text bleed) */
#features.deck-scrub .deck::before,
#features.deck-scrub .deck::after {
  content: '';
  position: absolute;
  left: 3%;
  right: 3%;
  top: 0;
  bottom: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  transform: translateY(-16px) scale(.965);
  opacity: .65;
  z-index: 0;
  pointer-events: none;
}
#features.deck-scrub .deck::after {
  transform: translateY(-30px) scale(.93);
  opacity: .4;
}

/* aurora glow behind the deck (hue shifts per card via JS) */
#features .deck-aurora {
  position: absolute;
  inset: -8% -14%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 38% at 28% 38%, rgba(124, 58, 237, .16) 0%, transparent 70%),
    radial-gradient(40% 36% at 74% 62%, rgba(16, 185, 129, .13) 0%, transparent 70%);
  filter: blur(6px);
  opacity: .9;
  will-change: filter;
}
#features.deck-static .deck-aurora { display: none; }

/* one card at a time: hidden by default, only .is-active is visible
   (and .is-leaving briefly while it flips out). No translucent peek stack. */
#features .deck-card {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(40px) rotateX(10deg) scale(.96);
  transform-origin: center 65%;
  backface-visibility: hidden;
  will-change: transform, opacity;
  pointer-events: none;
  transition: opacity .45s ease, transform .6s cubic-bezier(.4, 0, .2, 1), visibility .6s;
}
/* pre-JS only: show the first card so the section is never blank */
#features:not(.deck-scrub):not(.deck-static) .deck-card:first-child { opacity: 1; visibility: visible; transform: none; }
#features .deck-card.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  z-index: 3;
  pointer-events: auto;
}
#features .deck-card.is-leaving {
  opacity: 0;
  visibility: visible;
  transform: translateY(-28px) rotateX(-70deg) scale(.92);
  z-index: 2;
}

#features .card-face {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 30px 60px -25px rgba(17, 24, 39, .4);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
  padding: 28px;
  height: 100%;
  position: relative;
  overflow: hidden;
  transition: box-shadow .45s ease;
}
#features .deck-card.is-active .card-face {
  box-shadow: 0 44px 90px -34px rgba(17, 24, 39, .55);
}

/* fit the mockup within the card height, never clip or scroll */
#features .fvisual {
  min-height: 0;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#features .fvisual .window {
  width: 100%;
  max-height: 100%;
}
#features.deck-scrub .fcopy .lead { font-size: 15px; margin-bottom: 12px; }
#features.deck-scrub .flist li { font-size: 14px; margin: 0 0 9px; }

/* short laptop screens: scale the whole card face down so it always fits */
@media (max-height: 760px) {
  #features.deck-scrub .card-face { transform: scale(.9); transform-origin: center; }
  #features.deck-scrub .fcopy h3 { font-size: 22px; }
  #features.deck-scrub .feat-head p { display: none; }
}
/* sheen sweep injected by JS when a card lands */
#features .deck-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, .5) 48%, transparent 60%);
  transform: translateX(-130%);
  opacity: 0;
  z-index: 3;
}

/* scroll hint */
#features .deck-hint {
  text-align: center;
  margin: 14px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  animation: deckHintNudge 2.2s ease-in-out infinite;
}
@keyframes deckHintNudge {
  0%, 100% { transform: translateY(0); opacity: .75; }
  50% { transform: translateY(4px); opacity: 1; }
}
#features.deck-static .deck-hint { display: none; }

/* ===== static fallback: vertical stack (reduced motion, narrow/touch, no GSAP) ===== */
#features.deck-static .deck {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
  perspective: none;
}
#features.deck-static .deck-card {
  position: relative;
  inset: auto;
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  transition: none;
}
#features.deck-static .card-face { height: auto; }
#features.deck-static .deck-card.deck-reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .6s ease, transform .6s ease;
}
#features.deck-static .deck-card.deck-reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}
#features.deck-static .deck-ctrls { display: none; }
@media (prefers-reduced-motion: reduce) {
  #features.deck-static .deck-card.deck-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
#features .deck-card:nth-child(even) .card-face { grid-template-columns: 1fr 1fr; }
@media (max-width: 880px) {
  #features .card-face { grid-template-columns: 1fr; gap: 22px; padding: 24px; }
}

#features .fcopy .grouptag { text-transform: uppercase; letter-spacing: .1em; font-size: 11px; font-weight: 700; color: var(--muted); margin: 0 0 6px; }
#features .fcopy h3 { font-size: 26px; margin: 0 0 8px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
#features .flist a { color: var(--violet); text-decoration: underline; text-underline-offset: 2px; }
#features .fcopy .tag { font-size: 16px; font-weight: 700; color: var(--violet); margin: 0 0 12px; }
#features .fcopy .lead { font-size: 16px; color: var(--muted); line-height: 1.6; margin: 0 0 18px; }
#features .flist { list-style: none; margin: 0; padding: 0; }
#features .flist li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.5; margin: 0 0 12px; color: #374151; }
#features .flist svg { flex: 0 0 auto; width: 20px; height: 20px; color: var(--green); margin-top: 1px; }

/* dashboard mockup */
#features .window { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 30px -18px rgba(17, 24, 39, .3); overflow: hidden; }
#features .winbar { display: flex; align-items: center; gap: 7px; padding: 11px 15px; border-bottom: 1px solid var(--line); background: #fafafd; }
#features .dot { width: 11px; height: 11px; border-radius: 50%; }
#features .dot.r { background: #ff5f57; }
#features .dot.a { background: #febc2e; }
#features .dot.g { background: #28c840; }
#features .wintitle { margin-left: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
#features .winbody { padding: 16px; }
#features .kpirow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
#features .kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
#features .kpitop { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
#features .kpilabel { font-size: 12px; color: var(--muted); font-weight: 600; }
#features .chip { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; }
#features .chip svg { width: 15px; height: 15px; }
#features .chip.violet { background: var(--violet); }
#features .chip.green { background: var(--green); }
#features .kpival { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
#features .kpifoot { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; }
#features .kpifoot small { font-size: 11px; color: var(--muted); }
#features .delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
#features .delta.up, #features .delta.downgood { color: #047857; background: rgba(16, 185, 129, .12); }
#features .cardin { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
#features .cardhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#features .cardhead h4 { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); }
#features .live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .06em; color: var(--green); }
#features .live .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: featDeckPulse 1.4s infinite; }
@keyframes featDeckPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
#features .wave { display: flex; align-items: flex-end; gap: 4px; height: 32px; margin: 4px 0 12px; }
#features .wave span { flex: 1; background: var(--violet); border-radius: 3px; opacity: .85; animation: featDeckWv 1s ease-in-out infinite; }
#features .wave span:nth-child(1) { animation-delay: 0s; }
#features .wave span:nth-child(2) { animation-delay: .05s; }
#features .wave span:nth-child(3) { animation-delay: .1s; }
#features .wave span:nth-child(4) { animation-delay: .15s; }
#features .wave span:nth-child(5) { animation-delay: .2s; }
#features .wave span:nth-child(6) { animation-delay: .25s; }
#features .wave span:nth-child(7) { animation-delay: .3s; }
#features .wave span:nth-child(8) { animation-delay: .35s; }
#features .wave span:nth-child(9) { animation-delay: .4s; }
#features .wave span:nth-child(10) { animation-delay: .45s; }
#features .wave span:nth-child(11) { animation-delay: .5s; }
#features .wave span:nth-child(12) { animation-delay: .55s; }
@keyframes featDeckWv {
  0%, 100% { height: 20%; }
  50% { height: 100%; }
}
#features .act { display: flex; flex-direction: column; gap: 9px; }
#features .row { display: flex; align-items: center; gap: 10px; }
#features .rowic { width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: #f1f0f9; color: var(--violet); }
#features .rowic.green { background: rgba(16, 185, 129, .12); color: var(--green); }
#features .rowic.blue { background: rgba(59, 130, 246, .12); color: var(--blue); }
#features .rowic svg { width: 15px; height: 15px; }
#features .rowbody { flex: 1; min-width: 0; }
#features .rowtitle { font-size: 13px; font-weight: 600; color: var(--ink); }
#features .rowsub { font-size: 12px; color: var(--muted); }
#features .status { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
#features .status.green { color: #047857; background: rgba(16, 185, 129, .12); }
#features .status.violet { color: #6d28d9; background: rgba(124, 58, 237, .12); }
#features .slots { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
#features .slot { position: relative; font-size: 12px; font-weight: 600; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #374151; }
#features .slot.new { border-color: var(--green); color: var(--green); background: rgba(16, 185, 129, .06); }
#features .slot .tag2 { display: block; font-size: 10px; color: var(--green); margin-top: 2px; }
#features .chartsvg { width: 100%; height: auto; display: block; }
#features .legend { display: flex; gap: 18px; margin-top: 8px; }
#features .legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
#features .sw { width: 12px; height: 12px; border-radius: 3px; }
#features .sw.calls { background: var(--violet); }
#features .sw.appts { background: var(--green); }
#features .minirow { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 10px; align-items: center; margin-top: 12px; }
#features .mini { border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; }
#features .minilabel { font-size: 11px; color: var(--muted); font-weight: 600; }
#features .minival { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
#features .mini.blue .minival { color: var(--blue); }
#features .mini.green .minival { color: var(--green); }
#features .mini.violet .minival { color: var(--violet); }
#features .donutwrap { position: relative; width: 60px; height: 60px; }
#features .donutwrap svg { transform: rotate(-90deg); }
#features .donutlabel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: var(--ink); }

/* controls */
#features .deck-ctrls { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 28px; margin-bottom: 8px; }
#features .deck-arrow {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink);
  cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .2s, box-shadow .2s; padding: 0;
}
#features .deck-arrow:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -8px rgba(17, 24, 39, .35); }
#features .deck-arrow svg { width: 20px; height: 20px; }
#features .deck-dots { display: flex; gap: 9px; }
#features .deck-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #d5d3e6; border: none; cursor: pointer; padding: 0;
  transition: width .3s, background .3s;
  position: relative;
  overflow: hidden;
}
#features .deck-dot.active { width: 26px; border-radius: 20px; background: #e4defa; }
/* intra-card scroll progress fill (--p set by JS 0..1) */
#features .deck-dot.active::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--violet);
  transform-origin: left center;
  transform: scaleX(var(--p, 1));
}

/* grouped capability index below the deck */
#features .feat-groups {
  max-width: 1040px;
  margin: 36px auto 0;
  position: relative;
}
#features .feat-groups-head {
  text-align: center;
  margin: 0 0 22px;
}
#features .feat-groups-eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  font-weight: 700;
  color: var(--violet);
  margin: 0 0 8px;
}
#features .feat-groups-title {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
  line-height: 1.2;
}
#features .feat-groups-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  perspective: 1400px;
}
@media (max-width: 880px) {
  #features .feat-groups-grid { grid-template-columns: 1fr; }
}
#features .feat-group {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, .97) 0%, rgba(248, 247, 255, .96) 100%);
  border: 1px solid rgba(124, 58, 237, .12);
  border-radius: 20px;
  padding: 24px 22px 22px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .8) inset,
    0 18px 40px -28px rgba(17, 24, 39, .45);
  transform-style: preserve-3d;
  will-change: transform, box-shadow;
  transition: border-color .3s ease, box-shadow .35s ease;
}
#features .feat-group::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--violet), var(--green));
  opacity: .9;
}
#features .feat-group[data-accent="capture"]::before {
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
}
#features .feat-group[data-accent="fill"]::before {
  background: linear-gradient(90deg, #10b981, #34d399);
}
#features .feat-group[data-accent="run"]::before {
  background: linear-gradient(90deg, #3b82f6, #7c3aed);
}
#features .feat-group-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .55) 48%, transparent 62%);
  transform: translateX(-120%);
  opacity: 0;
  z-index: 1;
}
#features .feat-group-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  position: relative;
  z-index: 2;
}
#features .feat-group-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid rgba(79, 70, 229, .1);
  box-shadow: none;
}
#features .feat-group[data-accent="fill"] .feat-group-icon {
  color: #0f766e;
  background: #ecfdf5;
  border-color: rgba(15, 118, 110, .12);
  box-shadow: none;
}
#features .feat-group[data-accent="run"] .feat-group-icon {
  color: #4f46e5;
  background: #eef2ff;
  border-color: rgba(79, 70, 229, .1);
  box-shadow: none;
}
#features .feat-group-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.5;
}
#features .feat-group-kicker {
  margin: 0 0 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
#features .feat-group-titles h3,
#features .feat-group h3 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
  text-transform: none;
  color: var(--ink);
  margin: 0;
  line-height: 1.25;
}
#features .feat-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0;
}
#features .feat-group li {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #374151;
  border-top: 1px solid rgba(236, 236, 243, .9);
}
#features .feat-group li:first-child { border-top: none; padding-top: 2px; }
#features .feat-group li:last-child { padding-bottom: 0; }
#features .feat-group li::before {
  content: '';
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 6px;
  border: 1px solid rgba(15, 118, 110, .14);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat,
    #ecfdf5;
}
#features .feat-group a {
  color: var(--violet);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}
#features .feat-group.is-hot {
  border-color: rgba(124, 58, 237, .28);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 28px 55px -28px rgba(17, 24, 39, .5);
}
@media (hover: hover) and (pointer: fine) {
  #features .feat-group:hover {
    border-color: rgba(124, 58, 237, .26);
  }
}

@media (prefers-reduced-motion: reduce) {
  #features .deck-card { transition: none !important; }
  #features .live .pulse, #features .wave span { animation: none !important; }
  #features .feat-group,
  #features .feat-group-sheen { transition: none !important; transform: none !important; }
}
