/* ============================================================
   hm-player.css — Hotmaal video player (templates/js/hm-player.js)
   Loaded on video pages only. Uses the tokens from hm-theme.css.
   Motion is opacity/transform only; reduced-motion is handled in hm-theme.css.
   ============================================================ */

.hmp {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 100vh;
  max-height: 100svh;
  background: #000;
  color: #fff;
  overflow: hidden;
  outline: none;
  border-radius: inherit;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  font-variant-numeric: tabular-nums;
  isolation: isolate;
}
.hmp:focus-visible { box-shadow: inset 0 0 0 2px var(--pink); }
.hmp.hmp-portrait { aspect-ratio: 3 / 4; max-height: 75vh; max-height: 75svh; }
.hmp video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.hmp:not(.hmp-js) video { position: static; height: 100%; }

/* Layers above the picture */
.hmp-surface { position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.hmp-idle, .hmp-idle .hmp-surface { cursor: none; }
.hmp-center { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; gap: clamp(24px, 9vw, 64px); pointer-events: none; }
.hmp-bar, .hmp-center > * { transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s; }

/* ---------- Buttons ---------- */
.hmp-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: 0 0 auto;
  border: 0; border-radius: 50%;
  background: transparent; color: #fff; cursor: pointer;
  transition: background-color .15s, transform .15s var(--ease);
}
.hmp-btn:hover { background: rgba(255, 255, 255, .12); }
.hmp-btn:active { transform: scale(.92); }
.hmp-btn:focus-visible { outline: 2px solid var(--pink); outline-offset: 0; }
.hmp-btn[hidden] { display: none; }
.hmp-i { width: 24px; height: 24px; fill: currentColor; display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45)); }

/* Big centre play / pause and the touch skip buttons */
.hmp-big {
  width: 76px; height: 76px;
  background: var(--grad);
  box-shadow: 0 10px 30px rgba(255, 61, 154, .45), 0 0 0 6px rgba(255, 255, 255, .08);
  pointer-events: auto;
}
.hmp-big:hover { background: var(--grad); transform: scale(1.06); }
.hmp-big .hmp-i { width: 36px; height: 36px; }
.hmp-skip { width: 56px; height: 56px; background: rgba(14, 10, 29, .55); pointer-events: auto; display: none; }
.hmp-skip .hmp-i { width: 34px; height: 34px; }
.hmp-skip span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -38%); font-size: 10px; font-weight: 800; }
.hmp-skip-fwd .hmp-i { transform: scaleX(-1); }

/* Desktop: the big button only while paused or before the start */
.hmp:not(.hmp-paused) .hmp-big { opacity: 0; transform: scale(.8); visibility: hidden; }
/* Touch: play/pause and ±10 s in the centre while the controls are shown */
.hmp-touch.hmp-started .hmp-skip { display: inline-flex; }
.hmp-touch:not(.hmp-paused) .hmp-big { opacity: 1; transform: none; visibility: visible; background: rgba(14, 10, 29, .55); box-shadow: none; }
.hmp-touch.hmp-idle .hmp-center > *,
.hmp-loading .hmp-center > *,
.hmp-has-error .hmp-center > * { opacity: 0; visibility: hidden; pointer-events: none; }
.hmp:not(.hmp-started) .hmp-skip, .hmp-ended .hmp-skip { display: none; }

/* ---------- Spinner ---------- */
.hmp-spinner {
  position: absolute; left: 50%; top: 50%; z-index: 4;
  width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 25%, var(--violet), var(--pink));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  opacity: 0; visibility: hidden; transition: opacity .2s;
  animation: hmp-spin .85s linear infinite;
  pointer-events: none;
}
.hmp-loading .hmp-spinner { opacity: 1; visibility: visible; }
@keyframes hmp-spin { to { transform: rotate(360deg); } }

/* ---------- Control bar ---------- */
.hmp-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 36px 12px 8px;
  background: linear-gradient(to top, rgba(8, 5, 20, .9) 0%, rgba(8, 5, 20, .55) 45%, transparent 100%);
  pointer-events: none;   /* the gradient padding must not cover the big play button */
}
.hmp-bar > * { pointer-events: auto; }
.hmp-idle .hmp-bar { opacity: 0; transform: translateY(10px); visibility: hidden; pointer-events: none; }
.hmp-has-error .hmp-bar { display: none; }
.hmp-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
.hmp-spacer { flex: 1; }
.hmp-time { padding: 0 8px; font-size: 13px; font-weight: 600; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.hmp-sep, .hmp-dur { color: rgba(255, 255, 255, .72); }
.hmp-hd {
  position: absolute; top: 5px; right: 2px;
  padding: 0 3px; border-radius: 4px;
  background: var(--pink); color: #fff;
  font-size: 8px; font-weight: 800; line-height: 12px;
}
.hmp-hd[hidden] { display: none; }
.hmp-settings[aria-expanded="true"] .hmp-i { transform: rotate(45deg); }
.hmp-settings .hmp-i { transition: transform .25s var(--ease); }

/* Volume: slider opens on hover / keyboard focus (desktop only) */
.hmp-vol { display: flex; align-items: center; }
.hmp-vol-range {
  -webkit-appearance: none; appearance: none;
  width: 0; height: 4px; margin: 0; opacity: 0;
  border-radius: 4px; cursor: pointer;
  background: linear-gradient(to right, var(--pink) var(--v, 100%), rgba(255, 255, 255, .28) var(--v, 100%));
  transition: width .2s var(--ease), opacity .2s, margin .2s;
}
.hmp-vol:hover .hmp-vol-range, .hmp-vol:focus-within .hmp-vol-range { width: 72px; opacity: 1; margin: 0 8px 0 2px; }
.hmp-vol-range::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.hmp-vol-range::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; }
.hmp-vol-range:focus-visible { outline: 2px solid var(--pink); outline-offset: 4px; }
.hmp-touch .hmp-vol-range { display: none; }

