/* Release notes (/release-notes): every TestFlight build, newest first, on a grey sheet like the
   waitlist page's card, over the card's own dot grid spread across the background. The type is the
   legal pages' (legal.css). What's coming sits closed at the top, so the latest build is always in
   the first screen. Room is kept for the site's nav (styles.css), on the left or along the bottom. */

:root {
  --lime: #e4ff19;
  --meta: 180px;
  --columns: 48px;
  --row: 56px;    /* above and below each build */
  --first: 48px;  /* above the first, under the closed panel */
  --rail: 40px;   /* from the timeline's line to the builds */
  /* The markers are solid, mixed over the sheet's grey, so the line never shows through them. */
  --node-fill: var(--bg-surface);
  --node-ring: #6f6f6f;    /* white at 40% */
  --node-faint: #444;      /* white at 22% */
  --node-halo: #2d3110;    /* lime at 14% */
  --soon-pad: 20px;   /* the closed panel's padding above its number */
}

/* The background: the hero grid's 3pt squares every 7pt, lit from the top and fading out. It's
   drawn rather than an image, since the site's CSP allows no data: images. */
.notes-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: conic-gradient(at 3px 3px, transparent 75%, rgb(255 255 255 / 0.14) 0);
  background-size: 7px 7px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 0%, rgb(0 0 0 / 0.55) 40%, transparent 85%);
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 0%, rgb(0 0 0 / 0.55) 40%, transparent 85%);
}

/* The same grid alive (js/grid.js): light drifting through it. It takes over from the still one
   above once its first frame is drawn. */
.grid-field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100lvh;
  display: block;
  pointer-events: none;
  opacity: 0;
}

.has-grid .grid-field { opacity: 1; }
.has-grid .notes-page::before { display: none; }

/* The opening: the grid's light opens out from the top (grid.js), the sheet comes up into place,
   then its words rise in order, the way the waitlist card's do, and the nav comes last. Builds
   further down rise into place as they're scrolled to (reveal.js). */

/* The still grid waits a moment, so the live one can take over before it's ever seen. */
.notes-page::before { animation: fade 900ms ease-out 300ms backwards; }

.sheet { animation: arrive-sheet 900ms var(--ease-out) 120ms backwards; }

@keyframes arrive-sheet { from { opacity: 0; transform: translateY(40px) scale(0.98); } }

.sheet-head .wordmark,
.sheet-title .title,
.sheet-title .body,
.timeline,
.notes-page .site-nav {
  animation: rise 700ms var(--ease-out) backwards;
}

.sheet-head .wordmark { animation-delay: 360ms; }
.sheet-title .title { animation-delay: 440ms; }
.sheet-title .body { animation-delay: 520ms; }
.timeline { animation-delay: 600ms; }
.notes-page .site-nav { animation-delay: 820ms; }

/* What's in a build rises; its piece of line stays, so the marker slides down the line into
   place. */
.reveal-ready .release > * {
  transition:
    opacity 700ms ease,
    translate 800ms var(--ease-out);
}

.release.is-waiting > * {
  opacity: 0;
  translate: 0 32px;
}

@media (prefers-reduced-motion: reduce) {
  .notes-page::before,
  .sheet-head .wordmark,
  .sheet-title .title,
  .sheet-title .body,
  .timeline,
  .notes-page .site-nav { animation: none; }

  .sheet { animation: fade 300ms ease; }
}

/* The sheet: the waitlist card's grey, corners and heavy shadow. */
.sheet {
  position: relative;
  width: min(960px, calc(100% - 224px));
  margin: 60px auto;
  padding: 72px 64px 0;
  border-radius: 20px;
  background: var(--bg-surface);
  box-shadow:
    0 32px 96px 24px rgb(0 0 0 / 0.9),
    0 8px 24px rgb(0 0 0 / 0.6);
}

.sheet-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  padding-bottom: 56px;
  text-align: center;
}

.sheet-head .wordmark {
  color: var(--text-primary);
  text-decoration: none;
}

