/* =========================================================
   Modal Cards — layered hero crossfade + rise content
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --text: #2f3338;
  --shadow-modal:
    0 2px 4px rgba(15, 23, 42, 0.03),
    0 12px 24px rgba(15, 23, 42, 0.06),
    0 40px 80px rgba(15, 23, 42, 0.1);
  --radius-modal: 28px;
  --radius-hero: 18px;
  --modal-w: 428px;
  --modal-h: 540px;
  --hero-h: 200px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

button:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 3px;
}

/* ---------------------------------------------------------
   Page + open button
   --------------------------------------------------------- */

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 148px;
  height: 52px;
  padding: 0 1.75rem;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.08),
    0 8px 24px rgba(15, 23, 42, 0.12);
  transition:
    transform 0.3s var(--ease-out),
    box-shadow 0.3s var(--ease-out),
    background 0.2s ease;
}

.open-btn:hover {
  background: #1f2937;
  transform: translateY(-2px);
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.08),
    0 14px 32px rgba(15, 23, 42, 0.16);
}

.open-btn:active {
  transform: translateY(0) scale(0.98);
}

/* ---------------------------------------------------------
   Overlay + Modal shell
   --------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  pointer-events: none;
}

.overlay[hidden] {
  display: none;
}

.overlay.is-open {
  pointer-events: auto;
}

.overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(244, 244, 245, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  cursor: pointer;
}

.modal {
  position: relative;
  z-index: 1;
  width: min(100%, var(--modal-w));
  opacity: 0;
  transform: translateY(24px) scale(0.94);
  will-change: transform, opacity;
  outline: none;
}

.modal__shell {
  position: relative;
  display: flex;
  flex-direction: column;
  height: min(var(--modal-h), calc(100dvh - 2.5rem));
  max-height: calc(100dvh - 2.5rem);
  background: var(--surface);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
  border: 1px solid rgba(255, 255, 255, 0.9);
  overflow: hidden;
  padding: 1rem 1rem 0;
}

/* ---------------------------------------------------------
   Hero stage — fixed frame, layered BGs + brands
   --------------------------------------------------------- */

.hero-stage {
  position: relative;
  flex-shrink: 0;
  height: var(--hero-h);
  border-radius: var(--radius-hero);
  overflow: hidden;
  isolation: isolate;
  /* Dark fallback while layers fade */
  background: #121214;
}

.hero-stage__bgs {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.04);
  will-change: opacity, transform;
  backface-visibility: hidden;
  transform-origin: center center;
}

