/* ============================================================
   Adya video modal — shared across the home page and the
   RAI / RAS product pages.

   Two panes live in the same grid cell so they cross-fade in
   place with no layout jump:
     1. chooser — pick a product demo (home page)
     2. player  — the <video> itself
   A trigger with data-watch-video="sai|rai|ras" skips the
   chooser and opens that product straight away.

   Accents match the hero spotlight card and the nav dropdown
   dots: SAI cyan · RAI orange · RAS purple.
   ============================================================ */

.avm {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 3, 12, 0.74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .28s ease, visibility 0s linear .28s;
}

.avm.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .28s ease;
}

/* Both panes share one grid cell — the dialog never jumps on switch. */
.avm-pane {
  grid-area: 1 / 1;
  width: min(1080px, 100%);
  opacity: 0;
  visibility: hidden;
  transform: scale(.975) translateY(6px);
  transition: opacity .3s ease, transform .34s cubic-bezier(.16, 1, .3, 1), visibility 0s linear .34s;
}

.avm-pane.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .3s ease, transform .34s cubic-bezier(.16, 1, .3, 1);
}

/* Used to seat a pane before the overlay fades in, so reopening never
   cross-fades away from the pane the modal closed on. */
.avm.avm-no-anim .avm-pane {
  transition: none !important;
}

/* ── Shared dialog shell ─────────────────────────────────── */
.avm-card {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #04050F;
  box-shadow: 0 36px 120px -22px rgba(0, 0, 0, 0.78);
}

.avm-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(6, 8, 26, 0.72);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.avm-close:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.32);
  transform: scale(1.05);
}

.avm-close:focus-visible {
  outline: 2px solid #7FE8F2;
  outline-offset: 2px;
}

/* ── Chooser pane ────────────────────────────────────────── */
/* Focused programmatically on open so keyboard users land inside the
   dialog - it should never draw a ring of its own. */
.avm-chooser:focus { outline: none; }

.avm-chooser {
  padding: 34px clamp(22px, 3.4vw, 40px) clamp(26px, 3vw, 34px);
}

/* Soft aurora so the panel reads as part of the Adya surface,
   not a bare grey sheet. */
.avm-chooser::before {
  content: '';
  position: absolute;
  top: -140px;
  left: 50%;
  width: 620px;
  height: 320px;
  margin-left: -310px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(11, 200, 216, 0.16) 0%, transparent 68%);
  filter: blur(46px);
  pointer-events: none;
  z-index: 0;
}

.avm-head {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 560px;
  margin: 0 auto clamp(24px, 2.6vw, 30px);
}

.avm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.avm-title {
  margin: 14px 0 0;
  font-family: 'Inter', 'Helvetica Neue', system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(23px, 2.6vw, 31px);
  line-height: 1.14;
  letter-spacing: -0.02em;
  color: #fff;
}

.avm-title .avm-em {
  font-family: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  background: linear-gradient(120deg, #46C8E8 0%, #B6ECF7 50%, #46C8E8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.avm-sub {
  margin: 10px 0 0;
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.58);
}

.avm-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* Each option carries its product accent through the dot, the
   hover border and the play chip — same palette as the hero card. */
.avm-opt {
  --avm-accent: #0BC8D8;
  --avm-soft: #7FE8F2;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 20px 18px 18px;
  border-radius: 16px;
  text-align: left;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.012) 100%);
  transition: border-color .22s ease, background .22s ease, transform .22s cubic-bezier(.16, 1, .3, 1), box-shadow .22s ease;
}

