/* ==========================================================================
   Hexmodal Platform Demo — module.css
   Scoped under .hxdemo. Tokens match Custom/hexmodal_install_map_general and
   the 3D product carousel (Red Hat Display, Hexmodal blue, soft glass).
   Desktop/tablet: an app window. Phones (<720px): a screen bubble that opens full screen.
   ========================================================================== */
.hxdemo {
  --hxd-accent: #4253F1;
  --hxd-font: inherit;
  --hxd-ink: #121212;
  --hxd-ink-2: #3F403C;
  --hxd-ink-3: #6E6E6E;
  --hxd-hairline: rgba(18, 18, 18, 0.08);
  --hxd-surface: #FFFFFF;
  --hxd-canvas: #EEF1F6;
  --hxd-radius-window: 18px;
  --hxd-radius-pill: 999px;
  --hxd-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --hxd-dur-fast: 180ms;
  --hxd-gutter: clamp(16px, 4vw, 48px);
  --hxd-section-y: clamp(32px, 5vw, 72px);
  --hxd-max: 1180px;
  --hxd-fs-title: clamp(26px, 3vw, 42px);
  --hxd-fs-sub: clamp(15px, 1.2vw, 18px);
  --hxd-glass-filter: blur(20px) saturate(185%) brightness(1.08);
  --hxd-glass-depth:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(255, 255, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.38);
  --hxd-glass-shadow: 0 1px 2px rgba(18, 18, 18, 0.04), 0 24px 60px -26px rgba(18, 18, 18, 0.22);
  --hxd-accent-soft: color-mix(in srgb, var(--hxd-accent) 14%, transparent);

  position: relative;
  padding: var(--hxd-section-y) var(--hxd-gutter);
  font-family: var(--hxd-font);
  color: var(--hxd-ink-2);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@supports not (color: color-mix(in srgb, red, blue)) {
  .hxdemo { --hxd-accent-soft: rgba(66, 83, 241, 0.14); }
}
.hxdemo *, .hxdemo *::before, .hxdemo *::after { box-sizing: border-box; }
.hxdemo [hidden] { display: none !important; }
.hxdemo__inner { max-width: var(--hxd-max); margin: 0 auto; }

/* ---------- Header ---------- */
.hxdemo__head { max-width: 720px; margin: 0 auto clamp(28px, 4vw, 52px); text-align: center; }
.hxdemo__title {
  margin: 0;
  font-family: inherit;
  font-weight: 700;
  font-size: var(--hxd-fs-title);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--hxd-ink);
  text-wrap: balance;
}
.hxdemo__sub { max-width: 600px; margin: 14px auto 0; font-size: var(--hxd-fs-sub); line-height: 1.55; color: var(--hxd-ink-2); text-wrap: pretty; }
.hxdemo__sub > :first-child { margin-top: 0; }
.hxdemo__sub > :last-child { margin-bottom: 0; }
.hxdemo__sub p:empty { display: none; }

