/* Cinema-only surface; page geometry and archive card dimensions stay untouched. */
dialog.nq-video-modal {
  --nq-cinema-ink: #0e0e0e;
  --nq-cinema-text: #f5f0e8;
  --nq-cinema-line: #414141;
  --nq-cinema-accent: #ff4d8d;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #050505;
  color: var(--nq-cinema-text);
  font-family: var(--sans, sans-serif);
  color-scheme: dark;
  overflow: hidden;
  overscroll-behavior: contain;
}

dialog.nq-video-modal:not([open]) { display: none; }
dialog.nq-video-modal[open] { display: flex; flex-direction: column; }
dialog.nq-video-modal::backdrop { background: #050505; }

.nq-video-modal *,
.nq-video-modal *::before,
.nq-video-modal *::after { box-sizing: border-box; letter-spacing: 0; }

.nq-video-modal .nq-video-bar {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: calc(12px + env(safe-area-inset-top, 0px))
    max(24px, env(safe-area-inset-right, 0px)) 12px
    max(24px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid #ffffff14;
  background: #050505;
}

.nq-video-modal .nq-video-label {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.nq-video-label :is(h2, h3, p, strong) {
  margin: 0;
  font: inherit;
  color: inherit;
}

.nq-video-label :is(small, .nq-video-index) {
  color: #bcb7b1;
  font-size: 11px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.nq-video-tools { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }

.nq-video-modal .nq-video-icon {
  display: inline-flex;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--nq-cinema-text);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transform: none;
  transition: background-color 160ms ease;
}

.nq-video-modal .nq-video-tools > .nq-video-icon:last-child {
  position: relative;
  margin-inline-start: 12px;
}

.nq-video-modal .nq-video-tools > .nq-video-icon:last-child::before {
  content: "";
  position: absolute;
  inset-inline-start: -11px;
  top: 12px;
  bottom: 12px;
  width: 1px;
  background: #ffffff26;
  pointer-events: none;
}

.nq-video-modal .nq-video-flight {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  object-fit: contain;
  background: #050505;
}

.nq-video-icon :is(img, svg) {
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  max-width: none;
  object-fit: contain;
  pointer-events: none;
}

.nq-video-icon img { filter: brightness(0) invert(1); }
.nq-video-icon:is(:disabled, [aria-disabled="true"]) { opacity: .35; cursor: default; }

.nq-video-modal .nq-player-stage {
  position: relative;
  display: flex;
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  background: #050505;
  isolation: isolate;
  align-items: center;
  justify-content: center;
}

.nq-player-stage:not(.nq-fit-screen) > :is(video-player.nq-player,video) {
  max-width: min(100%, var(--nq-source-width, 100%));
  max-height: min(100%, var(--nq-source-height, 100%));
}
.nq-video-icon[aria-pressed="true"] { border-color: var(--nq-cinema-accent); }

.nq-player-stage > video-player.nq-player {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.nq-player-stage video-player.nq-player > video-neutral-skin {
  --media-accent-color: #ff4d8d;
  --media-accent-text-color: #000;
  --media-font-family: var(--sans, sans-serif);
  --media-scale-unit: 20px;
  --media-border-radius: 0;
  --media-object-fit: contain;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
  background: #050505;
}

.nq-player-stage :is(video, iframe) {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border: 0;
  object-fit: contain;
  background: #050505;
}

/* The caller supplies status content only while loading or after a failure. */
.nq-video-modal .nq-video-status {
  position: absolute;
  z-index: 2;
  inset: 50% 16px auto;
  width: fit-content;
  max-width: calc(100% - 32px);
  margin-inline: auto;
  padding: 12px 16px;
  border: 1px solid var(--nq-cinema-line);
  border-radius: 4px;
  background: #171717;
  color: var(--nq-cinema-text);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.nq-video-modal .nq-video-status:empty,
.nq-video-modal [hidden] { display: none !important; }

.nq-video-modal .nq-video-fallback {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--nq-cinema-line);
  background: var(--nq-cinema-ink);
  color: var(--nq-cinema-text);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
  text-underline-offset: 4px;
}

.nq-video-fallback:empty { display: none; }
.nq-video-fallback a { display: inline-flex; align-items: center; min-height: 44px; color: inherit; }

.nq-video-preview { position: relative; isolation: isolate; background: #0e0e0e; }
.video-archive-card > .nq-video-preview{width:100%;height:100%}
.video-card > .nq-video-preview{width:100%;aspect-ratio:16/9}
.project-media > .nq-video-preview{height:290px;min-width:0}
.project-media > .nq-video-preview.wide{height:420px}
.project-media > .nq-video-preview > video { grid-column: auto; height: 100%; }
.nq-player-stage > .nq-theatre-start{position:absolute;z-index:3;top:50%;left:50%;transform:translate(-50%,-50%);width:64px;height:64px;border-radius:50%;background:#101010d9;border-color:#f5f0e8}
.nq-player-stage > .nq-theatre-start[hidden]{display:none}
.nq-player-stage youtube-video{display:block;width:100%;height:100%;min-width:0;min-height:0}
.nq-player-stage > .nq-loading-poster{width:100%;height:100%;object-fit:contain;min-width:0;min-height:0}
@media(max-width:900px){.project-media > .nq-video-preview.wide{height:330px}}
@media(max-width:560px){.project-media > .nq-video-preview{height:190px}.project-media > .nq-video-preview.wide{height:260px}}
.nq-video-preview > video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain !important;
  object-position: center;
  background: #0e0e0e;
}

.nq-video-preview > button.nq-archive-play {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #f5f0e8;
  cursor: pointer;
  touch-action: manipulation;
  transform: none;
  transition: border-color 160ms ease;
}

.nq-archive-play .nq-play-glyph {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid #f5f0e8;
  border-radius: 50%;
  background: #0e0e0ee6;
  transition: background-color 160ms ease, border-color 160ms ease;
  pointer-events: none;
}

.nq-video-preview .nq-archive-play img {
  display: block;
  width: 20px;
  height: 20px;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  object-fit: contain;
  filter: brightness(0) invert(1);
  transform: none !important;
  transition: none;
  pointer-events: none;
}

.nq-archive-play > span:not(.nq-play-glyph) {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 4px;
  border: 1px solid #ffffff66;
  border-radius: 3px;
  background: #0e0e0ecc;
  pointer-events: none;
}

.nq-video-modal :is(button, a):focus-visible,
.nq-video-preview > .nq-archive-play:focus-visible {
  outline: 2px solid #ff4d8d;
  outline-offset: -4px;
}

@media (hover: hover) {
  .nq-video-modal .nq-video-icon:not(:disabled):not([aria-disabled="true"]):hover { background-color: #ffffff0d; }
  .nq-video-preview > .nq-archive-play:hover { border-color: #ff4d8d; }
  .nq-archive-play:hover .nq-play-glyph { background: #ff4d8d; border-color: #ff4d8d; }
  .nq-archive-play:hover .nq-play-glyph img { filter: brightness(0); }
}

@media (max-width: 560px) {
  .nq-video-modal .nq-video-bar {
    flex-wrap: wrap;
    gap: 8px 12px;
    min-height: 64px;
    padding-inline: max(12px, env(safe-area-inset-left, 0px)) max(12px, env(safe-area-inset-right, 0px));
  }
  .nq-video-modal .nq-video-label { flex-basis: 0; font-size: 12px; }
  .nq-video-tools { margin-left: auto; gap: 6px; }
  .nq-video-modal .nq-video-tools > .nq-video-icon:last-child { margin-inline-start: 6px; }
  .nq-video-modal .nq-video-tools > .nq-video-icon:last-child::before { inset-inline-start: -7px; }
}

@media (prefers-reduced-motion: reduce) {
  .nq-video-modal .nq-video-icon,
  .nq-video-preview > .nq-archive-play,
  .nq-archive-play .nq-play-glyph { transition: none; }
}
