/* Client pages: a light screening room. Today's Xfer client look (the white -> #ededed -> white page,
   navy Metropolis Light type), the dark LIME mark, teal for the primary action and the file that
   is playing; the stage stays black so footage reads true. Hooks are documented in
   src/views/types.ts (CLIENT VIEWS). No inline styles anywhere: the CSP only allows this
   stylesheet and base.css.

   base.css (loaded first, shared with staff) holds the fonts, brand and ink tokens, the gradient,
   focus, selection and the no-italics rule. Type: Metropolis Light (300) for titles and for text of
   16px and up; Regular or Medium for small labels, sizes and buttons. Nothing is ever italic. */

:root {
  --faint: #8a91a2; /* decorative only: separators */

  --line: rgba(20, 44, 97, 0.13);
  --line-strong: rgba(20, 44, 97, 0.24);
  --field-border: #7a8193; /* 3.9:1 on white: an input's edge has to be seen */
  --wash: rgba(255, 255, 255, 0.62);
  --wash-strong: rgba(255, 255, 255, 0.85);
  --navy-tint: rgba(20, 44, 97, 0.06);
  --navy-tint-strong: rgba(20, 44, 97, 0.1);

  --teal-hover: #004a3c;
  --teal-tint: rgba(0, 93, 76, 0.09);
  --teal-tint-strong: rgba(0, 93, 76, 0.16);

  --error: #a3261b;

  --gutter: 16px;
  --max: 1200px;
  --stage-max: min(70vh, 720px);
}

@media (min-width: 720px) {
  :root {
    --gutter: 32px;
  }
}

@media (min-width: 1100px) {
  :root {
    --gutter: 48px;
  }
}

/* ---------- base ---------- */

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
}