/* ---------- Stage: floor-plan grid + glow behind the window ---------- */
.hxdemo__stage { position: relative; perspective: 2200px; perspective-origin: 50% 0%; }
.hxdemo--grid .hxdemo__stage::before {
  content: "";
  position: absolute;
  inset: -9% -7% -14%;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(66, 83, 241, 0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(66, 83, 241, 0.10) 1px, transparent 1px),
    linear-gradient(to right, rgba(66, 83, 241, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(66, 83, 241, 0.05) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
  background-position: center center;
  -webkit-mask-image: radial-gradient(ellipse 62% 58% at 50% 46%, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse 62% 58% at 50% 46%, #000 30%, transparent 78%);
}
@supports (color: color-mix(in srgb, red, blue)) {
  .hxdemo--grid .hxdemo__stage::before {
    background-image:
      linear-gradient(to right, color-mix(in srgb, var(--hxd-accent) 11%, transparent) 1px, transparent 1px),
      linear-gradient(to bottom, color-mix(in srgb, var(--hxd-accent) 11%, transparent) 1px, transparent 1px),
      linear-gradient(to right, color-mix(in srgb, var(--hxd-accent) 5%, transparent) 1px, transparent 1px),
      linear-gradient(to bottom, color-mix(in srgb, var(--hxd-accent) 5%, transparent) 1px, transparent 1px);
  }
}
.hxdemo__glow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -4%;
  height: 46%;
  z-index: 0;
  border-radius: 50%;
  background: var(--hxd-accent);
  opacity: 0.16;
  filter: blur(70px);
  pointer-events: none;
}

/* ---------- The device (desktop window by default) ---------- */
.hxdemo__device {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--hxd-radius-window);
  background: var(--hxd-surface);
  box-shadow:
    0 0 0 1px rgba(18, 18, 18, 0.07),
    0 2px 4px rgba(18, 18, 18, 0.04),
    0 30px 70px -30px rgba(18, 18, 18, 0.38),
    0 70px 120px -60px rgba(18, 18, 18, 0.28);
  transform-origin: 50% 0%;
  isolation: isolate;
}

/* Window bar */
.hxdemo__bar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 12px 0 16px;
  background: linear-gradient(#FAFBFD, #F0F2F7);
  border-bottom: 1px solid var(--hxd-hairline);
}
.hxdemo__lights { display: inline-flex; gap: 8px; }
.hxdemo__lights i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.18);
}
.hxdemo__lights i:nth-child(1) { background: #FF5F57; }
.hxdemo__lights i:nth-child(2) { background: #FEBC2E; }
.hxdemo__lights i:nth-child(3) { background: #28C840; }
.hxdemo__address {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: clamp(220px, 34vw, 420px);
  max-width: 100%;
  height: 28px;
  padding: 0 14px;
  border-radius: 8px;
  background: rgba(18, 18, 18, 0.045);
  color: var(--hxd-ink-2);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.005em;
  white-space: nowrap;
  overflow: hidden;
}
.hxdemo__address svg { flex: none; color: var(--hxd-ink-3); }
.hxdemo__address span { overflow: hidden; text-overflow: ellipsis; }
.hxdemo__tools { display: inline-flex; justify-content: flex-end; gap: 4px; }
.hxdemo__tool {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--hxd-ink-2);
  cursor: pointer;
  transition: background-color var(--hxd-dur-fast) var(--hxd-ease-out), color var(--hxd-dur-fast) var(--hxd-ease-out);
}
.hxdemo__tool:hover { background: rgba(18, 18, 18, 0.06); color: var(--hxd-ink); }
.hxdemo__tool:focus-visible { outline: 2px solid var(--hxd-accent); outline-offset: 1px; }
.hxdemo__ico-exit { display: none; }
.hxdemo.is-fullscreen .hxdemo__ico-enter { display: none; }
.hxdemo.is-fullscreen .hxdemo__ico-exit { display: block; }

/* Screen */
.hxdemo__screen {
  position: relative;
  width: 100%;
  aspect-ratio: 1440 / 766;
  background: var(--hxd-canvas);
  overflow: hidden;
}
@supports not (aspect-ratio: 1 / 1) {
  .hxdemo__screen { height: 0; padding-bottom: 53.2%; }
}
.hxdemo__frame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  opacity: 0;
  transition: opacity 500ms var(--hxd-ease-out);
}
.hxdemo.is-loaded .hxdemo__frame { opacity: 1; }

/* Loading skeleton: a quiet sketch of the dashboard */
.hxdemo__skeleton {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 15% 1fr;
  grid-template-rows: auto 1fr;
  gap: 2.4% 2%;
  padding: 0 2% 2% 0;
  transition: opacity 400ms var(--hxd-ease-out);
}
.hxdemo.is-loaded .hxdemo__skeleton { opacity: 0; pointer-events: none; }
.hxdemo__sk-side { grid-row: 1 / -1; background: #D2D8F5; background: color-mix(in srgb, var(--hxd-accent) 22%, var(--hxd-canvas)); }
.hxdemo__sk-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2%; padding-top: 5%; }
.hxdemo__sk-tiles i, .hxdemo__sk-main {
  border-radius: 10px;
  background: linear-gradient(100deg, #FFFFFF 30%, #F6F8FC 50%, #FFFFFF 70%) 0 0 / 300% 100%;
  animation: hxd-shimmer 1.6s linear infinite;
}
.hxdemo__sk-tiles i { aspect-ratio: 2.1 / 1; }
.hxdemo__sk-load {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: var(--hxd-radius-pill);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px -10px rgba(18, 18, 18, 0.35);
  font-size: 13px;
  font-weight: 600;
  color: var(--hxd-ink-2);
  white-space: nowrap;
}
@keyframes hxd-shimmer { to { background-position: -150% 0; } }

/* Phone-only parts are hidden on the desktop window */
.hxdemo__status,
.hxdemo__home,
.hxdemo__mobile-actions { display: none; }

/* ---------- Full screen ---------- */
.hxdemo__device:fullscreen { width: 100vw; height: 100vh; border-radius: 0; transform: none !important; }
.hxdemo__device:fullscreen .hxdemo__screen { flex: 1 1 auto; aspect-ratio: auto; height: auto; padding: 0; }
.hxdemo__device:-webkit-full-screen { width: 100vw; height: 100vh; border-radius: 0; transform: none !important; }
.hxdemo__device:-webkit-full-screen .hxdemo__screen { flex: 1 1 auto; aspect-ratio: auto; height: auto; padding: 0; }

/* ---------- Entrance: the window settles from a tilt, once ---------- */
.hxdemo--js .hxdemo__device {
  transition: transform 1200ms var(--hxd-ease-out), opacity 700ms var(--hxd-ease-out);
}
.hxdemo--js:not(.is-in) .hxdemo__device { opacity: 0; transform: translate3d(0, 48px, 0) rotateX(16deg) scale(0.96); }
.hxdemo--js .hxdemo__glow { transition: opacity 1400ms var(--hxd-ease-out) 200ms, transform 1400ms var(--hxd-ease-out) 200ms; }
.hxdemo--js:not(.is-in) .hxdemo__glow { opacity: 0; transform: scale(0.8); }

/* ---------- Notes under the window ---------- */
.hxdemo__notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 44px);
  margin: clamp(36px, 5vw, 64px) 0 0;
  padding: 0;
  list-style: none;
}
.hxdemo__note { margin: 0; padding: 18px 0 0; position: relative; border-top: 1px solid var(--hxd-hairline); }
.hxdemo__note::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  width: 28px;
  height: 2px;
  border-radius: 2px;
  background: var(--hxd-accent);
}
.hxdemo__note-title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; color: var(--hxd-ink); }
.hxdemo__note-text { margin: 8px 0 0; font-size: 15px; line-height: 1.55; color: var(--hxd-ink-2); }

