/* Rize open beta page (/open-beta). Built on Rize Sage: every colour, space, radius, size and type
   style comes from tokens.css, and the rz- components follow docs/design-system/components.
   The whole page is one Night band (data-theme="dark" on body) that fills the window and never
   scrolls: the copy's type, gaps and padding scale with the window's height as well as its width,
   and the phone takes whatever room is left and runs off the band's foot. */

:root {
  --ease-reveal: cubic-bezier(0.22, 0.61, 0.36, 1);
  --rise: 14px;
  --reveal: 0.95s;
  /* The band's inset and the copy's stack gap follow the window so short windows stay inside it. */
  --pad: clamp(var(--space-5), 5vmin, var(--space-16));
  --stack: clamp(var(--space-3), 2.4vh, var(--space-6));
  /* content-max (1160px) in rem, so the composition grows with the root size on big screens. */
  --page-max: 72.5rem;
}

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

html {
  /* The root size grows a little with the window, up to a quarter, so a big monitor gets a bigger
     poster rather than a small one in a corner. The reader's own browser size is the floor. */
  font-size: clamp(100%, 0.4rem + 0.9vmin, 125%);
  background: var(--band-start);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { overflow-x: clip; }
body {
  font: var(--body);
  color: var(--on-band);
  background: var(--band-start);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
::selection { background: var(--tint); }

/* Every focusable element shows the same ring. The transparent outline is what forced-colours mode draws. */
:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus-ring); }
a:not(.badge):focus-visible { border-radius: var(--radius-xs); }

.sprite {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Paper grain over the whole page, as on the home page. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}

.wordmark {
  font: var(--wordmark);
  /* Larger than the app's wordmark, since it heads a poster: 2rem on a phone up to 2.75rem on a wide window. */
  font-size: clamp(2rem, 1.4rem + 1.2vw, 2.75rem);
  letter-spacing: var(--wordmark-tracking);
  color: var(--sage);
  text-decoration: none;
}
.wordmark:hover { color: var(--sage); }

.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- The band */
/* One grid, the height of the window. Portrait: the wordmark, the copy, then the phone in whatever
   room is left, then the foot. Landscape: the copy on the left with the foot under it, the phone on
   the right from the wordmark down to the band's foot. */
.launch {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-areas: "top" "copy" "phone" "foot";
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: var(--stack) var(--space-10);
  min-height: 100vh;
  min-height: 100dvh;
  /* Inset by the pad, or centred on the content width when the window is wider than that. */
  padding: var(--space-4) max(var(--pad), calc((100% - var(--page-max)) / 2)) var(--space-4);
  color: var(--on-band);
  background:
    radial-gradient(70% 110% at 88% 118%, color-mix(in srgb, var(--attention) 40%, transparent) 0%, transparent 62%),
    linear-gradient(150deg, var(--band-start) 0%, var(--band-end) 100%);
}

.top {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: var(--nav-bar);
}
/* The event's own logo in the corner. The file is the lockup with its navy set to on-band, so the
   wordmark reads on the band and the two triangles keep their colours. */
.event { flex: none; }
.event-logo { width: clamp(11rem, 18vw, 16rem); height: auto; }

.launch-copy {
  grid-area: copy;
  display: grid;
  align-content: center;
  align-self: center;
}
/* Each step down the copy gets its own room, growing with the window's height: the hero line
   sits close to the title, the sub a little further, the badges and the QR code further still. */
.launch-sub { margin-top: clamp(var(--space-4), 3.5vh, var(--space-8)); }
.launch-copy .badges { margin-top: clamp(var(--space-5), 4.5vh, var(--space-10)); }
.qr { margin-top: clamp(var(--space-5), 5vh, var(--space-12)); }
.launch-title {
  font-family: var(--font-display);
  font-weight: 300;
  /* display-xl, scaled up to the hero size the window has room for, by width and by height. */
  font-size: clamp(2.25rem, min(9vw, 8.5vh), 4.6rem);
  line-height: 1.02;
  letter-spacing: var(--display-xl-tracking);
  color: var(--on-band);
  text-wrap: balance;
}
.launch-title em { font-style: italic; color: var(--accent); }
.launch-sub {
  /* body on short windows, body-lg where there is room. */
  font: var(--body);
  font-size: clamp(1rem, 0.5rem + 1.6vh, 1.125rem);
  line-height: 1.5;
  color: var(--on-band);
  max-width: 34rem;
  text-wrap: pretty;
}

