/* =====================================================================
   KOA presentation player — zoomable video (used on Systems & Projects)
   Uses the site tokens from koa-v5.css, with fallbacks so it also works alone.
   ===================================================================== */
.kp, .kp-assist {
  --sky: #2E9BFF; --royal: #1552D6; --navy: #0B2566; --slate: #55627D;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r-lg: 20px; --shadow-lg: 0 30px 60px -24px rgba(6,20,55,.45);
}

/* ---------- Player ---------- */
.kp {
  --kp-bg: #0A1638; --kp-fg: #DCE6FA; --kp-accent: var(--sky);
  position: relative; display: flex; flex-direction: column; border-radius: var(--r-lg); overflow: hidden;
  background: var(--kp-bg); color: var(--kp-fg); box-shadow: var(--shadow-lg); outline: none;
  isolation: isolate;
}
.kp:focus-visible { box-shadow: 0 0 0 3px var(--sky), var(--shadow-lg); }
.kp-stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.kp.is-zoomed .kp-stage { cursor: grab; }
.kp.is-dragging .kp-stage { cursor: grabbing; }
.kp-canvas { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.kp.kp-smooth .kp-canvas { transition: transform .22s cubic-bezier(.2,.7,.2,1); }
.kp-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; pointer-events: none; }

/* Play button: one pill in the empty band at the foot of the poster, so it never covers the poster's text */
.kp-bigplay {
  position: absolute; inset: 0; z-index: 3; display: flex; align-items: flex-end; justify-content: center;
  padding: 0 1rem 5.5%; border: 0; color: #fff; cursor: pointer; pointer-events: none;
  background: linear-gradient(180deg, rgba(6,20,55,0) 70%, rgba(6,20,55,.35) 100%);
  transition: opacity .25s;
}
.kp-bigplay-pill {
  display: inline-flex; align-items: center; gap: .75rem; padding: .4rem 1.15rem .4rem .4rem; border-radius: 999px;
  background: rgba(255,255,255,.97); color: #0B2566; font-weight: 700; font-size: .98rem; white-space: nowrap;
  box-shadow: 0 0 0 6px rgba(255,255,255,.16), 0 16px 34px rgba(2,8,28,.45);
  pointer-events: auto; transition: transform .2s, box-shadow .2s;
}
.kp-bigplay-icon {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--royal); color: #fff; font-size: 1.45rem; padding-left: 3px;
}
.kp-duration { font-family: var(--mono); font-weight: 500; font-size: .85em; color: #55627D; }
.kp-bigplay:hover .kp-bigplay-pill, .kp-bigplay:focus-visible .kp-bigplay-pill { transform: translateY(-2px); box-shadow: 0 0 0 6px rgba(255,255,255,.24), 0 20px 40px rgba(2,8,28,.5); }
.kp-bigplay:focus-visible { outline: none; }
.kp-bigplay:focus-visible .kp-bigplay-pill { outline: 3px solid var(--sky); outline-offset: 4px; }

/* After the first play: hidden while playing; a round resume button in the corner while paused */
.kp.has-started .kp-bigplay { opacity: 0; }
.kp.has-started .kp-bigplay * { pointer-events: none; }
.kp.has-started .kp-bigplay { justify-content: flex-start; padding: 0 0 1rem 1rem; background: none; }
.kp.has-started .kp-bigplay-pill { padding: .35rem; gap: 0; }
.kp.has-started .kp-bigplay-text { display: none; }
.kp.has-started:not(.is-playing) .kp-bigplay { opacity: 1; }
.kp.has-started:not(.is-playing) .kp-bigplay-pill { pointer-events: auto; }
.kp.is-zoomed.has-started:not(.is-playing) .kp-bigplay { opacity: 0; }                    /* keep a zoomed view clear */
.kp.is-zoomed.has-started:not(.is-playing) .kp-bigplay-pill { pointer-events: none; }

/* Loading, toast, error */
.kp-spinner { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; z-index: 2; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; opacity: 0; pointer-events: none; }
.kp.is-loading .kp-spinner { opacity: 1; animation: kp-spin .8s linear infinite; }
@keyframes kp-spin { to { transform: rotate(360deg); } }
.kp-toast { position: absolute; top: .9rem; left: 50%; z-index: 4; transform: translate(-50%, -6px); padding: .35rem .8rem; border-radius: 999px; background: rgba(6,20,55,.85); color: #fff; font-size: .82rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; white-space: nowrap; }
.kp.kp-toast-on .kp-toast { opacity: 1; transform: translate(-50%, 0); }
.kp-error { position: absolute; inset: auto 1rem 1rem; z-index: 5; margin: 0; padding: .75rem 1rem; border-radius: 10px; background: rgba(120,20,30,.9); color: #fff; font-size: .9rem; }

/* Minimap: where you are when zoomed in */
.kp-minimap { position: absolute; right: .9rem; bottom: .9rem; z-index: 4; width: 22%; max-width: 180px; min-width: 96px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,.55); box-shadow: 0 8px 20px rgba(0,0,0,.4); opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .2s, transform .2s; cursor: crosshair; touch-action: none; }
.kp.is-zoomed .kp-minimap { opacity: 1; transform: none; pointer-events: auto; }
.kp-minimap img { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(.7); }
.kp-minimap-view { position: absolute; border: 2px solid #fff; border-radius: 3px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

/* Control bar */
.kp-bar { position: relative; z-index: 5; padding: .35rem .75rem .6rem; background: var(--kp-bg); transition: opacity .3s, transform .3s; }
.kp-seek {
  --played: 0%; --buffered: 0%;
  display: block; width: 100%; height: 18px; margin: 0 0 .15rem; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.kp-seek::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--kp-accent) var(--played), rgba(255,255,255,.35) var(--played), rgba(255,255,255,.35) var(--buffered), rgba(255,255,255,.15) var(--buffered)); }
.kp-seek::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--kp-accent) var(--played), rgba(255,255,255,.35) var(--played), rgba(255,255,255,.35) var(--buffered), rgba(255,255,255,.15) var(--buffered)); }
.kp-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(46,155,255,.35); }
.kp-seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(46,155,255,.35); }
.kp-seek:focus-visible { outline: 2px solid var(--kp-accent); outline-offset: 2px; }
.kp-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.kp-group { display: flex; align-items: center; gap: .15rem; min-width: 0; }
.kp-btn, .kp-zoom-value {
  display: inline-grid; place-items: center; height: 38px; min-width: 38px; padding: 0 .4rem; border: 0; border-radius: 8px;
  background: transparent; color: var(--kp-fg); font-size: 1.1rem; cursor: pointer; transition: background .15s, color .15s;
}
.kp-btn:hover, .kp-zoom-value:hover { background: rgba(255,255,255,.1); color: #fff; }
.kp-btn:focus-visible, .kp-zoom-value:focus-visible, .kp-speed:focus-visible { outline: 2px solid var(--kp-accent); outline-offset: 1px; }
.kp-time { font-family: var(--mono); font-size: .78rem; color: #AFC0E3; margin-left: .5rem; white-space: nowrap; }
.kp-volume, .kp-zoom-range { width: 84px; accent-color: var(--kp-accent); cursor: pointer; }
.kp-zoom { display: inline-flex; align-items: center; gap: .1rem; padding: 0 .15rem; margin-right: .35rem; border-radius: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(159,195,255,.18); }
.kp.is-zoomed .kp-zoom { border-color: rgba(46,155,255,.55); background: rgba(46,155,255,.12); }
.kp-zoom-value { font-family: var(--mono); font-size: .76rem; min-width: 50px; }
.kp-speed { height: 32px; padding: 0 .4rem; border-radius: 8px; border: 1px solid rgba(159,195,255,.25); background: transparent; color: var(--kp-fg); font-family: var(--mono); font-size: .76rem; cursor: pointer; }
.kp-speed option { color: #0B1533; }

/* Full screen: video fills the screen, controls float and auto-hide */
.kp.is-fullscreen { border-radius: 0; background: #000; width: 100%; height: 100%; }
.kp.is-fullscreen .kp-stage { aspect-ratio: auto; flex: 1; }
.kp.is-fullscreen .kp-bar { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, rgba(4,12,34,.92), rgba(4,12,34,0)); padding-top: 2.5rem; }
.kp.is-fullscreen .kp-minimap { bottom: 5.5rem; }
.kp.kp-idle .kp-bar { opacity: 0; transform: translateY(8px); pointer-events: none; }
.kp.kp-idle .kp-stage { cursor: none; }

@media (max-width: 575.98px) {
  .kp-hide-sm { display: none !important; }
  .kp-bar { padding: .25rem .4rem .45rem; }
  .kp-btn { min-width: 34px; height: 34px; font-size: 1rem; }
  .kp-zoom-value { min-width: 44px; height: 34px; }
  .kp-time { margin-left: .25rem; font-size: .72rem; }
  .kp-bigplay { padding-bottom: 2.5%; }
  .kp-bigplay-pill { font-size: .76rem; gap: .45rem; padding: .2rem .7rem .2rem .2rem; box-shadow: 0 0 0 3px rgba(255,255,255,.16), 0 8px 20px rgba(2,8,28,.45); }
  .kp-bigplay-icon { width: 28px; height: 28px; font-size: 1rem; padding-left: 2px; }
  .kp-speed { display: none; }
}
@media (prefers-reduced-motion: reduce) { .kp.is-loading .kp-spinner { animation: none; } }


/* ---------- Zoom help + quick presets under the player ---------- */
.kp-assist { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; margin-top: 1rem; }
.kp-tip { display: flex; gap: .5rem; align-items: flex-start; margin: 0; font-size: .86rem; color: var(--slate); line-height: 1.5; }
.kp-tip .bi { color: var(--royal); margin-top: .1rem; }
.section-dark .kp-tip { color: #93A6CC; }
.section-dark .kp-tip .bi { color: var(--sky); }
.kp-tip kbd { font-family: var(--mono); font-size: .75rem; padding: .05rem .35rem; border-radius: 4px; background: #EAF1FE; color: var(--navy); box-shadow: inset 0 -1px 0 #C9D7F2; }
.kp-presets { display: inline-flex; gap: .35rem; flex-wrap: wrap; }
.kp-preset { border: 1px solid #CFE0F1; background: #fff; color: #173F68; border-radius: 999px; padding: .3rem .75rem; font-family: var(--mono); font-size: .76rem; font-weight: 500; transition: background .15s, border-color .15s, color .15s; }
.kp-preset:hover { border-color: var(--royal); color: var(--royal); }
.kp-preset[aria-pressed="true"] { background: #133E6B; border-color: #133E6B; color: #fff; }
.kp-preset:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* ---------- "Watch presentation" badge on a system card ---------- */
.ks-play-badge {
  position: absolute; right: 14px; bottom: 14px; z-index: 2; display: inline-flex; align-items: center; gap: .45rem;
  padding: 4px 12px 4px 4px; border-radius: 999px; background: rgba(6,20,55,.85); color: #fff;
  font-size: .72rem; font-weight: 700; text-decoration: none; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background .15s;
}
.ks-play-badge .bi { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--royal); font-size: .95rem; padding-left: 2px; }
.ks-play-badge:hover, .ks-play-badge:focus-visible { background: var(--royal); color: #fff; }
.ks-play-badge:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
#hr-file-201-showcase { scroll-margin-top: 90px; }
/* Poster on a card: framed so the logo and feature tags stay visible above the badges at every card width */
.ks-card-photo img.ks-cover.ks-cover-poster { object-position: center 75%; }   /* outranks the older top-aligned rule in systems.css */
/* One card per row (below 768px): show the whole 16:9 poster instead of a shallow crop */
@media (max-width: 767.98px) { .ks-card-photo.ks-card-photo--poster { height: auto; aspect-ratio: 16 / 9; } }

/* Zoom tip: mouse wording by default, touch wording on phones and tablets */
.kp-tip-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .kp-tip-mouse { display: none; } .kp-tip-touch { display: inline; } }

/* ---------- Chapters ---------- */
.kp-seekwrap { position: relative; }
.kp-ticks { position: absolute; left: 7px; right: 7px; top: 50%; height: 0; pointer-events: none; }
.kp-tick { position: absolute; top: -4px; width: 2px; height: 8px; margin-left: -1px; border-radius: 1px; background: rgba(255,255,255,.6); }
.kp-chapter-now { margin-left: .75rem; padding-left: .75rem; border-left: 1px solid rgba(159,195,255,.25); font-size: .78rem; font-weight: 600; color: #DCE6FA; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16rem; }
.kp-chapter-now:empty { display: none; }

.kp-chapters { margin-top: 1.25rem; border: 1px solid #DBE5F1; border-radius: 16px; background: #fff; overflow: hidden; }
.kp-chapters > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.1rem;
  cursor: pointer; list-style: none; font-weight: 700; color: #102D4B; font-size: .95rem;
}
.kp-chapters > summary::-webkit-details-marker { display: none; }
.kp-chapters > summary .bi { color: var(--royal); margin-right: .35rem; }
.kp-chapters > summary::after { content: "\F282"; font-family: "bootstrap-icons"; color: #526981; transition: transform .2s; }
.kp-chapters[open] > summary::after { transform: rotate(180deg); }
.kp-chapters > summary:focus-visible { outline: 3px solid var(--sky); outline-offset: -3px; }
.kp-chapters-count { margin-left: auto; font-family: var(--mono); font-size: .75rem; font-weight: 500; color: #526981; }
.kp-chapters ol { list-style: none; margin: 0; padding: .35rem; border-top: 1px solid #DBE5F1; display: grid; gap: .15rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .kp-chapters ol { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: .35rem; } }
.kp-chapter {
  display: flex; align-items: flex-start; gap: .8rem; width: 100%; height: 100%; padding: .6rem .7rem; border: 0; border-radius: 10px;
  background: transparent; text-align: left; color: #102D4B; transition: background .15s;
}
.kp-chapter:hover { background: #F0F6FC; }
.kp-chapter:focus-visible { outline: 3px solid var(--sky); outline-offset: -2px; }
.kp-chapter-time { flex: none; min-width: 2.6rem; padding-top: .1rem; font-family: var(--mono); font-size: .78rem; color: #526981; }
.kp-chapter-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.kp-chapter-tag { font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #1764BB; }
.kp-chapter-title { font-size: .88rem; font-weight: 600; line-height: 1.4; }
.kp-chapter.is-active { background: #133E6B; color: #fff; }
.kp-chapter.is-active .kp-chapter-time { color: #B9D4F2; }
.kp-chapter.is-active .kp-chapter-tag { color: #7BCAFF; }

/* Second and later showcases: white background so consecutive sections stay distinct */
.ks-latest-project.ks-latest-project--alt { background: #fff; }

/* Keep the control bar on one line: the player drops optional extras when it is narrow */
.kp { container-type: inline-size; }
@container (max-width: 900px) { .kp-volume { display: none; } }
@container (max-width: 700px) { .kp-chapter-now { display: none; } }
@container (max-width: 760px) { .kp-zoom-range { display: none; } }
@container (max-width: 640px) { .kp-btn[data-kp-action="back"], .kp-btn[data-kp-action="forward"] { display: none; } }
