/* Trinket's own layer over the design kit (public/assets).
   The palette is the app's (PuzzleApp/Assets.xcassets/Colors): powder, chocolate, paper, blue. */
:root {
  --p-bg: #eaf4fb; --p-surface: #fffdf9; --p-ink: #3d2722; --p-muted: #685a58;
  --p-accent: #3d2722; --p-accent-ink: #eaf4fb; --p-action: #3d2722; --p-action-ink: #eaf4fb;
  --p-inv-bg: #3d2722; --p-inv-surface: #48332f; --p-inv-ink: #eaf4fb; --p-inv-muted: #c9bdb8;
  --p-inv-accent: #eaf4fb; --p-inv-accent-ink: #3d2722; --p-inv-action: #eaf4fb; --p-inv-action-ink: #3d2722;
  --font-display: var(--font-fraunces), Georgia, serif;
  --font-text: var(--font-dm-sans), system-ui, sans-serif;
  --font-hand: var(--font-patrick-hand), "Bradley Hand", cursive;
  --font-mono: ui-monospace, Menlo, monospace;
  --display-weight: 600;
  --display-tracking: -0.02em;
  --display-tracking-xl: -0.028em;
  --display-axes: 'SOFT' 0;
  --app-blue: #5f7d90;      /* the second half of the app's two-tone titles */
  --app-blue-light: #8fb0c6;
  --hard-shadow: rgb(61 39 34 / .18);  /* the app's shadow under physical things: hard, offset */
}
html[data-ground="sky"] { --ground-ink: #3d2722; --ground-muted: #5a4a47; --ground-accent: #5f7d90; }

/* Dark: the app's dark values of the same colors. */
@media (prefers-color-scheme: dark) {
  :root {
    --p-bg: #131c25; --p-surface: #27354a; --p-ink: #e9d8ce; --p-muted: #b4a9a4;
    --p-accent: #e9d8ce; --p-accent-ink: #131c25; --p-action: #e9d8ce; --p-action-ink: #131c25;
    --p-inv-bg: #27354a; --p-inv-surface: #32425a; --p-inv-ink: #e9d8ce; --p-inv-muted: #b9aea8;
    --p-inv-accent: #e9d8ce; --p-inv-accent-ink: #131c25; --p-inv-action: #e9d8ce; --p-inv-action-ink: #131c25;
    --app-blue: #8fb0c6;
    --hard-shadow: rgb(0 0 0 / .45);
  }
  html[data-ground="sky"] { --ground-bg: #1b2633; --ground-surface: #27354a; --ground-ink: #e9d8ce; --ground-muted: #b4a9a4; --ground-accent: #8fb0c6; }
}

/* Two-tone titles, as in the app: the last words in blue, ending on a full stop. */
:is(h1, h2) em { font-style: normal; color: var(--app-blue); }
.ground-inverse h2 em { color: var(--app-blue-light); }
.footer--statement h2 em { color: inherit; }

/* Titles never hyphenate: Safari ignores the kit's hyphenate-limit-chars and broke "Trin-ket" in the closing title. */
:is(h1, h2, h3) { hyphens: manual; -webkit-hyphens: manual; }

.logo-icon { border-radius: 7px; margin-right: 8px; }
picture { display: contents; }
picture > source { display: none; }   /* or, with its picture gone, a source is a grid item of its own */
/* No drop-shadow filter on a phone, anywhere: while scrolling, browsers flash the filter's whole box
   as a tinted rectangle around it. */
.phone { height: auto; max-width: none; }

/* Apple's badge is the button, as Apple drew it: nothing of ours behind it (a ground with its own
   corners showed through the badge's and read as a clipped edge), never stretched, no arrow. */
.btn.btn--appstore, .btn.btn--appstore:hover, .btn.btn--appstore:active { padding: 0; background: none; border: 0; box-shadow: none; height: auto; border-radius: 0; }
.btn.btn--appstore > img { display: block; height: 44px; width: auto; }
.btn.btn--appstore-lg > img { height: 64px; }
.btn.btn--appstore::after, .btn.btn--appstore > .m-arrow { display: none; }
.btn.btn--appstore, .btn-row > .btn.btn--appstore, .section-head--split > .btn.btn--appstore { width: fit-content; flex: none; }

/* Snow falls behind everything: under the words, the phones and every coloured tile. */
.snow { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

/* ---------- Hero: the hook at the left, the phone in front of a wall of boxes at the right.
   Every size on the stage is in svh, so the picture grows with a tall screen instead of leaving it empty. */
.hero--trinket { overflow: hidden; }
.hero--trinket > .wrap { position: relative; z-index: 1; pointer-events: none; }
.hero--trinket .hero__text { display: grid; align-content: center; justify-items: start; gap: var(--s-5); width: min(100%, 560px); pointer-events: auto; }
.hero--trinket h1 { font-size: clamp(40px, 5.4vw, 88px); }
/* the words stop short of the phone (its left edge is at 46vw), which a 1,200px laptop did not manage */
@media (min-width: 1024px) { .hero--trinket .hero__text { width: min(100%, 560px, 46vw - 104px); } }
.hero__kicker { display: block; margin-bottom: var(--s-4); font: 500 var(--t-small)/1.4 var(--font-text); letter-spacing: 0; color: var(--muted); }
.hero__proof { font-size: var(--t-small); color: var(--muted); }

.hero-stage { --ph: min(80svh, 56vw); --pw: calc(var(--ph) * 0.489); --col: min(21svh, 13.5vw);
  position: absolute; top: var(--nav); right: 0; bottom: 0; left: 42%; overflow: hidden; }
.box-wall { position: absolute; top: -5svh; left: calc(4vw + var(--pw) - 4svh); display: flex; align-items: flex-start; gap: var(--s-4); }
.box-wall__col { display: grid; gap: var(--s-4); width: var(--col); }
.box-wall__col:nth-child(2) { margin-top: -9svh; }
.box-wall__col:nth-child(3) { margin-top: -3svh; }
.box-wall img { width: 100%; height: auto; border-radius: 4px; box-shadow: 3px 3px 0 var(--hard-shadow); }
.hero-phone { position: absolute; left: 4vw; top: calc(50% - var(--ph) / 2); height: var(--ph); width: auto; }

@media (max-width: 1023px) {
  /* the words first, then the stage across the screen in what is left */
  /* at least the screen and taller when the words leave the phone less than its height: a hero held
     to one screen showed only the phone's top edge on an iPhone */
  main > .hero.hero--trinket { display: grid; grid-template-rows: auto 1fr; height: auto; min-height: 100svh; padding-bottom: 0; }
  main > .hero.hero--trinket > .wrap { grid-row: 1; height: auto; }
  main > .hero.hero--trinket > .wrap > .hero__text { height: auto; }
  .hero-stage { --pw: min(240px, 26svh); --col: 34vw; grid-row: 2; position: relative; inset: auto; min-height: calc(var(--pw) / 0.489 + 2 * var(--s-5)); margin-top: var(--s-6); }
  .box-wall { top: -60px; left: 50%; margin-left: calc(-1.5 * var(--col) - var(--s-4)); }
  .hero-phone { left: calc(50% - var(--pw) / 2); top: var(--s-5); width: var(--pw); height: auto; }
}

/* ---------- That sounds familiar: what puzzlers say, in the app's handwriting on coloured paper, each
   with one of the app's hand-drawn pieces; under it, what Trinket does. The paper keeps its colour
   and chocolate ink in the dark: it is a thing, not a surface. */
.notes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gutter); margin: 0; padding: 0; list-style: none; }
.note { display: grid; grid-template-rows: 1fr auto; gap: var(--s-6); }
.note__paper { position: relative; margin: 0; padding: var(--s-6) var(--s-6) 148px; background: var(--tint); border-radius: 6px; box-shadow: 6px 6px 0 var(--hard-shadow);
  font: 400 clamp(26px, 2.55vw, 38px)/1.2 var(--font-hand); color: #3d2722; }
.note:nth-child(odd) .note__paper { rotate: -1.6deg; }
.note:nth-child(even) .note__paper { rotate: 1.4deg; }
.note__piece { position: absolute; right: var(--s-5); bottom: var(--s-5); width: 112px; height: 112px; rotate: 9deg; }
.note:nth-child(even) .note__piece { rotate: -11deg; }
.note__fix { margin: 0; padding-inline: var(--s-2); font-weight: 500; font-size: var(--t-lead); line-height: 1.35; }
@media (max-width: 1023px) { .notes { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--s-7); } .note__paper { font-size: 28px; padding-bottom: 116px; } .note__piece { width: 88px; height: 88px; } }
@media (max-width: 639px) { .notes { gap: var(--s-6) var(--s-4); } .note { gap: var(--s-4); } .note__paper { font-size: 19px; padding: var(--s-4) var(--s-4) 72px; box-shadow: 4px 4px 0 var(--hard-shadow); }
  .note__piece { width: 52px; height: 52px; right: var(--s-3); bottom: var(--s-3); } .note__fix { font-size: 14px; padding: 0; } }

/* ---------- Box fronts on shelves. Each box grows by its width over its height from a basis of 0, so the
   boxes between two boards share one height and the shelf runs from line to line. A board is a
   full-width flex item, which is also what breaks the line. */
.shelves { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3) var(--s-5); }
.shelves > img { flex: var(--r) 1 0; min-width: 0; height: auto; aspect-ratio: var(--r); object-fit: cover; box-shadow: 3px 3px 0 var(--hard-shadow); }
.shelf-board { display: none; flex: 0 0 100%; height: 6px; margin-bottom: var(--s-5); border-radius: 3px; background: color-mix(in srgb, var(--p-ink) 14%, transparent); }
.shelf-board.per-6 { display: block; }
@media (max-width: 1023px) { .shelf-board.per-6 { display: none; } .shelf-board.per-4 { display: block; } }
@media (max-width: 639px) {
  .shelves { gap: var(--s-2) var(--s-3); }
  .shelf-board.per-4 { display: none; } .shelf-board.per-3 { display: block; margin-bottom: var(--s-3); }
  .shelves > img:nth-of-type(n + 10), .shelves > img:nth-of-type(n + 10) + .shelf-board { display: none; }
}