img,
svg,
video,
audio {
  display: block;
  max-width: 100%;
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon .solid {
  fill: currentColor;
  stroke: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* The textarea client.js uses when the async Clipboard API is missing. */
.clipboard-helper {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font: 500 0.9375rem/1.2 var(--font);
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.button-primary {
  min-height: 48px;
  padding: 0 26px;
  background: var(--teal);
  box-shadow: 0 1px 2px rgba(0, 61, 50, 0.18), 0 8px 20px -10px rgba(0, 93, 76, 0.55);
  color: #fff;
}

/* Today's Xfer buttons: navy outline, navy fill on hover. */
.button-ghost {
  border-color: var(--ink);
  background: var(--wash);
  color: var(--ink);
}

/* Row actions: icon-only on phones (aria-label carries the name), icon + label from 720 px. */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 500 0.875rem/1 var(--font);
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.icon-button .label {
  display: none;
}

/* ---------- header and footer ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  min-height: 76px; /* the same with or without Copy link, so the mark doesn't move after Unlock */
  margin: 0 auto;
  padding: 16px var(--gutter);
}

.brand-mark {
  width: auto;
  height: 22px;
}

.copy-link {
  min-height: 44px;
  padding: 0 16px;
}

.site-footer {
  padding: 56px var(--gutter) calc(36px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--ink-3);
  font: 400 0.75rem/1.4 var(--font);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* A short teal rule, the same mark as the project-name eyebrow. */
.site-footer::before {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  margin: 0 auto 16px;
  background: var(--teal);
}

/* ---------- page frame ---------- */

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- title block ---------- */

.title-block {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 40px;
  padding: 28px 0 32px;
}

.title-text {
  flex: 1 1 30rem;
  min-width: 0;
}

.project-name {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--ink-2);
  font: 500 0.75rem/1.4 var(--font);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.project-name::before {
  content: "";
  flex: none;
  width: 22px;
  height: 2px;
  background: var(--teal);
}

.share-title {
  color: var(--ink);
  font: 300 clamp(1.875rem, 1.3rem + 2.4vw, 3rem) / 1.12 var(--font);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.share-details {
  margin-top: 14px;
  color: var(--ink-2);
  font: 300 1rem/1.5 var(--font);
  letter-spacing: 0.01em;
}

.share-details .sep {
  color: var(--faint);
}

/* Wrap between phrases, not inside "Link expires Jan 29, 2027". */
.share-details > span:not(.sep) {
  white-space: nowrap;
}

/* Phones: the expiry takes a line of its own, so the first line never ends in a dangling "·". */
@media (max-width: 599px) {
  .share-details .sep:has(+ .detail-expires) {
    display: none;
  }

  .share-details .detail-expires {
    display: block;
  }
}

/* The page's one primary action sits in the title block: Download all on a folder, Download on a
   video file link (so it's above the fold, not under the player). */
.download-all,
.download-file {
  flex: 1 1 100%;
}

.zip-too-large {
  flex: 1 1 100%;
  color: var(--ink-2);
  font: 400 0.9375rem/1.5 var(--font);
}

@media (min-width: 600px) {
  .download-all,
  .download-file {
    flex: 0 0 auto;
  }

  .zip-too-large {
    flex: 0 1 18rem;
  }
}

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

/* Edge to edge on phones; a framed screen from 720 px. The frame stays black: footage reads true. */
.stage {
  margin: 0 calc(var(--gutter) * -1) 40px;
  scroll-margin-top: 0;
}

.stage-frame {
  position: relative;
  background: #000;
  overflow: hidden;
}

/* Uses the video's own aspect ratio once known (16:9 until then), never taller than --stage-max;
   object-fit keeps 9x16 and 16x9 uncropped and centered on black. */
.stage-video {
  width: 100%;
  height: auto;
  max-height: var(--stage-max);
  aspect-ratio: auto 16 / 9;
  object-fit: contain;
  background: #000;
}

.stage-video:focus-visible {
  outline-color: var(--focus-on-dark);
  outline-offset: -3px;
}

.stage-unavailable {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: #d5d8de;
  font: 400 1.0625rem/1.45 var(--font);
  text-wrap: balance;
}

.stage-unavailable .icon {
  width: 32px;
  height: 32px;
  stroke-width: 1.3;
  color: #9aa0ab;
}

.stage.is-unavailable .stage-video {
  display: none;
}

/* No preview (ProRes in Chrome, say): a short band with the message, not a full-size black screen. */
.stage.is-unavailable .stage-frame {
  width: 100%;
  height: clamp(200px, 30vh, 280px);
}

/* On a folder the Download under the band becomes the primary action. A file link already has its
   primary Download in the title block. */
.page-share[data-scope-kind="folder"] .stage.is-unavailable .stage-download {
  border-color: transparent;
  background: var(--teal);
  color: #fff;
}

.stage-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 16px var(--gutter) 0;
}

.stage-text {
  flex: 1 1 14rem;
  min-width: 0;
}

.stage-name {
  color: var(--ink);
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.stage-meta {
  margin-top: 3px;
  color: var(--ink-3);
  font: 400 0.875rem/1.4 var(--font);
  font-variant-numeric: tabular-nums;
}

/* A file link's title already is the file name, and its Download is the one in the title block. */
.page-share[data-scope-kind="file"] .stage-name,
.page-share[data-scope-kind="file"] .stage-download {
  display: none;
}

/* On a phone a 9x16 frame at --stage-max would push the controls and the file list off the screen. */
@media (max-width: 719px) {
  .stage.is-portrait:not(.is-unavailable) .stage-video {
    max-height: min(56vh, 520px);
    max-height: min(56svh, 520px);
  }
}

@media (min-width: 720px) {
  .stage {
    margin: 0 0 52px;
  }

  .stage-frame {
    border-radius: var(--radius-lg);
    box-shadow:
      0 0 0 1px rgba(11, 38, 82, 0.1),
      0 2px 6px rgba(11, 38, 82, 0.08),
      0 36px 70px -34px rgba(11, 38, 82, 0.5);
  }

  .stage.is-unavailable .stage-frame {
    height: clamp(220px, 32vh, 300px);
  }

  /* Vertical video (9x16 socials; client.js sets .is-portrait once the size is known): the frame
     hugs the picture, centered, instead of a wide black box around a narrow strip. Still uncropped. */
  .stage.is-portrait:not(.is-unavailable) .stage-frame {
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
  }

  .stage.is-portrait:not(.is-unavailable) .stage-video {
    width: auto;
    height: var(--stage-max);
    max-width: 100%;
  }

  .stage-caption {
    padding: 18px 0 0;
  }
}

/* ---------- file list ---------- */

.file-list {
  display: grid;
  gap: 44px;
}

.file-group-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 0 0 14px;
  color: var(--ink);
  font: 300 1.25rem/1.3 var(--font);
}

.file-group-heading .icon {
  width: 20px;
  height: 20px;
  color: var(--teal);
}

.file-group-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-group-count {
  color: var(--ink-3);
  font: 400 0.8125rem/1.35 var(--font);
  letter-spacing: 0.02em;
}

.files {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-strong);
}

/* Phones: glyph | name over meta | actions. The inline audio player takes a row of its own. */
.file-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  grid-template-areas:
    "glyph name actions"
    "glyph meta actions";
  align-items: center;
  column-gap: 12px;
  row-gap: 4px;
  padding: 12px 4px 12px 0;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.15s ease;
}

.file-row[data-playable="true"] {
  cursor: pointer;
}

.file-glyph {
  grid-area: glyph;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--navy-tint);
  color: var(--ink-2);
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.file-glyph .icon {
  width: 18px;
  height: 18px;
}

/* One weight for file names everywhere (row, stage caption): Light at 17px, navy (13.4:1 on white). */
.file-name {
  grid-area: name;
  align-self: end;
  color: var(--ink);
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.file-meta {
  grid-area: meta;
  align-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.badge-new {
  padding: 4px 7px 3px;
  border-radius: 3px;
  background: var(--teal-tint);
  color: var(--teal);
  font: 600 0.6875rem/1.1 var(--font);
  letter-spacing: 0.14em;
}

.file-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 2px;
}

.file-play {
  color: var(--teal);
}

.file-play .icon-pause,
.file-row.is-playing .file-play .icon-play {
  display: none;
}

.file-row.is-playing .file-play .icon-pause {
  display: block;
}

.file-audio {
  grid-column: 2 / -1;
  width: 100%;
  height: 44px;
  margin: 8px 0 4px;
}

/* Two states, two looks. Playing: the teal wash, the bar and a solid teal glyph (and Pause).
   On the stage but not playing (paused, or an audio row is playing instead): the bar and a tinted
   glyph only, so there is never more than one row that looks like it's playing. */
.file-row.is-playing {
  background: linear-gradient(90deg, rgba(0, 93, 76, 0.11), rgba(0, 93, 76, 0.02) 70%);
  box-shadow: inset 2px 0 0 var(--teal);
}

.file-row.is-playing .file-glyph {
  background: var(--teal);
  color: #fff;
}

.file-row.is-current:not(.is-playing) {
  box-shadow: inset 2px 0 0 var(--teal);
}

.file-row.is-current:not(.is-playing) .file-glyph {
  background: var(--teal-tint-strong);
  color: var(--teal);
}

.row-note {
  grid-column: 2 / -1;
  margin: 4px 0 2px;
  color: var(--ink-2);
  font: 400 0.875rem/1.45 var(--font);
}

@media (min-width: 720px) {
  .file-row {
    grid-template-columns: 40px minmax(0, 1fr) auto auto;
    grid-template-areas: "glyph name meta actions";
    column-gap: 16px;
    min-height: 66px;
    padding: 10px 8px 10px 12px;
  }

  .file-glyph {
    width: 40px;
    height: 40px;
  }

  .file-name {
    align-self: center;
  }

  .file-meta {
    align-self: center;
    justify-content: flex-end;
  }

  /* A fixed size column keeps the NEW badges lined up. */
  .file-size {
    min-width: 4.5rem;
    text-align: right;
  }

  /* Same width with or without Play, so the size column lines up. */
  .file-actions {
    justify-content: flex-end;
    gap: 6px;
    min-width: 15rem;
  }

  .icon-button {
    padding: 0 14px;
  }

  .icon-button .label {
    display: inline;
  }

  .file-play {
    min-width: 96px;
    background: var(--teal-tint);
  }

  .file-row.is-playing .file-play {
    background: var(--teal);
    color: #fff;
  }

  .file-audio,
  .row-note {
    grid-column: 2 / -1;
  }
}

/* ---------- file link (not a video) ---------- */

.single-file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 20px 16px;
  max-width: 760px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--wash);
  box-shadow: 0 18px 40px -30px rgba(11, 38, 82, 0.35);
}

