/*
 * ZHS Ecom deck slide player.
 *
 * A framed slide image with a connected control bar underneath: previous,
 * current/total, next. Desktop and mobile use the same artwork and chrome.
 *
 * Tokens come from public/assets/zhs-design-system.css when the host page links
 * it. Every value below carries the canonical fallback, so the player still looks
 * right on a page that has not linked the system.
 *
 * See docs/landing-page-design-system.md and docs/dsl-player-integration.md.
 */

.dsl-player {
  --dsl-surface: #0c0d12;
  --dsl-surface-2: #11131a;
  --dsl-line: rgba(255, 255, 255, 0.09);
  --dsl-line-2: rgba(255, 255, 255, 0.14);
  --dsl-text: #fafbfc;
  --dsl-muted: #a6acb7;
  --dsl-accent: var(--zhs-blue-accent, #8da7ff);
  --dsl-ratio: 16 / 9;

  display: block;
  text-align: left;
  max-width: 1120px;
  margin: 0 auto;
  color: var(--dsl-text);
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.dsl-player:focus-visible {
  outline: 2px solid var(--dsl-accent);
  outline-offset: 4px;
}

/* ── Frame ─────────────────────────────────────────────────────────────── */

.dsl-viewport {
  position: relative;
  aspect-ratio: var(--dsl-ratio);
  width: 100%;
  background: var(--dsl-surface);
  border: 1px solid var(--dsl-line);
  border-radius: var(--zhs-radius-card, 16px);
  overflow: hidden;
  /* Vertical page scrolling still belongs to the page until the deck is zoomed. */
  touch-action: pan-y pinch-zoom;
}

.dsl-player[data-dsl-zoom='on'] .dsl-viewport {
  overflow: auto;
  touch-action: pan-x pan-y;
  cursor: grab;
  -webkit-overflow-scrolling: touch;
}

.dsl-canvas {
  position: relative;
  /* Zoom is a width multiplier rather than a transform, so the scroll area is real
     and the percentage-positioned hotspots stay locked to the artwork. */
  width: 100%;
}

.dsl-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: inherit;
  user-select: none;
  -webkit-user-drag: none;
}

.dsl-player[data-dsl-state='loading'] .dsl-image,
.dsl-player[data-dsl-state='error'] .dsl-image {
  opacity: 0;
}

.dsl-hotspots {
  position: absolute;
  inset: 0;
}

/* One hotspot per hyperlink in the source deck, at the source deck's own
   proportions. Invisible at rest so the approved artwork is unaltered; outlined on
   hover and focus so the link is discoverable and keyboard-reachable. */
.dsl-hotspot {
  position: absolute;
  display: block;
  border-radius: 4px;
  text-decoration: none;
  background: transparent;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.dsl-hotspot { -webkit-tap-highlight-color: transparent; }

.dsl-hotspot:hover {
  background: transparent;
  box-shadow: none;
}

.dsl-hotspot:focus-visible {
  outline: 2px solid var(--dsl-accent);
  outline-offset: 2px;
  background: transparent;
}

.dsl-status {
  position: absolute;
  inset: auto 12px 12px 12px;
  margin: 0;
  color: var(--dsl-muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.dsl-status:empty {
  display: none;
}

.dsl-player[data-dsl-state='loading'] .dsl-status,
.dsl-player[data-dsl-state='error'] .dsl-status {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ── Progress ──────────────────────────────────────────────────────────── */

.dsl-progress {
  height: 3px;
  margin-top: 10px;
  background: var(--dsl-line);
  border-radius: 999px;
  overflow: hidden;
}

.dsl-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--zhs-gradient, linear-gradient(135deg, #3d6cff 0%, #6f8eff 100%));
  transition: width 0.2s ease;
}

/* ── Controls ──────────────────────────────────────────────────────────── */

.dsl-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.dsl-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* Every control clears the 44px minimum target on both axes. */
.dsl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 20px;
  background: var(--dsl-surface-2);
  color: var(--dsl-text);
  border: 1px solid var(--dsl-line-2);
  border-radius: var(--zhs-radius-pill, 980px);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dsl-btn:hover:not(:disabled) {
  background: #171a23;
  border-color: rgba(141, 167, 255, 0.45);
}

.dsl-btn:focus-visible {
  outline: 2px solid var(--dsl-accent);
  outline-offset: 3px;
}

.dsl-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.dsl-btn--tool {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
}

.dsl-counter {
  margin: 0;
  color: var(--dsl-muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.dsl-zoom-level {
  min-width: 52px;
  color: var(--dsl-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ── Slide text disclosure ─────────────────────────────────────────────── */

.dsl-text {
  margin-top: 14px;
  background: var(--dsl-surface);
  border: 1px solid var(--dsl-line);
  border-radius: var(--zhs-radius-card, 16px);
}

.dsl-text-summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  color: var(--dsl-accent);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.dsl-text-summary:focus-visible {
  outline: 2px solid var(--dsl-accent);
  outline-offset: 3px;
}

/* The exact wording from the approved deck, reflowed for screen readers and small
   screens. Never edited, never summarised. */
.dsl-text-body {
  padding: 0 18px 16px;
  color: var(--dsl-muted);
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ── Unavailable state ─────────────────────────────────────────────────── */

.dsl-unavailable {
  margin: 0;
  padding: 28px 24px;
  background: var(--dsl-surface, #0c0d12);
  border: 1px solid var(--dsl-line, rgba(255, 255, 255, 0.09));
  border-radius: var(--zhs-radius-card, 16px);
  color: var(--dsl-muted, #a6acb7);
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  text-align: center;
}

/* ── Full screen ───────────────────────────────────────────────────────── */

.dsl-player:fullscreen,
.dsl-player[data-dsl-expanded='1'] {
  max-width: none;
  background: #050608;
  padding: 16px;
  overflow: auto;
}

.dsl-player[data-dsl-expanded='1'] {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.dsl-player:fullscreen .dsl-viewport,
.dsl-player[data-dsl-expanded='1'] .dsl-viewport {
  max-height: calc(100vh - 190px);
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .dsl-bar {
    flex-wrap: wrap;
    justify-content: center;
  }
  .dsl-counter {
    order: -1;
    width: 100%;
  }
  .dsl-btn {
    flex: 1 1 auto;
    padding: 10px 14px;
  }
  .dsl-btn--tool {
    flex: 0 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dsl-progress-fill,
  .dsl-btn,
  .dsl-hotspot {
    transition: none;
  }
}

@media (forced-colors: active) {
  .dsl-hotspot:hover,
  .dsl-hotspot:focus-visible {
    box-shadow: none;
    outline: 2px solid currentColor;
  }
  .dsl-progress-fill {
    background: currentColor;
  }
}

/* One connected viewer: slide above, grey previous / counter / next bar below. */
.dsl-player { position: relative; padding: 0; box-sizing: border-box; }
.dsl-tools, .dsl-text, .dsl-progress { display: none; }
.dsl-viewport {
  border-bottom: 0;
  border-radius: var(--zhs-radius-card, 16px) var(--zhs-radius-card, 16px) 0 0;
}
.dsl-bar {
  position: static;
  inset: auto;
  z-index: 4;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0 4px;
  box-sizing: border-box;
  background: #eceef2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 1px solid rgba(15, 18, 28, 0.08);
  border-radius: 0 0 var(--zhs-radius-card, 16px) var(--zhs-radius-card, 16px);
  pointer-events: auto;
}
.dsl-bar .dsl-btn--nav {
  flex: none;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  justify-self: center;
  line-height: 0;
  color: #4b5160;
  background: transparent;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
}
.dsl-nav-icon {
  display: block;
  width: 20px;
  height: 20px;
  pointer-events: none;
}
.dsl-bar .dsl-btn--nav { transform: none; }
.dsl-bar .dsl-btn--nav:hover:not(:disabled) {
  background: rgba(15, 18, 28, 0.06);
  color: #1f2330;
  filter: none;
}
.dsl-bar .dsl-btn--nav:disabled {
  opacity: 0.32;
}
.dsl-bar .dsl-counter {
  position: static;
  transform: none;
  order: 0;
  width: max-content;
  justify-self: center;
  margin: 0;
  padding: 6px 14px;
  color: #1f2330;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(15, 18, 28, 0.08);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}