/* ---------- Call to action ---------- */
.hxdemo__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  margin-top: clamp(32px, 4vw, 56px);
  text-align: center;
}
.hxdemo__cta-text { margin: 0; font-size: var(--hxd-fs-sub); font-weight: 600; line-height: 1.35; color: var(--hxd-ink); text-wrap: balance; }
.hxdemo__cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 24px;
  border-radius: var(--hxd-radius-pill);
  background: var(--hxd-accent);
  color: #FFFFFF !important;
  font: 600 15px/1 var(--hxd-font);
  text-decoration: none !important;
  box-shadow: 0 14px 30px -16px var(--hxd-accent);
  transition: transform var(--hxd-dur-fast) var(--hxd-ease-out), box-shadow var(--hxd-dur-fast) var(--hxd-ease-out);
}
.hxdemo__cta-btn:hover { transform: translateY(-1px); box-shadow: 0 18px 34px -16px var(--hxd-accent); }
.hxdemo__cta-btn:focus-visible { outline: 2px solid var(--hxd-accent); outline-offset: 3px; }
.hxdemo__noscript { text-align: center; }

/* ---------- Tablet ---------- */
@media (max-width: 1023px) {
  .hxdemo__notes { grid-template-columns: 1fr; gap: 0; }
  .hxdemo__note { padding: 16px 0 18px; }
}