.single-glyph {
  grid-area: auto;
  grid-column: 1;
  grid-row: 1;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--teal-tint);
  color: var(--teal);
}

.single-glyph .icon {
  width: 24px;
  height: 24px;
}

.single-info {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  align-items: baseline;
}

.single-type {
  color: var(--ink);
  font-weight: 500;
}

.single-size {
  color: var(--ink-3);
  font: 400 0.9375rem/1.4 var(--font);
  font-variant-numeric: tabular-nums;
}

.single-audio {
  grid-column: 1 / -1;
  width: 100%;
  height: 44px;
}

.single-download {
  grid-column: 1 / -1;
}

@media (min-width: 600px) {
  .single-file {
    padding: 26px 28px;
  }

  .single-download {
    justify-self: start;
  }
}

/* ---------- empty state ---------- */

.empty-state {
  padding: 64px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--wash);
  color: var(--ink);
  text-align: center;
  font: 300 1.375rem/1.4 var(--font);
  text-wrap: balance;
}

/* ---------- password, inactive, error, landing ---------- */

.notice,
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 48px;
  padding-bottom: 48px;
  text-align: center;
}

.notice h1 {
  max-width: 22ch;
  color: var(--ink);
  font: 300 clamp(1.75rem, 1.4rem + 1.4vw, 2.375rem) / 1.2 var(--font);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.notice-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--wash);
  color: var(--teal);
}

