/* ============================================================
   THE OPENING — the web's first run.
   ------------------------------------------------------------
   The same scene the app plays on a first launch
   (mobile/lib/components/opening/), rebuilt for a browser. The
   beats, the copy and the numbers are the ones in
   `opening/timeline.dart`; keeping them identical is what lets
   the two be retuned together.

   This file is the *look* only. Every beat's timing lives in
   static/intro.js, and every colour, type size, radius and
   control below comes from airtime.css — the scene is built out
   of the site's own objects (.card, .person, .runbar, .tag,
   .nudge, .pill, .tabs, .btn) so it shows the product as it is
   rather than a drawing of it. What is defined here is only the
   handful of things the scene needs that the site does not
   already have: a sticky note, a chat bubble, a sentence with
   slots in it, a calendar, an envelope.

   Rules carried over from the app:
     * one accent block on screen at a time (70/20/10)
     * a person's name is Fraunces, every number is IBM Plex Mono
     * all motion is a pure function of one clock, so a frame can
       be seeked to and nothing can drift
     * prefers-reduced-motion gets the last frame and the button,
       never the ride
   ============================================================ */

/* ---- the overlay ------------------------------------------- */

.jo {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--ground);
  overflow: hidden;
  /* The scene paints its own ground; nothing behind it should
     show through, including the page's scrollbar gutter. */
  contain: layout paint;
}
.jo[hidden] { display: none !important; }
/* Once the close is up, a click anywhere is the button. */
.jo.is-done { cursor: pointer; }

/* While the scene is up the page under it does not scroll. */
html.jo-open, body.jo-open { overflow: hidden; }

.jo-stage {
  position: absolute;
  inset: 0;
  /* The column the whole composition is built in. The phone
     plays this full-bleed; a browser window is far wider than
     the scene is, so the stage stays a column and the ground
     runs out to the edges — the same composition at every
     width. */
  --col: min(560px, calc(100vw - 32px));
  --colx: calc((100% - var(--col)) / 2);
}

/* Everything positioned against the column. */
.jo-col {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--colx);
  width: var(--col);
}

/* ---- the mark: one object, centre -> masthead -> the close -- */

.jo-mark {
  position: absolute;
  left: 0; top: 0;
  pointer-events: none;
  will-change: transform;
}
.jo-mark .jusa-mark { width: 100%; height: 100%; }
/* There is deliberately no rule for .hand here. The clock steps
   it six degrees at a time by setting the group's `transform`
   ATTRIBUTE — a CSS transform would outrank that, and the SVG's
   own SMIL cannot be seeked, which is why _intro.html includes
   the mark without ticking=True. The ground under the mark is
   set the same way, on --jusa-ink. */

/* The orbit at the close: clay dashes on a ring, running the way
   they ran on the wire. */
.jo-orbit {
  position: absolute;
  left: 0; top: 0;
  pointer-events: none;
  overflow: visible;
}
.jo-orbit circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 8 12;
}

/* ---- the words under the mark, beat 0 ----------------------- */

.jo-open-words {
  position: absolute;
  left: 24px; right: 24px;
  text-align: center;
  pointer-events: none;
}
.jo-wordmark {
  font-family: var(--f-display);
  font-variation-settings: 'opsz' 48, 'SOFT' 20, 'WONK' 0;
  font-weight: 700;
  font-size: 34px;
  line-height: 1.06;
  letter-spacing: -.022em;
  color: var(--accent);
  margin: 0;
}
.jo-tagline {
  margin: 10px 0 0;
  font-family: var(--f-num);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.jo-tagline .hot { color: var(--accent); }

/* ---- chrome: skip, and how much is left -------------------- */

.jo-skip {
  position: absolute;
  top: 8px; right: 10px;
  z-index: 6;
  height: 40px; min-height: 40px;
  padding: 0 14px;
  border: 0; border-radius: var(--r-ctl);
  background: transparent;
  font-family: var(--f-body); font-size: var(--t-ui); font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.jo-skip:hover { background: rgba(23, 28, 26, .06); }
.jo.is-night .jo-skip { color: var(--night-text); }
.jo.is-night .jo-skip:hover { background: rgba(242, 243, 240, .08); }

/* A hairline of elapsed time, so the length of the thing is
   honest rather than a surprise. */
.jo-progress {
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  z-index: 6;
  background: transparent;
  pointer-events: none;
}
.jo-progress > i {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  /* Information, not an alarm: enough to read how much is left,
     not so much that it reads as a page still loading. */
  opacity: .55;
}

/* ---- 1: the wall — the load of remembering ----------------- */

.jo-wall { position: absolute; left: 0; right: 0; top: 0; bottom: 0; }

.jo-clock {
  font-family: var(--f-num);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--night-muted);
}

.jo-bubble {
  max-width: 300px;
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--night-2);
  border-radius: 4px 14px 14px 14px;
}
.jo-bubble .who {
  display: block;
  font-family: var(--f-num); font-size: 9px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--night-muted);
  margin-bottom: 3px;
}
.jo-bubble .said {
  display: block;
  font-family: var(--f-body); font-size: 15px; line-height: 1.45;
  color: var(--night-text);
}