.sheet-title {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* What's coming: closed, on the card's inset grey (the waitlist's email field), reaching a little
   past the columns so what's inside lines up with the builds below. */

.soon {
  margin: 0 -24px;
  padding: 0 24px;
  border-radius: 16px;
  background: var(--bg-surface-inset);
}

.soon summary {
  display: grid;
  grid-template-columns: var(--meta) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px var(--columns);
  padding: 20px 0;
  list-style: none;
  cursor: pointer;
  border-radius: 16px;
}

.soon summary::-webkit-details-marker { display: none; }

.soon summary:focus-visible { outline-offset: 4px; }

.soon-meta {
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

/* Body/Medium */
.soon-title {
  color: var(--text-primary);
  font: 600 16px/1.4 var(--sans);
  letter-spacing: -0.32px;
  text-wrap: balance;
}

/* Callout, with Phosphor's caret turning over when it's open. */
.soon-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font: 500 14px/1.2 var(--sans);
  white-space: nowrap;
  transition: color 160ms ease;
}

.soon-toggle svg {
  width: 16px;
  height: 16px;
  transition: rotate 240ms var(--ease-out);
}

.soon-hide,
.soon[open] .soon-show { display: none; }

.soon[open] .soon-hide { display: inline; }
.soon[open] .soon-toggle svg { rotate: 180deg; }

@media (hover: hover) and (pointer: fine) {
  .soon summary:hover .soon-toggle { color: var(--text-primary); }
}

.soon-body {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin-left: calc(var(--meta) + var(--columns));
  padding: 8px 0 40px;
}

/* Opening slides it down where the browser can size to its content; elsewhere it opens at once. */
@media (prefers-reduced-motion: no-preference) {
  @supports (interpolate-size: allow-keywords) {
    .soon { interpolate-size: allow-keywords; }

    .soon::details-content {
      height: 0;
      opacity: 0;
      overflow: clip;
      transition:
        height 360ms var(--ease-out),
        opacity 240ms ease,
        content-visibility 360ms allow-discrete;
    }

    .soon[open]::details-content {
      height: auto;
      opacity: 1;
    }
  }
}

/* The builds */

/* The timeline: a line down the left of every build, coming soon included, with a marker level
   with each build's number. It runs from the first marker to the last and no further, drawn a
   piece at a time from one marker to the next, so it stays on them whatever wraps or opens. */
.timeline {
  position: relative;
  padding-left: var(--rail);
}

/* From the top of a build to the middle of its number: the overline, the gap, half the number. */
:root { --dot: calc(12px * 1.2 + 8px + 20px * 0.6); }

.release-build { position: relative; }

.release-build::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: calc(-1 * var(--rail) - 4px);
  top: calc(50% - 4.5px);
  width: 9px;
  height: 9px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1.5px solid var(--node-ring);
  background: var(--node-fill);
}

/* Still to come: a fainter ring. */
.soon .release-build::before { border-color: var(--node-faint); }

/* The build testers have now: lime, like its overline, with a soft halo. */
.release-latest .release-build::before {
  border: 0;
  background: var(--lime);
  box-shadow: 0 0 0 4px var(--node-halo);
}

/* Milestones: a solid grey point rather than a ring. */
.milestone .release-build::before {
  border: 0;
  background: var(--node-ring);
}

/* The pieces of line. Coming soon's runs from its marker down to the first build's; each build's
   runs from its marker down to the next one's. The markers are drawn over them, so the line meets
   each at its middle and ends inside the first and last. */
.soon-step,
.release { position: relative; }

.soon-step::after,
.release:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(-1 * var(--rail));
  width: 1px;
  background: rgb(255 255 255 / 0.12);
}

.soon-step::after {
  top: calc(var(--soon-pad) + var(--dot));
  bottom: calc(-1 * (var(--first) + var(--dot)));
}

.release:not(:last-child)::after {
  top: calc(var(--row) + var(--dot));
  bottom: calc(-1 * (var(--row) + var(--dot)));
}

.release:first-child:not(:last-child)::after { top: calc(var(--first) + var(--dot)); }

.releases {
  display: flex;
  flex-direction: column;
}

.release {
  position: relative;
  display: grid;
  grid-template-columns: var(--meta) minmax(0, 1fr);
  gap: var(--columns);
  padding: var(--row) 0;
  scroll-margin-top: 24px;
}

/* Between builds, a rule across the notes only, starting where they start. */
.release + .release::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: calc(var(--meta) + var(--columns));
  height: 1px;
  background: var(--border-subtle);
}

/* The first build under the closed panel needs no rule of its own. */
.release:first-child { padding-top: var(--first); }