.hero-bg.is-active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  z-index: 1;
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Theme backgrounds */
.hero-bg[data-theme="grok"] {
  background:
    radial-gradient(ellipse 90% 100% at 28% 45%, #5a5a64 0%, transparent 52%),
    radial-gradient(ellipse 70% 80% at 72% 55%, #18181c 0%, transparent 48%),
    radial-gradient(ellipse 50% 60% at 50% 100%, #0a0a0c 0%, transparent 60%),
    linear-gradient(160deg, #2e2e34 0%, #121214 55%, #0a0a0c 100%);
}

.hero-bg[data-theme="grok"]::after {
  background:
    radial-gradient(circle at 35% 40%, rgba(255, 255, 255, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 70% 60%, rgba(0, 0, 0, 0.35) 0%, transparent 45%);
}

.hero-bg[data-theme="claude"] {
  background:
    radial-gradient(ellipse 95% 110% at 22% 38%, #f0b090 0%, transparent 50%),
    radial-gradient(ellipse 75% 90% at 78% 65%, #7a3a28 0%, transparent 48%),
    radial-gradient(ellipse 50% 50% at 55% 50%, #c47855 0%, transparent 55%),
    linear-gradient(155deg, #d99070 0%, #b56040 50%, #8a3e2a 100%);
}

.hero-bg[data-theme="claude"]::after {
  background:
    radial-gradient(circle at 30% 35%, rgba(255, 220, 190, 0.35) 0%, transparent 40%),
    radial-gradient(circle at 75% 70%, rgba(60, 20, 10, 0.4) 0%, transparent 45%);
}

.hero-bg[data-theme="codex"] {
  background:
    radial-gradient(ellipse 90% 100% at 20% 40%, #7ab0e8 0%, transparent 50%),
    radial-gradient(ellipse 70% 85% at 82% 50%, #e0a060 0%, transparent 48%),
    radial-gradient(ellipse 55% 60% at 55% 55%, #5a90d0 0%, transparent 50%),
    linear-gradient(150deg, #5a9ad8 0%, #4a7ec0 45%, #3a6aa8 100%);
}

.hero-bg[data-theme="codex"]::after {
  background:
    radial-gradient(circle at 25% 40%, rgba(180, 220, 255, 0.35) 0%, transparent 40%),
    radial-gradient(circle at 80% 55%, rgba(240, 170, 90, 0.45) 0%, transparent 42%);
}

.hero-bg[data-theme="cursor"] {
  background:
    radial-gradient(ellipse 90% 100% at 25% 35%, #a898f0 0%, transparent 50%),
    radial-gradient(ellipse 70% 85% at 80% 70%, #1e1450 0%, transparent 48%),
    radial-gradient(ellipse 50% 55% at 50% 55%, #5a48c8 0%, transparent 50%),
    linear-gradient(155deg, #7b6ae8 0%, #4a3ab0 50%, #2a1e70 100%);
}

.hero-bg[data-theme="cursor"]::after {
  background:
    radial-gradient(circle at 28% 35%, rgba(200, 190, 255, 0.4) 0%, transparent 40%),
    radial-gradient(circle at 75% 70%, rgba(20, 10, 60, 0.5) 0%, transparent 45%);
}

/* Brand overlays (logo + title) */
.hero-stage__brands {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.hero-brand {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 1.5rem;
  max-width: 90%;
  color: #fff;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  will-change: opacity, transform;
  backface-visibility: hidden;
}

.hero-brand.is-active {
  opacity: 1;
  visibility: visible;
}

.hero-brand__logo {
  display: block;
  width: 36px;
  height: 36px;
  margin-bottom: 0.85rem;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.18));
  user-select: none;
  pointer-events: none;
}

.hero-brand__company {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 0.4rem;
}

.hero-brand__title {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #ffffff;
  margin-bottom: 0.4rem;
}

.hero-brand__tagline {
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.78);
  max-width: 18rem;
}

/* ---------------------------------------------------------
   Content stage — scrollable stacked panels
   --------------------------------------------------------- */

.content-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.15rem;
}

.content-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
  will-change: opacity;
}

.content-panel.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

.content-panel.is-leaving {
  visibility: visible;
  pointer-events: none;
  z-index: 1;
}

.content-panel.is-entering {
  visibility: visible;
  pointer-events: none;
  z-index: 3;
}

.content-panel__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem 0.4rem 5.25rem 0.55rem;
  /* Firefox: hide by default, reveal on hover */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.35s ease;
}

.content-panel__scroll:hover,
.content-panel__scroll:focus-within,
.content-panel__scroll.is-scrolling {
  scrollbar-color: rgba(15, 23, 42, 0.22) rgba(15, 23, 42, 0.04);
}

/* WebKit premium scrollbar — reserved width, thumb fades in */
.content-panel__scroll::-webkit-scrollbar {
  width: 10px;
}

.content-panel__scroll::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0 4.5rem;
  border-radius: 999px;
}

.content-panel__scroll::-webkit-scrollbar-thumb {
  background-color: transparent;
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 999px;
  box-shadow: none;
  transition:
    background-color 0.35s ease,
    box-shadow 0.35s ease;
}

/* Soft rail on hover */
.content-panel__scroll:hover::-webkit-scrollbar-track,
.content-panel__scroll:focus-within::-webkit-scrollbar-track,
.content-panel__scroll.is-scrolling::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.035);
}

/* Pill thumb — soft graphite with light depth */
.content-panel__scroll:hover::-webkit-scrollbar-thumb,
.content-panel__scroll:focus-within::-webkit-scrollbar-thumb,
.content-panel__scroll.is-scrolling::-webkit-scrollbar-thumb {
  background-color: rgba(15, 23, 42, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.content-panel__scroll:hover::-webkit-scrollbar-thumb:hover,
.content-panel__scroll:focus-within::-webkit-scrollbar-thumb:hover,
.content-panel__scroll.is-scrolling::-webkit-scrollbar-thumb:hover {
  background-color: rgba(15, 23, 42, 0.3);
}

.content-panel__scroll:hover::-webkit-scrollbar-thumb:active,
.content-panel__scroll:focus-within::-webkit-scrollbar-thumb:active,
.content-panel__scroll.is-scrolling::-webkit-scrollbar-thumb:active {
  background-color: rgba(15, 23, 42, 0.42);
}

.content-panel__copy {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.content-panel__copy p {
  font-size: 0.875rem;
  line-height: 1.62;
  color: #5a6169;
  letter-spacing: -0.006em;
  will-change: opacity, transform;
}

/* ---------------------------------------------------------
   Footer
   --------------------------------------------------------- */

.modal__footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 1.35rem 1.2rem;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 1) 48%,
    rgba(255, 255, 255, 0.92) 68%,
    rgba(255, 255, 255, 0) 100%
  );
}

.dots,
.nav {
  pointer-events: auto;
  display: flex;
  align-items: center;
}

.dots {
  gap: 0.45rem;
  padding: 0.25rem 0;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #d1d5db;
  transition:
    background 0.25s ease,
    width 0.45s var(--ease-out);
  flex-shrink: 0;
}

.dot:hover:not(.is-active) {
  background: #9ca3af;
}

.dot.is-active {
  width: 18px;
  background: var(--dot-accent, #111111);
}

.nav {
  gap: 0.4rem;
}

.nav__btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #ffffff;
  color: #4b5563;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s var(--ease-out),
    box-shadow 0.2s ease;
}

.nav__btn:hover {
  background: #f9fafb;
  color: #111827;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.nav__btn:active {
  transform: scale(0.94);
}

.nav__btn svg {
  display: block;
}

body.is-modal-open {
  overflow: hidden;
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 480px) {
  :root {
    --modal-w: 100%;
    --radius-modal: 24px;
    --hero-h: 168px;
    --modal-h: 520px;
  }

  .hero-brand__title {
    font-size: 1.75rem;
  }

  .content-panel__copy p {
    font-size: 0.8125rem;
  }

  .modal__footer {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .open-btn,
  .dot,
  .nav__btn {
    transition: none;
  }
}
