/* Alfred's own page. Colours, type and corners are the app's (ios/Alfred/Alfred/DesignSystem/Tokens.swift); the ground is
   milk instead of the app's pearl gray. Two ways to read it: straight down the page (the rules first, with no class), or
   in the bowl (`html.milk`, set by main.js where the milk can be drawn). */

/* PingFang's own three weights by name: a Mac's browser takes its Thin for 300, the app its Light. */
@font-face { font-family: "Han"; src: local("PingFangSC-Light"); font-weight: 300; }
@font-face { font-family: "Han"; src: local("PingFangSC-Regular"); font-weight: 400; }
@font-face { font-family: "Han"; src: local("PingFangSC-Medium"); font-weight: 500; }

:root {
  --milk: #FBFAF8;
  --ink: #0A0A0A;
  --ink-2: #55565A;
  --ink-3: #67686B;
  --pearl-lit: #3B3B3F;
  --pearl-deep: #0D0D0F;
  --critical: #D33A31;
  --gutter: 24px;
  --vh: 1svh;
  --type: -apple-system, "SF Pro Display", "Han", "PingFang SC", "MiSans", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; }
html { background: var(--milk); color: var(--ink); font: 17px/1.5 var(--type); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 8px; }

#bowl { display: none; }

/* ---- type ---- */

h1, h2 { font-weight: 300; text-align: center; text-wrap: balance; letter-spacing: .01em; }
h1 span, h2 span { display: block; }
/* A comma in a headline takes half a square and a little air, as the app sets it. */
h2 i { font-style: normal; display: inline-block; width: .7em; text-spacing-trim: space-all; text-align: left; }
h1, .big { font-size: clamp(42px, min(6.1vw, 10.4svh), 88px); line-height: 1.22; }
h2 { font-size: clamp(31px, min(4.3vw, 7.2svh), 60px); line-height: 1.25; }

.lead { text-wrap: balance; }
.lead, .words p, .gone { color: var(--ink-2); font-size: clamp(16px, 1.35vw, 19px); line-height: 1.7; text-align: center; }
/* A line breaks between its clauses, never inside one. */
.lead span { display: inline-block; }
.when { color: var(--ink-3); font-size: 15px; text-align: center; }

/* ---- the head ---- */

header { position: fixed; z-index: 5; inset: 0 0 auto; display: flex; justify-content: space-between; align-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left)); pointer-events: none; }
header a { pointer-events: auto; }
.name { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 20px; font-weight: 400; letter-spacing: .01em; }
.join, button { font: 500 16px/1 var(--type); color: #fff; border: 0; border-radius: 99px; cursor: pointer;
  background: linear-gradient(var(--pearl-lit), var(--pearl-deep)); box-shadow: inset 0 1px .5px rgb(255 255 255 / .24), 0 6px 16px rgb(20 16 18 / .16);
  transition: transform .18s cubic-bezier(.2, .9, .3, 1), opacity .4s, box-shadow .18s; -webkit-tap-highlight-color: transparent; }
.join { display: grid; place-items: center; height: 44px; padding: 0 20px; font-size: 15px; }
.join:active, button:active { transform: scale(.975); box-shadow: inset 0 1px .5px rgb(255 255 255 / .18), 0 2px 6px rgb(20 16 18 / .2); }
.join.away { opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s .3s; }

/* ---- the field ---- */