/* What the build is and when: it stays in view while its notes scroll by. */
.release-meta {
  position: sticky;
  /* Sticky makes its own layer, so its marker's z-index only counts inside it: the column itself
     has to sit over the line, or the line runs through the marker. */
  z-index: 1;
  top: 40px;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

/* Label/Caps: an overline over the build's number. */
.chip {
  color: var(--text-secondary);
  font: 600 12px/1.2 var(--sans);
  letter-spacing: 0.48px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* The build testers have now: the page's one highlight, in the app's lime. */
.chip-latest { color: var(--lime); }

.chip-quiet { color: var(--text-tertiary); }

/* Headline/Bold */
.release-build {
  color: var(--text-primary);
  font: 700 20px/1.2 var(--display);
  letter-spacing: -0.4px;
  text-transform: uppercase;
}

/* Callout/Regular */
.release-when {
  color: var(--text-tertiary);
  font: 400 14px/1.4 var(--sans);
  font-variant-numeric: tabular-nums;
}

.release-body {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.release-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Title/3 */
.release-head h2 {
  margin: 0;
  color: var(--text-primary);
  font: 700 28px/1.2 var(--display);
  letter-spacing: -0.84px;
  text-wrap: balance;
}

/* New, Improved, Fixed */

.changes {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.changes ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.changes li {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Body/Medium */
.changes h3 {
  margin: 0;
  color: var(--text-primary);
  font: 600 16px/1.4 var(--sans);
  letter-spacing: -0.32px;
}

/* Body/Regular, in text/secondary, like the policies' own words. */
.changes li p,
.fixes li {
  color: var(--text-secondary);
  font: 400 16px/1.6 var(--sans);
  letter-spacing: -0.32px;
  text-wrap: pretty;
}

/* Fixes are one line each, so they're a list with dots rather than headed items. */
.changes .fixes { gap: 12px; }

.fixes li {
  position: relative;
  display: block;
  padding-left: 20px;
}

.fixes li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.35);
}

/* The foot, like the card's: inside the sheet, under a rule. */
.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  padding: 32px 0 40px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font: 400 14px/1.4 var(--sans);
}

.sheet-foot a { color: var(--text-tertiary); }

/* Too narrow for two columns: each build's chip, number and date sit in a row over its notes. */
@media (max-width: 1099px) {
  .sheet {
    width: min(720px, calc(100% - 224px));
    padding: 64px 40px 0;
  }

  .soon { margin: 0 -16px; padding: 0 16px; }

  .soon summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 24px;
  }

  .soon-meta {
    grid-column: 1 / -1;
    flex-direction: row;
  }

  .soon-body { margin-left: 0; }

  .release {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  /* One column: each title is just off the line, and the rules run the full width of the notes. */
  :root { --rail: 32px; }

  .release + .release::before { left: 0; }

  .release-meta {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
  }

  /* The overline keeps its own line, over the number and date. */
  .soon-meta { flex-wrap: wrap; align-items: baseline; gap: 8px 16px; }
  .soon-meta .chip,
  .release-meta .chip { flex-basis: 100%; }
}

/* The nav moves to the bottom (styles.css): the sheet takes the width back, with the waitlist
   page's 16pt either side, and keeps clear of the nav below. */
@media (max-width: 819px) {
  .sheet {
    width: calc(100% - 32px);
    margin-bottom: calc(88px + env(safe-area-inset-bottom));
  }
}

/* The phone, like the waitlist's own phone design: no container, and the grid only behind the
   top of the page, fading out by the title. It's part of the page there, not pinned to the
   screen, so it scrolls away with the header instead of sitting under the words. The nav pill is
   at the top-left (styles.css), and AHEAD sits level with it, like a bar. */
@media (max-width: 640px) {
  .notes-page::before,
  .grid-field {
    position: absolute;
    inset: 0 0 auto;
    height: 440px;
  }

  .notes-page::before {
    -webkit-mask-image: linear-gradient(#000, rgb(0 0 0 / 0.4) 160px, transparent 340px);
    mask-image: linear-gradient(#000, rgb(0 0 0 / 0.4) 160px, transparent 340px);
  }

  .sheet {
    width: 100%;
    margin: 0 0 calc(32px + env(safe-area-inset-bottom));
    /* AHEAD's middle level with the pill's: 16pt down, 48pt tall. */
    padding: 29px 20px 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  .sheet-head { gap: 44px; padding-bottom: 40px; }

  .soon { margin: 0 -12px; padding: 0 12px; }

  /* The title gets the whole width, with "See what's coming" on its own row under it. */
  .soon summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px 0;
    padding: 16px 0;
  }

  .soon-toggle { justify-self: start; }

  :root { --soon-pad: 16px; }

  .soon-body { padding-bottom: 32px; }

  :root {
    --row: 40px;
    --first: 40px;
    --rail: 20px;
    --node-fill: #000;
    --node-ring: #666;
    --node-faint: #383838;
    --node-halo: #202404;
  }

  .release { gap: 24px; }

  .release-body { gap: 40px; }

  /* Title/4 */
  .release-head h2 {
    font-size: 22px;
    letter-spacing: -0.66px;
  }

  .changes li p,
  .fixes li {
    font-size: 15px;
    letter-spacing: -0.3px;
  }

  .changes ul { gap: 20px; }

  .sheet-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
  }
}
