/* Product tours (js/reels.js): the tour button on each module card, the
   modal player, and the light, app-like mocks inside it. The mocks are laid
   out on a fixed 640 x 360 canvas that the player scales to fit. */

/* ===== Tour button on the module cards (shown once reels.js is running) ===== */
.reel-btn {
  display: none;
  align-items: center;
  gap: 0.55rem;
  align-self: flex-start;
  margin-top: 1rem;
  padding: 0.45rem 0.9rem 0.45rem 0.45rem;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(108, 92, 231, 0.1);
  border: 1px solid rgba(108, 92, 231, 0.3);
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}

.reels-on .reel-btn {
  display: inline-flex;
}

.reel-btn:hover {
  background: rgba(108, 92, 231, 0.18);
  border-color: rgba(108, 92, 231, 0.55);
}

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

.reel-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent-gradient);
}

/* ===== Modal ===== */
.reel-open,
.reel-open body {
  overflow: hidden;
}

.reel-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.reel-modal[hidden] {
  display: none;
}

.reel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 10, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.reel-dialog {
  position: relative;
  width: min(880px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: reel-pop 0.25s ease both;
}

@keyframes reel-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
}

.reel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem 0.9rem 1.25rem;
}

.reel-title {
  font-size: 1rem;
  font-weight: 700;
}

.reel-close {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-hover);
  border-radius: 50%;
  cursor: pointer;
}

.reel-close:hover {
  color: var(--text-primary);
}

.reel-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(108, 92, 231, 0.35), transparent 60%),
    radial-gradient(ellipse at 90% 100%, rgba(0, 206, 201, 0.25), transparent 55%),
    #0e0e16;
}

.reel-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 640px;
  height: 360px;
  transform-origin: 0 0;
}

.reel-text {
  padding: 1rem 1.25rem 0.25rem;
  min-height: 5.6rem;
}

.reel-headline {
  font-size: 1.15rem;
  font-weight: 700;
}

.reel-caption {
  margin-top: 0.25rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.reel-caption:empty {
  display: none;
}

.reel-note {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.reel-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.reel-cta[hidden] {
  display: none;
}

.reel-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem 1.1rem;
}

.reel-ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-hover);
  border-radius: 50%;
  cursor: pointer;
}

.reel-ctl[hidden] {
  display: none;
}

.reel-ctl:disabled {
  opacity: 0.35;
  cursor: default;
}

.reel-play {
  color: #fff;
  background: var(--accent-gradient);
  border-color: transparent;
}

.reel-close:focus-visible,
.reel-ctl:focus-visible,
.reel-dot:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.reel-progress {
  flex: 1 1 120px;
  height: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.reel-bar {
  height: 100%;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.reel-dots {
  display: flex;
  gap: 2px;
}

.reel-dot {
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
}

.reel-dot::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}

.reel-dot.is-on::after {
  inset: 6px;
  background: var(--accent-2);
}

/* ===== Scene animation =====
   Items enter in order (--i). Pausing freezes them where they are. */
.reel-scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  animation: m-scene 0.4s ease both;
}

@keyframes m-scene {
  from { opacity: 0; transform: translateY(10px); }
}

.reel-scene .m-i {
  opacity: 0;
}

.reel-scene.in .m-i {
  animation: m-in 0.45s ease both;
  animation-delay: calc(var(--i, 0) * 0.42s + 0.35s);
}

@keyframes m-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.reel-stage.paused .reel-scene,
.reel-stage.paused .reel-scene * {
  animation-play-state: paused !important;
}

/* ===== Mocks: the app's light look ===== */
.m-wrap {
  width: 576px;
}

.m-panel {
  position: relative;
  color: #1f2330;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  font-size: 12.5px;
}

.m-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #3b4054;
  background: #f5f6fa;
  border-bottom: 1px solid #e8e9f0;
}