/* Two equal badges side by side when they fit, one above the other when they don't. */
.badges { display: flex; flex-wrap: wrap; gap: var(--space-3); max-width: 26rem; }
.badge {
  flex: 1 1 9.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: var(--control-lg);
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--ink);
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.badge:hover { background: var(--fill); color: var(--ink); }
.badge-logo { flex: none; width: var(--icon-lg); height: var(--icon-lg); fill: currentColor; }
.badge-text { display: grid; text-align: left; white-space: nowrap; }
.badge-sub { font: var(--chip); }
.badge-name { font: var(--label); }

/* The lead action follows the visitor's phone: iPhone, unless the page sees Android. It takes the
   accent fill; the other store keeps an outline. Android visitors also get Google Play first. */
.dl-ios,
[data-platform="android"] .dl-android {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.dl-ios:hover,
[data-platform="android"] .dl-android:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--on-accent);
}
[data-platform="android"] .dl-ios { background: transparent; border-color: var(--line-strong); color: var(--ink); }
[data-platform="android"] .dl-ios:hover { background: var(--fill); color: var(--ink); }
[data-platform="android"] .badges .dl-android { order: -1; }

/* The QR code is for desktop visitors with a mouse, since the beta installs on a phone. */
.qr { display: none; }
@media (min-width: 900px) and (min-height: 640px) and (hover: hover) and (pointer: fine) {
  .qr { display: flex; align-items: center; gap: var(--space-5); }
  /* Big enough to scan from a step back, growing with the window's height. */
  .qr svg {
    flex: none;
    width: clamp(6rem, 15vh, 10rem);
    height: clamp(6rem, 15vh, 10rem);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    background: var(--on-band);
    fill: var(--band-start);
  }
  .qr figcaption { font: var(--body); color: var(--ink-muted); max-width: 14rem; }
}

/* ---------------------------------------------------------------- The phone */
/* The app in use (open-beta-phone.css and .js), with a bezel drawn around the screen (a shadow spread that follows the
   screen's corners), as in the walkthroughs. The cell is a size container, so the phone's width
   follows the room the cell has and the band's foot crops it. */
.launch-phone {
  --bw: 6px;
  grid-area: phone;
  position: relative;
  container-type: size;
  min-height: 0;
  overflow: hidden;
  /* Room for the bezel and the shadow on the sides; the foot of the cell is the crop. */
  margin-inline: calc(-1 * var(--pad));
  padding: 0 var(--pad);
}
.phone {
  position: absolute;
  top: var(--bw);
  left: 50%;
  translate: -50% 0;
  /* Narrow enough to fit the cell, and never so tall that less than half of it shows. */
  width: min(70%, 20rem, 84cqh);
  height: auto;
  border-radius: 13.7% / 6.3%;
  background: var(--sunken);
  box-shadow: 0 0 0 var(--bw) var(--bezel), 0 0 0 calc(var(--bw) + 1px) var(--line), var(--shadow-overlay);
}
/* No room left for a phone: the copy has the window. */
@container (max-height: 120px) { .phone { display: none; } }

/* A phone held upright is too small for the poster: there the phone sits whole under the badges, the
   row takes its height, and the page grows past the window and scrolls down to it and the foot. The
   cell contains only its width, so the row can size to the phone and the height query above does
   not apply. */
@media (max-width: 719.98px) and (orientation: portrait) {
  .launch { grid-template-rows: auto auto 1fr auto; }
  .launch-phone { container-type: inline-size; overflow: visible; margin-inline: 0; padding: 0; }
  /* The same width as the cropped phone had (seven tenths of the window), now of the band's content. */
  .phone {
    position: relative;
    top: auto;
    left: auto;
    translate: none;
    width: min(78%, 20rem);
    margin: var(--bw) auto calc(var(--bw) + var(--space-4));
  }
}

/* ---------------------------------------------------------------- Landscape */
@media (min-width: 720px) and (min-aspect-ratio: 1/1) {
  .launch {
    grid-template-areas: "top top" "copy phone" "foot phone";
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding-bottom: 0;
  }
  .launch-copy { padding-bottom: var(--space-4); }
  .foot { padding-bottom: var(--space-4); }
  .launch-phone { --bw: 8px; margin-inline: 0; padding: 0; }
  /* Anchored to the band's foot and pushed a fifth of its own height past it, so the top four fifths
     of the screen show whatever the window's height, and the phone never sits whole. */
  .phone { top: auto; bottom: 0; translate: -50% 20%; width: min(100%, 27rem, 56cqh); }
}

