/* SecurityBox interactive presentation */
.pres-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pres-launch {
  position: fixed;
  left: 1.5rem;
  bottom: 1.5rem;
  z-index: 998;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  max-width: calc(100vw - 3rem);
  padding: 0.8rem 1.15rem;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  color: var(--text-heading);
  background: var(--accent-gradient);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  animation: pres-launch-in 0.6s 1.2s forwards, pres-launch-pulse 3s 1.8s infinite;
}

.pres-launch:hover,
.pres-launch:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 30px var(--border-glow);
}

.pres-launch:focus-visible,
.pres-icon-button:focus-visible,
.pres-primary-button:focus-visible,
.pres-secondary-button:focus-visible,
.pres-ask input:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

.pres-modal[hidden],
.pres-end-state[hidden],
.pres-answer[hidden],
.pres-answer button[hidden] {
  display: none;
}

.pres-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100vw;
  min-height: 100%;
  padding: 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  background: color-mix(in srgb, var(--bg-primary) 94%, transparent);
  animation: pres-modal-in 0.25s ease-out;
}

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

.pres-player {
  box-sizing: border-box;
  width: 100%;
  max-width: min(1200px, 110dvh);
  min-width: 0;
  margin: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  overflow: hidden;
}

.pres-slide-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-primary);
}

.pres-slide-frame picture,
.pres-slide-frame img {
  display: block;
  width: 100%;
  height: 100%;
}

.pres-slide-frame img {
  object-fit: contain;
}

/* The slide art already carries its own title, subtitle, and counter, so the
   caption bar is visually removed. Kept in the a11y tree (aria-live counter)
   for screen-reader slide-change announcements. */
.pres-caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pres-caption > div {
  min-width: 0;
}

.pres-slide-title,
.pres-slide-subtitle,
.pres-counter,
.pres-answer p,
.pres-end-state p {
  margin: 0;
}

.pres-slide-title {
  overflow: hidden;
  color: var(--text-heading);
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pres-slide-subtitle {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pres-counter {
  flex: 0 0 auto;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.pres-progress {
  width: 100%;
  height: 3px;
  overflow: hidden;
  background: var(--border-color);
}

.pres-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent-gradient);
  transition: width 0.1s linear;
}

.pres-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.pres-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  height: 2.65rem;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-primary);
  background: var(--bg-card);
  line-height: 1;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.pres-icon-button:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.pres-icon-button:disabled {
  color: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.4;
}

.pres-play-button {
  width: 3rem;
  height: 3rem;
  border-color: var(--accent-cyan);
  background: var(--accent-gradient);
  color: var(--text-heading);
}

.pres-ask {
  padding: 0.8rem 1rem 1rem;
}

.pres-ask label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 700;
}

.pres-ask-row {
  display: flex;
  gap: 0.6rem;
  min-width: 0;
}

.pres-ask input {
  min-width: 0;
  flex: 1 1 auto;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  background: var(--bg-primary);
}

.pres-ask input::placeholder {
  color: var(--text-secondary);
}

.pres-primary-button,
.pres-secondary-button {
  flex: 0 0 auto;
  padding: 0.68rem 0.95rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-weight: 700;
  line-height: 1.3;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.pres-primary-button {
  border-color: var(--accent-cyan);
  color: var(--text-heading);
  background: var(--accent-gradient);
}

.pres-secondary-button {
  color: var(--text-primary);
  background: var(--bg-card);
}

.pres-primary-button:hover:not(:disabled),
.pres-secondary-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.pres-secondary-button:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
}

.pres-primary-button:disabled,
.pres-secondary-button:disabled,
.pres-ask input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.pres-answer {
  margin-top: 0.7rem;
  padding: 0.8rem;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  background: var(--bg-card);
}

.pres-answer p {
  overflow-wrap: anywhere;
}

.pres-answer .pres-secondary-button {
  margin-top: 0.75rem;
}

.pres-answer a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pres-end-state {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  text-align: center;
  background: color-mix(in srgb, var(--bg-primary) 94%, transparent);
}

.pres-end-state > div {
  max-width: 42rem;
}

.pres-end-state h3 {
  margin: 0.35rem 0 1.2rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.pres-eyebrow {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pres-end-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* Fullscreen mode — native (:fullscreen on the modal) and the iOS Safari CSS
   fallback (.pres-fs-fallback) both get .pres-fs from JS. Slide area is
   maximized: caps released, chrome minimized, image letterboxed to fit. */
.pres-modal.pres-fs {
  padding: 0;
  background: var(--bg-primary);
}

.pres-modal.pres-fs .pres-player {
  display: flex;
  flex-direction: column;
  width: 100dvw;
  height: 100dvh;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.pres-modal.pres-fs .pres-slide-frame {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: auto;
}

.pres-modal.pres-fs .pres-progress,
.pres-modal.pres-fs .pres-controls,
.pres-modal.pres-fs .pres-ask {
  flex: 0 0 auto;
}

.pres-modal.pres-fs .pres-controls {
  padding: 0.5rem 1rem;
  border-bottom: 0;
}

/* Landscape phone: every vertical pixel goes to the slide. */
@media (max-height: 500px) {
  .pres-modal.pres-fs .pres-ask {
    display: none;
  }
}

@keyframes pres-launch-in {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pres-launch-pulse {
  0%, 100% { box-shadow: var(--shadow-lg), var(--shadow-glow); }
  50% { box-shadow: var(--shadow-lg), 0 0 30px var(--border-glow); }
}

@keyframes pres-modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 768px) {
  .pres-launch {
    left: 0.75rem;
    bottom: 0.75rem;
    max-width: calc(100vw - 1.5rem);
    padding: 0.68rem 0.9rem;
    font-size: 0.84rem;
  }

  .pres-modal {
    align-items: flex-start;
    padding: 0.5rem;
  }

  .pres-player {
    border-radius: var(--radius-md);
  }

  .pres-slide-title {
    font-size: 0.88rem;
  }

  .pres-slide-subtitle {
    display: none;
  }

  .pres-controls {
    gap: 0.4rem;
    padding: 0.65rem 0.5rem;
  }

  .pres-icon-button {
    width: 2.4rem;
    height: 2.4rem;
  }

  .pres-play-button {
    width: 2.75rem;
    height: 2.75rem;
  }

  .pres-ask {
    padding: 0.7rem;
  }

  .pres-ask-row {
    flex-wrap: wrap;
  }

  .pres-ask input {
    flex-basis: 100%;
  }

  .pres-ask-row .pres-primary-button {
    width: 100%;
  }

  .pres-end-state {
    padding: 0.75rem;
  }

  .pres-end-state h3 {
    margin-bottom: 0.75rem;
  }

  .pres-end-actions {
    gap: 0.4rem;
  }

  .pres-end-actions .pres-primary-button,
  .pres-end-actions .pres-secondary-button {
    padding: 0.5rem 0.65rem;
    font-size: 0.76rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pres-launch,
  .pres-modal {
    animation: none;
  }

  .pres-launch {
    opacity: 1;
  }

  .pres-launch,
  .pres-icon-button,
  .pres-primary-button,
  .pres-secondary-button,
  .pres-progress span {
    transition: none;
  }
}
