/* community clips — extends styles.css, same tokens, same restraint */

/* the gallery is the first page short enough to leave the footer floating */
body.doc {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body.doc .doc-body { flex: 1 0 auto; }

.gallery-body { max-width: 1120px; }
.gallery-body .lede { color: var(--muted); max-width: 55ch; margin-bottom: 0.5em; }
.gallery-body .howto { color: var(--muted); }

/* — grid — */

/* specificity has to beat `.doc-body ul li { list-style: disc }` in styles.css */
.doc-body ul.clip-grid {
  list-style: none;
  padding: 0;
  margin: clamp(32px, 5vw, 56px) 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: clamp(20px, 3vw, 32px);
}
.doc-body ul.clip-grid li { margin: 0; list-style: none; }

/* the whole image is the download link — the icon is just the affordance.
   selector has to carry `.doc-body a` specificity (0,1,1) to drop the underline
   that styles.css puts on every link inside a doc page. */
.clip-frame {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  cursor: pointer;
}
/* One border, on the container — the stacked img and canvas must not carry
   their own or they paint over each other's edges.

   1px, not the site's usual 0.5px hairline: the grid sizes cards fluidly, so
   their edges land on fractional device pixels. A 0.5px border is exactly one
   device pixel at 2x, so at a half-pixel offset it splits across two rows at
   ~50% each, and --hair's own 0.5 alpha halves that again into invisibility —
   which is why the bottom edge kept vanishing while the top survived. A 1px
   border always fully covers at least one device row at any offset. The alpha
   is lowered to match, so it still reads as a hairline. */
.doc-body .clip-frame,
.doc-body a.clip-frame { border: 1px solid rgba(178, 178, 178, 0.26); }
.doc-body .clip-frame:hover,
.doc-body a.clip-frame:hover,
.doc-body .clip-frame:focus-within { border-color: var(--fg); }
.clip-frame:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }
.clip-frame--pending { cursor: default; }

/* the still and the canvas share one box — the canvas only paints while playing */
.clip-thumb,
.clip-canvas {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  background: #000;
}
.clip-canvas { opacity: 0; transition: opacity 90ms ease; }
.clip-card.is-playing .clip-canvas { opacity: 1; }

/* a hard white square flush into the bottom-right corner, revealed on hover */
.clip-get {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fg);
  color: var(--bg);
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;   /* the whole frame is the link; don't intercept the click */
}
.clip-get svg { width: 17px; height: 17px; display: block; }
.clip-frame:hover .clip-get,
.clip-frame:focus-within .clip-get { opacity: 1; }

.clip-name,
.clip-by,
.clip-spec { display: block; }
.clip-name { margin-top: 10px; font-size: 16px; }
.clip-by { margin-top: 3px; font-size: 13px; color: var(--fg); }
.clip-spec {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* — send us one — */

.submit {
  margin-top: clamp(64px, 9vw, 112px);
  margin-bottom: clamp(64px, 9vw, 112px);
  font-size: clamp(18px, 2.6vw, 26px);
  font-weight: 200;
  line-height: 1.5;
}
.submit p { margin: 0; }
.submit a {
  color: var(--fg);
  border-bottom: 1px solid var(--hair);
}
.submit a:hover { border-bottom-color: var(--fg); }

/* the subreddit — a quieter line under the contribute call, since it points at
   people rather than at clips. inline img so the sentence wraps normally. */
.submit .join {
  margin-top: clamp(20px, 3vw, 30px);
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 54ch;
}
.submit .join img {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 7px;
}

/* full width of the content column, left aligned like everything above it */
.rights {
  margin: 0 0 clamp(56px, 8vw, 96px);
  padding-top: 20px;
  border-top: 0.5px solid var(--hair);
  font-size: 13px;
  color: var(--muted);
  max-width: none;
}

@media (max-width: 600px) {
  .doc-body ul.clip-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
  }
  .clip-name { margin-top: 8px; font-size: 15px; }
  /* no hover on touch — keep the download always visible instead */
  .clip-get { opacity: 1; width: 26px; height: 26px; }
  .clip-get svg { width: 15px; height: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .clip-canvas { display: none; }
}