.jo-question {
  margin: 16px 0 0;
  font-family: var(--f-display);
  font-variation-settings: 'opsz' 32, 'SOFT' 20, 'WONK' 0;
  font-weight: 600; font-size: 26px; line-height: 1.06; letter-spacing: -.022em;
  color: var(--night-text);
}
.jo-question .hot { color: var(--accent-bright); }

/* A note on the wall: paper, a little off true, one job on it. */
.jo-note {
  position: absolute;
  padding: 10px 10px 12px;
  background: var(--ground-2);
  border-radius: 2px;
  box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .7);
  transform-origin: 50% 0;
}
.jo-note::before {              /* the pin */
  content: "";
  position: absolute; top: -4px; left: 50%;
  width: 8px; height: 8px; margin-left: -4px;
  border-radius: var(--r-round);
  background: var(--ink-2);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .35);
}
.jo-note.is-loose::before { display: none; }
.jo-note .head {
  display: block;
  font-family: var(--f-num); font-size: 9px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.jo-note .line {
  display: block; margin-top: 4px;
  font-family: var(--f-display);
  font-variation-settings: 'opsz' 18, 'SOFT' 20, 'WONK' 0;
  font-weight: 600; font-size: 15px; line-height: 1.15; color: var(--ink);
}
.jo-note .heart { position: absolute; right: 8px; bottom: 6px; }

/* ---- the captions on the night ----------------------------- */

.jo-caption {
  position: absolute;
  left: 24px; right: 24px;
  text-align: center;
  pointer-events: none;
}
.jo-caption .one,
.jo-caption .two {
  margin: 0;
  font-family: var(--f-display);
  font-variation-settings: 'opsz' 28, 'SOFT' 20, 'WONK' 0;
  font-weight: 600; line-height: 1.1; letter-spacing: -.022em;
  color: var(--night-text);
}
.jo-caption .one { font-size: 24px; }
.jo-caption .two { font-size: 22px; margin-top: 8px; }
.jo-caption .hot { color: var(--accent-bright); }
.jo-caption .sub {
  margin: 6px 0 0;
  font-family: var(--f-body); font-size: 14.5px; line-height: 1.45;
  color: var(--night-muted);
}

/* ---- 2: the house — what a miss costs ---------------------- */

.jo-house { position: absolute; left: 0; right: 0; transform-origin: 50% 0; }
.jo-house svg { display: block; width: 100%; height: auto; }
.jo-house .ink {
  fill: none; stroke: var(--night-muted); stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round;
}
.jo-house .wire  { fill: none; stroke: var(--night-3); stroke-width: 2; }
.jo-house .flow  { fill: none; stroke: var(--accent); stroke-width: 2.5;
                   stroke-linecap: round; stroke-dasharray: 6 8; }
.jo-house .glow  { fill: var(--accent-bright); }
.jo-house .steam { fill: var(--night-muted); }
.jo-house .thin  { fill: none; stroke: var(--night-muted); stroke-width: 1.5; }
.jo-house .meter-box { fill: var(--night); stroke: var(--night-text); stroke-width: 1.5; }
.jo-house .meter-txt {
  fill: var(--night-text);
  font-family: var(--f-num); font-size: 10px; font-weight: 600;
  text-anchor: middle; dominant-baseline: central;
}
.jo-house .low-box { fill: rgba(178, 122, 21, .22); }
.jo-house .low-txt {
  fill: var(--warning-bright);
  font-family: var(--f-num); font-size: 8.5px; font-weight: 600;
  letter-spacing: 1px; text-anchor: middle; dominant-baseline: central;
}

/* ---- the app: a paper panel that rises over the night ------- */

.jo-panel {
  position: absolute;
  background: var(--ground);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}
.jo-screens { position: absolute; inset: 0; }
.jo-screen {
  position: absolute;
  left: 0; right: 0; top: 0;
  padding: 0 24px;
}
.jo-screen > .fit {
  /* The app caps a screen at 400 because a phone is about that
     wide. A browser can spare a little more, and the extra 40
     stops a long "every month, on the 25th" truncating. */
  width: min(100%, 440px);
  margin: 0 auto;
  transform-origin: 50% 0;
}
/* The close fills the panel, so its button sits at the bottom
   where a hand already is. */
.jo-screen.is-claim {
  top: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center;
}
.jo-screen.is-claim > .fit {
  /* Column flow, so the 440 cap is the cross axis and a flex
     basis of 0 cannot stretch it to the width of the window. */
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
}

.jo-lbl {
  font-family: var(--f-num); font-size: var(--t-label); font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.jo-h {
  margin: 0;
  font-family: var(--f-display);
  font-variation-settings: 'opsz' 36, 'SOFT' 20, 'WONK' 0;
  font-weight: 600; line-height: 1.06; letter-spacing: -.022em; color: var(--ink);
}
.jo-h .hot { color: var(--accent); }
.jo-p { margin: 0; font-family: var(--f-body); font-size: 14.5px; line-height: 1.45; color: var(--ink-soft); }
.jo-p.sm { font-size: 13.5px; color: var(--muted); }
.jo-p.strong { font-weight: 600; color: var(--ink); }
.jo-p .hot { color: var(--accent); }
.jo-num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.jo-stack { display: flex; flex-direction: column; }

/* A text field, frozen mid-typing. */
.jo-field {
  min-height: 44px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  font-family: var(--f-num); font-size: 15px;
  color: var(--ink);
  display: flex; align-items: center;
}
.jo-field.is-focused { border-color: var(--accent); border-width: 1.5px; padding: 9.5px 11.5px; }
.jo-field.is-prose { font-family: var(--f-body); font-size: 14px; min-height: 56px; align-items: flex-start; }
.jo-field .caret { color: var(--accent); }

/* ---- 4: the turn — the sentence with slots in it ------------ */

.jo-sentence {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 4px 8px;
}
.jo-sentence .word {
  padding: 6px 0;
  font-family: var(--f-display);
  font-variation-settings: 'opsz' 24, 'SOFT' 20, 'WONK' 0;
  font-weight: 600; font-size: 22px; line-height: 1.06; color: var(--ink-soft);
}
.jo-slot { display: inline-flex; align-items: center; }
.jo-slot .blank {
  display: block; height: 32px; margin: 6px 0;
  border-bottom: 2px solid var(--line-strong);
}
.jo-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--r-round);
  font-family: var(--f-display);
  font-variation-settings: 'opsz' 24, 'SOFT' 20, 'WONK' 0;
  font-weight: 600; font-size: 20px; line-height: 1.2; color: var(--accent-hover);
  transform-origin: 50% 50%;
}
.jo-chip.has-av { padding-left: 6px; }
.jo-chip .person-av { width: 24px; height: 24px; font-size: 10px; }

