/* The opening: a short film before the story's first screen. Rules in docs/story-direction.md, "Opening" */

/* Until the film is on screen, the story's ground covers the page, so nothing of the story shows first */
html.opening-on body::after { content: ""; position: fixed; inset: 0; z-index: 2147482000; background: var(--bg); }
/* The page's own scrollbar stays, so the page underneath keeps its width; it is only hidden while the film runs */
html.opening-on { scrollbar-color: transparent transparent; }
/* The first screen's cursor holds still, on the real page and on the copy inside the film alike, until the hand-over */
html.opening-hold :is(.opening, .typed-end) .caret { animation: none; }

.opening-film {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  overflow: hidden;
  background: var(--bg);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  --glass: 0;
}
/* The room: two photographs, the live screens on them, the screens' glass over those, then the air and the lens */
.of-room { position: absolute; inset: 0; pointer-events: none; }
/* The move videos play unseen; their frames are painted onto the canvases beside them */
.of-video { position: absolute; left: 0; top: 0; inline-size: 2px; block-size: 2px; opacity: 0; pointer-events: none; }
.of-move { position: absolute; left: 0; top: 0; transform-origin: 0 0; visibility: hidden; opacity: 0; }
.of-photo, .of-refl { position: absolute; left: 0; top: 0; max-inline-size: none; transform-origin: 0 0; visibility: hidden; opacity: 0; }
.of-refl { mix-blend-mode: screen; }
.of-fx { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; visibility: hidden; opacity: 0; }
/* Grain at about the strength of a fine film stock: felt rather than seen */
.of-bloom { position: absolute; inset: 0; visibility: hidden; opacity: 0; mix-blend-mode: screen;
  background: radial-gradient(130% 110% at 12% 18%, #fff6e6 0%, #ffe9c8 38%, #f3d9b0 70%, #d9c3a0 100%); }
.of-vignette { position: absolute; inset: 0; opacity: var(--glass); background: radial-gradient(120% 95% at 50% 46%, transparent 55%, rgb(0 0 0 / .32)); }
.of-screens { position: absolute; inset: 0; pointer-events: none; }
.of-screens > div { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; visibility: hidden; opacity: 0; backface-visibility: hidden; }
/* A screen in a sunlit room is a little dimmer than paper white; the glare on its glass comes from the photograph */
.of-glass {
  position: absolute; inset: 0; pointer-events: none; opacity: var(--glass);
  background:
    rgb(8 10 9 / .1);
}

/* The question that opens the film; answering it is the click that lets the score play */
.of-start { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 28px; padding: 24px; text-align: center; transition: opacity .6s; }
.of-start.is-gone { opacity: 0; pointer-events: none; }
.of-ask { margin: 0; max-inline-size: 16em; font: italic 400 clamp(1.7rem, min(6vw, 8vh), 4.2rem)/1.2 var(--display); color: var(--ink); text-wrap: balance; }
.of-begin {
  display: inline-flex; align-items: center; min-block-size: 48px; padding: 0 24px;
  border: 1px solid var(--ink-3); border-radius: 99px; background: transparent; color: var(--ink);
  font: 500 1rem/1 var(--data); cursor: pointer;
  &:hover { background: rgb(248 249 240 / .08); }
  &:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
}

/* Beat 1: one line, slightly above the middle */
.of-line {
  position: absolute; left: 16px; right: 16px; top: 44%; margin: 0;
  transform: translateY(-50%);
  text-align: center; white-space: pre-wrap;
  /* Long enough lines wrap, as typing in a narrow box does; the single words stay on one line */
  max-inline-size: 18em; margin-inline: auto;
  font: italic 400 clamp(1.7rem, min(7vw, 9vh), 5rem)/1.2 var(--display);
  color: var(--ink);
  letter-spacing: -.005em;
}
/* Over the room: the same hand as the first lines, light on a soft shade so it reads against today's bright window */
.of-next {
  position: absolute; left: 16px; right: 16px; top: 44%; margin: 0 auto; max-inline-size: 18em;
  transform: translateY(-50%); text-align: center; white-space: pre-wrap;
  font: italic 400 clamp(1.7rem, min(6.4vw, 8.5vh), 4.6rem)/1.2 var(--display);
  color: #fffaf0; text-shadow: 0 1px 2px rgb(0 0 0 / .35), 0 4px 40px rgb(0 0 0 / .45);
  visibility: hidden; opacity: 0;
}
.of-next::before { content: ""; position: absolute; inset: -60% -30%; z-index: -1; background: radial-gradient(closest-side, rgb(10 12 10 / .38), transparent); }
.of-caret { display: inline-block; inline-size: 2px; block-size: 1.02em; margin-inline-start: .05em; vertical-align: -.17em; background: currentColor; }
@keyframes of-blink { 50% { visibility: hidden; } }
.of-fly { position: absolute; left: 0; top: 0; inline-size: 2px; background: var(--ink); visibility: hidden; opacity: 0; }

/* The phone framing of beat 2: the compose window alone, as wide as the screen */
.of-pcompose { position: absolute; inset: 0 0 auto; block-size: calc(100% - 76px - env(safe-area-inset-bottom)); transform-origin: 0 0; visibility: hidden; opacity: 0; background: #fff; box-shadow: 0 10px 30px rgb(0 0 0 / .4); }

}

/* ----- Gmail as it was in July 2016: layout, colour and type only ----- */
.g { background: #fff; color: #222; font: 13px/1.4 Arial, "Liberation Sans", Helvetica, sans-serif; -webkit-font-smoothing: auto; }
:is(.g, .d, .p, .g-compose) svg { inline-size: 20px; block-size: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:is(.g, .d, .p, .g-compose) svg.fill { fill: currentColor; stroke: none; }
.g-top { position: absolute; inset: 0 0 auto; block-size: 60px; background: #f1f1f1; border-bottom: 1px solid #e5e5e5; }
.g-search { position: absolute; left: 150px; top: 15px; display: flex; }
.g-search span { inline-size: 560px; block-size: 29px; background: #fff; border: 1px solid #d9d9d9; border-top-color: #c0c0c0; }
.g-search b { display: grid; place-items: center; inline-size: 66px; block-size: 29px; margin-left: -1px; background: #4d90fe; border: 1px solid #3079ed; border-radius: 0 2px 2px 0; color: #fff; }
.g-search b svg { inline-size: 17px; block-size: 17px; stroke-width: 2.2; }
.g-top-r { position: absolute; right: 30px; top: 14px; display: flex; align-items: center; gap: 26px; color: #666; }
.g-top-r svg { inline-size: 22px; block-size: 22px; }
.g-avatar { inline-size: 32px; block-size: 32px; border-radius: 50%; background: radial-gradient(circle at 50% 38%, #c9ced1 0 26%, transparent 27%), radial-gradient(circle at 50% 108%, #c9ced1 0 46%, transparent 47%), #8e989e; }
.g-bar { position: absolute; left: 0; right: 0; top: 61px; block-size: 57px; border-bottom: 1px solid #e5e5e5; display: flex; align-items: center; gap: 8px; padding-left: 210px; }
.g-label { position: absolute; left: 28px; top: 17px; display: inline-flex; align-items: center; gap: 2px; color: #dd4b39; font-size: 18px; }
.g-label svg { inline-size: 12px; block-size: 12px; stroke-width: 2; }
.g-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; block-size: 27px; min-inline-size: 34px; padding: 0 8px; background: #f5f5f5; border: 1px solid rgb(0 0 0 / .1); border-radius: 2px; color: #666; font-size: 11px; font-weight: 700; }
.g-btn svg { inline-size: 15px; block-size: 15px; }
.g-btn > svg:last-child:not(:first-child) { inline-size: 9px; block-size: 9px; }
.g-btn-text { color: #444; font-size: 11px; }
.g-count { margin-left: auto; color: #222; font-size: 11.5px; padding-right: 8px; }
.g-btn-pager { min-inline-size: 30px; padding: 0 4px; }
.g-btn-gear { margin: 0 28px 0 10px; }
.g-box { display: inline-block; inline-size: 13px; block-size: 13px; border: 1px solid #c6c6c6; border-radius: 1px; background: #fff; flex: none; }
.g-side { position: absolute; left: 0; top: 119px; inline-size: 200px; }
.g-compose-btn { display: block; inline-size: 118px; margin: 14px 0 16px 28px; block-size: 29px; line-height: 27px; text-align: center; background: #d14836; border: 1px solid #b0281a; border-radius: 2px; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.g-side ul { list-style: none; margin: 0; padding: 0; }
.g-side li { block-size: 27px; line-height: 27px; padding-left: 28px; color: #222; font-size: 13px; display: flex; align-items: center; gap: 2px; }
.g-side li svg { inline-size: 11px; block-size: 11px; stroke-width: 2; }
.g-side li.on { color: #dd4b39; font-weight: 700; background: #eee; }
.g-main { position: absolute; left: 200px; right: 0; top: 119px; bottom: 0; }
.g-tabs { display: flex; block-size: 54px; border-bottom: 1px solid #e5e5e5; }
.g-tabs span { display: flex; align-items: center; gap: 14px; inline-size: 242px; padding-left: 22px; color: #616161; font-size: 14px; font-weight: 700; border-bottom: 4px solid transparent; margin-bottom: -1px; }
.g-tabs span svg { inline-size: 21px; block-size: 21px; stroke-width: 1.7; }
.g-tabs span.on { color: #d23f31; border-bottom-color: #d23f31; }
.g-row { display: flex; align-items: center; block-size: 36px; padding: 0 16px 0 12px; border-bottom: 1px solid #ebebeb; background: rgb(242 242 242 / .8); color: #555; }
.g-row.unread { background: #fff; color: #222; font-weight: 700; }
.g-row .g-box { margin-right: 13px; }
.g-star { display: inline-flex; color: #c4c4c4; margin-right: 16px; }
.g-star svg { inline-size: 17px; block-size: 17px; stroke-width: 1.4; }
.g-from, .g-subj, .g-date { white-space: nowrap; overflow: hidden; }
/* Other people's mail stays soft. All of it is blurred as one layer over the crisp rows: one filter to draw
   rather than sixty, which a scaled-up screen can't keep up with */
.g-list-text { position: absolute; inset: 55px 0 0; filter: blur(2.6px); }
.g-list-text .g-row { background: transparent; border-color: transparent; }
.g-list-text :is(.g-box, .g-star) { visibility: hidden; }
.g-list:not(.g-list-text) :is(.g-from, .g-subj, .g-subj span, .g-date) { color: transparent; }
.g-from { inline-size: 168px; flex: none; }
.g-subj { flex: 1; min-inline-size: 0; }
.g-subj b { font-weight: inherit; }
.g-subj span { color: #777; font-weight: 400; }
.g-date { inline-size: 76px; flex: none; text-align: right; font-size: 12px; }
.g-toast { position: absolute; left: 50%; top: 74px; transform: translateX(-50%); padding: 5px 16px; background: #f9edbe; border: 1px solid #f0c36d; border-radius: 2px; box-shadow: 0 2px 4px rgb(0 0 0 / .2); font-size: 13px; font-weight: 700; color: #222; visibility: hidden; opacity: 0; }
.g-toast u { color: #222; margin-left: 6px; font-weight: 700; }

/* The compose window, 2012 to 2018: docked at the bottom right, a dark strip on top, the tools along the bottom */
.g-compose { display: flex; flex-direction: column; background: #fff; color: #222; font-family: Arial, "Liberation Sans", Helvetica, sans-serif; }
.g-docked { position: absolute; right: 64px; bottom: 0; inline-size: 540px; block-size: 520px; border-radius: 2px 2px 0 0; box-shadow: 0 8px 10px 1px rgb(0 0 0 / .14), 0 3px 14px 2px rgb(0 0 0 / .12), 0 5px 5px -3px rgb(0 0 0 / .2); }
.g-c-head { display: flex; align-items: center; justify-content: space-between; block-size: 40px; padding: 0 10px 0 12px; flex: none; background: #404040; border-radius: 2px 2px 0 0; color: #fff; font-size: 14px; font-weight: 700; }
.g-c-head i { display: flex; gap: 8px; color: #e0e0e0; }
.g-c-head svg { inline-size: 15px; block-size: 15px; stroke-width: 1.8; }
.g-c-row { display: flex; align-items: center; gap: 6px; flex: none; block-size: 36px; margin: 0 10px; border-bottom: 1px solid #cfcfcf; font-size: 14px; color: #777; overflow: hidden; white-space: nowrap; }
/* Who it went to stays soft: the recipients are real students, and this is their story to tell */
.g-c-to { filter: blur(3.2px); }
.g-chip { padding: 1px 6px; background: #f5f5f5; border: 1px solid #d9d9d9; border-radius: 3px; color: #222; font-size: 13px; }
.g-more { color: #555; }
.g-c-body { flex: 1; min-block-size: 0; overflow: hidden; padding: 10px 10px 0; }
.g-c-text { white-space: pre-wrap; overflow-wrap: break-word; font-size: 13px; line-height: 1.38; color: #222; }
.g-caret { display: inline-block; inline-size: 1px; block-size: 1.2em; margin-right: -1px; vertical-align: -.25em; background: #222; }
.g-c-bar { display: flex; align-items: center; gap: 4px; flex: none; block-size: 56px; padding: 0 12px 0 16px; border-top: 1px solid #f1f1f1; }
.g-send { display: inline-block; block-size: 36px; line-height: 34px; padding: 0 18px; margin-right: 10px; background: #4d90fe; border: 1px solid #3079ed; border-radius: 2px; color: #fff; font-size: 13px; font-weight: 700; box-shadow: none; }
.is-pressed .g-send { background: #357ae8; border-color: #2f5bb7; box-shadow: inset 0 1px 2px rgb(0 0 0 / .3); }
.g-tools { display: flex; gap: 14px; color: #777; }
.g-tools svg { inline-size: 20px; block-size: 20px; stroke-width: 1.5; }
.g-right { margin-left: auto; gap: 6px; }
.g-right svg:last-child { inline-size: 12px; block-size: 12px; align-self: center; }

/* The phone framing: the same window, as wide as the screen, at a size a phone can read */
.g-full { position: absolute; inset: 0; }
.g-full .g-c-head { block-size: 52px; padding: 0 14px 0 16px; font-size: 16px; }
.g-full .g-c-head svg { inline-size: 18px; block-size: 18px; }
.g-full .g-c-row { block-size: 46px; margin: 0 16px; font-size: 16px; }
.g-full .g-c-body { padding: 14px 16px 0; }
.g-full .g-c-text { font-size: 15.5px; line-height: 1.45; }
.g-full .g-c-bar { block-size: 66px; padding: 0 16px calc(env(safe-area-inset-bottom)); }
.g-full .g-right { display: none; }

/* ----- Today's browser on the laptop: rounded tabs, a quiet address bar, a light start page ----- */
.d { background: linear-gradient(160deg, #2b3530, #141a17 70%); font: 13px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1f2320; }
.d-win { position: absolute; display: flex; flex-direction: column; background: #fff; border-radius: 10px 10px 0 0; overflow: hidden; box-shadow: 0 18px 50px rgb(0 0 0 / .45); }
.d-tabs { position: relative; display: flex; align-items: flex-end; gap: 2px; block-size: 40px; padding: 0 8px; flex: none; background: #dfe3e0; }
.d-tab { display: flex; align-items: center; gap: 9px; inline-size: 240px; max-inline-size: 240px; block-size: 34px; padding: 0 10px 0 12px; border-radius: 10px 10px 0 0; color: #4a514c; font-size: 12.5px; overflow: hidden; white-space: nowrap; flex: none; }
.d-tab span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.d-tab svg { inline-size: 14px; block-size: 14px; flex: none; }
.d-tab-a { background: #fff; color: #1f2320; }
.d-tab-b { max-inline-size: 0; opacity: 0; }
.tab-b .d-tab-a { background: transparent; color: #4a514c; }
.tab-b .d-tab-b { background: #fff; color: #1f2320; }
.d-fav { inline-size: 16px; block-size: 16px; border-radius: 50%; background: #c3cac5; flex: none; }
.has-fav .d-fav-b { background: url(/favicon-32.png) center / 16px 16px no-repeat; border-radius: 3px; }
.d-new { display: grid; place-items: center; inline-size: 30px; block-size: 34px; color: #4a514c; }
.d-new svg { inline-size: 16px; block-size: 16px; }
.d-winctl { display: flex; gap: 20px; margin-left: auto; align-self: center; color: #4a514c; padding-right: 8px; }
.d-winctl svg { inline-size: 14px; block-size: 14px; }
.d-bar { display: flex; align-items: center; gap: 6px; block-size: 46px; padding: 0 10px; flex: none; background: #fff; color: #49514b; border-bottom: 1px solid #e3e6e3; }
.d-bar > i { display: grid; place-items: center; inline-size: 32px; block-size: 32px; }
.d-bar > i.dim { color: #b3b9b4; }
.d-bar svg { inline-size: 18px; block-size: 18px; }
.d-omni, .p-omni { position: relative; display: flex; align-items: center; gap: 8px; flex: 1; block-size: 34px; padding: 0 14px; border-radius: 17px; background: #eef1ee; color: #1f2320; font-size: 14px; white-space: nowrap; overflow: hidden; }
.d-omni.is-focused, .p-omni.is-focused { box-shadow: inset 0 0 0 2px #2f7d5b; background: #fff; }
.d-lock { display: none; color: #59605b; }
.d-lock svg { inline-size: 15px; block-size: 15px; }
.has-lock .d-lock { display: inline-flex; }
.d-ph, .p-ph { color: #737a75; }
.d-caret { display: inline-block; inline-size: 1.5px; block-size: 18px; margin-left: -7px; background: #1f2320; }
.d-profile { inline-size: 26px; block-size: 26px; margin: 0 4px; border-radius: 50%; background: #a9c2b5; }
.d-load, .p-load { position: absolute; left: 0; right: 0; block-size: 2px; background: #2f7d5b; transform-origin: 0 50%; transform: scaleX(0); visibility: hidden; opacity: 0; z-index: 2; }
.d-load { top: 86px; }
.d-page { position: relative; flex: 1; overflow: hidden; background: #fff; }
.d-blank, .p-blank { position: absolute; inset: 0; display: grid; place-items: center; background: #f7f8f6; }
.d-blank-pill { display: flex; align-items: center; inline-size: min(560px, 60%); block-size: 46px; padding: 0 18px; border-radius: 23px; background: #fff; box-shadow: 0 1px 6px rgb(32 40 35 / .18); color: #737a75; }
.of-frame { position: absolute; left: 0; top: 0; border: 0; display: block; visibility: hidden; opacity: 0; pointer-events: none; background: var(--bg); }

/* ----- Today's browser on the phone: the status bar, the page, the address bar at the bottom ----- */
.p { display: flex; flex-direction: column; background: #f7f8f6; font: 14px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1f2320; }
.p-status { display: flex; align-items: center; justify-content: space-between; block-size: 44px; padding: 0 26px 0 30px; flex: none; font-size: 15px; background: #f7f8f6; transition: none; }
.p-status b { font-weight: 600; letter-spacing: .01em; }
.p-status i { display: flex; align-items: center; gap: 6px; }
.p-status svg { block-size: 12px; inline-size: auto; stroke-width: 1.5; }
.p-page { position: relative; flex: 1; overflow: hidden; }
.p-load { bottom: 98px; }
.p-bar { position: relative; display: flex; flex-direction: column; gap: 6px; block-size: 98px; padding: 10px 14px 0; flex: none; background: #eef0ed; }
.p-omni { flex: none; block-size: 42px; border-radius: 13px; justify-content: center; background: #fff; box-shadow: 0 1px 3px rgb(32 40 35 / .14); font-size: 15px; }
.p-omni.is-focused { justify-content: flex-start; }
.p-tools { display: flex; justify-content: space-around; color: #2f3531; }
.p-tools .dim { color: #b3b9b4; }
.p-tools svg { inline-size: 21px; block-size: 21px; }
.p.is-themed, .is-themed .p-status { background: var(--bg); color: #eef0ec; }
.is-themed .p-bar { background: #151c18; }
.is-themed .p-omni { background: #262e29; color: #eef0ec; box-shadow: none; }
.is-themed .p-tools { color: #dfe3dd; }
.is-themed .d-lock { color: #b8bdb7; }

/* ----- Motion off: the same moments as stills, in the page's own flow ----- */
.os-reel { position: relative; z-index: 3; display: grid; gap: 12svh; padding: 18svh 20px 16svh; background: var(--bg); }
.os-q { margin: 0; text-align: center; font: italic 400 clamp(1.8rem, 6vw, 4.4rem)/1.15 var(--display); color: var(--ink); text-wrap: balance; }
.os-legend { font-size: clamp(1.5rem, 4.4vw, 3.2rem); max-inline-size: 20em; margin-inline: auto; }
.os-email { display: grid; justify-items: center; }
.os-compose { position: relative; inline-size: min(100%, 600px); border-radius: 3px 3px 0 0; box-shadow: 0 10px 30px rgb(0 0 0 / .35); }
.os-compose .g-c-head { block-size: 46px; font-size: 15px; }
.os-compose .g-c-row { block-size: 42px; font-size: 15px; }
.os-compose .g-c-body { padding: 14px 14px 18px; }
.os-compose .g-c-text { font-size: 15.5px; line-height: 1.5; }
.os-compose .g-c-bar { block-size: 60px; }
.os-scene { margin: 0 auto; inline-size: min(100%, 64rem); }
.os-scene img { display: block; inline-size: 100%; block-size: auto; border-radius: 4px; }
@media (max-width: 40em) { .os-compose .g-right { display: none; } .os-reel { gap: 10svh; padding-inline: 16px; } }

.p.is-compact .p-tools { display: none; }
.p.is-compact .p-bar { justify-content: center; padding-top: 0; }
