/**
 * HealthN.E.S.S. — Shared video facade + modal
 * Thumbnail-first playback. No initial iframe load.
 */

.hn-video {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(153, 144, 124, 0.22);
  background: var(--color-surface-container-low, #1a1c1b);
  aspect-ratio: 16 / 9;
  color: inherit;
  text-decoration: none;
}

.hn-video__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hn-video__poster--failed {
  opacity: 0.35;
}

.hn-video__placeholder {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: var(--media-placeholder-gap, 0.4rem);
  width: 100%;
  height: 100%;
  min-height: var(--media-placeholder-min-height, 12rem);
  padding: var(--media-placeholder-padding, 1.35rem 1.4rem);
  background: var(--media-placeholder-bg);
  box-shadow: var(--media-placeholder-inset, inset 0 0 0 1px rgba(153, 144, 124, 0.18));
}

.hn-video__placeholder-label {
  font-family: var(--font-label, Montserrat, sans-serif);
  font-size: var(--media-placeholder-label-size, 0.625rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary, #f2ca50);
}

.hn-video__placeholder-note {
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: var(--media-placeholder-note-size, 0.875rem);
  line-height: 1.45;
  color: var(--color-on-surface-variant, #d0c5af);
  max-width: 22rem;
}

.hn-video__play {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 48px;
  min-height: 48px;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(242, 202, 80, 0.55);
  border-radius: 999px;
  background: rgba(12, 15, 14, 0.78);
  color: var(--color-primary, #f2ca50);
  font-family: var(--font-label, Montserrat, sans-serif);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
}

.hn-video__play:hover,
.hn-video__play:focus-visible {
  background: var(--color-primary, #f2ca50);
  color: var(--color-on-primary, #3c2f00);
  outline: none;
}

.hn-video__play:focus-visible {
  outline: 2px solid rgba(242, 202, 80, 0.65);
  outline-offset: 3px;
}

.hn-video__play .material-symbols-outlined {
  font-size: 1.25rem;
}

.hn-video__play-label {
  display: none;
}

@media (min-width: 640px) {
  .hn-video__play-label {
    display: inline;
  }
}

.hn-video__badge {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  font-family: var(--font-label, Montserrat, sans-serif);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(153, 144, 124, 0.4);
  background: rgba(12, 15, 14, 0.7);
  color: var(--color-on-surface-variant, #d0c5af);
}

.hn-video__format-label {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  padding: 0.3rem 0.5rem;
  border: 1px solid rgba(242, 202, 80, 0.35);
  background: rgba(8, 9, 8, 0.78);
  font-family: var(--font-label, Montserrat, sans-serif);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(242, 202, 80, 0.92);
}

/* —— Portrait / Shorts / Reels shell —— */
.portrait-video-shell {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  background:
    radial-gradient(ellipse 55% 50% at 50% 45%, rgba(242, 202, 80, 0.06), transparent 70%),
    #050505;
}

.portrait-video-stage {
  width: min(100%, 430px);
  aspect-ratio: 9 / 16;
  position: relative;
  overflow: hidden;
  border-radius: 0.75rem;
  background: #050505;
  border: 1px solid rgba(153, 144, 124, 0.28);
}

.portrait-video-stage .hn-video,
.portrait-video-stage .hn-video--portrait {
  width: 100%;
  height: 100%;
  aspect-ratio: 9 / 16;
  border: 0;
  border-radius: 0;
  max-width: none;
  margin: 0;
}

.portrait-video-stage video,
.portrait-video-stage iframe,
.portrait-video-stage img,
.portrait-video-stage .hn-video__poster {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.hn-video--portrait {
  aspect-ratio: 9 / 16;
  max-width: min(100%, 430px);
  margin-inline: auto;
  background: #050505;
}

.hn-video--portrait .hn-video__poster {
  object-fit: contain;
  object-position: center center;
  background: #050505;
}

.hn-video-modal--portrait .hn-video-modal__dialog {
  width: min(100%, 28rem);
  max-width: 100%;
}

.hn-video-modal__frame--portrait,
.hn-video-modal--portrait .hn-video-modal__frame {
  width: min(100%, 430px, calc((min(82vh, 100dvh) - 7.5rem) * 9 / 16));
  max-width: 100%;
  max-height: min(82vh, calc(100dvh - 7.5rem));
  aspect-ratio: 9 / 16;
  margin-inline: auto;
  background: #050505;
  overflow: hidden;
}

.hn-video-modal__frame--portrait iframe,
.hn-video-modal__frame--portrait video,
.case-video-modal__frame--portrait iframe,
.case-video-modal__frame--portrait video {
  object-fit: contain;
}

/* Integrate with existing proof / work / case shells */
.proof-media--video .hn-video,
.work-card__media .hn-video,
.case-hero__media .hn-video,
.case-gallery .hn-video {
  border: 0;
}

.proof-media--video:has(.hn-video--portrait),
.proof-media--video:has(.portrait-video-shell),
.work-card__media--video:has(.hn-video--portrait),
.work-card__media--video:has(.portrait-video-shell),
.case-hero__video:has(.hn-video--portrait),
.case-hero__video:has(.portrait-video-shell),
.case-hero__video--portrait {
  aspect-ratio: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #050505;
  min-height: 0;
  padding: 0.75rem 0;
}

.work-card--portrait .work-card__media--video {
  aspect-ratio: auto;
  background: #050505;
}

.work-card--portrait .portrait-video-stage {
  width: min(100%, 280px);
}

.proof-media--video:has(.hn-video) {
  padding: 0;
}

.proof-media--video:has(.portrait-video-shell) {
  padding: 0.75rem 0;
}

.hn-video__caption {
  margin: 0.65rem 0 0;
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-on-surface-variant, #d0c5af);
}

.hn-video--empty {
  min-height: var(--media-placeholder-min-height, 12rem);
  border-color: transparent;
}

/* Inline in-card player */
.hn-video__player,
.svc-example__media .hn-video__player {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #000;
  overflow: hidden;
  border-radius: inherit;
}

.hn-video__player iframe,
.hn-video__player video,
.svc-example__media .hn-video__player iframe,
.svc-example__media .hn-video__player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  object-fit: contain;
  background: #000;
}

.svc-example--portrait .svc-example__media .hn-video__player iframe,
.svc-example--portrait .svc-example__media .hn-video__player video {
  object-fit: cover;
}

.svc-example--portrait .svc-example__media .hn-video__player iframe,
.svc-example--portrait .svc-example__media .hn-video__player video {
  object-fit: cover;
}

.hn-video.is-playing .hn-video__poster,
.hn-video.is-playing .hn-video__play,
.hn-video.is-playing .hn-video__badge,
.hn-video.is-playing .hn-video__caption,
.svc-example__media.is-playing .svc-example__thumb,
.svc-example__media.is-playing .svc-example__play {
  visibility: hidden;
  pointer-events: none;
}

.hn-video__stop {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 4;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(153, 144, 124, 0.45);
  border-radius: 999px;
  background: rgba(12, 15, 14, 0.78);
  color: var(--color-primary, #f2ca50);
  cursor: pointer;
}

.hn-video__stop:hover,
.hn-video__stop:focus-visible {
  border-color: var(--color-primary, #f2ca50);
  outline: 2px solid rgba(242, 202, 80, 0.65);
  outline-offset: 2px;
}

.hn-video__fallback {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1.25rem;
  background: rgba(8, 9, 8, 0.88);
}

.hn-video__fallback-text {
  margin: 0;
  font-family: var(--font-body, Manrope, sans-serif);
  font-size: 0.9375rem;
  color: var(--color-on-surface-variant, #d0c5af);
}

.hn-video__fallback-link {
  font-family: var(--font-label, Montserrat, sans-serif);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary, #f2ca50);
  text-decoration: underline;
}

.svc-example__media {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  border-radius: inherit;
}

.svc-example--video .svc-example__screen > .svc-example__media {
  position: absolute;
  inset: 0;
}

.svc-example__media .svc-example__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.svc-example__screen {
  position: relative;
}

/* Modal */
.hn-video-modal[hidden] {
  display: none !important;
}

.hn-video-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top, 0px))
    max(0.75rem, env(safe-area-inset-right, 0px))
    max(0.75rem, env(safe-area-inset-bottom, 0px))
    max(0.75rem, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
}

.hn-video-modal__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.82);
  cursor: pointer;
}

.hn-video-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-width: 100%;
  max-height: calc(100svh - 1.5rem);
  max-height: calc(100dvh - 1.5rem);
  display: flex;
  flex-direction: column;
  background: var(--color-surface-container-lowest, #0c0f0e);
  border: 1px solid rgba(153, 144, 124, 0.3);
  padding: 0.85rem;
  box-sizing: border-box;
  overflow: auto;
}

.hn-video-modal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.hn-video-modal__title {
  margin: 0;
  font-family: var(--font-heading, Montserrat, sans-serif);
  font-size: 1rem;
  color: var(--color-on-background, #e2e3e1);
  overflow-wrap: anywhere;
}

.hn-video-modal__close {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(153, 144, 124, 0.35);
  background: transparent;
  color: var(--color-primary, #f2ca50);
  cursor: pointer;
  flex-shrink: 0;
}

.hn-video-modal__close:hover,
.hn-video-modal__close:focus-visible {
  border-color: var(--color-primary, #f2ca50);
  outline: 2px solid rgba(242, 202, 80, 0.65);
  outline-offset: 2px;
}

.hn-video-modal__frame {
  position: relative;
  /* Cap by short landscape viewports so 16:9 never exceeds the dialog */
  width: min(100%, calc((100svh - 7.5rem) * 16 / 9));
  width: min(100%, calc((100dvh - 7.5rem) * 16 / 9));
  max-width: 100%;
  aspect-ratio: 16 / 9;
  margin-inline: auto;
  background: #000;
  flex-shrink: 0;
}

.hn-video-modal__frame iframe,
.hn-video-modal__frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 767px) {
  .hn-video-modal {
    padding: 0.75rem;
    align-items: center;
  }

  .hn-video__play {
    left: 50%;
    bottom: 50%;
    transform: translate(-50%, 50%);
    min-width: 56px;
    min-height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hn-video__play {
    transition: none;
  }
}