.field { position: relative; width: min(440px, 100%); height: 62px; margin: 0 auto; }
.field figure { position: absolute; inset: 0; border-radius: 31px; background: #fff; box-shadow: 0 6px 24px rgb(0 0 0 / .07); }
.field input { position: absolute; inset: 0; width: 100%; padding: 0 148px 0 26px; border: 0; background: none; color: var(--ink);
  font: 400 17px/1.2 var(--type); border-radius: 31px; outline: none; appearance: none; transition: filter .7s, opacity .7s; }
.field input::placeholder { color: var(--ink-3); opacity: 1; }
.field .trap { left: -9999px; width: 1px; }
.field button { position: absolute; right: 7px; top: 7px; height: 48px; padding: 0 22px; transition: transform .18s cubic-bezier(.2, .9, .3, 1), opacity .5s, box-shadow .18s; }
.field button[disabled] { cursor: default; }
.said { position: absolute; left: 0; right: 0; top: calc(100% + 14px); text-align: center; font-size: 15px; color: var(--ink-2); min-height: 1.5em; }
.said span { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.field.wrong .said { color: var(--critical); }
.field.kept input { opacity: 0; filter: blur(9px); pointer-events: none; }
.field.kept button { opacity: 0; pointer-events: none; }
.field.kept figure { opacity: 0; transition: opacity .7s; }
.field.kept .said { top: 50%; transform: translateY(-50%); color: var(--ink); font-size: 19px; line-height: 1.5; animation: up 1.5s .7s cubic-bezier(.3, 0, .2, 1) both; }
@keyframes up { from { opacity: 0; filter: blur(12px); } }

/* ---- read straight down ---- */

section { max-width: 1080px; margin: 0 auto; padding: 14vh var(--gutter); display: flex; flex-direction: column; align-items: center; gap: 28px; }
.hero { min-height: 100svh; justify-content: center; }
.hero .pearl { width: 132px; height: 132px; background: url(/img/pearl.svg) center / contain no-repeat; }
.set { display: flex; flex-direction: column; align-items: center; gap: 22px; width: 100%; }
figure img { border-radius: 28px; box-shadow: 0 10px 40px rgb(0 0 0 / .08); }
.say img { border-radius: 22px; }
.phone img { border-radius: 56px; box-shadow: 0 0 0 9px #fff, 0 30px 80px rgb(0 0 0 / .12); width: min(340px, 78vw); }
.words { display: grid; gap: 10px; }
.field { margin-top: 12px; margin-bottom: 44px; }
footer { display: flex; gap: 6px 22px; justify-content: center; flex-wrap: wrap; color: var(--ink-3); font-size: 13px; }
footer a { text-decoration: underline; text-decoration-color: rgb(0 0 0 / .2); text-underline-offset: 3px; }

/* ---- in the bowl ---- */

html.milk { scroll-behavior: auto; }
.milk #bowl { display: block; position: fixed; inset: 0 auto auto 0; width: 100vw; height: 100lvh; background: var(--milk); touch-action: pan-y; }
.milk main { position: relative; height: calc(var(--length, 15) * 100 * var(--vh)); }
.milk section { position: fixed; inset: 0 0 auto; max-width: none; height: 100svh; margin: 0; padding: 0 var(--gutter); visibility: hidden; pointer-events: none; }
.milk section.up { visibility: visible; }
.milk [data-word] { opacity: 0; will-change: opacity, filter; }
.milk figure img { opacity: 0; border-radius: 0; box-shadow: none; width: 100%; height: 100%; pointer-events: none; }
.milk figure { background: none !important; box-shadow: none !important; touch-action: pan-y; }
.milk section.up figure[data-body]:not(.off), .milk section.up form.on > *, .milk section.up footer a { pointer-events: auto; }
.milk .field { opacity: 1; }
.milk .field input, .milk .field button { opacity: var(--k, 0); filter: blur(calc((1 - var(--k, 0)) * 10px)); }
.milk .field.still input, .milk .field.still button { filter: none; }
.milk .field.kept input, .milk .field.kept button { opacity: 0; }

.milk .hero { gap: 0; justify-content: center; padding-bottom: 5.5svh; }
.milk .hero .pearl { width: clamp(100px, min(10.6vw, 16.6svh), 160px); height: auto; aspect-ratio: 1; margin-bottom: clamp(22px, 4.6svh, 48px); }
.milk .hero .lead { margin-top: clamp(16px, 2.6svh, 28px); }
.milk .hero .field { margin-top: clamp(28px, 4.8svh, 52px); margin-bottom: 30px; }
.milk footer { position: absolute; left: 0; right: 0; bottom: max(22px, env(safe-area-inset-bottom)); }

.milk .today { gap: 0; }
.milk .today .words { position: absolute; top: clamp(84px, 13svh, 140px); gap: 12px; }
.milk .phone { position: absolute; left: 50%; top: 50%; height: min(86svh, 800px, 186vw); aspect-ratio: 402 / 874; transform: translate(-50%, -50%); margin-top: 1svh; }

.milk .scene { gap: 0; }
.milk .scene h2 { position: absolute; top: clamp(92px, 14svh, 150px); left: var(--gutter); right: var(--gutter); }
.milk .scene .set { position: absolute; inset: 0; display: block; }
.milk .set > figure { position: absolute; left: 50%; top: 50%; translate: -50% -50%; }
.milk .set .when { position: absolute; left: 0; right: 0; top: calc(clamp(92px, 14svh, 150px) + clamp(52px, min(6.4vw, 11svh), 92px)); font-size: 17px; }

/* Where a scene's things stand, in units main.js sizes to the window (--u: about one point of the app). */
.milk .say { width: calc(var(--w) * 1.36px * var(--u)); height: calc(44px * 1.36 * var(--u)); top: 54% !important; }
.milk .menu { width: calc(230px * 1.2 * var(--u)); height: calc(300px * 1.2 * var(--u)); margin-left: calc(-212px * var(--u)); top: 61% !important; }
.milk .watch { width: calc(340px * 1.2 * var(--u)); height: calc(283px * 1.2 * var(--u)); margin-left: calc(-197px * var(--u)); top: 61% !important; }
.milk .approve { width: calc(370px * 1.2 * var(--u)); height: calc(303px * 1.2 * var(--u)); margin-left: calc(-160px * var(--u)); top: 61% !important; }
.milk .reply { width: calc(var(--w) * 1.2px * var(--u)); height: calc(var(--t) * 1.2px * var(--u)); }
.milk .reply.nuts { margin-left: calc(152px * var(--u)); margin-top: calc(60px * var(--u)); top: 61% !important; }
.milk .reply.price { margin-left: calc(220px * var(--u)); margin-top: calc(72px * var(--u)); top: 61% !important; }
.milk .reply.tea { margin-left: calc(236px * var(--u)); margin-top: calc(82px * var(--u)); top: 61% !important; }
.milk .memory { width: calc(340px * 1.3 * var(--u)); height: calc(122px * 1.3 * var(--u)); top: 47% !important; }
.milk .forget .say { top: 68% !important; }
.milk .gone { position: absolute; left: var(--gutter); right: var(--gutter); top: 50%; translate: 0 -50%; }
.say { --w: 304; }
.say[data-body="say-nuts"] { --w: 168; }
.say[data-body="say-forget"] { --w: 134; }
.nuts { --w: 330; --t: 105; }
.price { --w: 306; --t: 60; }
.tea { --w: 244; --t: 82; }

/* Over a phone's own bar the browser paints plain milk: the bowl runs into it with no edge. */
@media (max-aspect-ratio: 1/1) {
  .milk body::after { content: ""; position: fixed; z-index: 3; inset: auto 0 0; height: 64px; pointer-events: none;
    background: linear-gradient(rgb(251 250 248 / 0), var(--milk)); }
}

/* Taller than wide: a scene's things stand one over the other. */
@media (max-aspect-ratio: 1/1) {
  .milk .set > figure { margin-left: 0 !important; }
  .milk .scene h2 { top: 13svh; }
  .milk .set .when { top: calc(13svh + clamp(58px, 8vw, 86px)); font-size: clamp(15px, 2vw, 17px); }
  .milk .say { width: calc(var(--w) * 1.1px * var(--u)); height: calc(44px * 1.1 * var(--u)); }
  .milk .menu { width: calc(204px * var(--u)); height: calc(266px * var(--u)); top: 48% !important; }
  .milk .watch { width: calc(330px * var(--u)); height: calc(275px * var(--u)); top: 48% !important; }
  .milk .approve { width: calc(350px * var(--u)); height: calc(287px * var(--u)); top: 49% !important; }
  .milk .reply { width: calc(var(--w) * 1px * var(--u)); height: calc(var(--t) * 1px * var(--u)); margin-top: 0 !important; }
  .milk .reply.nuts, .milk .reply.price, .milk .reply.tea { top: 77% !important; }
  .milk .phone { height: min(78svh, 178vw); margin-top: 3.4svh; }
  .milk .memory { width: calc(330px * var(--u)); height: calc(118px * var(--u)); }
  .milk .today .words { top: 12svh; padding: 0 var(--gutter); }
}

@media (max-width: 760px) {
  .field input { padding: 0 128px 0 22px; }
  .field button { padding: 0 17px; font-size: 15px; }
}

/* A phone on its side: the same bowl, shallower. */
@media (max-height: 560px) {
  h1, .big { font-size: clamp(30px, 10.4svh, 44px); }
  .milk .hero { padding-bottom: 0; padding-top: 20px; }
  .milk .hero .pearl { width: 62px; margin-bottom: 10px; }
  .milk .hero .lead { margin-top: 6px; font-size: 14px; line-height: 1.5; }
  .milk .hero .field { margin-top: 14px; margin-bottom: 20px; }
  .milk .today .words, .milk .scene h2 { top: 30px; }
  .milk .set .when { top: 74px; font-size: 13px; }
  .milk .set > figure { margin-top: 14px; }
  .milk footer { bottom: 8px; }
}
