/* The public share page: an iPhone, drawn, with the exported replay playing in
 * its screen. Nothing else is on the page on purpose — the replay is the whole
 * message, and anything beside it competes with the map.
 */

:root {
  --page: #f5f5ee;
  --body: #2b2b2f;
  --body-edge: #4a4a50;
  --text: #171c24;
  --secondary-text: #5c6675;
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only a UA `display: none`, so any rule that sets
   `display` on the same element silently defeats it. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* The phone ---------------------------------------------------------------
 *
 * Sized once, then every radius, bezel and button is expressed in `em` — with
 * `font-size` set so that **1em is one iPhone point**. That is what keeps the
 * drawing proportional at any size: the numbers below are the device's own
 * measurements rather than values retuned for each breakpoint.
 */

.phone {
  /* 393 × 852 points: iPhone 15 Pro. Whichever of height, a cap, or the
     available width binds first. */
  --height: min(92vh, 940px, (100vw - 32px) * 852 / 393);
  /* `dvh` over `vh`, because mobile Safari's `vh` includes the space under its
     own toolbars and cropped the bottom of the phone off the page. The `vh`
     line above stays as the fallback for browsers without `dvh`. */
  --height: min(92dvh, 940px, (100vw - 32px) * 852 / 393);
  height: var(--height);
  width: calc(var(--height) * 393 / 852);
  font-size: calc(var(--height) / 852);
  /* One iPhone point, as a variable. The chrome uses bare `em` (safe there:
     none of those elements set their own font-size), but anything that *does*
     set a font-size must measure in `--pt` — an `em` on such an element is
     relative to its own new size and compounds. The claim sheet's button once
     computed 54em against a 16-point font and swallowed the screen. */
  --pt: calc(var(--height) / 852);

  position: relative;
  padding: 11em;
  border-radius: 62em;
  background: linear-gradient(150deg, var(--body-edge), var(--body) 22%, var(--body) 78%, var(--body-edge));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 30px 60px rgba(0, 0, 0, 0.28),
    0 4px 12px rgba(0, 0, 0, 0.18);
}

.screen {
  position: relative;
  height: 100%;
  width: 100%;
  border-radius: 51em;
  overflow: hidden;
  background: #000;
}

.screen video {
  display: block;
  height: 100%;
  width: 100%;
  /* `cover`, so a video rendered at a slightly different ratio fills the screen
     rather than letterboxing inside a device that has no letterbox. */
  object-fit: cover;
}

/* The Dynamic Island, drawn over the video. The export is the screen's content;
   this is the hardware in front of it. */
.island {
  position: absolute;
  top: 11em;
  left: 50%;
  transform: translateX(-50%);
  width: 125em;
  height: 37em;
  border-radius: 19em;
  background: #000;
}

.button {
  position: absolute;
  background: linear-gradient(180deg, #56565c, #3a3a40);
  border-radius: 2em;
}

.button-silence { left: -2em; top: 118em; width: 3em; height: 30em; }
.button-up      { left: -2em; top: 168em; width: 3em; height: 62em; }
.button-down    { left: -2em; top: 244em; width: 3em; height: 62em; }
.button-power   { right: -2em; top: 196em; width: 3em; height: 100em; }

/* What covers the screen -------------------------------------------------
 *
 * Two of them: the greeting the link opens on, and the state where there is no
 * recording to play. Both fill the screen over the video rather than replacing
 * it — a `hidden` video is `display: none`, and WebKit does not load the source
 * of one.
 */

.screen-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8em;
  padding: 40em;
  text-align: center;
  color: #f2f5fa;
  background: linear-gradient(160deg, #24405f, #6d5a6b);
}

/* The greeting is a button, so a keyboard and a screen reader reach it the same
   way a thumb does. It has to shed the UA button styling to look like a screen.

   `font: inherit`, not `font-family: inherit`, and it is load-bearing: a button
   carries its own UA `font-size` of 13px, which is a new font size in the middle
   of the drawing. Every `em` below then measured against 13px instead of one
   iPhone point — a 40em padding became 520px and pushed the whole greeting off
   the screen, leaving a phone with nothing in it. Same compounding trap as the
   claim sheet's; see the note on `.phone`. */
.greeting {
  width: 100%;
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.greeting:active { filter: brightness(0.94); }

/* These four set their own `font-size`, so every *other* length on them is in
   `--pt` and not `em` — an `em` here would measure against the new size and
   compound. Written the wrong way once: `padding: 12em 26em` on the cue below
   resolved against its own 13px and drew a 750×410 pill that shoved the
   greeting off the top of the screen. Same trap as the claim sheet's; see the
   note on `.phone`. `font-size` itself is the exception — it resolves against
   the parent, which is one iPhone point. */
.greeting-mark { font-size: 44em; line-height: 1; }
.greeting-title { font-size: 30em; font-weight: 700; }
.greeting-body {
  font-size: 16em;
  line-height: 1.45;
  max-width: calc(var(--pt) * 250);
  opacity: 0.92;
}

/* The cue reads as the tappable thing, so the whole screen can be the target
   without looking like a dead end. */
.greeting-cue {
  margin-top: calc(var(--pt) * 14);
  padding: calc(var(--pt) * 12) calc(var(--pt) * 26);
  border-radius: calc(var(--pt) * 26);
  border: 1px solid rgba(255, 255, 255, 0.55);
  font-size: 15em;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.placeholder-title { margin: 0; font-size: 17em; font-weight: 600; }
.placeholder-body { margin: 0; font-size: 13em; line-height: 1.5; opacity: 0.82; }

/* The claim sheet ----------------------------------------------------------
 *
 * Drawn as one of the app's own bottom sheets, because the page's whole idea
 * is that the recipient is holding the app. Surface, radius, and button all
 * come from the app's design tokens (Theme.swift): card white, sheet radius
 * 24, the primary button's blue gradient at radius 17 and height 54.
 *
 * Everything in here measures in `--pt` (one iPhone point), never `em`:
 * these elements set their own font sizes, and an `em` on such an element
 * compounds against the new size. See the note on `.phone`.
 */

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: calc(var(--pt) * 8) calc(var(--pt) * 20) calc(var(--pt) * 18);
  background: #ffffff;
  border-radius: calc(var(--pt) * 24) calc(var(--pt) * 24) 0 0;
  box-shadow: 0 calc(var(--pt) * -8) calc(var(--pt) * 24) rgba(0, 0, 0, 0.18);
  transform: translateY(105%);
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.sheet.up { transform: translateY(0); }

.grabber {
  width: calc(var(--pt) * 36);
  height: calc(var(--pt) * 5);
  margin: 0 auto calc(var(--pt) * 12);
  border-radius: calc(var(--pt) * 3);
  background: rgba(0, 0, 0, 0.16);
}

.sheet-eyebrow {
  margin: 0 0 calc(var(--pt) * 6);
  font-size: calc(var(--pt) * 12);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #171c24;
}

.sheet-title {
  margin: 0 0 calc(var(--pt) * 4);
  font-size: calc(var(--pt) * 20);
  line-height: 1.25;
  font-weight: 700;
  color: #171c24;
}

.sheet-body {
  margin: 0 0 calc(var(--pt) * 14);
  font-size: calc(var(--pt) * 14);
  line-height: 1.45;
  color: #5c6675;
}

/* `ActionButton` in CSS: Theme.primary's gradient, Radius.card 17, minimum
   height 54, semibold white label. */
.app-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: calc(var(--pt) * 54);
  padding: calc(var(--pt) * 8) calc(var(--pt) * 18);
  border: 0;
  border-radius: calc(var(--pt) * 17);
  background: linear-gradient(90deg, #337ae0, #4092ee);
  color: #fff;
  font: 600 calc(var(--pt) * 16)/1.2 -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, sans-serif;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.app-button:active { opacity: 0.85; }

.sheet-fine {
  margin: calc(var(--pt) * 10) calc(var(--pt) * 2) 0;
  font-size: calc(var(--pt) * 11);
  line-height: 1.5;
  color: #5c6675;
}

.sheet form {
  display: flex;
  flex-direction: column;
  gap: calc(var(--pt) * 10);
}

.sheet input[type="email"] {
  width: 100%;
  padding: calc(var(--pt) * 15) calc(var(--pt) * 16);
  border-radius: calc(var(--pt) * 13);
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #f5f5ee;
  color: #171c24;
  /* Floored at 16 real pixels: iOS Safari zooms the whole page into any
     focused input smaller than that, and never zooms back out. On a large
     phone drawing --pt exceeds a pixel and the floor is invisible. */
  font-size: max(16px, calc(var(--pt) * 16));
}

.sheet input[type="email"]:focus {
  outline: 2px solid #337ae0;
  outline-offset: 1px;
}

.sheet-error {
  margin: 0;
  font-size: calc(var(--pt) * 12);
  color: #b3401b;
}

/* The replay keeps looping behind the sheet, quieter. */
.screen video.dimmed { filter: brightness(0.72); }

/* The one page that is not a phone ---------------------------------------- */

.state {
  flex-direction: column;
  text-align: center;
  max-width: 420px;
  margin: 0 auto;
}

.state h1 { font-size: 22px; margin: 0 0 8px; }
.state p { margin: 0; color: var(--secondary-text); }
.state-quiet { opacity: 0.7; }

/* Reachable by a screen reader, invisible on the glass. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0e1014;
    --text: #f0f2f6;
    --secondary-text: #a3adbd;
  }
}