/* The year, unrolling like a till receipt. */
.jo-spool-row {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px 6px;
}
.jo-spool-row .dot {
  width: 6px; height: 6px; border-radius: var(--r-round);
  background: var(--ink-2); flex: none;
}
.jo-spool-row .when {
  font-family: var(--f-num); font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.jo-spool-row .what {
  flex: 1; min-width: 0;
  font-family: var(--f-num); font-size: var(--t-label); font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.jo-rule { height: 1px; background: var(--line); }

/* ---- 4.5: birthdays — the switch --------------------------- */

.jo-switch {
  width: 40px; height: 24px; flex: none;
  border-radius: var(--r-round);
  background: var(--ground-3);
  position: relative;
  transition: none;
}
.jo-switch > i {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: var(--r-round);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
}

/* A compact row puts the name and the detail on one line, so the
   name must not wrap and the detail must be the thing that gives
   — the site's rule, restated here because the scene's rows are
   narrower than any real screen's. */
.jo-screen .person.is-compact .person-name {
  flex: none; white-space: nowrap; overflow-wrap: normal;
}
.jo-screen .person.is-compact .person-rel { flex: 1; min-width: 0; }
.jo-screen .person.is-compact .person-side { flex: none; }

/* ---- 5: the month — the calendar --------------------------- */

.jo-cal { position: relative; }
.jo-cal-head { display: grid; grid-template-columns: repeat(7, 1fr); }
.jo-cal-head span {
  text-align: center;
  font-family: var(--f-num); font-size: var(--t-label); font-weight: 500;
  letter-spacing: .14em; color: var(--muted);
}
.jo-cal-grid { position: relative; margin-top: 6px; }
.jo-cal-cell {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
}
.jo-cal-cell .d {
  font-family: var(--f-num); font-size: 12px; font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.jo-cal-cell.is-past .d { color: var(--subtle); }
.jo-cal-cell.is-marked .d { font-weight: 600; color: var(--ink); }
.jo-cal-cell .marks { height: 8px; display: flex; align-items: center; gap: 2px; }
.jo-cal-cell .marks i {
  width: 6px; height: 6px; flex: none;
  border-radius: var(--r-round);
  border: 1px solid var(--line-strong);
}
.jo-cal-ring {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: var(--r-round);
  pointer-events: none;
}

/* the transaction's three steps */
.jo-steps { display: flex; align-items: flex-start; }
.jo-step { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 80px; }
.jo-step .bead {
  width: 14px; height: 14px; border-radius: var(--r-round);
  background: var(--surface); border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
}
.jo-step.is-active .bead { border: 2px solid var(--accent); }
.jo-step.is-done .bead { background: var(--ink-2); border-color: var(--ink-2); }
.jo-step .bead svg { display: none; }
.jo-step.is-done .bead svg { display: block; }
.jo-step .cap {
  text-align: center;
  font-family: var(--f-num); font-size: 8px; font-weight: 500;
  letter-spacing: .8px; text-transform: uppercase; color: var(--muted);
  line-height: 1.25;
}
.jo-step.is-done .cap { color: var(--ink); }
.jo-steps .link { flex: 1; height: 2px; margin: 6px 6px 0; background: var(--ground-3); }
.jo-steps .link.is-done { background: var(--ink-2); }

/* ---- the envelope: a send, framed as a letter --------------- */

.jo-env-fit {
  height: 134px;                  /* 190 * .705, the app's fit */
  display: flex; justify-content: center;
}
.jo-env-fit > .jo-env { transform: scale(.705); transform-origin: 50% 0; }
.jo-env { position: relative; margin: 0 auto; }
.jo-env svg { display: block; overflow: visible; }
.jo-env .body { fill: var(--ground-2); stroke: var(--line-strong); stroke-width: 1.5; }
.jo-env .pocket { fill: var(--ground-3); stroke: var(--line-strong); stroke-width: 1.5; stroke-linejoin: round; }
.jo-env .flap { stroke: var(--line-strong); stroke-width: 1.5; stroke-linejoin: round; }
.jo-letter {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}
.jo-letter .title {
  font-family: var(--f-display);
  font-variation-settings: 'opsz' 18, 'SOFT' 20, 'WONK' 0;
  font-weight: 600; font-size: 14px; line-height: 1.15; color: var(--ink);
}
.jo-letter .line {
  margin-top: 4px;
  font-family: var(--f-body); font-size: 11.5px; line-height: 1.35; color: var(--ink-soft);
}
.jo-stamp {
  position: absolute;
  padding: 6px 10px;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  background: var(--accent-soft);
  font-family: var(--f-num); font-size: var(--t-label); font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent-hover);
  white-space: nowrap;
}

/* ---- the other end: a note pinned to the wall -------------- */

.jo-pin {
  position: relative;
  width: 186px; flex: none;
  padding: 12px 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: var(--shadow-lift);
  transform-origin: 50% 0;                 /* it swings from the nail */
}
.jo-pin::before {                          /* the nail */
  content: "";
  position: absolute; top: -5px; left: 50%;
  width: 9px; height: 9px; margin-left: -4.5px;
  border-radius: var(--r-round);
  background: var(--ink-2);
  box-shadow: inset 1.5px 1.5px 0 rgba(255, 255, 255, .4);
}
.jo-pin::after {                           /* the dog-ear */
  content: "";
  position: absolute; right: 0; bottom: 0;
  border-width: 0 0 14px 14px;
  border-style: solid;
  border-color: transparent transparent var(--ground-2) transparent;
  filter: drop-shadow(-1px -1px 0 var(--line));
}
.jo-pin .head {
  display: block;
  font-family: var(--f-num); font-size: 9px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.jo-pin p {
  margin: 6px 0 0;
  font-family: var(--f-body); font-size: 12px; line-height: 1.4; color: var(--ink);
}
.jo-pin .heart { position: absolute; top: 10px; right: 10px; }

/* ---- 7: the close ------------------------------------------ */

.jo-claim {
  margin: 0;
  font-family: var(--f-display);
  font-variation-settings: 'opsz' 40, 'SOFT' 20, 'WONK' 0;
  font-weight: 600; font-size: 28px; line-height: 1.1; letter-spacing: -.022em;
  color: var(--ink); text-align: center;
}
.jo-claim .hot { color: var(--accent); }
.jo-proof {
  display: flex; flex-direction: column; gap: 8px;
  text-align: center;
  font-family: var(--f-num); font-size: var(--t-label); font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}

/* The one flattering line, underlined by a hand. */
.jo-underlined {
  display: inline-flex; flex-direction: column;
  max-width: 100%;
}
.jo-underlined .said {
  font-family: var(--f-body); font-size: 15.5px; font-style: italic;
  line-height: 1.35; color: var(--ink-2);
  white-space: nowrap;
}
.jo-pen { display: block; height: 26px; width: 100%; overflow: visible; }
.jo-pen path {
  fill: none; stroke: var(--accent);
  stroke-linecap: round; stroke-linejoin: round;
}

/* The button, powered: a current runs round its edge, the same
   flow that ran along the wire and circled the mark. */
/* line-height:0 and a block button: an inline-flex child leaves
   a baseline gap under it, and the current is drawn into a
   viewBox the size of the button, so a few stray pixels of
   height would push the circuit outside the clay. */
.jo-live { position: relative; display: block; line-height: 0; }
.jo-live .btn { display: flex; width: 100%; line-height: 1.2; }
.jo-live svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.jo-live rect { fill: none; }
.jo-live .track { stroke: rgba(255, 255, 255, .12); stroke-width: 1; }
.jo-live .glow {
  stroke: var(--accent-bright); stroke-width: 3.5; stroke-linecap: round;
  stroke-dasharray: 18 120; opacity: .45; filter: blur(2px);
}
.jo-live .spark {
  stroke: rgba(255, 255, 255, .7); stroke-width: 1.25; stroke-linecap: round;
  stroke-dasharray: 18 120;
}

/* ---- the heart, drawn --------------------------------------- */
.jo-heart { display: inline-block; vertical-align: middle; fill: var(--accent); }

/* ---- narrow screens ----------------------------------------- */

@media (max-width: 520px) {
  .jo-question { font-size: 22px; }
  .jo-caption .one { font-size: 21px; }
  .jo-caption .two { font-size: 19px; }
  .jo-claim { font-size: 24px; }
  .jo-screen { padding: 0 16px; }
  .jo-pin { width: 150px; }
}

/* ---- no ride ------------------------------------------------ */
/* With animations turned off in the system settings the scene is
   not played at all: intro.js mounts it on its last frame, with
   the button, and this stops anything that would still move. */
@media (prefers-reduced-motion: reduce) {
  .jo * { animation: none !important; transition: none !important; }
}
