/* =========================================================
   Interactive pieces (assets/js/interactive.js)
   ========================================================= */

/* ---------- SOS demo ---------- */
.sos-demo-section { padding: 74px 0 40px; }
.sos-demo {
  margin-top: 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background:
    radial-gradient(600px 260px at 20% 0%, rgba(67, 160, 71, 0.12), transparent 70%),
    radial-gradient(600px 260px at 90% 100%, rgba(38, 198, 218, 0.1), transparent 70%),
    var(--surface);
  backdrop-filter: blur(8px);
}
.demo-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.demo-tabs button,
.plan-filter button {
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s var(--ease-out);
}
.demo-tabs button:hover,
.plan-filter button:hover { color: #fff; border-color: rgba(255, 255, 255, 0.28); transform: translateY(-1px); }
.demo-tabs button[aria-selected="true"],
.plan-filter button[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(120deg, rgba(67, 160, 71, 0.32), rgba(38, 198, 218, 0.22));
  border-color: rgba(255, 255, 255, 0.35);
}
.demo-tabs button:focus-visible,
.plan-filter button:focus-visible,
.sos-demo button:focus-visible,
.shot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.demo-stage {
  display: grid;
  gap: 22px;
  margin-top: 22px;
  align-items: center;
}
@media (min-width: 900px) {
  .demo-stage { grid-template-columns: 1.25fr 1fr; }
}
.demo-phones {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.demo-phone {
  position: relative;
  flex: 0 1 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.demo-screen {
  width: 100%;
  aspect-ratio: 9 / 17;
  border-radius: 28px;
  border: 6px solid #24323F;
  outline: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, #1E2A36, #141C25);
  padding: 22px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  overflow: hidden;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
  transition: box-shadow .4s ease;
}
.sos-demo.is-alerting .is-family .demo-screen {
  box-shadow: 0 0 0 2px rgba(255, 77, 109, 0.7), 0 24px 60px rgba(255, 41, 87, 0.35);
}
.demo-label { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.demo-link {
  flex: 0 0 34px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  overflow: hidden;
}
.demo-link.is-live::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, #43A047, transparent);
  animation: ds-flow 1s linear infinite;
}
@keyframes ds-flow { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.ds-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ds-hint, .ds-quiet { margin: 0; font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.ds-msg { margin: 0; font-size: 0.82rem; color: #E4EAEE; line-height: 1.4; }
.ds-big { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; color: #fff; }
.ds-sos {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  font: 800 1.5rem var(--font-display);
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff7b93, #ff2957 60%, #c8103a);
  box-shadow: 0 0 0 10px rgba(255, 77, 109, 0.14), 0 0 0 22px rgba(255, 77, 109, 0.07), 0 14px 30px rgba(255, 41, 87, 0.45);
  animation: ds-pulse 2.2s var(--ease-out) infinite;
}
.ds-sos:hover { filter: brightness(1.08); }
@keyframes ds-pulse {
  0%, 100% { box-shadow: 0 0 0 10px rgba(255, 77, 109, 0.14), 0 0 0 22px rgba(255, 77, 109, 0.07), 0 14px 30px rgba(255, 41, 87, 0.45); }
  50% { box-shadow: 0 0 0 16px rgba(255, 77, 109, 0.1), 0 0 0 32px rgba(255, 77, 109, 0.04), 0 14px 30px rgba(255, 41, 87, 0.45); }
}
.ds-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  background: linear-gradient(120deg, #ff4d6d, #ff2957);
  box-shadow: 0 8px 20px rgba(255, 41, 87, 0.35);
}
.ds-btn.ghost { background: rgba(255, 255, 255, 0.08); box-shadow: none; border: 1px solid var(--line); }
.ds-count {
  font: 800 4rem/1 var(--font-display);
  color: #ff4d6d;
  text-shadow: 0 0 30px rgba(255, 77, 109, 0.6);
  animation: ds-pop .5s var(--ease-out);
}
@keyframes ds-pop { from { transform: scale(1.35); opacity: 0.2; } to { transform: scale(1); opacity: 1; } }
.ds-ok {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #ff4d6d, #ff2957);
  animation: ds-pop .45s var(--ease-out);
}
.ds-ok.is-calm { background: linear-gradient(135deg, #2dd4a8, #6ae3ff); color: #04211a; }
.ds-bar { width: 80%; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.ds-bar span { display: block; height: 100%; background: linear-gradient(90deg, #ffb35c, #ff4d6d); animation: ds-drain 5s linear forwards; }
@keyframes ds-drain { from { width: 100%; } to { width: 0; } }
.ds-drive { position: relative; width: 90%; height: 60px; }
.ds-road { position: absolute; left: 0; right: 0; bottom: 12px; height: 4px; border-radius: 4px; background: repeating-linear-gradient(90deg, rgba(255,255,255,0.35) 0 14px, transparent 14px 26px); animation: ds-road .6s linear infinite; }
@keyframes ds-road { to { background-position: -26px 0; } }
.ds-car { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%) scaleX(-1); font-size: 2rem; }
.ds-lock { font-size: 2.4rem; opacity: 0.8; }
.ds-wave { display: flex; gap: 5px; align-items: center; height: 44px; }
.ds-wave i { width: 6px; border-radius: 4px; background: linear-gradient(180deg, #4DD0E1, #2dd4a8); animation: ds-wave 0.9s ease-in-out infinite; }
.ds-wave i:nth-child(1) { animation-delay: -0.1s; }
.ds-wave i:nth-child(2) { animation-delay: -0.3s; }
.ds-wave i:nth-child(3) { animation-delay: -0.5s; }
.ds-wave i:nth-child(4) { animation-delay: -0.2s; }
.ds-wave i:nth-child(5) { animation-delay: -0.4s; }
@keyframes ds-wave { 0%, 100% { height: 10px; } 50% { height: 40px; } }
.ds-map {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  max-height: 120px;
  min-height: 80px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(135deg, #22303E, #1A2530);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.ds-map.is-alert { border-color: rgba(255, 77, 109, 0.45); }
.ds-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 800;
}
.ds-pin-home { left: 18%; top: 22%; background: rgba(255, 255, 255, 0.08); }
.ds-pin-you { right: 20%; bottom: 20%; color: #051b22; background: #4DD0E1; box-shadow: 0 0 0 6px rgba(38, 198, 218, 0.18); }
.ds-pin-you.is-sos { color: #fff; background: #ff2957; animation: ds-beacon 1.4s ease-out infinite; }
@keyframes ds-beacon { 0% { box-shadow: 0 0 0 0 rgba(255, 41, 87, 0.6); } 100% { box-shadow: 0 0 0 18px rgba(255, 41, 87, 0); } }
.ds-alert {
  width: 100%;
  border-radius: 12px;
  padding: 9px 10px;
  text-align: left;
  font-size: 0.82rem;
  color: #fff;
  background: linear-gradient(120deg, rgba(255, 77, 109, 0.3), rgba(255, 41, 87, 0.18));
  border: 1px solid rgba(255, 77, 109, 0.5);
  animation: ds-slide .5s var(--ease-out);
}
.ds-alert small { display: block; margin-top: 3px; color: #ffd1da; font-size: 0.7rem; }
@keyframes ds-slide { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
.ds-row { display: flex; gap: 6px; }
.ds-chip { font-size: 0.72rem; font-weight: 700; padding: 6px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }

.demo-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.demo-steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  color: var(--muted);
  transition: background .3s ease, border-color .3s ease, color .3s ease;
}
.demo-steps .ds-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.07);
}
.demo-steps li.is-active { color: #fff; background: rgba(255, 255, 255, 0.06); border-color: rgba(67, 160, 71, 0.45); }
.demo-steps li.is-active .ds-num { background: #43A047; color: #fff; }
.demo-steps li.is-done { color: #DDE5EA; }
.demo-steps li.is-done .ds-num { background: rgba(38, 198, 218, 0.2); color: #80DEEA; }
.demo-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.86rem;
}
.demo-status { min-height: 1.3em; margin: 0; color: #CDD7DE; }

@media (max-width: 460px) {
  .sos-demo { padding: 14px; }
  .demo-screen { border-width: 4px; border-radius: 22px; padding: 16px 8px 10px; }
  .ds-sos { width: 78px; height: 78px; font-size: 1.15rem; }
  .ds-count { font-size: 3rem; }
  .ds-btn { font-size: 0.74rem; padding: 8px 10px; }
  .demo-link { flex-basis: 16px; }
}

/* ---------- Plan filter over feature cards ---------- */
.plan-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 22px 0 0;
}
.plan-filter [data-filter-count] { flex-basis: 100%; text-align: center; color: var(--muted); font-size: 0.86rem; min-height: 1.2em; }
.plan-tag.both {
  color: #d9f7ea;
  background: linear-gradient(120deg, rgba(38, 198, 218, 0.13), rgba(255, 190, 92, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.feature .plan-tag.both ~ h3 { padding-right: 120px; }

/* ---------- Screenshot viewer ---------- */
.showcase .shot { cursor: zoom-in; transition: transform .28s var(--ease-out), border-color .28s ease; }
.showcase .shot:hover { transform: translateY(-4px); border-color: rgba(38, 198, 218, 0.4); }
.lb-open, .lb-open body { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 56px 10px 40px;
  background: rgba(14, 20, 27, 0.92);
  backdrop-filter: blur(6px);
  animation: lb-in .25s ease;
}
.lightbox[hidden] { display: none; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lb-figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.lb-figure img {
  max-width: 100%;
  max-height: calc(100vh - 150px);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  object-fit: contain;
}
.lb-figure figcaption { color: #E4EAEE; font-weight: 700; text-align: center; }
.lb-close, .lb-nav {
  font: inherit;
  color: #fff;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  cursor: pointer;
}
.lb-close { position: absolute; top: 12px; right: 12px; width: 42px; height: 42px; font-size: 1.1rem; }
.lb-nav { width: 46px; height: 46px; font-size: 1.8rem; line-height: 1; }
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, 0.16); }
.lb-count { position: absolute; bottom: 10px; left: 0; right: 0; margin: 0; text-align: center; color: var(--muted); font-size: 0.85rem; }
@media (max-width: 600px) {
  .lb-nav { position: absolute; bottom: 4px; width: 40px; height: 40px; }
  .lb-prev { left: 16px; }
  .lb-next { right: 16px; }
  .lightbox { grid-template-columns: 1fr; padding: 60px 12px 56px; }
}

/* ---------- Pricing table: only the differences ---------- */
.diff-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  cursor: pointer;
  color: #E4EAEE;
  font-weight: 700;
  font-size: 0.92rem;
  user-select: none;
}
.diff-toggle input {
  appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  cursor: pointer;
  transition: background .2s ease;
  margin: 0;
}
.diff-toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s var(--ease-out);
}
.diff-toggle input:checked { background: linear-gradient(120deg, #43A047, #4DD0E1); }
.diff-toggle input:checked::after { transform: translateX(18px); }
.diff-toggle input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.compare-table.only-diff tr.same,
.compare-table.only-diff tr.group-row.all-same { display: none; }
.compare-table tbody tr:not(.group-row) { transition: background .2s ease; }
.compare-table tbody tr:not(.group-row):hover { background: rgba(255, 255, 255, 0.04); }

@media (prefers-reduced-motion: reduce) {
  .ds-sos, .ds-count, .ds-ok, .ds-alert, .ds-road, .ds-wave i,
  .ds-pin-you.is-sos, .demo-link.is-live::after, .lightbox { animation: none !important; }
  .ds-bar span { animation-duration: 2.5s !important; }
}

/* ---------- Screenshot pairs (features page) ---------- */
.shot-pair { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; max-width: 640px; margin: 26px auto 0; }
.shot-strip .shot img, .showcase .shot img { aspect-ratio: 9 / 16; object-fit: cover; }

/* ---------- The demo as the home page hero ----------
   Copy, then the demo, then the store buttons on a phone, so a visitor meets
   the demo straight after the headline. Side by side on a wide screen. */
.hero-grid-demo { grid-template-areas: "copy" "demo" "actions"; row-gap: 26px; }
.hero-grid-demo .hero-copy { grid-area: copy; }
.hero-grid-demo .hero-demo { grid-area: demo; display: block; }
.hero-grid-demo .hero-actions { grid-area: actions; }
.hero-grid-demo .hero-actions .store-ctas { margin-top: 0; }
@media (min-width: 880px) {
  .hero-grid-demo {
    grid-template-columns: 1.02fr 0.98fr;
    grid-template-areas: "copy demo" "actions demo";
    /* The demo is taller than the copy: let the lower row take the slack, or
       the store buttons float halfway down the page. */
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: 40px;
    row-gap: 10px;
  }
}
.sos-demo.is-hero {
  margin-top: 0;
  padding: 18px 16px 14px;
  border-color: rgba(67, 160, 71, 0.35);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.sos-demo.is-hero .demo-stage { grid-template-columns: 1fr; margin-top: 14px; }
.sos-demo.is-hero .demo-phone { flex-basis: 185px; }
.hero-demo-head { text-align: center; margin-bottom: 12px; }
.hero-demo-kicker {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #ffd1da;
  background: rgba(67, 160, 71, 0.16);
  border: 1px solid rgba(67, 160, 71, 0.42);
}
.hero-demo-head h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.3vw, 1.65rem);
  letter-spacing: -0.2px;
}
.hero-demo-head p { margin: 0 auto; color: var(--muted); font-size: 0.93rem; line-height: 1.5; max-width: 46ch; }
.demo-step {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-height: 2.6em;
  margin: 12px 0 0;
  color: #fff;
  font-weight: 700;
  font-size: 0.93rem;
}
.demo-step .ds-num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  background: #43A047;
  color: #fff;
}
.sos-demo.is-hero .demo-foot { margin-top: 6px; }
