/*
 * SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: Apache-2.0
 */
/* Grana draft · section 02 "Post-training with Grana" (assets/draft/js/posttrain-section.js).
   The film, one card per task (real rollout + Grana-vs-alternative bars), the four-camera player in a dialog.
   Card language follows the MPC gallery (mpc.css). Colours: Grana violet (the film's), the alternative grey;
   green only for a real success. */
.pt-band, .pt-dialog { --pt-violet: var(--accent, #84cc3f); --pt-violet-ink: var(--accent-ink, #9bdd55); --pt-grey: rgba(200, 196, 215, 0.55); --pt-green: #76da8c; }   /* Grana = the page accent (as in the charts) */

/* ---------- the film ---------- */
.pt-film { margin: 0 0 1.6rem; display: grid; gap: 0.7rem; }
.pt-film-media {
  position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 24px 60px rgba(0, 0, 0, 0.45);
}
.pt-film-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-film-video:fullscreen { object-fit: contain; background: #000; }
.pt-film-video:-webkit-full-screen { object-fit: contain; background: #000; }
.pt-playback {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 44px;
  padding: 0.45rem 0.8rem; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(8, 10, 14, 0.72);
  color: #f2f4f7; font: 600 0.875rem/1 Inter, system-ui, sans-serif; cursor: pointer; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.pt-playback:hover { border-color: rgba(255, 255, 255, 0.45); }
.pt-playback:focus-visible { outline: 2px solid var(--pt-violet-ink); outline-offset: 2px; }
.pt-film-controls { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.pt-film-cap { margin: 0 0.15rem; font: 400 0.9375rem/1.5 Inter, system-ui, sans-serif; color: rgba(236, 239, 244, 0.82); }
.pt-film-cap strong { color: #f2f4f7; font-weight: 600; }
.pt-film-dur { margin-left: 0.6rem; font: 500 0.8125rem/1 "IBM Plex Mono", ui-monospace, monospace; color: rgba(255, 255, 255, 0.55); white-space: nowrap; }

/* ---------- the cards ---------- */
.pt-gallery-controls { display: flex; justify-content: flex-end; margin: 0 0 0.7rem; }
.pt-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.1rem; }
.pt-card {
  display: flex; flex-direction: column; gap: 0.7rem; padding: 0.85rem; border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.pt-card:hover { border-color: rgba(255, 255, 255, 0.26); transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45); }
.pt-head { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; margin: 0.1rem 0.15rem 0; text-align: center; }
.pt-head .pt-chip { order: -1; }                              /* the method above the task: the titles line up */
.pt-card-title { margin: 0; font: 600 1.0625rem/1.3 Inter, system-ui, sans-serif; color: #f2f4f7; letter-spacing: -0.005em; }
.pt-chip {
  flex: none; padding: 0.18rem 0.5rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--pt-violet) 55%, transparent);
  font: 600 0.75rem/1.2 "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.02em; color: var(--pt-violet-ink);
}
.pt-media { position: relative; aspect-ratio: 4 / 3; border-radius: 11px; overflow: hidden; background: #000; box-shadow: inset 0 0 0 2px rgba(118, 218, 140, 0.55); }
.pt-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-media::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 2px rgba(118, 218, 140, 0.55); pointer-events: none; }
.pt-tag, .pt-speed {
  position: absolute; top: 0.5rem; padding: 0.22rem 0.5rem; border-radius: 7px; pointer-events: none;
  font: 600 0.8125rem/1.2 "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.02em;
  background: rgba(8, 10, 14, 0.78); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.pt-tag { left: 0.5rem; color: #8fe6a3; }
.pt-speed { right: 0.5rem; color: rgba(255, 255, 255, 0.82); }

/* the bars: Grana (violet) against the alternative (grey); values from the paper */
.pt-bars { display: grid; gap: 0.55rem; margin: 0.15rem 0.15rem 0; }
.pt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name name" "track val"; gap: 0.25rem 0.65rem; align-items: center; }
.pt-name { grid-area: name; font: 500 0.875rem/1.3 Inter, system-ui, sans-serif; color: rgba(236, 239, 244, 0.72); }
.pt-row.is-grana .pt-name { color: var(--pt-violet-ink); font-weight: 600; }
.pt-val { grid-area: val; display: inline-flex; align-items: baseline; gap: 0.4rem; white-space: nowrap; }
.pt-val b { font: 600 1.0625rem/1 "IBM Plex Mono", ui-monospace, monospace; color: rgba(236, 239, 244, 0.8); }
.pt-row.is-grana .pt-val b { color: #f4f1ff; }
.pt-val small { font: 500 0.75rem/1 "IBM Plex Mono", ui-monospace, monospace; color: rgba(255, 255, 255, 0.5); }
.pt-track { grid-area: track; position: relative; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.pt-track i { position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 100%); border-radius: inherit; background: var(--pt-grey); transform-origin: left center; }
.pt-row.is-grana .pt-track i { background: var(--pt-violet); box-shadow: 0 0 12px color-mix(in srgb, var(--pt-violet) 45%, transparent); }
.pt-gallery .pt-track i { transform: scaleX(0); transition: transform 1.1s cubic-bezier(0.16, 1, 0.3, 1); transition-delay: calc(var(--i, 0) * 120ms + 0.15s); }
.pt-gallery.is-in .pt-track i { transform: scaleX(1); }
.pt-note { margin: 0 0.15rem; font: 500 0.8125rem/1.4 "IBM Plex Mono", ui-monospace, monospace; color: rgba(255, 255, 255, 0.5); }
.pt-open {
  margin-top: auto; display: flex; align-items: center; gap: 0.55rem; width: 100%; min-height: 44px; padding: 0.55rem 0.85rem;
  border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.05); color: #f2f4f7;
  font: 600 0.9375rem/1.2 Inter, system-ui, sans-serif; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease;
}
.pt-open:hover, .pt-card:hover .pt-open { background: color-mix(in srgb, var(--pt-violet) 14%, transparent); border-color: color-mix(in srgb, var(--pt-violet) 55%, transparent); }
.pt-open:focus-visible { outline: 2px solid var(--pt-violet-ink); outline-offset: 2px; }
.pt-open-ico { color: var(--pt-violet-ink); font-size: 0.8rem; }
.pt-open-dur { margin-left: auto; font: 500 0.8125rem/1 "IBM Plex Mono", ui-monospace, monospace; color: rgba(255, 255, 255, 0.6); }

@media (max-width: 1100px) { .pt-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .pt-gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 0.9rem; padding-bottom: 0.6rem; overscroll-behavior-x: contain; }
  .pt-card { flex: 0 0 min(80vw, 340px); scroll-snap-align: start; }
  .pt-card:hover { transform: none; }
  .pt-film-cap span:not(.pt-film-dur) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pt-card, .pt-open { transition: none; } .pt-card:hover { transform: none; }
  .pt-gallery .pt-track i { transform: none; transition: none; }
}

/* ---------- the four-camera player in a dialog ---------- */
.pt-dialog {
  width: min(1180px, 96vw); max-width: none; max-height: 94vh; padding: 0; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 18px; background: #06080b; color: #e8eaee;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}
.pt-dialog::backdrop { background: rgba(3, 4, 6, 0.78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pt-dialog-body { position: relative; max-height: 94vh; overflow: auto; padding: 1.1rem 1.1rem 1.2rem; overscroll-behavior: contain; }
.pt-close {
  position: sticky; top: 0; float: right; z-index: 3; width: 44px; height: 44px; margin: -0.3rem -0.3rem 0 0.5rem; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(10, 12, 16, 0.85); color: #f2f4f7; font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.pt-close:hover { border-color: rgba(255, 255, 255, 0.4); }
.pt-close:focus-visible { outline: 2px solid var(--pt-violet-ink); outline-offset: 2px; }
@media (max-width: 640px) { .pt-dialog { width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; } .pt-dialog-body { max-height: 100vh; padding: 0.75rem; } }