/* ---------- How it tracks a puzzle (the kit's pinned-chapters moment). The phone stands whole on the
   page's own ground and takes the height the screen has. */
#how .mo-pc__visual { border-radius: 0; overflow: visible; }
#how:not(.is-live) .mo-pc__visual .phone { display: block; margin-inline: auto; height: 30svh; width: auto; }
/* live: flex none, because between 1024 and 1279px the kit lets a section's wrap grow to the section's
   full two screens, and a stage that tall has nothing left to stick to */
html main [data-moment="pinned-chapters"][data-moment].is-live > .mo-pc__grid { align-content: start; padding-top: var(--padt); flex: none; }
html [data-moment="pinned-chapters"].is-live .mo-pc__visuals { aspect-ratio: auto; height: calc(100svh - var(--padt) - var(--s-7)); max-height: none; }
html [data-moment="pinned-chapters"].is-live .mo-pc__visual .phone { width: 100%; height: 100%; object-fit: contain; }

/* three screens, not the kit's two: a fast scroll ran through all three steps at once */
html #how.is-live { height: 300svh; }
/* a step's title is a button: a click scrolls to that step (app/kit-scripts.tsx) */
.step-btn { margin: 0; padding: 0; border: 0; background: none; font: inherit; letter-spacing: inherit; color: inherit; text-align: left; cursor: inherit; }
.step-btn:focus-visible { outline: 2px solid var(--app-blue); outline-offset: 4px; border-radius: 4px; }
#how.is-live .mo-pc__step { cursor: pointer; }
#how.is-live .mo-pc__step:not(.is-on):hover h3 { color: var(--ink); }