.notice-icon .icon {
  width: 24px;
  height: 24px;
}

.notice-message {
  max-width: 34ch;
  margin-top: 12px;
  color: var(--ink-2);
  font: 300 1.125rem/1.5 var(--font);
}

.unlock-form {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  margin-top: 34px;
  text-align: left;
}

.unlock-form label {
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.unlock-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--black);
  font-size: 1rem; /* 16 px keeps iOS from zooming in */
  font-weight: 400;
  letter-spacing: 0.04em;
}

.unlock-form input:focus-visible {
  border-color: var(--teal);
  outline-offset: 1px;
}

.unlock-form input[aria-invalid="true"],
.unlock-form input[aria-invalid="true"]:focus-visible {
  border-color: var(--error);
  outline-color: var(--error);
}

.form-error {
  color: var(--error);
  font-size: 0.875rem;
  font-weight: 500;
}

.unlock-button {
  width: 100%;
  margin-top: 8px;
}

/* The lockup is the whole landing page: no header mark or footer repeating "LIME" around it. Both keep
   their space, so the lockup stays centered. */
.page-landing .site-header,
.page-landing .site-footer {
  visibility: hidden;
}

.brand-lockup {
  width: min(260px, 64vw);
  height: auto;
}

.landing-tagline {
  margin-top: 32px;
  color: var(--ink-2);
  font: 300 1.125rem/1.4 var(--font);
  letter-spacing: 0.02em;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 12px 20px 12px 14px;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 18px 40px -14px rgba(11, 38, 82, 0.6);
  color: #fff;
  font-weight: 500;
  font-size: 0.9375rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast::before {
  content: "✓";
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--teal);
  font-size: 0.75rem;
}

.toast:empty {
  padding: 0;
  border: 0;
}

.toast:empty::before {
  display: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- larger screens ---------- */

@media (min-width: 720px) {
  .site-header {
    min-height: 96px;
    padding-top: 26px;
    padding-bottom: 26px;
  }

  .brand-mark {
    height: 26px;
  }

  .title-block {
    padding: 40px 0 44px;
  }
}

/* Hover only where there is a real pointer, so a tap on a phone doesn't leave rows lit. */
@media (hover: hover) {
  .button-primary:hover {
    background: var(--teal-hover);
  }

  .button-ghost:hover {
    border-color: var(--ink);
    background: var(--ink);
    color: #fff;
  }

  .page-share[data-scope-kind="folder"] .stage.is-unavailable .stage-download:hover {
    border-color: transparent;
    background: var(--teal-hover);
  }

  .icon-button:hover {
    background: var(--navy-tint);
  }

  .file-row[data-playable="true"]:not(.is-current, .is-playing):hover {
    background: var(--wash-strong);
  }
}

@media (hover: hover) and (min-width: 720px) {
  .file-play:hover {
    background: var(--teal);
    color: #fff;
  }

  .file-row.is-playing .file-play:hover {
    background: var(--teal-hover);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
