/* Tutorial video dialog + player (Midnight style). Used with tutorial-player.js. */
#service-tutorial.tp-dialog {
  --tp-brand: #10b981;
  --tp-brand-2: #059669;
  --tp-ink: #f2fbf7;
  --tp-muted: #a8c2ba;
  --tp-panel: #0c1f1b;
  --tp-line: rgb(255 255 255 / .1);
  width: min(1120px, 96vw);
  max-width: none;
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: 26px;
  overflow: hidden;
  background: radial-gradient(ellipse at 100% 0%, rgb(16 185 129 / .22), transparent 55%), linear-gradient(150deg, #07110f, #0f2a24);
  color: var(--tp-ink);
  box-shadow: 0 40px 90px -20px rgb(0 0 0 / .6);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
#service-tutorial.tp-dialog[open] { display: flex; flex-direction: column; animation: tp-pop .45s cubic-bezier(.22, 1, .36, 1) both; }
#service-tutorial.tp-dialog::backdrop { background: rgb(3 8 7 / .72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#service-tutorial.tp-dialog > h2 {
  margin: 0;
  padding: 20px 70px 14px 26px;
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--tp-ink);
}
#service-tutorial.tp-dialog .website-tutorial-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / .1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
#service-tutorial.tp-dialog .website-tutorial-close:hover { background: rgb(255 255 255 / .2); }

.tp-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  grid-template-rows: minmax(0, auto);
  align-items: start;
  gap: 18px;
  padding: 0 22px 22px;
  min-height: 0;
  flex: 1 1 auto;
}
/* Reserve room for the title, subtitle strip and control bar, so the
   controls are always on screen however short the window is. */
#service-tutorial.tp-dialog { --tp-chrome: 200px; }
.tp-stage { min-height: 0; }
.tp-screen { flex: none; max-height: calc(94vh - var(--tp-chrome)); min-height: 140px; }

/* ---------- Stage ---------- */
.tp-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 1px var(--tp-line);
}
.tp-screen { position: relative; aspect-ratio: 16 / 9; background: #000; }
.tp-screen video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; cursor: pointer; }
.tp-big {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tp-brand), var(--tp-brand-2));
  color: #fff;
  box-shadow: 0 18px 40px -10px rgb(16 185 129 / .7), 0 0 0 0 rgb(16 185 129 / .45);
  cursor: pointer;
  transition: transform .3s, opacity .3s;
  animation: tp-ring 2.4s ease-out infinite;
}
.tp-big svg { width: 38px; height: 38px; fill: currentColor; margin-left: 4px; }
.tp-big:hover { transform: scale(1.06); }
.tp-playing .tp-big { opacity: 0; pointer-events: none; transform: scale(.8); }