.m-lights {
  width: 34px;
  height: 8px;
  background:
    radial-gradient(circle at 4px 4px, #ff5f57 3.5px, transparent 4px),
    radial-gradient(circle at 17px 4px, #febc2e 3.5px, transparent 4px),
    radial-gradient(circle at 30px 4px, #28c840 3.5px, transparent 4px);
}

.m-body {
  padding: 14px;
}

/* Room for a stamp under the last row */
.m-body:has(> .m-stamp) {
  padding-bottom: 46px;
}

.m-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 14px;
}

.m-form-1 {
  grid-template-columns: 1fr;
  gap: 6px;
}

.m-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.m-field > span {
  font-size: 10.5px;
  color: #7a7f94;
}

.m-field > b {
  display: block;
  padding: 6px 9px;
  font-weight: 500;
  color: #1f2330;
  border: 1px solid #d9dbe5;
  border-radius: 6px;
  background: #fff;
}

.m-form-1 .m-field {
  flex-direction: row;
  align-items: center;
}

.m-form-1 .m-field > span {
  width: 74px;
  flex-shrink: 0;
}

.m-form-1 .m-field > b {
  flex: 1;
  padding: 4px 8px;
  background: #f3f1ff;
  border-color: #c9c2ff;
}

.m-extract {
  display: grid;
  grid-template-columns: 1fr 34px 1.05fr;
  align-items: center;
  gap: 10px;
}

.m-email {
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.55;
  color: #4a4f63;
  background: #fafafc;
  border: 1px dashed #c9cbd8;
  border-radius: 8px;
}

.m-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6c5ce7, #00cec9);
  border-radius: 50%;
}

.m-table {
  width: 100%;
  border-collapse: collapse;
}

.m-table th {
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  color: #5b6075;
  background: #fafafa;
  border-bottom: 1px solid #ececf2;
}

.m-table td {
  padding: 8px 9px;
  border-bottom: 1px solid #f0f0f5;
}

.m-tag {
  white-space: nowrap;
}

.m-tag {
  display: inline-block;
  padding: 1px 8px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid;
}

.m-green { color: #389e0d; background: #f6ffed; border-color: #b7eb8f; }
.m-blue { color: #0958d9; background: #e6f4ff; border-color: #91caff; }
.m-amber { color: #d46b08; background: #fff7e6; border-color: #ffd591; }
.m-red { color: #cf1322; background: #fff1f0; border-color: #ffa39e; }
.m-purple { color: #531dab; background: #f9f0ff; border-color: #d3adf7; }
.m-grey { color: #595959; background: #fafafa; border-color: #d9d9d9; }
.m-pink { color: #c41d7f; background: #fff0f6; border-color: #ffadd2; }

.m-total {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding: 8px 10px;
  font-size: 12.5px;
  background: #f3f1ff;
  border-radius: 6px;
}

.m-total b {
  color: #4b3bd6;
}

.m-stamp {
  position: absolute;
  right: 18px;
  bottom: 16px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #389e0d;
  border: 2px solid #52c41a;
  border-radius: 6px;
  background: rgba(246, 255, 237, 0.92);
  opacity: 0;
  transform: rotate(-6deg);
}

.reel-scene.in .m-stamp {
  animation: m-stamp 0.5s cubic-bezier(0.2, 1.4, 0.5, 1) both;
  animation-delay: calc(var(--i, 0) * 0.42s + 0.35s);
}

@keyframes m-stamp {
  from { opacity: 0; transform: rotate(-6deg) scale(1.6); }
  to { opacity: 1; transform: rotate(-6deg) scale(1); }
}

.m-ledger {
  display: grid;
  grid-template-columns: 190px 34px 1fr;
  align-items: center;
  gap: 10px;
  padding-bottom: 26px;
}

.m-doc-card {
  padding: 10px 12px;
  background: #fafafc;
  border: 1px solid #e3e4ec;
  border-radius: 8px;
}

.m-doc-card > b {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.m-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  font-size: 11.5px;
  color: #4a4f63;
}

.m-line > span:last-child {
  color: #1f2330;
  font-weight: 500;
  text-align: right;
}

/* Timeline */
.m-timeline {
  position: relative;
  padding: 18px 4px 6px;
}

.m-timeline ol {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  list-style: none;
}

.m-track {
  position: absolute;
  left: calc(50% / var(--n) + 4px);
  right: calc(50% / var(--n) + 4px);
  top: 25px;
  height: 4px;
  background: #e6e7ef;
  border-radius: 2px;
}

.m-track-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #6c5ce7, #00cec9);
  border-radius: 2px;
}

.reel-scene.in .m-track-fill {
  animation: m-fill linear both;
  animation-duration: calc(var(--steps) * 0.42s);
  animation-delay: 0.35s;
}

@keyframes m-fill {
  to { width: var(--w); }
}

.m-timeline li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.m-dot {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #d0d2de;
}

.m-timeline li.done .m-dot {
  border-color: #6c5ce7;
  background: #6c5ce7;
}

.m-timeline li.now .m-dot {
  box-shadow: 0 0 0 6px rgba(108, 92, 231, 0.2);
}

.m-timeline li.todo {
  opacity: 0.55;
}

.m-step {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  color: #3b4054;
}

.m-timeline-long .m-step {
  font-size: 9.5px;
}

/* Kanban */
.m-kanban {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 10px;
  width: 600px;
}

.m-col {
  min-height: 230px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

.m-col-h {
  margin-bottom: 8px;
  padding: 2px 4px 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #3b4054;
  border-bottom: 2px solid #e6e7ef;
}

.m-card {
  position: relative;
  z-index: 1;
  margin-bottom: 8px;
  padding: 8px 9px;
  background: #fff;
  border: 1px solid #e3e4ec;
  border-left: 3px solid #6c5ce7;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(20, 20, 40, 0.06);
}

.m-card b {
  display: block;
  font-size: 11.5px;
  color: #1f2330;
}

.m-card span {
  font-size: 10.5px;
  color: #7a7f94;
}

.reel-scene.in .m-move {
  z-index: 2;
  animation: m-in 0.45s ease both, m-move 1.1s cubic-bezier(0.5, 0, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 0.42s + 0.35s), 2.6s;
}

@keyframes m-move {
  0% { transform: none; box-shadow: 0 2px 6px rgba(20, 20, 40, 0.06); }
  30% { transform: translate(0, -6px) rotate(-2deg); box-shadow: 0 14px 30px rgba(20, 20, 40, 0.25); }
  85% { transform: translate(var(--dx), -6px) rotate(-1deg); }
  100% { transform: translate(var(--dx), 0); box-shadow: 0 2px 6px rgba(20, 20, 40, 0.06); border-left-color: #00b894; }
}

/* Document */
.m-paper {
  position: relative;
  width: 360px;
  margin: 0 auto;
  padding: 18px 20px 20px;
  color: #1f2330;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-size: 12px;
}

.m-paper:has(> .m-stamp) {
  padding-bottom: 50px;
}

.m-paper .m-stamp {
  bottom: 12px;
}

.m-paper-h {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 800;
}

.m-rule {
  height: 1px;
  margin: 8px 0;
  background: #e6e7ef;
}

/* Stats */
.m-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.m-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px;
  border: 1px solid;
  border-radius: 8px;
}

.m-tile b {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.m-tile span {
  font-size: 11px;
  font-weight: 600;
}

/* Calendar */
.m-cal-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  min-height: 34px;
  border-bottom: 1px solid #f0f0f5;
}

.m-cal-head {
  grid-template-columns: 96px repeat(var(--days), 1fr);
  min-height: 24px;
  font-size: 10px;
  color: #7a7f94;
  text-align: center;
}

.m-cal-unit {
  font-size: 11.5px;
  font-weight: 600;
  text-align: left;
}

.m-cal-lane {
  position: relative;
  height: 24px;
}

.m-cal-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid;
  border-radius: 5px;
  margin-right: 2px;
}

.m-sync {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #389e0d;
}

/* Title and closing cards */
.m-card-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-align: center;
}

.m-icon-big .module-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.m-icon-big .module-icon svg {
  width: 36px;
  height: 36px;
}

.m-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.m-name {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.m-tagline {
  font-size: 16px;
  color: var(--text-secondary);
}

.m-final .m-name {
  font-size: 34px;
}

.m-price {
  padding: 12px 22px;
  font-size: 18px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-hover);
  border-radius: 14px;
}

.m-price strong {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
}

.m-price .module-price-label {
  justify-content: center;
  font-size: 12px;
}

.m-price .module-price-needs {
  font-size: 11px;
}

/* ===== Phone ===== */
@media (max-width: 600px) {
  .reel-modal {
    padding: 0;
    align-items: stretch;
  }

  .reel-dialog {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .reel-head {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
  }

  .reel-text {
    min-height: 7rem;
  }

  .reel-controls {
    gap: 0.4rem;
  }

  .reel-dots {
    width: 100%;
    justify-content: center;
  }
}

/* ===== Reduced motion: a still storyboard, stepped with Previous / Next =====
   reels.js sets .is-reduced from prefers-reduced-motion. */
.is-reduced .reel-dialog,
.is-reduced .reel-scene,
.is-reduced .reel-scene.in .m-i,
.is-reduced .reel-scene.in .m-stamp,
.is-reduced .reel-scene.in .m-move,
.is-reduced .reel-scene.in .m-track-fill {
  animation: none !important;
}

.is-reduced .reel-scene .m-i,
.is-reduced .reel-scene .m-stamp {
  opacity: 1;
}

.is-reduced .reel-scene .m-move {
  transform: translate(var(--dx), 0);
  border-left-color: #00b894;
}

.is-reduced .reel-scene .m-track-fill {
  width: var(--w);
}

.m-kanban-wrap {
  width: 600px;
}

.m-doc-wrap {
  width: auto;
}

/* Text for screen readers only (the module name on each tour button) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
