/* ==========================================================================
   Opsly - product tour / launch deck
   Layered on top of styles.css (design tokens, buttons, .brand, screenshot bits).
   Without JavaScript the slides stack and read as a normal page; main.js's
   sibling here (deck.js) turns them into a keyboard-driven deck.
   ========================================================================== */

/* ---------- Page shell ---------- */
.deck-body { min-height: 100dvh; }

/* In deck mode the deck is fixed to the viewport, so the body must not scroll
   behind it. Scoped to .js so the fallback page still scrolls normally. */
.js .deck-body { overflow: hidden; }

/* ---------- Top bar ---------- */
.deck-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 3.75rem;
  padding-inline: clamp(1.125rem, 3vw, 1.75rem);
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.js .deck-bar { position: fixed; inset: 0 0 auto 0; }

.deck-bar__spacer { margin-left: auto; }

.deck-count {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* The live counter only means something once JS is driving the deck. */
.deck-count { display: none; }
.js .deck-count { display: inline; }

.deck-bar__actions { display: flex; align-items: center; gap: 0.5rem; }

/* ---------- Deck + slides ---------- */
.deck { position: relative; }

/* Fallback (no JS): every slide is just a tall, readable section. */
.slide {
  padding-block: clamp(3rem, 8vw, 5rem);
  border-bottom: 1px solid var(--border);
}
.slide:last-child { border-bottom: 0; }

.slide__inner {
  width: 100%;
  max-width: 62rem;
  margin-inline: auto;
  padding-inline: clamp(1.125rem, 4vw, 2rem);
}

/* Deck mode (JS): one slide at a time, cross-faded. */
.js .deck {
  position: fixed;
  inset: 3.75rem 0 0 0;
  overflow: hidden;
}
.js .slide {
  position: absolute;
  inset: 0;
  display: grid;
  /* "safe" so a slide taller than the area below the bar aligns to the top and
     scrolls, instead of centering and clipping its heading under the fixed bar. */
  align-content: safe center;
  padding-block: clamp(1.5rem, 4vw, 3rem) clamp(5rem, 10vw, 7rem);
  border-bottom: 0;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s;
}
.js .slide.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ---------- Slide typography ---------- */
.slide__eyebrow {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.85rem;
}
.slide h2 {
  font-size: clamp(1.9rem, 4.4vw, 3rem);
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.slide__lede {
  color: var(--fg-muted);
  font-size: clamp(1.0625rem, 1.8vw, 1.25rem);
  max-width: 40rem;
}

/* ---------- Title slide ---------- */
.slide--title { text-align: center; }
.slide--title .slide__inner { display: grid; justify-items: center; }
.deck-logo {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}
.slide--title h1 {
  font-size: clamp(2.5rem, 6.5vw, 4.5rem);
  letter-spacing: -0.035em;
  margin-bottom: 1.25rem;
}
.slide--title h1 .grad {
  background: linear-gradient(100deg, var(--primary), var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.deck-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem 0.35rem 0.5rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 1.75rem;
}
.deck-badge strong {
  color: var(--accent-fg);
  background: var(--accent-bg);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.deck-hint {
  margin-top: 2.25rem;
  font-size: 0.8125rem;
  color: var(--fg-muted);
}
.deck-hint kbd {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
  color: var(--fg);
}
/* The keyboard hint is meaningless without JS driving the deck. */
.deck-hint { display: none; }
.js .deck-hint { display: block; }

/* ---------- Screenshot slides ----------
   The app screenshots are full-page captures at roughly 2.16:1, so they get a
   compact header and the full slide width underneath rather than a side-by-side
   split, which would shrink them to nothing. */
.slide--shot .slide__inner { max-width: 82rem; }
.slide--shot .slide__eyebrow { margin-bottom: 0.5rem; }
.slide--shot h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  margin-bottom: 0.5rem;
}
.slide--shot .slide__lede {
  max-width: 62rem;
  font-size: clamp(0.9375rem, 1.4vw, 1.0625rem);
}
.slide__shot { margin-top: clamp(1rem, 2.5vw, 1.75rem); }

/* Bound the frame by the height left over after the header so a wide capture
   never pushes the slide into scrolling. 2.16 is the screenshots' aspect. */
.slide__shot .screen {
  width: 100%;
  max-width: calc((100dvh - 19rem) * 2.16);
  margin-inline: auto;
}

.slide__points {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.75rem;
}
.slide__points li {
  display: flex;
  gap: 0.6rem;
  font-size: 0.9375rem;
  color: var(--fg-muted);
}
.slide__points li strong { color: var(--fg); font-weight: 600; }
.slide__points svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 0.28rem;
  color: var(--green);
}

/* ---------- Screenshot frame + placeholder ---------- */
.screen {
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  background: var(--shot-frame);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.screen img { width: 100%; display: block; }

/* Light/dark screenshot swap, mirroring styles.css .shot behaviour. */
.screen .shot-dark { display: none; }
:root[data-theme='dark'] .screen .shot-dark { display: block; }
:root[data-theme='dark'] .screen .shot-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .screen .shot-dark { display: block; }
  :root:not([data-theme='light']) .screen .shot-light { display: none; }
}

.screen__ph {
  display: grid;
  place-items: center;
  gap: 0.6rem;
  aspect-ratio: 16 / 10;
  padding: 1.5rem;
  text-align: center;
  color: var(--fg-muted);
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 12px,
      color-mix(in srgb, var(--fg-muted) 6%, transparent) 12px,
      color-mix(in srgb, var(--fg-muted) 6%, transparent) 24px);
}
.screen__ph svg { width: 30px; height: 30px; opacity: 0.6; }
.screen__ph p { font-size: 0.875rem; font-weight: 600; color: var(--fg); }
.screen__ph code {
  font-size: 0.75rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  color: var(--accent-fg);
}

/* ---------- Scale / three-up columns ---------- */
.slide__cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}
.slide__cols article {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.slide__cols .step__num {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.6rem;
  background: var(--accent-bg);
  color: var(--accent-fg);
  font-weight: 700;
  font-size: 0.9375rem;
  font-family: var(--font-mono);
  margin-bottom: 0.85rem;
}
.slide__cols h3 { font-size: 1.0625rem; margin-bottom: 0.4rem; }
.slide__cols p { font-size: 0.875rem; color: var(--fg-muted); }

/* ---------- Language chips ---------- */
.lang-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}
.lang-grid span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  font-size: 0.9375rem;
  font-weight: 500;
}
.lang-grid span b {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 700;
}

/* ---------- Code block on the self-host slide ---------- */
.slide .code { max-width: 42rem; }

/* ---------- Bottom controls ---------- */
.deck-nav {
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.85rem clamp(1.125rem, 3vw, 1.75rem) 1.1rem;
  background: linear-gradient(to top, var(--bg) 55%, transparent);
}
.js .deck-nav { display: flex; }

.deck-arrow {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.deck-arrow:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-1px); }
.deck-arrow:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.deck-arrow svg { width: 18px; height: 18px; }

.deck-dots { display: flex; align-items: center; gap: 0.5rem; }
.deck-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: var(--border);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.deck-dot:hover { background: var(--fg-muted); }
.deck-dot[aria-current='true'] { background: var(--primary); transform: scale(1.25); }

/* Thin progress bar pinned to the very bottom edge. */
.deck-progress {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 31;
  height: 3px;
  background: transparent;
}
.js .deck-progress { display: block; }
.deck-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--teal));
  transition: width 0.4s ease;
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .deck-dots { display: none; }
  /* Height-bounding the frame stops mattering once the slide scrolls. */
  .slide__shot .screen { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .js .slide { transition: opacity 0.01ms, visibility 0s; transform: none; }
  .deck-progress span { transition: none; }
}