/* ---------- Phones: a screen bubble that opens into full screen ---------- */
.hxdemo__mbar, .hxdemo__tap, .hxdemo__scrim { display: none; }
@media (max-width: 719px) {
  .hxdemo__head { margin-bottom: 26px; }
  .hxdemo__stage { perspective: none; }
  .hxdemo--grid .hxdemo__stage::before { inset: -4% -20% -6%; }
  .hxdemo__glow { left: 14%; right: 14%; bottom: 2%; height: 42%; }

  /* The bubble: same window language as desktop, sized to the walkthrough */
  .hxdemo__device {
    width: min(100%, 420px);
    margin: 0 auto;
    border-radius: 24px;
    background: #FFFFFF;
    box-shadow:
      0 0 0 1px rgba(18, 18, 18, 0.07),
      0 2px 4px rgba(18, 18, 18, 0.05),
      0 30px 60px -28px rgba(18, 18, 18, 0.45),
      0 24px 50px -30px var(--hxd-accent);
  }
  .hxdemo__bar, .hxdemo__status, .hxdemo__home, .hxdemo__mobile-actions { display: none; }

  .hxdemo__mbar {
    position: relative; z-index: 6; flex: none;
    display: grid; grid-template-columns: 1fr minmax(0, auto) 1fr; align-items: center; gap: 8px;
    height: 44px; padding: 0 8px 0 14px;
    background: linear-gradient(#FAFBFD, #F0F2F7);
    border-bottom: 1px solid var(--hxd-hairline);
  }
  .hxdemo__mbar-lead { display: inline-flex; align-items: center; }
  .hxdemo__mbar .hxdemo__lights { gap: 6px; }
  .hxdemo__mbar .hxdemo__lights i { width: 10px; height: 10px; }
  .hxdemo__mbar-addr {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 12px;
    border-radius: 8px; background: rgba(18, 18, 18, 0.045);
    font-size: 12.5px; font-weight: 500; color: var(--hxd-ink-2); white-space: nowrap; overflow: hidden;
  }
  .hxdemo__mbar-addr svg { flex: none; color: var(--hxd-ink-3); }
  .hxdemo__mbar-addr span { overflow: hidden; text-overflow: ellipsis; }
  .hxdemo__mbar-tools { display: inline-flex; justify-content: flex-end; gap: 2px; }
  .hxdemo__mbar-btn {
    display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px;
    background: transparent; color: var(--hxd-ink-2); cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .hxdemo__mbar-btn:active { background: rgba(18, 18, 18, 0.07); }
  .hxdemo__mbar-done {
    display: none; align-items: center; gap: 6px; height: 32px; padding: 0 13px 0 10px; border: 0; border-radius: var(--hxd-radius-pill);
    background: rgba(18, 18, 18, 0.06); color: var(--hxd-ink); font: 600 14px/1 var(--hxd-font); cursor: pointer;
    -webkit-tap-highlight-color: transparent; white-space: nowrap; flex: none;
  }
  .hxdemo__mbar-done:active { background: rgba(18, 18, 18, 0.12); }

  /* Screen: exactly the walkthrough's own shape (481 x 827), so nothing is letterboxed */
  .hxdemo__screen { flex: none; aspect-ratio: 481 / 827; height: auto; padding: 0; background: #FFFFFF; }
  @supports not (aspect-ratio: 1 / 1) { .hxdemo__screen { height: 0; padding-bottom: 171.9%; } }
  .hxdemo__frame { inset: 0 auto auto 0; transform-origin: 0 0; transition: opacity 500ms var(--hxd-ease-out), filter 600ms var(--hxd-ease-out) !important; }
  .hxdemo__skeleton { grid-template-columns: 1fr; grid-template-rows: auto; padding: 6%; gap: 4%; align-content: start; }
  .hxdemo__sk-side, .hxdemo__sk-main { display: none; }
  .hxdemo__sk-tiles { grid-template-columns: 1fr; gap: 10px; padding: 0; }
  .hxdemo__sk-tiles i { aspect-ratio: 3 / 1; }

  /* In the bubble the demo is a preview: one tap opens it full screen */
  .hxdemo--js:not([data-hxdemo-editor]):not(.is-immersive):not(.is-gated) .hxdemo__catch { display: block; }
  .hxdemo__tap {
    position: absolute; left: 50%; bottom: 16px; z-index: 3;
    display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px 0 14px;
    border-radius: var(--hxd-radius-pill); transform: translateX(-50%); white-space: nowrap; pointer-events: none;
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%);
    box-shadow: inset 0 1px 1px #fff, 0 0 0 0.5px rgba(18, 18, 18, 0.1), 0 14px 30px -14px rgba(18, 18, 18, 0.55);
    font: 600 14px/1 var(--hxd-font); color: var(--hxd-ink);
    transition: opacity 300ms var(--hxd-ease-out), transform 400ms var(--hxd-ease-out);
  }
  .hxdemo__tap i {
    display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff;
    background: var(--hxd-accent); box-shadow: 0 6px 14px -6px var(--hxd-accent);
  }
  .hxdemo__tap-locked { display: none; }
  .hxdemo.is-locked .hxdemo__tap-open { display: none; }
  .hxdemo.is-locked .hxdemo__tap-locked { display: inline; }
  .hxdemo.is-gated .hxdemo__tap, .hxdemo.is-immersive .hxdemo__tap { opacity: 0; transform: translateX(-50%) translateY(8px); }

  .hxdemo--js:not(.is-in) .hxdemo__device { transform: translate3d(0, 32px, 0) scale(0.97); }

  /* ---------- Full screen (works the same on iPhone and Android) ---------- */
  .hxdemo__scrim {
    display: block; position: fixed; inset: 0; z-index: 2147482000; pointer-events: none;
    background: radial-gradient(120% 80% at 50% 0%, rgba(66, 83, 241, 0.28), rgba(66, 83, 241, 0) 60%), rgba(10, 13, 28, 0.78);
    -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
    opacity: 0; transition: opacity 420ms var(--hxd-ease-out);
  }
  .hxdemo.is-immersive .hxdemo__scrim { opacity: 1; pointer-events: auto; }
  .hxdemo__ph {
    display: block; width: min(100%, 420px); margin: 0 auto; border-radius: 24px;
    background: linear-gradient(160deg, #F6F7FB, #ECEFF6); box-shadow: 0 0 0 1px rgba(18, 18, 18, 0.05);
  }
  .hxdemo.is-immersive .hxdemo__device {
    position: fixed; inset: 0; z-index: 2147482001;
    width: auto; max-width: none; height: auto; margin: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 10px calc(env(safe-area-inset-bottom, 0px) + 12px);
    border-radius: 0; background: transparent; box-shadow: none; overflow: visible;
    transform: none !important; opacity: 1 !important;
  }
  .hxdemo.is-immersive .hxdemo__screen {
    flex: none; margin: 0; aspect-ratio: auto; padding: 0; border-radius: 20px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 40px 90px -30px rgba(0, 0, 0, 0.75), 0 20px 60px -30px var(--hxd-accent);
  }
  .hxdemo.is-immersive .hxdemo__mbar {
    flex: none; height: 50px; padding: 0 6px 0 7px; border-radius: 16px; border-bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
    box-shadow: inset 0 1px 1px #fff, 0 0 0 0.5px rgba(18, 18, 18, 0.1), 0 14px 34px -18px rgba(0, 0, 0, 0.7);
    animation: hxd-bar-in 460ms var(--hxd-ease-out) both 80ms;
  }
  @keyframes hxd-bar-in { from { opacity: 0; transform: translate3d(0, -10px, 0); } to { opacity: 1; transform: none; } }
  .hxdemo.is-immersive .hxdemo__mbar .hxdemo__lights, .hxdemo.is-immersive [data-hxdemo-expand] { display: none; }
  .hxdemo.is-immersive .hxdemo__mbar-done { display: inline-flex; }
  .hxdemo.is-immersive .hxdemo__mbar-addr { height: 30px; font-size: 13px; }
  /* The grow and the return are one transform on the screen, so they stay smooth */
  .hxdemo.is-morphing .hxdemo__screen { transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1) !important; will-change: transform; }
  .hxdemo.is-returning .hxdemo__device { z-index: 2147482001; overflow: visible; }
  .hxdemo.is-returning .hxdemo__mbar { opacity: 0; }
  .hxdemo.is-returned .hxdemo__mbar { transition: opacity 260ms var(--hxd-ease-out); }
}
@media (max-width: 719px) {
  /* Loading label sits mid-screen so it never collides with the tap pill */
  .hxdemo__sk-load { top: 50%; bottom: auto; transform: translate(-50%, -50%); }
}
html.hxdemo-lock, html.hxdemo-lock body { overflow: hidden !important; overscroll-behavior: none; }

/* ---------- Text color field ---------- */
.hxdemo.hxdemo--text .hxdemo__head,
.hxdemo.hxdemo--text .hxdemo__notes,
.hxdemo.hxdemo--text .hxdemo__cta-text {
  --hxd-ink: var(--hxd-text);
  --hxd-ink-2: var(--hxd-text);
  --hxd-hairline: rgba(255, 255, 255, 0.2);
}
@supports (color: color-mix(in srgb, red, blue)) {
  .hxdemo.hxdemo--text .hxdemo__head,
  .hxdemo.hxdemo--text .hxdemo__notes {
    --hxd-ink-2: color-mix(in srgb, var(--hxd-text) 80%, transparent);
    --hxd-hairline: color-mix(in srgb, var(--hxd-text) 16%, transparent);
  }
  .hxdemo.hxdemo--text .hxdemo__cta-text { color: var(--hxd-text); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hxdemo *, .hxdemo *::before, .hxdemo *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .hxdemo--js:not(.is-in) .hxdemo__device,
  .hxdemo--js:not(.is-in) .hxdemo__glow { opacity: 1; transform: none; }
}

/* ==========================================================================
   Email gate (tap the screen → demo blurs → glass card asks for an email)
   ========================================================================== */
.hxdemo__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hxdemo__catch {
  position: absolute; inset: 0; z-index: 4; margin: 0; padding: 0; border: 0; cursor: pointer;
  background: transparent; -webkit-tap-highlight-color: transparent;
}
.hxdemo__catch:focus-visible { outline: 3px solid var(--hxd-accent); outline-offset: -3px; }
.hxdemo:not(.is-locked) .hxdemo__catch { display: none; }
.hxdemo__frame, .hxdemo__skeleton { transition: opacity 500ms var(--hxd-ease-out), filter 600ms var(--hxd-ease-out), transform 700ms var(--hxd-ease-out); }
.hxdemo.is-gated .hxdemo__frame, .hxdemo.is-gated .hxdemo__skeleton { filter: blur(14px) saturate(0.85) brightness(0.92); transform: scale(1.035); pointer-events: none; }

.hxdemo__gate {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; padding: clamp(12px, 3%, 28px);
  background: rgba(18, 22, 40, 0.22);
  opacity: 0; transition: opacity 420ms var(--hxd-ease-out);
}
.hxdemo__gate[hidden] { display: none; }
.hxdemo.is-gated .hxdemo__gate { opacity: 1; }
.hxdemo__gate-card {
  position: relative; isolation: isolate; width: min(100%, 400px); padding: 30px 30px 26px; text-align: left;
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.76) 50%, rgba(255, 255, 255, 0.88) 100%);
  -webkit-backdrop-filter: blur(24px) saturate(190%); backdrop-filter: blur(24px) saturate(190%);
  box-shadow:
    inset 0 1.5px 1px rgba(255, 255, 255, 0.95),
    inset 0 -1.5px 1px rgba(255, 255, 255, 0.5),
    inset 0 -40px 60px -40px rgba(66, 83, 241, 0.16),
    0 0 0 0.5px rgba(18, 18, 18, 0.08),
    0 30px 70px -28px rgba(18, 18, 18, 0.5);
  transform: translate3d(0, 18px, 0) scale(0.96); opacity: 0;
  transition: transform 640ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 420ms var(--hxd-ease-out);
}
.hxdemo__gate-card::before {
  content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; padding: 1.2px; pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.25) 28%, rgba(255, 255, 255, 0) 52%, rgba(255, 255, 255, 0.25) 76%, rgba(255, 255, 255, 0.9) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
}
.hxdemo.is-gated .hxdemo__gate-card { transform: none; opacity: 1; }
.hxdemo__gate-mark {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 16px; border-radius: 50%; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--hxd-accent) 85%, #fff), var(--hxd-accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 10px 22px -10px var(--hxd-accent);
}
.hxdemo__gate-mark svg { margin-left: 2px; }
.hxdemo__gate-title { margin: 0; padding-right: 28px; font-family: inherit; font-size: clamp(21px, 2.2vw, 26px); font-weight: 700; line-height: 1.12; letter-spacing: -0.02em; color: var(--hxd-ink); text-wrap: balance; }
.hxdemo__gate-body { margin: 8px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--hxd-ink-2); text-wrap: pretty; }
.hxdemo__gate-form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.hxdemo__gate-input {
  width: 100%; height: 48px; padding: 0 16px; border: 0; outline: none; border-radius: var(--hxd-radius-pill);
  font-family: inherit; font-size: 16px; color: var(--hxd-ink);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 1px 1px #fff, 0 0 0 0.5px rgba(18, 18, 18, 0.12), 0 12px 30px -22px rgba(18, 18, 18, 0.5);
  transition: box-shadow 240ms var(--hxd-ease-out), background 240ms;
}
.hxdemo__gate-input:focus { background: #fff; box-shadow: inset 0 1px 1px #fff, 0 0 0 2px var(--hxd-accent), 0 18px 40px -22px rgba(66, 83, 241, 0.6); }
.hxdemo__gate-input::placeholder { color: var(--hxd-ink-3); }
.hxdemo__gate-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 48px; padding: 0 20px; border: 0; border-radius: var(--hxd-radius-pill); cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: -0.005em; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--hxd-accent) 88%, #fff) 0%, var(--hxd-accent) 55%, color-mix(in srgb, var(--hxd-accent) 85%, #000) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.15), 0 10px 22px -10px var(--hxd-accent);
  transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 260ms var(--hxd-ease-out), filter 200ms;
}
@supports not (color: color-mix(in srgb, red, blue)) { .hxdemo__gate-btn, .hxdemo__gate-mark { background: var(--hxd-accent); } }
.hxdemo__gate-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.hxdemo__gate-btn:active { transform: scale(0.985); }
.hxdemo__gate-btn:focus-visible { outline: 2px solid var(--hxd-ink); outline-offset: 2px; }
.hxdemo__gate-spin { display: none; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; border-radius: 50%; animation: hxd-spin 800ms linear infinite; }
@keyframes hxd-spin { to { transform: rotate(360deg); } }
.hxdemo__gate-form.is-busy .hxdemo__gate-spin { display: block; }
.hxdemo__gate-form.is-busy .hxdemo__gate-btn { pointer-events: none; }
.hxdemo__gate-form.is-busy .hxdemo__gate-btn-label { opacity: 0.75; }
.hxdemo__gate-error { margin: 0 0 0 6px; font-size: 13px; line-height: 1.4; color: #C7382F; }
.hxdemo__gate-error:empty { display: none; }
.hxdemo__gate-form.is-shake .hxdemo__gate-input { animation: hxd-shake 420ms var(--hxd-ease-out); }
@keyframes hxd-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-7px); } 45% { transform: translateX(6px); } 70% { transform: translateX(-3px); } }
.hxdemo__gate-note { margin: 2px 0 0; text-align: center; font-size: 12px; line-height: 1.45; color: var(--hxd-ink-3); }
.hxdemo__gate-x {
  position: absolute; top: 12px; right: 12px; z-index: 3; display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer; color: var(--hxd-ink-2); background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 1px #fff, 0 0 0 0.5px rgba(18, 18, 18, 0.08);
  transition: transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1), background 200ms;
}
.hxdemo__gate-x:hover { background: #fff; transform: rotate(90deg); }
/* Unlock: the card lifts away and the screen snaps back into focus */
.hxdemo.is-unlocking .hxdemo__gate-card { transform: translate3d(0, -10px, 0) scale(0.97); opacity: 0; transition-duration: 280ms, 220ms; }
.hxdemo.is-unlocking .hxdemo__gate { opacity: 0; }
/* Editor: show the card so the copy can be edited in place */
.hxdemo[data-hxdemo-editor] .hxdemo__gate { display: flex; opacity: 1; }
.hxdemo[data-hxdemo-editor] .hxdemo__gate-card { transform: none; opacity: 1; }
.hxdemo[data-hxdemo-editor] .hxdemo__catch { display: none; }
@media (max-width: 719px) {
  .hxdemo__gate { align-items: flex-end; padding: 10px; }
  .hxdemo__gate-card { width: 100%; padding: 22px 20px 20px; border-radius: 22px; }
  .hxdemo__gate-title { font-size: 20px; }
  .hxdemo__gate-body { font-size: 14px; }
  .hxdemo__gate-input, .hxdemo__gate-btn { height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  .hxdemo__gate, .hxdemo__gate-card, .hxdemo__frame, .hxdemo__skeleton { transition-duration: 1ms !important; }
  .hxdemo.is-gated .hxdemo__frame, .hxdemo.is-gated .hxdemo__skeleton { transform: none; }
}