/* Subtitles: a strip under the picture, so they never cover the slide text. */
.tp-caption {
  min-height: 52px;
  padding: 10px 16px;
  background: #050c0b;
  border-top: 1px solid var(--tp-line);
  color: #fff;
  text-align: center;
  font-size: clamp(13px, 1.3vw, 15px);
  line-height: 1.45;
}
:fullscreen .tp-caption { font-size: clamp(16px, 1.8vw, 22px); }
.tp-caption b { display: block; color: #6ee7b7; font-size: .92em; margin-bottom: 2px; }
.tp-caption[hidden] { display: none; }

/* Control bar */
.tp-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #0c1f1b, #07110f);
  transition: opacity .3s;
}
.tp-btn {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  background: rgb(255 255 255 / .07);
  color: #fff;
  font: 800 13px inherit;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.tp-btn svg { width: 20px; height: 20px; fill: currentColor; }
.tp-btn:hover { background: rgb(255 255 255 / .16); }
.tp-btn:focus-visible, .tp-seek:focus-visible, .tp-vol:focus-visible, .tp-big:focus-visible { outline: 3px solid #6ee7b7; outline-offset: 2px; }
.tp-cc[aria-pressed="true"], .tp-music[aria-pressed="true"] { background: rgb(16 185 129 / .22); color: #6ee7b7; }
.tp-cc[aria-pressed="false"], .tp-music[aria-pressed="false"] { color: #8aa39b; text-decoration: line-through; }
.tp-play { background: linear-gradient(135deg, var(--tp-brand), var(--tp-brand-2)); }
.tp-time { flex: none; font: 600 12px/1 inherit; font-family: inherit; color: var(--tp-muted); font-variant-numeric: tabular-nums; min-width: 78px; }

.tp-seek-wrap { position: relative; flex: 1; min-width: 60px; display: flex; align-items: center; }
#service-tutorial .tp-seek, #service-tutorial .tp-vol {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--tp-brand) var(--tp-p, 0%), rgb(255 255 255 / .18) var(--tp-p, 0%));
  cursor: pointer;
}
#service-tutorial .tp-vol { flex: none; width: 70px; background: linear-gradient(90deg, #6ee7b7 var(--tp-v, 70%), rgb(255 255 255 / .18) var(--tp-v, 70%)); }
.tp-seek::-webkit-slider-thumb, .tp-vol::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgb(16 185 129 / .35); }
.tp-seek::-moz-range-thumb, .tp-vol::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }
.tp-marks { position: absolute; inset: 0; pointer-events: none; }
.tp-marks i { position: absolute; top: 50%; width: 2px; height: 10px; margin-top: -5px; background: rgb(7 17 15 / .8); }
.tp-music-off .tp-vol { opacity: .45; }

/* Hide controls while watching; show on move/focus. */
:fullscreen.tp-stage { border-radius: 0; justify-content: center; }
:fullscreen .tp-screen { flex: 1; aspect-ratio: auto; }
/* Controls hide only in full screen, where they sit over nothing else. */
:fullscreen.tp-stage.tp-idle .tp-bar { opacity: 0; }
:fullscreen.tp-stage.tp-idle { cursor: none; }
.tp-bar { flex: none; }
.tp-caption { flex: none; }

/* ---------- Chapters ---------- */
.tp-chapters {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(94vh - 90px);
  padding: 14px 10px 10px;
  border-radius: 18px;
  background: rgb(255 255 255 / .04);
  box-shadow: inset 0 0 0 1px var(--tp-line);
}
.tp-chapters h3 { margin: 0 6px 10px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--tp-muted); }
.tp-chapters ol { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 4px; }
.tp-chapters button {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--tp-ink);
  text-align: left;
  font: 600 13px/1.3 inherit;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s;
}
.tp-chapters button:hover { background: rgb(255 255 255 / .07); }
.tp-chapters .tp-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: rgb(255 255 255 / .08); color: var(--tp-muted); font-size: 12px; font-weight: 800; }
.tp-chapters .tp-at { color: var(--tp-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.tp-chapters li.is-active button { background: rgb(16 185 129 / .16); }
.tp-chapters li.is-active .tp-n { background: linear-gradient(135deg, var(--tp-brand), var(--tp-brand-2)); color: #fff; }

/* ---------- Phones ---------- */
@media (max-width: 820px) {
  #service-tutorial.tp-dialog { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  #service-tutorial.tp-dialog > h2 { padding: 16px 64px 12px 16px; }
  .tp-body { grid-template-columns: 1fr; padding: 0 0 12px; gap: 12px; overflow-y: auto; }
  .tp-stage { border-radius: 0; }
  .tp-chapters { max-height: none; margin: 0 12px; }
  .tp-vol { display: none; }
  .tp-time { min-width: 0; }
  .tp-bar { gap: 6px; padding: 8px; }
  .tp-btn { min-width: 38px; height: 38px; }
}
@media (max-width: 420px) { .tp-speed { display: none; } }
@media (max-width: 820px) {
  .tp-screen { max-height: calc(100dvh - var(--tp-chrome)); }
}
/* Short screens (phone sideways, small laptop windows): smaller chrome. */
@media (max-height: 520px) {
  #service-tutorial.tp-dialog { --tp-chrome: 150px; }
  #service-tutorial.tp-dialog > h2 { padding-block: 10px 8px; font-size: 16px; }
  .tp-caption { min-height: 0; padding: 6px 12px; font-size: 12px; }
  .tp-caption b { display: inline; margin-right: 6px; }
  .tp-bar { padding: 6px 8px; }
  .tp-btn { height: 34px; min-width: 34px; }
}
@media (max-height: 520px) and (max-width: 900px) {
  .tp-body { grid-template-columns: minmax(0, 1fr) 220px; padding: 0 10px 10px; gap: 10px; overflow: hidden; }
  .tp-stage { border-radius: 12px; }
  .tp-chapters { margin: 0; max-height: calc(100dvh - 60px); }
  #service-tutorial.tp-dialog { --tp-chrome: 130px; }
}

@keyframes tp-pop { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes tp-ring { 0% { box-shadow: 0 18px 40px -10px rgb(16 185 129 / .7), 0 0 0 0 rgb(16 185 129 / .45); } 70%, 100% { box-shadow: 0 18px 40px -10px rgb(16 185 129 / .7), 0 0 0 18px transparent; } }
@media (prefers-reduced-motion: reduce) { #service-tutorial.tp-dialog[open], .tp-big { animation: none; } }