.avm-opt[data-product="sai"] { --avm-accent: #0BC8D8; --avm-soft: #7FE8F2; }
.avm-opt[data-product="rai"] { --avm-accent: #F7941D; --avm-soft: #FFC372; }
.avm-opt[data-product="ras"] { --avm-accent: #8B5CF5; --avm-soft: #C9B2FF; }

.avm-opt:hover,
.avm-opt:focus-visible {
  outline: none;
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--avm-accent) 46%, transparent);
  background: linear-gradient(165deg,
      color-mix(in srgb, var(--avm-accent) 13%, transparent) 0%,
      rgba(255, 255, 255, 0.015) 100%);
  box-shadow:
    0 18px 44px -20px rgba(0, 0, 0, 0.7),
    0 0 0 1px color-mix(in srgb, var(--avm-accent) 22%, transparent),
    0 0 46px -22px var(--avm-accent);
}

.avm-opt-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 5px;
}

.avm-opt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--avm-accent);
  box-shadow: 0 0 12px var(--avm-accent);
}

.avm-opt-name {
  font-family: 'Inter', 'Helvetica Neue', system-ui, sans-serif;
  font-weight: 700;
  font-size: 19px;
  line-height: 1;
  letter-spacing: -0.015em;
  color: #fff;
}

.avm-opt-kicker {
  display: block;
  margin-bottom: 10px;
  font-family: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 13.5px;
  line-height: 1.3;
  color: var(--avm-soft);
}

.avm-opt-desc {
  margin: 0;
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.6);
}

.avm-opt-play {
  margin-top: auto;
  padding-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.48);
  transition: color .22s ease;
}

.avm-opt:hover .avm-opt-play,
.avm-opt:focus-visible .avm-opt-play {
  color: var(--avm-soft);
}

.avm-opt-play svg {
  width: 18px;
  height: 18px;
  padding: 4px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  transition: border-color .22s ease, background .22s ease;
}

.avm-opt:hover .avm-opt-play svg,
.avm-opt:focus-visible .avm-opt-play svg {
  border-color: color-mix(in srgb, var(--avm-accent) 60%, transparent);
  background: color-mix(in srgb, var(--avm-accent) 20%, transparent);
}

/* ── Player pane ─────────────────────────────────────────── */
.avm-player {
  --avm-accent: #0BC8D8;
  --avm-soft: #7FE8F2;
}

.avm-player[data-product="sai"] { --avm-accent: #0BC8D8; --avm-soft: #7FE8F2; }
.avm-player[data-product="rai"] { --avm-accent: #F7941D; --avm-soft: #FFC372; }
.avm-player[data-product="ras"] { --avm-accent: #8B5CF5; --avm-soft: #C9B2FF; }

.avm-bar {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 52px;
  padding: 0 62px 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(6, 8, 26, 0.5);
}

.avm-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px 6px 8px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.62);
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}

.avm-back:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Hidden when the modal was opened straight into one product —
   there is no chooser to go back to. */
.avm[data-mode="direct"] .avm-back { display: none; }

.avm-bar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--avm-accent);
  box-shadow: 0 0 12px var(--avm-accent);
}

.avm-bar-name {
  font-family: 'Inter', 'Helvetica Neue', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
}

.avm-bar-kicker {
  font-family: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: var(--avm-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buffering state — shown while the player builds a lead buffer before
   starting, and if playback ever outruns the download. */
.avm-player.is-busy::after {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(50% + 26px);
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--avm-soft);
  animation: avm-spin .7s linear infinite;
  pointer-events: none;
  z-index: 3;
}

@keyframes avm-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .avm-player.is-busy::after { animation-duration: 2s; }
}

.avm-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 148px);
  background: #000;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 860px) {
  .avm-grid { grid-template-columns: 1fr; gap: 10px; }
  .avm-opt { padding: 16px; }
  .avm-opt-play { padding-top: 12px; }
}

@media (max-width: 560px) {
  .avm { padding: 14px; }
  .avm-chooser { padding: 26px 18px 20px; }
  .avm-bar { height: 48px; padding-right: 56px; }
  .avm-bar-kicker { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .avm,
  .avm-pane,
  .avm-opt { transition-duration: .01ms; }
  .avm-pane { transform: none; }
  .avm-opt:hover { transform: none; }
}

body.avm-open { overflow: hidden; }
