/* ============================================================================
   ARPLUS — video placeholder page
   Standalone. No framework, no build step. See index.html for the why.
   ========================================================================== */

:root {
  --bg: #0c0a0b;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
}

/* Clip on BOTH html and body. Body alone is not enough: the entrance animation
   scales .stage to 1.04, so its box momentarily exceeds 100dvh, and
   documentElement grows a scrollbar even though body has overflow:hidden. That
   scrollbar then steals width from the video. Nothing here is meant to scroll. */
html,
body {
  overflow: hidden;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- stage ---------------------------------------------------------------- */

.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  /* dvh, not vh: on mobile browsers vh includes the collapsing toolbar, which
     leaves a sliver of background visible under the video as it hides. */
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  animation: stage-in 620ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes stage-in {
  from {
    opacity: 0;
    transform: scale(1.04);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- video ---------------------------------------------------------------- */

.cover {
  display: block;
  width: 100%;
  height: 100%;

  /* cover, not the `contain` default. Source is 16:9 and the stage can be
     squarer, so cover crops the sides instead of letterboxing. No bars means
     no exposed background. */
  object-fit: cover;
  object-position: center;

  border: 0;
  outline: none;

  /* <video poster> takes one URL with no media-query support, so the poster is
     applied here instead — one rule per orientation. Without this a phone
     would flash the 16:9 poster, itself cropped to a sliver, before the
     portrait file's first frame paints. */
  background: url("/media/arplus-hero-poster.jpg") center / cover no-repeat;
}

@media (orientation: portrait) and (max-width: 767px) {
  .cover {
    background-image: url("/media/arplus-hero-portrait-poster.jpg");
  }
}

/* --- X button ------------------------------------------------------------- */

/* Fixed, and a sibling of .stage. .stage has a transform on it, and a fixed
   child of a transformed ancestor anchors to that ancestor instead of the
   viewport — so this has to live outside it to stay in the corner. */
.x-btn {
  position: fixed;
  top: max(2rem, env(safe-area-inset-top));
  right: max(2rem, env(safe-area-inset-right));
  z-index: 50;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;

  /* 8px corners, not a full pill — a perfect circle on a square element reads
     as a toggle/switch, which is the wrong affordance for a link. */
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);

  /* Blur + saturate rather than a flat grey: the button picks up the video
     behind it instead of sitting on top of it as a dead square. */
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 8px 24px rgba(0, 0, 0, 0.45);

  /* Transform-only transitions so hovering never triggers layout or a repaint
     of the video underneath. */
  transition:
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease,
    color 220ms ease;
}

.x-btn svg {
  width: 1.125rem;
  height: 1.125rem;
  /* The glyph is drawn at 24x24 with the letterform starting around y=2.25 —
     nudge it down a hair to optically centre it. */
  transform: translateY(0.5px);
}

.x-btn:hover,
.x-btn:focus-visible {
  /* Lift, not scale. A uniform scale on a compact square reads as a toggle
     being pressed; an upward nudge plus a glow reads as a button. */
  transform: translateY(-2px);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 10px 30px rgba(0, 0, 0, 0.55),
    0 0 0 4px rgba(255, 255, 255, 0.06);
}

.x-btn:active {
  transform: translateY(0);
}

.x-btn:focus-visible {
  outline: 2px solid rgba(226, 94, 13, 0.85);
  outline-offset: 3px;
}

/* Touch devices have no hover, and 44px is the accessibility hit-target floor,
   so grow it slightly. The radius scales with it (10px on 48px) so the corner
   ratio stays visually identical to the 8px-on-44px version. */
@media (hover: none) {
  .x-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 10px;
  }
  .x-btn svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage {
    animation: none;
  }
  .x-btn {
    transition: background-color 150ms ease, border-color 150ms ease;
  }
  .x-btn:hover,
  .x-btn:focus-visible {
    transform: none;
  }
}