/* ---------- Progress bar ---------- */
.hmp-progress { position: relative; height: 20px; display: flex; align-items: center; cursor: pointer; touch-action: none; outline: none; margin: 0 4px; }
.hmp-track { position: relative; flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .22); transition: height .15s var(--ease); --p: 0; }
.hmp-buffer, .hmp-played { position: absolute; inset: 0; border-radius: inherit; transform-origin: 0 50%; transform: scaleX(0); }
.hmp-buffer { background: rgba(255, 255, 255, .38); }
.hmp-played { background: var(--grad); transform: scaleX(var(--p)); }
.hmp-thumb {
  position: absolute; top: 50%; left: calc(var(--p) * 100%);
  width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 61, 154, .35), 0 2px 6px rgba(0, 0, 0, .4);
  transform: scale(0); transition: transform .15s var(--ease);
}
.hmp-progress:hover .hmp-track, .hmp-scrubbing .hmp-track, .hmp-progress:focus-visible .hmp-track { height: 6px; }
.hmp-progress:hover .hmp-thumb, .hmp-scrubbing .hmp-thumb, .hmp-progress:focus-visible .hmp-thumb, .hmp-touch .hmp-thumb { transform: scale(1); }
.hmp-progress:focus-visible .hmp-track { box-shadow: 0 0 0 2px rgba(255, 61, 154, .6); }
.hmp-tip {
  position: absolute; bottom: 24px; left: 0;
  transform: translateX(-50%);
  padding: 4px 9px; border-radius: 8px;
  background: rgba(14, 10, 29, .92); border: 1px solid var(--border-strong);
  font-size: 12px; font-weight: 700; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.hmp-tip.is-on { opacity: 1; }

/* ---------- Double-tap ripple, on-screen messages, toast ---------- */
.hmp-ripple {
  position: absolute; top: 0; bottom: 0; z-index: 2; width: 38%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255, 255, 255, .1);
  font-size: 13px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.hmp-ripple-back { left: 0; border-radius: 0 50% 50% 0 / 0 100% 100% 0; }
.hmp-ripple-fwd { right: 0; border-radius: 50% 0 0 50% / 100% 0 0 100%; }
.hmp-ripple.is-on { opacity: 1; }
.hmp-ripple-arrows { font-size: 16px; letter-spacing: -3px; }
.hmp-ripple.is-on .hmp-ripple-arrows { animation: hmp-nudge .6s var(--ease); }
@keyframes hmp-nudge { from { opacity: .3; } to { opacity: 1; } }

.hmp-osd {
  position: absolute; top: 12%; left: 50%; z-index: 6;
  transform: translateX(-50%);
  padding: 7px 16px; border-radius: 999px;
  background: rgba(14, 10, 29, .82); border: 1px solid var(--border-strong);
  font-size: 14px; font-weight: 700; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.hmp-osd.is-on { opacity: 1; }

.hmp-toast {
  position: absolute; left: 12px; bottom: 84px; z-index: 6;
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 24px);
  padding: 8px 8px 8px 14px; border-radius: 12px;
  background: rgba(14, 10, 29, .9); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 13px; font-weight: 600;
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .2s, transform .2s var(--ease), visibility .2s, bottom .25s var(--ease);
}
.hmp-toast.is-on { opacity: 1; visibility: visible; transform: none; }
.hmp-idle .hmp-toast { bottom: 16px; }
.hmp-toast-btn { flex: 0 0 auto; border: 0; border-radius: 999px; padding: 6px 12px; background: var(--grad); color: #fff; font-weight: 700; font-size: 12px; cursor: pointer; }

/* ---------- Error overlay ---------- */
.hmp-error {
  position: absolute; inset: 0; z-index: 7;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 20px; text-align: center;
  background: radial-gradient(circle at center, rgba(37, 28, 74, .92), rgba(8, 5, 20, .96));
}
.hmp-has-error .hmp-error { display: flex; }
.hmp-error .hmp-i { width: 40px; height: 40px; fill: var(--amber); }
.hmp-error-text { max-width: 420px; font-size: 15px; font-weight: 600; line-height: 1.45; }
.hmp-error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.hmp-error-btn { border: 1px solid var(--border-strong); border-radius: 999px; padding: 9px 18px; background: rgba(255, 255, 255, .06); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
.hmp-error-btn.is-primary { border-color: transparent; background: var(--grad); }
.hmp-error-btn:hover { color: #fff; filter: brightness(1.1); }

/* ---------- Settings menu ---------- */
.hmp-menu {
  position: absolute; right: 12px; bottom: 66px; z-index: 8;
  min-width: 232px; max-height: calc(100% - 80px); overflow-y: auto; overscroll-behavior: contain;
  padding: 6px; border-radius: 14px;
  background: rgba(20, 14, 40, .96); border: 1px solid var(--border-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; transform: translateY(8px) scale(.98); transform-origin: 100% 100%;
  transition: opacity .18s, transform .18s var(--ease), visibility .18s;
}
.hmp-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.hmp-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 40px; padding: 8px 10px 8px 12px;
  border: 0; border-radius: 10px; background: transparent; color: #fff;
  font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.hmp-menu-item:hover, .hmp-menu-item:focus-visible { background: rgba(255, 255, 255, .08); outline: none; }
.hmp-menu-item .hmp-i { width: 20px; height: 20px; filter: none; }
.hmp-menu-label { flex: 1; }
.hmp-menu-value { color: var(--muted); font-weight: 600; font-size: 13px; }
.hmp-menu-item[role="menuitemradio"] .hmp-i { visibility: hidden; color: var(--pink); }
.hmp-menu-item[aria-checked="true"] .hmp-i { visibility: visible; }
.hmp-menu-item[aria-checked="true"] .hmp-menu-label { color: #fff; }
.hmp-menu-head { color: var(--text-2); border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; margin-bottom: 4px; }

/* ---------- Keyboard shortcuts ---------- */
.hmp-help {
  position: absolute; left: 50%; top: 50%; z-index: 9;
  width: min(440px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow-y: auto;
  transform: translate(-50%, -50%);
  padding: 14px 18px 16px; border-radius: 16px;
  background: rgba(20, 14, 40, .97); border: 1px solid var(--border-strong);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
  display: none;
}
.hmp-help.is-open { display: block; }
.hmp-help-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 15px; }
.hmp-help dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.hmp-help dt { font-weight: 800; color: #fff; white-space: nowrap; }
.hmp-help dd { color: var(--text-2); }

/* ---------- Touch devices: bigger targets ---------- */
.hmp-touch .hmp-btn { width: 44px; height: 44px; }
.hmp-touch .hmp-progress { height: 28px; }
.hmp-touch .hmp-tip { bottom: 30px; }

/* ---------- Small players (phones in portrait) ---------- */
.hmp-sm .hmp-bar { padding: 30px 6px 4px; }
.hmp-sm .hmp-time { font-size: 12px; padding: 0 4px; }
.hmp-sm .hmp-big { width: 64px; height: 64px; }
.hmp-sm .hmp-big .hmp-i { width: 30px; height: 30px; }
.hmp-sm .hmp-skip { width: 48px; height: 48px; }
.hmp-sm .hmp-skip .hmp-i { width: 28px; height: 28px; }
.hmp-sm .hmp-menu { right: 6px; bottom: 58px; max-height: calc(100% - 66px); min-width: 210px; }
.hmp-sm .hmp-toast, .hmp-sm.hmp-idle .hmp-toast { top: 8px; bottom: auto; left: 8px; font-size: 12px; }
.hmp-sm .hmp-osd { top: 8%; font-size: 13px; }
.hmp-xs .hmp-sep, .hmp-xs .hmp-dur { display: none; }

/* ---------- Fullscreen (element API, and the CSS fallback for in-app browsers) ---------- */
.hmp:fullscreen { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; border-radius: 0; }
.hmp:-webkit-full-screen { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; border-radius: 0; }
.hmp.hmp-pseudo { position: fixed; inset: 0; z-index: 2147483000; width: 100%; height: 100vh; height: 100dvh; max-height: none; aspect-ratio: auto; border-radius: 0; }
html.hmp-noscroll, html.hmp-noscroll body { overflow: hidden; }
.hmp-fs .hmp-bar {
  padding: 56px max(20px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.hmp-fs .hmp-btn { width: 48px; height: 48px; }
.hmp-fs .hmp-i { width: 28px; height: 28px; }
.hmp-fs .hmp-big { width: 92px; height: 92px; }
.hmp-fs .hmp-big .hmp-i { width: 42px; height: 42px; }
.hmp-fs .hmp-skip { width: 64px; height: 64px; }
.hmp-fs .hmp-time { font-size: 15px; }
.hmp-fs .hmp-progress { height: 26px; }
.hmp-fs .hmp-menu { right: max(20px, env(safe-area-inset-right)); bottom: 86px; }
.hmp-fs .hmp-toast { left: max(20px, env(safe-area-inset-left)); bottom: 110px; }
.hmp-fs.hmp-idle .hmp-toast { bottom: max(20px, env(safe-area-inset-bottom)); }