/* Short windows (a phone on its side): the wordmark row, gaps and padding close up. */
@media (max-height: 480px) {
  :root { --stack: var(--space-2); }
  .launch { padding-block: var(--space-3); }
  .top { min-height: 0; }
  .launch-copy, .foot { padding-bottom: var(--space-2); }
  .launch-sub { font: var(--body-sm); margin-top: var(--space-3); }
  .launch-copy .badges { margin-top: var(--space-3); }
}

/* ---------------------------------------------------------------- The foot */
.foot { grid-area: foot; font: var(--body-sm); color: var(--ink-muted); }
.foot a { color: var(--ink-muted); }
.foot a:hover { color: var(--ink); }
/* A 44px hit area around the links' small type, without moving the line. */
.foot a { display: inline-block; padding-block: 0.8rem; margin-block: -0.8rem; }

/* ---------------------------------------------------------------- Privacy policy */
/* A dialog over the poster. Display is set only while open, so the closed dialog stays hidden.
   The policy itself is the live page, brought in by open-beta.js. It is sized to be read: most of
   the window on a desktop, with the policy in a centred column no wider than the measure, and the
   whole window but a margin on a phone. */
.policy {
  width: min(60rem, calc(100% - var(--space-8)));
  height: min(64rem, calc(100vh - var(--space-8)));
  height: min(64rem, calc(100dvh - var(--space-8)));
  max-width: calc(100% - var(--space-8));
  max-height: calc(100vh - var(--space-8));
  max-height: calc(100dvh - var(--space-8));
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.policy[open] { display: flex; }
.policy::backdrop { background: var(--scrim); }
.policy-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-overlay);
  overflow: hidden;
}
.policy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex: none;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--line);
}
.policy-title { font: var(--title-lg); font-weight: 400; }
.policy-close {
  flex: none;
  min-height: var(--touch-target);
  padding: 0 var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--ink);
  font: var(--label-sm);
  cursor: pointer;
}
.policy-close:hover { background: var(--fill); }
.policy-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  /* The side padding grows with the dialog, so the text sits in a centred column at the measure. */
  padding: var(--space-6) max(var(--space-5), calc((100% - var(--measure)) / 2)) var(--space-10);
  font: var(--body-lg);
  color: var(--ink);
}
.policy-status { color: var(--ink-muted); }
.policy-body h2 { font: var(--label); margin: var(--space-6) 0 var(--space-3); }
.policy-body h2:first-child { margin-top: 0; }
.policy-body h3 { font: var(--label-sm); margin: var(--space-5) 0 var(--space-2); }
.policy-body p,
.policy-body ul,
.policy-body ol { margin: 0 0 var(--space-4); }
.policy-body ul,
.policy-body ol { padding-left: var(--space-5); }
.policy-body li + li { margin-top: var(--space-2); }
.policy-body a { color: var(--accent); }
.policy-body a:hover { color: var(--accent-strong); }
.policy-body .meta { color: var(--ink-muted); font: var(--body-sm); }
.policy-body .note {
  background: var(--sunken);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
}
.policy-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--space-4);
  font: var(--body-sm);
}
.policy-body th,
.policy-body td {
  border: 1px solid var(--line);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: top;
}
.policy-body th { background: var(--sunken); font-weight: 300; }
.policy-body code {
  font: inherit;
  background: var(--sunken);
  border-radius: var(--radius-xs);
  padding: 0 var(--space-1);
}

/* ---------------------------------------------------------------- Motion */
/* The band's lines and phone rise in on the site's 0.07s stagger. The keyframes start from
   hidden and end on the element's own style, so if animations never run, everything still shows. */
.rise {
  animation: rise var(--reveal) var(--ease-reveal) both;
  animation-delay: calc(0.15s + var(--i, 0) * 0.07s);
}
@keyframes rise { from { opacity: 0; transform: translateY(var(--rise)); } }
@keyframes fade { from { opacity: 0; } }

/* Reduced motion: fades only. */
@media (prefers-reduced-motion: reduce) {
  .rise { animation-name: fade; }
}