/* ---------- Feature tiles: each its own colour, the same in light and dark. The words open the tile,
   the first sentence in full ink and the rest lighter; the phones run off the tile's edge. Sizes
   inside a tile are in cqw (the tile's width), places from the top in px, so the words never meet a phone. */
main > #features { height: auto; }
.tiles { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); }
.tile { --tile-ink: #fffdf9; position: relative; overflow: hidden; grid-column: span 4; height: 600px; border-radius: 28px;
  background: var(--tile-bg); color: var(--tile-ink); container-type: inline-size; }
.tile__text { position: relative; z-index: 1; padding: var(--s-7) var(--s-7) 0; font: 500 22px/1.32 var(--font-text); letter-spacing: -0.012em; text-wrap: pretty; }
.tile__text :is(h3, p) { display: inline; margin: 0; max-width: none; font: inherit; letter-spacing: inherit; color: inherit; }
.tile__text p { opacity: .74; }
.tile__art { position: absolute; inset: 0; }
.tile .phone { position: absolute; }

.tile--filter { grid-column: span 7; --tile-bg: #4d6a7d; }
.tile--filter .tile__text { max-width: 48%; }
.tile--filter .phone { width: 40cqw; }
.tile--filter picture:nth-of-type(1) .phone { left: 6cqw; top: 250px; }
/* the filter sheet fills its screen, so that phone stands almost whole: only the bezel's top runs off */
.tile--filter picture:nth-of-type(2) .phone { right: 6cqw; bottom: 36px; }

.tile--lock { grid-column: span 5; --tile-bg: #3d2722; }
.tile--lock .phone { left: 50%; top: 190px; width: min(250px, 62cqw); translate: -50% 0; }

.tile--shelf { grid-column: 1 / -1; height: 640px; --tile-bg: #2f4a3c; }
.tile--shelf .tile__text { position: absolute; left: 0; bottom: var(--s-7); max-width: 31cqw; padding-top: 0; }
/* nine screens in three rows, leaning left: the wall's left edge runs down and to the right, which
   leaves the foot of the tile's left side to the words */
.tile--shelf .tile__art { inset: auto; left: 36.6cqw; top: 50%; width: 72cqw; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.6cqw; transform: translateY(-46%) rotate(-22deg); }
.tile--shelf .phone { position: static; width: 100%; }
.tile--shelf picture:nth-of-type(3n + 2) .phone { translate: 0 -18%; }

.tile--wishlist { --tile-bg: #f4d8cb; --tile-ink: #3d2722; }
.tile--discover { --tile-bg: #f3e2a9; --tile-ink: #3d2722; }
.tile--finishes { --tile-bg: #dcd2ea; --tile-ink: #3d2722; }
:is(.tile--wishlist, .tile--discover, .tile--finishes) .phone { left: 15cqw; top: 216px; width: 70cqw; }

/* The Lock Screen, drawn after the real Live Activity and set behind the bezel. Sizes in cqw of the phone. */
.lockphone { aspect-ratio: 1350 / 2760; container-type: inline-size; }
.lockphone__frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lock { position: absolute; inset: 2.5% 5.33%; overflow: hidden; border-radius: 13.5cqw; color: #fff; text-align: center;
  background: radial-gradient(130% 55% at 0% 105%, #2b4051 0 60%, transparent 60.5%), radial-gradient(120% 60% at 110% 62%, #53707f 0 60%, transparent 60.5%), linear-gradient(165deg, #a7c2d2, #6c8a9c 50%, #3c5565); }
.lock p { margin: 0; max-width: none; }
.lock .lock__date { margin-top: 15cqw; font: 600 5cqw/1 var(--font-text); }
.lock .lock__clock { margin-top: 1.5cqw; font: 600 27cqw/1 var(--font-text); letter-spacing: -0.04em; }
.lock__activity { position: absolute; left: 3.5cqw; right: 3.5cqw; top: 61%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 3cqw;
  padding: 4.2cqw 4.6cqw; border-radius: 6.5cqw; background: #0f1724; color: #e9d8ce; text-align: left; }
.lock__ring { display: grid; place-items: center; width: 7.4cqw; height: 7.4cqw; border: .55cqw solid currentColor; border-radius: 50%; font: 400 3.4cqw/1 var(--font-text); }
.lock__ring::after { content: "\2726"; }
.lock .lock__title { font: 600 4.7cqw/1.15 var(--font-display); color: #f4ebe5; }
.lock .lock__meta { margin-top: .6cqw; font-size: 3.2cqw; opacity: .7; }
.lock .lock__time { font: 500 7.2cqw/1 var(--font-text); font-variant-numeric: tabular-nums; }
.lock__key { position: absolute; bottom: 5.5%; width: 13cqw; height: 13cqw; border-radius: 50%; background: rgb(255 255 255 / .18); }
.lock__key:nth-last-child(2) { left: 9cqw; } .lock__key:last-child { right: 9cqw; }

/* ---------- Recap: the profile, whole, on the chocolate band. */
.recap-phone { display: grid; justify-items: center; }
.recap-phone .phone { width: min(320px, 100%, (100svh - 220px) * 0.489); }

/* ---------- Questions and the close. */
.faq-icon { width: 96px; height: 96px; margin-top: var(--s-6); border-radius: 22px; box-shadow: 3px 3px 0 var(--hard-shadow); }
/* the close: the icon, the heading and Apple's badge in the middle, nothing else */
.closing__cta.close--centre { align-items: center; justify-content: center; gap: var(--s-5); text-align: center; }
.close--centre h2 { max-width: 13ch; font-size: clamp(44px, 6vw, 92px); }
.close__icon { width: 120px; height: 120px; border-radius: 27px; box-shadow: 4px 4px 0 var(--hard-shadow); }

/* ---------- A tall desktop: sections stop growing at 900px, so a 1,200px-high window isn't half empty.
   The hero and the pinned section still take the whole screen: their pictures scale with it. */
@media (min-width: 1280px) and (min-height: 960px) {
  main > :is(section, .section):not(.hero, [data-moment]), footer.closing { height: auto; min-height: calc(var(--h, 1) * 900px); }
}

/* ---------- Small laptop, tablet and phone: what each section holds there. */
@media (min-width: 1024px) and (max-width: 1279px) {
  .tile__text { padding: var(--s-6) var(--s-6) 0; font-size: 19px; }
  .tile--shelf .tile__text { bottom: var(--s-6); }
}
@media (max-width: 1023px) {
  .footer__legal { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); }
  .closing__links > .grid { grid-template-columns: 1fr 1fr; }
  .closing__links > .grid > * { grid-column: auto; }
  .faq-icon { width: 64px; height: 64px; margin-top: var(--s-4); border-radius: 15px; }
  #recap .rows { display: none; }
  .recap-phone .phone { width: 250px; }
  /* tiles two to a row, the two wide ones across; the wide green one moves under the first pair */
  .tile { grid-column: span 6; height: 560px; }
  .tile--filter, .tile--shelf { grid-column: 1 / -1; }
  .tile--filter picture:nth-of-type(2) .phone { bottom: -8px; }
  .tile--shelf { order: 1; height: 520px; }
  .tile--discover, .tile--finishes { order: 2; }
  .tile__text { padding: var(--s-6) var(--s-6) 0; font-size: 20px; }
  .tile--shelf .tile__text { bottom: var(--s-6); max-width: 38cqw; }
  .close__icon { width: 96px; height: 96px; border-radius: 22px; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  #how .mo-pc__steps { gap: var(--s-5); }
  #how .mo-pc__step { padding-top: var(--s-5); }
  #how:not(.is-live) .mo-pc__visual .phone { height: 19svh; }
  #questions .faq > .faq__item { padding-block: var(--s-3); }
  #questions .section-head { position: relative; }
  #questions .faq-icon { position: absolute; right: 0; top: 0; margin: 0; }
}
@media (max-width: 639px) {
  .btn-row:has(> .btn--appstore) { flex-direction: row; flex-wrap: wrap; }
  .btn-row:has(> .btn--appstore) > .btn--secondary { width: auto; flex: 1 1 auto; }
  main > #how[data-moment]:not(.is-live) { min-height: calc(2 * 100lvh); }
  #how:not(.is-live) .mo-pc__visual .phone { height: 34svh; }
  .recap-phone .phone { width: 220px; }
  /* one tile to a row; the words take the tile's width, so both of the first tile's phones rise from the foot */
  .tiles { gap: var(--s-4); }
  .tile, .tile--filter, .tile--lock { grid-column: 1 / -1; height: 500px; border-radius: 22px; }
  .tile--shelf, .tile--discover, .tile--finishes { order: 0; }
  .tile__text { padding: var(--s-5) var(--s-5) 0; font-size: 19px; }
  .tile--filter .tile__text { max-width: none; }
  .tile--filter .phone { width: 43cqw; }
  .tile--filter picture:nth-of-type(1) .phone { left: 5cqw; top: 210px; }
  .tile--filter picture:nth-of-type(2) .phone { right: 5cqw; bottom: auto; top: 250px; }
  .tile--lock .phone { top: 170px; width: 58cqw; }
  .tile--shelf { height: 520px; }
  /* the wall runs under the words here, so they stand on the tile's own green, fading out below them */
  .tile--shelf .tile__text { position: relative; bottom: auto; max-width: none; padding: var(--s-5) var(--s-5) var(--s-8); background: linear-gradient(var(--tile-bg) 72%, transparent); }
  .tile--shelf .tile__art { top: 74%; left: -12cqw; width: 124cqw; }
  :is(.tile--wishlist, .tile--discover, .tile--finishes) .phone { left: 19cqw; top: 190px; width: 62cqw; }
  .btn.btn--appstore-lg > img { height: 56px; }
}
/* The narrowest phones: the icon alone is the logo, so the menu button stays on the screen. */
@media (max-width: 359px) { .logo-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }
/* the kit pads the nav's button on small screens; the badge takes none */
.nav .nav__actions .btn.btn--appstore { padding: 0; min-width: 0; }

/* ---------- The privacy policy: one readable column, nothing of the landing page's staging. */
.legal { max-width: 760px; padding-block: 32px 96px; }
.legal article { margin-top: 56px; color: var(--ink); line-height: 1.6; }
.legal h1 { font-size: clamp(36px, 6vw, 56px); margin-bottom: 16px; }
.legal h2 { font-size: 26px; margin: 56px 0 12px; }
.legal h3 { font-size: 19px; margin: 32px 0 8px; }
.legal :is(p, ul, .legal__table) { margin: 0 0 16px; }
.legal ul { padding-left: 20px; list-style: disc; }
.legal li { margin-bottom: 8px; }
.legal a { text-decoration: underline; text-underline-offset: 3px; }
.legal a.nav__logo { text-decoration: none; }
.legal__table { overflow-x: auto; }
.legal table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 15px; }
.legal :is(th, td) { text-align: left; vertical-align: top; padding: 10px 16px 10px 0; border-bottom: 1px solid var(--line); }
.legal__back { margin-top: 56px; }
body:has(.legal) .snow { display: none; }   /* no snowfall over the small print */
