/* Texts2PDF: the home page is a Messages conversation (shell in inc/chat.php).
   Exporting the home turns the bubbles into the PDF layout the mini-app shortcut produces.
   System font throughout, like the Messages app.
   The guides and the other pages (privacy, terms, restore, checkout, install) use site.css. */

/* ---------- Tokens ---------- */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --side: #f4f4f6;
  --side-line: #e2e2e7;
  --ink: #000000;
  --ink-2: #6c6c70;
  --sep: #e3e3e8;
  --in: #e9e9eb;
  --in-ink: #000000;
  --in-ink-2: #55555a;
  --in-link: #0757c4;
  --out: #0a72e8;
  --tint: #0a68e0;
  --chip: #f2f2f7;
  --glass: rgba(255, 255, 255, .8);
  --sel: #0a72e8;
  --focus: #0a68e0;
  --shadow-pop: 0 12px 40px -12px rgba(0, 0, 0, .3);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --side-w: 330px;
  --head-h: 86px;     /* the conversation's header; the sidebar's title bar matches it */
  --status-h: 0px;    /* the iPad status bar, on desktop */
  --desk: #e4e4ea;
  --desk-hi: #fbfbfd;
  --orb-strength: 20%;                    /* the desk's drifting bubbles, in the selected section's colour */
  --glow-strength: 34%;                   /* light from the screen on the desk */
}

/* The colour of the section on screen, cast on the desk (eased between sections). */
@property --glow { syntax: "<color>"; inherits: true; initial-value: #2f7cf6; }
/* How strongly that colour shows: bright hues (orange, green, teal) need less to look as quiet as blue. */
@property --glow-k { syntax: "<number>"; inherits: true; initial-value: 1; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --side: #161618;
  --side-line: #2a2a2d;
  --ink: #ffffff;
  --ink-2: #9a9aa1;
  --sep: #2c2c2e;
  --in: #26252a;
  --in-ink: #ffffff;
  --in-ink-2: #a5a5ab;
  --in-link: #5aa8ff;
  --tint: #5aa8ff;
  --chip: #1c1c1e;
  --glass: rgba(16, 16, 18, .78);
  --focus: #5aa8ff;
  --shadow-pop: 0 12px 40px -12px rgba(0, 0, 0, .8);
  --desk: #050506;
  --desk-hi: #1f1f22;
  --orb-strength: 26%;
  --glow-strength: 40%;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --side: #161618;
    --side-line: #2a2a2d;
    --ink: #ffffff;
    --ink-2: #9a9aa1;
    --sep: #2c2c2e;
    --in: #26252a;
    --in-ink: #ffffff;
    --in-ink-2: #a5a5ab;
    --in-link: #5aa8ff;
    --tint: #5aa8ff;
    --chip: #1c1c1e;
    --glass: rgba(16, 16, 18, .78);
    --focus: #5aa8ff;
    --shadow-pop: 0 12px 40px -12px rgba(0, 0, 0, .8);
    --desk: #050506;
    --desk-hi: #1f1f22;
    --orb-strength: 26%;
    --glow-strength: 40%;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 96px; scroll-padding-bottom: 90px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video, svg { max-width: 100%; }
img { height: auto; }
h1, h2, h3, p { margin: 0; }
a { color: var(--tint); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.i { width: 20px; height: 20px; flex: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 100; padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }
[hidden] { display: none !important; }
.nowrap { white-space: nowrap; }

/* Going between pages: on the iPad only the screen changes (.app is "screen"). */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tint);
  cursor: pointer;
}
.icon-btn:hover { background: var(--chip); }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--out);
  color: #fff;
  font: 600 16px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
}
.pill:hover { filter: brightness(1.08); }
.pill--block { width: 100%; }
.pill--ghost { background: transparent; color: var(--tint); box-shadow: inset 0 0 0 1.5px currentColor; }
.pill .i { width: 16px; height: 16px; }
.buy { margin: 0; }

/* ---------- Avatars ---------- */

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, #a5a5ab, #858589);
}
.avatar svg { width: 54%; height: 54%; }
.avatar .i { width: 46%; height: 46%; }
.avatar--blue { background: linear-gradient(180deg, #5aa2ff, #1161d9); }
.avatar--blue svg { width: 60%; height: 60%; transform: translateY(4%); }
.avatar--indigo { background: linear-gradient(180deg, #8f8bff, #5856d6); }
.avatar--purple { background: linear-gradient(180deg, #d58cff, #a13fe0); }
.avatar--green { background: linear-gradient(180deg, #5fe08a, #23a94d); }
.avatar--gray { background: linear-gradient(180deg, #a8adb7, #6f7682); }
.avatar--orange { background: linear-gradient(180deg, #ffb35c, #f07d12); }
.avatar--teal { background: linear-gradient(180deg, #6fdcef, #1aa2c2); }
.avatar--paper { border-radius: 11px; background: #f6f6f8; color: #48484a; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.avatar--doc { width: 44px; height: 54px; border-radius: 6px; }
.avatar--app { width: 58px; height: 58px; border-radius: 14px; }
.avatar--sm { width: 30px; height: 30px; }
.avatar--xs { width: 22px; height: 22px; }
.avatar--head { width: 52px; height: 52px; }

/* ---------- App frame: sidebar + chat ---------- */

.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  background: var(--side);
  border-right: 1px solid var(--side-line);
}
.side__top {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: calc(var(--head-h) - var(--status-h));
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--side-line);
}
.side__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--ink);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.side__close { display: none; }

.threads { display: grid; gap: 2px; padding: 8px 10px 4px; }
.thread {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 10px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
}
.thread:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.thread.is-active { background: var(--sel); color: #fff; }
.thread.is-active .thread__preview, .thread.is-active .thread__time { color: #fff; }
.thread__top { display: flex; align-items: baseline; gap: 8px; }
.thread__name { font-weight: 650; font-size: 15px; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread__time { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.thread__preview {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.3;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.side__label { margin: 18px 0 4px; padding: 0 22px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.side__foot { margin-top: auto; padding: 22px 22px 20px; font-size: 13px; }
.side__foot a { color: var(--ink-2); text-decoration: none; }
.side__foot a:hover { color: var(--ink); text-decoration: underline; }
.side__fine { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--ink-2); }

.scrim { display: none; }
.statusbar, .homebar, .desk { display: none; }
.pad-only { display: none; }   /* words for the desktop iPad view only ("iPhone or iPad") */

.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat__head {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--head-h);
  padding: 8px 14px 6px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--sep);
}
.chat__back {
  display: none;
  align-items: center;
  gap: 4px;
  justify-self: start;
  padding: 6px 6px 6px 2px;
  border: 0;
  background: none;
  color: var(--tint);
  cursor: pointer;
}
.chat__back svg { width: 12px; height: 20px; }
/* Like the label of an iOS back button */
.chat__back-label { font-size: 17px; font-weight: 400; line-height: 1; }
.chat__who {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--ink);
  text-decoration: none;
}
.chat__name { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 500; }
.chat__name svg { width: 7px; height: 11px; color: var(--ink-2); }
.chat__tools { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 6px; }

/* Buy, always in reach: a nav-bar button that opens the purchase sheet */
.buy-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--out);
  color: #fff;
  font: 650 15px/1 var(--font);
  white-space: nowrap;
  cursor: pointer;
}
.buy-pill:hover { filter: brightness(1.08); }
.buy-pill:disabled { cursor: progress; opacity: .8; }
.buy-pill__price { font-weight: 500; opacity: .9; }

/* The left of the header: "Menu", back to the sections (phones and tablets) */
.chat__lead { grid-column: 1; justify-self: start; display: flex; align-items: center; gap: 4px; }

/* ---------- The conversation ---------- */

.log {
  flex: 1;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 10px 22px 36px;
}

.stamp {
  margin: 20px 0 14px;
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-2);
}
.stamp strong { font-weight: 600; }

.topic { padding-top: 18px; }
.stamp + .topic { padding-top: 0; }
/* Section labels, like the date stamps in Messages: visible headings that carry the search wording */
.topic__label {
  margin: 6px auto 14px;
  max-width: 34em;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-2);
  text-wrap: balance;
}

.msg {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 3px;
}
.msg--out { align-items: flex-end; }
.msg--in + .msg--out, .msg--out + .msg--in { margin-top: 14px; }
.msg--wide { align-items: stretch; }

.bubble {
  position: relative;
  z-index: 0;
  width: fit-content;
  max-width: min(76%, 32em);
  padding: 8px 14px 9px;
  border-radius: 19px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.32;
  overflow-wrap: break-word;
}
.msg--in .bubble { background: var(--in); color: var(--in-ink); }
.msg--out .bubble { background: var(--out); color: #fff; }
.msg--out .bubble a { color: #fff; }
.msg--in .bubble a { color: var(--in-link); }

/* Tails on the last bubble of each run, like Messages */
.msg--in:not(:has(+ .msg--in)) > .bubble::before,
.msg--out:not(:has(+ .msg--out)) > .bubble::before,
.msg--in:not(:has(+ .msg--in)) > .bubble::after,
.msg--out:not(:has(+ .msg--out)) > .bubble::after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 0;
  height: 20px;
}
.msg--in:not(:has(+ .msg--in)) > .bubble::before { left: -7px; width: 20px; background: var(--in); border-bottom-right-radius: 16px 14px; }
.msg--in:not(:has(+ .msg--in)) > .bubble::after { left: -10px; width: 10px; background: var(--bg); border-bottom-right-radius: 10px; }
.msg--out:not(:has(+ .msg--out)) > .bubble::before { right: -7px; width: 20px; background: var(--out); border-bottom-left-radius: 16px 14px; }
.msg--out:not(:has(+ .msg--out)) > .bubble::after { right: -10px; width: 10px; background: var(--bg); border-bottom-left-radius: 10px; }

/* "Loud" message: the headline */
.bubble--loud {
  max-width: min(94%, 11.5em);
  padding: 14px 22px 17px;
  border-radius: 30px;
  font-family: var(--font-display);
  font-size: clamp(34px, 3.1vw + 18px, 58px);
  font-weight: 750;
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.bubble__emoji { margin-right: .4em; }

/* Sending from the message box: the question pops in where it lands. */
@media (prefers-reduced-motion: no-preference) {
  .bubble.is-sent { animation: sent .55s cubic-bezier(.2, .9, .3, 1.2); }
}
@keyframes sent {
  0% { opacity: .2; transform: translateY(22px) scale(.84); transform-origin: right bottom; }
  60% { opacity: 1; transform: scale(1.05); transform-origin: right bottom; }
  100% { transform: none; }
}

/* Typing indicator */
.typing {
  display: inline-flex;
  gap: 5px;
  padding: 13px 15px;
  border-radius: 19px;
  background: var(--in);
}
.typing i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-2);
  opacity: .5;
}
@media (prefers-reduced-motion: no-preference) {
  .typing i { animation: dot 1.1s infinite ease-in-out; }
  .typing i:nth-child(2) { animation-delay: .15s; }
  .typing i:nth-child(3) { animation-delay: .3s; }
}
@keyframes dot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.typing--intro { position: absolute; left: 0; top: 0; opacity: 0; pointer-events: none; }

/* ---------- Attachments ---------- */

.attach {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 100%;
  padding: 10px 18px 10px 10px;
  border: 0;
  border-radius: 18px;
  background: var(--in);
  color: var(--in-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.attach:hover .attach__open { text-decoration: underline; }
.attach__thumb {
  flex: none;
  width: 64px;
  height: 82px;
  overflow: hidden;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  container-type: inline-size;
  pointer-events: none;
}
.attach__thumb .pdf { box-shadow: none; }
.attach__text { display: grid; gap: 2px; }
.attach__name { font-weight: 650; font-size: 15px; }
.attach__meta { font-size: 13px; color: var(--in-ink-2); }
.attach__open { margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--in-link); }

.preview {
  display: block;
  width: min(320px, 100%);
  overflow: hidden;
  border-radius: 18px;
  background: var(--in);
  color: var(--in-ink);
  text-decoration: none;
}
.preview img { display: block; width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; }
.preview__body { display: grid; gap: 2px; padding: 10px 14px 12px; }
.preview__title { font-weight: 650; font-size: 15px; line-height: 1.25; }
.preview__site { font-size: 13px; color: var(--in-ink-2); }
.preview:hover .preview__title { text-decoration: underline; }
.preview--app { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; width: auto; }
.preview--app img { width: 56px; height: 56px; aspect-ratio: 1; border-radius: 13px; }
.preview--app .preview__body { padding: 0; }
.preview--doc { display: flex; align-items: center; gap: 12px; width: min(380px, 100%); padding: 10px 16px 10px 10px; }
.preview--doc .preview__body { padding: 0; }

.pay {
  width: min(340px, 100%);
  padding: 18px 18px 16px;
  border-radius: 22px;
  background: var(--in);
  color: var(--in-ink);
}
.pay__who { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.pay__price {
  margin: 14px 0 4px;
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
}
.pay__note { margin-bottom: 16px; font-size: 15px; color: var(--in-ink-2); }
.pay__fine { margin-top: 10px; font-size: 12.5px; line-height: 1.4; color: var(--in-ink-2); text-align: center; }

/* Video attachment: the demo with a one-row timeline of its steps */
.video {
  display: grid;
  margin-bottom: 18px;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  max-width: 620px;
}
.device {
  position: relative;
  width: 100%;
  margin: 0;
  aspect-ratio: 800 / 1449;
}
.device::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 3% 9.5% 2.5%;
  border-radius: 16% / 7.5%;
  box-shadow: 0 24px 44px -16px rgba(0, 0, 0, .45);
}
.device__screen {
  position: absolute;
  left: 11.61%;
  top: 4.09%;
  width: 77.18%;
  height: 92.27%;
  overflow: hidden;
  border-radius: 15.4% / 7.1%;
  background: #f2f2f7;
}
.device__screen video { display: block; width: 100%; height: 100%; object-fit: cover; }
.device__frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.video__title { font-weight: 650; font-size: 15px; }
.video__title span { margin-left: 6px; font-weight: 400; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.timeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.chapter {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 6px 0 4px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: 500 13px/1.2 var(--font);
  text-align: left;
  cursor: pointer;
}
.chapter:hover, .chapter.is-active { color: var(--ink); }
.chapter.is-active { font-weight: 650; }
.chapter__bar {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
}
.chapter:hover .chapter__bar { background: color-mix(in srgb, var(--ink) 24%, transparent); }
.chapter__bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--out);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}
.timeline li:has(~ li .is-active) .chapter__bar::after { transform: none; }

/* What happens in the current step. All five stay in the page (and for screen readers);
   they share one grid cell, so the column keeps its height as they change. */
.video__steps { margin: 16px 0 0; padding-left: 1.2em; font-size: 17px; line-height: 1.35; }
.js .video__steps { display: grid; padding: 0; list-style: none; }
.js .video__steps li { grid-area: 1 / 1; opacity: 0; pointer-events: none; }
.js .video:not(:has(.chapter.is-active)) .video__steps li:nth-child(1),
.video:has(.timeline li:nth-child(1) .is-active) .video__steps li:nth-child(1),
.video:has(.timeline li:nth-child(2) .is-active) .video__steps li:nth-child(2),
.video:has(.timeline li:nth-child(3) .is-active) .video__steps li:nth-child(3),
.video:has(.timeline li:nth-child(4) .is-active) .video__steps li:nth-child(4),
.video:has(.timeline li:nth-child(5) .is-active) .video__steps li:nth-child(5) { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: no-preference) {
  .js .video__steps li { transition: opacity .25s ease; }
}

.video__toggle { margin-top: 16px; }
.video__toggle .i-pause { display: none; }
.is-playing .video__toggle .i-play { display: none; }
.is-playing .video__toggle .i-pause { display: block; }

/* ---------- Questions ---------- */

.faq-log .msg:first-child { margin-top: 14px; }
.suggest {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 14px;
}
.suggest button, .suggest a {
  max-width: 100%;
  padding: 5px 11px;
  border: 1px solid var(--out);
  border-radius: 15px;
  background: transparent;
  color: var(--tint);
  font: 500 14px/1.3 var(--font);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.suggest button:hover, .suggest a:hover { background: color-mix(in srgb, var(--out) 10%, transparent); }
.js .faq-static { display: none; }
.qa-pair { margin-top: 14px; }

/* ---------- Export ---------- */

.topic--end { padding-top: 30px; }
.export { display: flex; justify-content: center; margin: 8px 0 6px; }
.export__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font: 650 17px/1 var(--font);
  cursor: pointer;
  box-shadow: var(--shadow-pop);
}
.export__btn:hover { filter: brightness(1.15); }
.export__btn .i { width: 19px; height: 19px; }

.endnote {
  margin-top: 46px;
  padding-top: 20px;
  border-top: 1px solid var(--sep);
  text-align: center;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-2);
}
.endnote__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 10px; }
.endnote a { color: var(--ink-2); }

/* ---------- Composer: pick a question and send it ---------- */

.composer {
  position: sticky;
  bottom: 0;
  z-index: 30;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  backdrop-filter: blur(20px) saturate(1.8);
  border-top: 1px solid var(--sep);
}
.composer__form { display: flex; align-items: center; gap: 10px; max-width: 780px; margin: 0 auto; }
.composer__select {
  flex: 1;
  min-width: 0;
  height: 40px;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-radius: 20px;
  background-color: var(--bg);
  box-shadow: inset 0 0 0 1px var(--sep);
  color: var(--ink);
  font: 500 16px/1.2 var(--font);
}
.composer__select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Cpath d='m2.5 6 3.5-3.5L9.5 6M2.5 10 6 13.5 9.5 10' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 10px 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}
.composer__select:hover { box-shadow: inset 0 0 0 1.5px var(--out); }
.composer__select:disabled { cursor: progress; opacity: .75; }
.composer__send {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--out);
  color: #fff;
  cursor: pointer;
}
.composer__send:hover { filter: brightness(1.08); }
.composer__send svg { width: 20px; height: 20px; }

/* Browsers with customizable selects get a Messages-style list above the box. */
@supports (appearance: base-select) {
  .composer__select, .composer__select::picker(select) { appearance: base-select; }
  .composer__select { display: flex; align-items: center; }
  .composer__select::picker-icon { display: none; }
  .composer__select::picker(select) {
    position-area: top span-right;
    margin: 0 0 8px;
    padding: 6px;
    max-height: min(70vh, 470px);
    border: 0;
    border-radius: 18px;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    backdrop-filter: blur(24px) saturate(1.8);
    box-shadow: inset 0 0 0 1px var(--sep), var(--shadow-pop);
  }
  .composer__select option { padding: 9px 14px; border-radius: 12px; color: var(--ink); font: 500 15px/1.3 var(--font); }
  .composer__select option:hover, .composer__select option:focus-visible { outline: none; background: var(--chip); }
  .composer__select option:checked { color: var(--tint); font-weight: 650; }
  .composer__select option::checkmark { display: none; }
}

/* ---------- Quick Look ---------- */

.ql {
  width: min(94vw, 640px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.ql__sheet {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow: hidden;
  border-radius: 18px;
  background: var(--side);
  box-shadow: var(--shadow-pop);
}
.ql::backdrop { background: rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.ql__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid var(--sep);
}
.ql__title { margin-right: auto; font-weight: 650; font-size: 15px; }
.ql__done { padding: 8px 12px; border: 0; border-radius: 10px; background: none; color: var(--tint); font: 650 16px/1 var(--font); cursor: pointer; }

/* The purchase sheet, after the App Store's */
.ql--buy { width: min(94vw, 440px); }
/* The purchase sheet frosts what's behind it (on the iPad, only the screen: see below) */
.ql--buy::backdrop { background: rgba(0, 0, 0, .3); -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3); }
.buysheet { padding: 0 20px 18px; }
.buysheet__bar { display: flex; align-items: center; justify-content: space-between; margin: 0 -8px; padding: 10px 0 6px; }
.buysheet__label { padding-left: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.buysheet__app { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 8px 0 16px; border-bottom: 1px solid var(--sep); }
.buysheet__name { display: grid; gap: 2px; min-width: 0; font-size: 17px; font-weight: 700; }
.buysheet__name span + span { font-size: 14px; font-weight: 400; color: var(--ink-2); text-wrap: balance; }
.buysheet__price { font: 750 26px/1 var(--font-display); letter-spacing: -0.02em; }
.buysheet__rows { margin: 0; }
.buysheet__rows div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--sep); font-size: 14.5px; line-height: 1.4; }
.buysheet__rows dt { color: var(--ink-2); }
.buysheet__rows dd { margin: 0; }
.buysheet .buy { margin-top: 18px; }
.buysheet__go { min-height: 50px; font-size: 17px; }
.buysheet__fine { margin-top: 10px; text-align: center; font-size: 12.5px; color: var(--ink-2); }
.ql__page { flex: 0 1 auto; min-height: 0; overflow: auto; padding: 22px; background: #c9c9ce; container-type: inline-size; }
.ql__note { margin-top: 14px; text-align: center; font-size: 13px; color: #3a3a3c; }
@media (prefers-reduced-motion: no-preference) {
  .ql[open] .ql__sheet { animation: ql-in .32s cubic-bezier(.2, .9, .3, 1); }
}
@keyframes ql-in { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) and (prefers-reduced-motion: no-preference) {
  .ql--buy[open] .ql__sheet { animation: sheet-up .34s cubic-bezier(.2, .9, .3, 1); }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }


/* ---------- The PDF layout (Quick Look page and thumbnail) ---------- */

.pdf { background: #fff; color: #1c1c1e; font-family: var(--font); font-size: 12px; font-size: 2.85cqi; box-shadow: 0 2px 12px rgba(0, 0, 0, .2); }
.pdf__body { padding: 2.6em 2.3em 2.8em; }
.pdf-label, .pdf__label { text-align: center; font-size: .68em; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #636368; }
.pdf__name { margin-top: .3em; text-align: center; font-size: 1.78em; font-weight: 700; line-height: 1.2; }
.pdf__meta { margin-top: .3em; padding-bottom: 1.5em; border-bottom: 1px solid #e5e5ea; text-align: center; font-size: .84em; color: #636368; }
.pdf__day { margin: 1.9em 0 .4em; text-align: center; font-size: .78em; font-weight: 600; color: #636368; }
.pdf__msg { display: flex; flex-direction: column; align-items: flex-start; margin-top: .75em; }
.pdf__msg--out { align-items: flex-end; }
.pdf__who { margin: 0 0 .25em .9em; font-size: .68em; color: #636368; }
.pdf__bubble { max-width: 76%; padding: .62em 1em .66em; border-radius: 1.3em; background: #ececee; color: #1c1c1e; line-height: 1.36; }
.pdf__msg--out .pdf__bubble { background: #2a70df; color: #fff; }
.pdf__time { margin: .3em .9em 0; font-size: .62em; color: #6e6e73; }

/* ---------- Exported: the conversation becomes the PDF ---------- */

.xhead, .x-who, .x-time, .x-day, .exportbar[hidden] { display: none; }

.exportbar {
  position: sticky;
  top: 69px;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  max-width: 780px;
  width: calc(100% - 44px);
  margin: 14px auto 0;
  padding: 10px 10px 10px 18px;
  border-radius: 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  backdrop-filter: blur(20px) saturate(1.8);
  box-shadow: inset 0 0 0 1px var(--sep), var(--shadow-pop);
  font-size: 15px;
}
.exportbar span { color: var(--ink-2); }
.exportbar__actions { display: flex; gap: 8px; }
.exportbar .pill { min-height: 38px; font-size: 15px; }

.is-exported .side, .is-exported .scrim, .is-exported .chat__tools .buy { display: none; }
.app.is-exporting { grid-template-columns: minmax(0, 1fr); }
.is-exported .composer, .is-exported .suggest, .is-exported .export, .is-exported .endnote,
.is-exported .typing, .is-exported .chat__back, .is-exported .stamp,
.is-exported .video__toggle, .is-exported .attach__open, .is-exported .topic--end { display: none !important; }

.is-exported .log {
  max-width: 760px;
  width: calc(100% - 32px);
  margin: 18px auto 64px;
  padding: 46px clamp(18px, 6%, 48px) 56px;
  background: #fff;
  color: #1c1c1e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 30px 60px -24px rgba(0, 0, 0, .45);
}
.is-exported .xhead { display: block; text-align: center; padding-bottom: 18px; border-bottom: 1px solid #e5e5ea; }
.xhead__name { margin-top: 6px; font-size: 26px; font-weight: 700; color: #1c1c1e; }
.xhead__meta { margin-top: 4px; font-size: 13px; color: #636368; }
.is-exported .x-day { display: block; margin: 22px 0 4px; text-align: center; font-size: 11.5px; font-weight: 600; color: #636368; }
.is-exported .topic { padding-top: 6px; }
.is-exported .msg { margin-top: 10px; }
.is-exported .msg--in .x-who { display: block; margin: 0 0 3px 12px; font-size: 10.5px; color: #636368; }
.is-exported .x-time { display: block; margin: 3px 12px 0; font-size: 9.5px; color: #6e6e73; }
.is-exported .bubble {
  max-width: 76%;
  padding: 7px 12px 8px;
  border-radius: 15px;
  font-size: 13.5px;
  line-height: 1.38;
  font-family: var(--font);
  font-weight: 400;
  letter-spacing: 0;
}
.is-exported .msg--in .bubble { background: #ececee; color: #1c1c1e; }
.is-exported .msg--out .bubble { background: #2a70df; color: #fff; }
.is-exported .msg--in .bubble a { color: #1f5fc4; }
.is-exported .bubble::before, .is-exported .bubble::after { display: none; }
.is-exported .attach, .is-exported .pay, .is-exported .preview { background: #ececee; color: #1c1c1e; zoom: .86; }
.is-exported .attach__meta, .is-exported .pay__note, .is-exported .pay__fine, .is-exported .preview__site { color: #636368; }
.is-exported .pay .buy { display: none; }
.is-exported .video { grid-template-columns: 96px minmax(0, 1fr); gap: 18px; max-width: 520px; }
.is-exported .video__title, .is-exported .timeline { display: none; }
.is-exported .video__steps { display: block; margin: 0; padding-left: 1.2em; list-style: decimal; font-size: 13px; color: #1c1c1e; }
.is-exported .video__steps li { opacity: 1; }
.is-exported .video__steps li + li { margin-top: 5px; }

/* ---------- Load: the opening messages arrive once ----------
   Typing, then the headline, then the two messages under it (the visitor's opening question was
   removed by the owner, 2026-10-18). On desktop it waits for the iPad's entrance (--intro-at). */

@media (prefers-reduced-motion: no-preference) {
  .js .intro-2 .typing--intro { animation: typing-life 1s ease calc(var(--intro-at, 0s) + .1s) both; }
  .js .intro-2 .bubble--loud { animation: loud .7s cubic-bezier(.2, .9, .3, 1.25) calc(var(--intro-at, 0s) + 1.05s) both; }
  .js .intro-3 { animation: pop-in .4s cubic-bezier(.2, .9, .3, 1.2) calc(var(--intro-at, 0s) + 1.7s) both; }
  .js .intro-4 { animation: pop-in .4s cubic-bezier(.2, .9, .3, 1.2) calc(var(--intro-at, 0s) + 2s) both; }
  /* Then everything else, together, as the last opening message lands. */
  html.intro-rest .log > #start ~ * { animation: rest-in .45s ease-out calc(var(--intro-at, 0s) + 2.35s) backwards; }
  .faq-log .msg { animation: pop-in .35s cubic-bezier(.2, .9, .3, 1.2) both; }
  .faq-log .msg--out { animation-name: pop-out; }
}
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.92); transform-origin: left bottom; } to { opacity: 1; transform: none; } }
@keyframes pop-out { from { opacity: 0; transform: translateY(10px) scale(.92); transform-origin: right bottom; } to { opacity: 1; transform: none; } }
@keyframes rest-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes typing-life { 0% { opacity: 0; } 15%, 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes loud {
  0% { opacity: 0; transform: scale(.4); transform-origin: left center; }
  55% { opacity: 1; transform: scale(1.12); transform-origin: left center; }
  75% { transform: scale(.97) rotate(-.6deg); transform-origin: left center; }
  100% { transform: none; }
}

/* ---------- Steps: the rest of the conversation arrives as you scroll ----------
   html.steps (set in inc/chat.php) holds back everything after the opening exchange; chat.js then
   shows one question and its answer at a time (.is-later → .is-arriving → .is-landing).
   Held-back messages stay readable by screen readers, out of sight. Printing shows everything. */
@media screen {
  html.steps:not(.steps-ready) #start > .intro-4 ~ *,
  html.steps:not(.steps-ready) .log > #start ~ *,
  html.steps .is-later {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
    pointer-events: none;
  }
  .is-arriving { visibility: hidden; }
}
/* Typing, in the place the first answer will take */
.typing--step { position: absolute; left: 0; top: 0; visibility: visible; }
@media (prefers-reduced-motion: no-preference) {
  .is-landing { animation: pop-in .35s cubic-bezier(.2, .9, .3, 1.2) both; }
  .is-landing.msg--out, .is-landing.suggest { animation-name: pop-out; }
  .is-landing.topic__label, .is-landing.topic--end, .is-landing.endnote { animation: rise .35s ease both; }
  .typing--step { animation: pop-in .25s cubic-bezier(.2, .9, .3, 1.2) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Export transition: the chat steps back, the printed page rises in its place.
   On the iPad only the screen changes (see the iPad section), so the frame stays put. */
@media not screen and (min-width: 1100px) and (min-height: 660px) and (hover: hover) and (pointer: fine) {
  html.vt-export::view-transition-old(root) { animation: vt-recede .38s cubic-bezier(.4, 0, .6, 1) both; }
  html.vt-export::view-transition-new(root) { animation: vt-paper .7s cubic-bezier(.2, .85, .25, 1) .12s both; }
  html.vt-back::view-transition-old(root) { animation: vt-drop .35s cubic-bezier(.4, 0, .6, 1) both; }
  html.vt-back::view-transition-new(root) { animation: vt-fade .35s ease .1s both; }
}
@keyframes vt-recede { to { opacity: 0; transform: scale(.92); filter: blur(2px); } }
@keyframes vt-paper { from { opacity: 0; transform: translateY(18vh) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes vt-drop { to { opacity: 0; transform: translateY(10vh); } }
@keyframes vt-fade { from { opacity: 0; } to { opacity: 1; } }
.no-vt .is-exported .log { animation: vt-paper .6s cubic-bezier(.2, .85, .25, 1) both; }

/* ---------- Desktop: the whole site runs on an iPad ----------
   Frame: /assets/img/ipad-frame.webp, 1390 × 950, cropped from captures/ipad frame.png so the
   screen sits at its exact centre. Device body 6,5 – 1384,945 (corner 92); screen 1288 × 850
   (corner 47, concentric with the bezel). The page doesn't scroll; the chat column does. */

@media screen and (min-width: 1100px) and (min-height: 660px) and (hover: hover) and (pointer: fine) {
  :root {
    --pad-gap: clamp(16px, 3.4vh, 40px);
    --pad-w: min(1390px, calc(100vw - 64px), calc((100vh - 2 * var(--pad-gap)) * 1390 / 950));
    --screen-w: calc(var(--pad-w) * 1288 / 1390);
    --screen-h: calc(var(--pad-w) * 850 / 1390);
    --screen-r: calc(var(--pad-w) * 47 / 1390);
    --status-h: 24px;
    --head-h: 106px;
    --side-w: clamp(272px, 28%, 330px);
  }
  html { height: 100%; overflow: hidden; }
  body {
    display: grid;
    place-items: center;
    height: 100%;
    overflow: hidden;
    background: var(--desk) radial-gradient(110% 85% at 50% 42%, var(--desk-hi), var(--desk) 72%);
  }

  /* The desk: big out-of-focus bubbles drifting slowly and the screen's glow, all in one colour:
     the section selected in the sidebar (data-section, set by chat.js). Fixed behind the iPad. */
  .desk {
    position: fixed;
    inset: 0;
    display: block;
    overflow: hidden;
    pointer-events: none;
    transition: --glow .6s ease, --glow-k .6s ease;
  }
  .desk[data-section="start"] { --glow: #2f7cf6; }
  .desk[data-section="how"] { --glow: #5856d6; }
  .desk[data-section="private"] { --glow: #23a94d; --glow-k: .6; }
  .desk[data-section="price"] { --glow: #f07d12; --glow-k: .4; }
  .desk[data-section="questions"] { --glow: #1aa2c2; --glow-k: .62; }
  .desk i { position: absolute; border-radius: 50%; will-change: transform; }
  .desk i:nth-child(1) { width: 54vmax; height: 54vmax; left: -16vmax; top: -20vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--glow) calc(var(--orb-strength) * var(--glow-k)), transparent), transparent); animation: desk-a 70s ease-in-out calc(var(--desk-t, 0s) * -1) infinite alternate; }
  .desk i:nth-child(2) { width: 44vmax; height: 44vmax; right: -12vmax; bottom: -22vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--glow) calc(var(--orb-strength) * var(--glow-k)), transparent), transparent); animation: desk-b 85s ease-in-out calc(var(--desk-t, 0s) * -1) infinite alternate; }
  .desk i:nth-child(3) { width: 30vmax; height: 30vmax; right: 6vmax; top: -12vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--glow) calc(var(--orb-strength) * .6 * var(--glow-k)), transparent), transparent); animation: desk-a 62s ease-in-out calc(var(--desk-t, 0s) * -1) infinite alternate-reverse; }
  .desk i:nth-child(4) { width: 26vmax; height: 26vmax; left: 8vmax; bottom: -10vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--glow) calc(var(--orb-strength) * .6 * var(--glow-k)), transparent), transparent); animation: desk-b 76s ease-in-out calc(var(--desk-t, 0s) * -1) infinite alternate-reverse; }
  .desk__glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: calc(var(--pad-w) * 1.5);
    height: calc(var(--pad-w) * 1.12);
    translate: -50% -50%;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--glow) calc(var(--glow-strength) * var(--glow-k)), transparent), transparent);
  }

  .ipad {
    position: relative;
    z-index: 1;
    isolation: isolate;
    width: var(--pad-w);
    aspect-ratio: 1390 / 950;
    background: url("/assets/img/ipad-frame.webp") center / 100% 100% no-repeat;
  }
  .ipad::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: .53% .43%;
    border-radius: 6.68% / 9.79%;
    box-shadow:
      0 calc(var(--pad-w) * .028) calc(var(--pad-w) * .05) calc(var(--pad-w) * -.012) rgba(0, 0, 0, .42),
      0 2px 5px rgba(0, 0, 0, .18);
  }

  .app {
    position: absolute;
    inset: 0;
    width: var(--screen-w);
    height: var(--screen-h);
    min-height: 0;
    margin: auto;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    overflow: clip; /* never scrolled by anchor jumps */
    border-radius: var(--screen-r);
    background: var(--bg);
    view-transition-name: screen;
  }
  .side {
    position: relative;
    height: auto;
    border-top: var(--status-h) solid var(--side);
    scrollbar-width: none;
  }
  .chat {
    position: relative; /* holds the visually hidden headings, so they scroll with it */
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding: calc(var(--head-h) + 14px) 0 100px;
    scrollbar-width: none;
  }
  .side::-webkit-scrollbar, .chat::-webkit-scrollbar { display: none; }
  .chat__head { padding-top: calc(var(--status-h) + 4px); }
  .exportbar { top: calc(var(--head-h) + 10px); }
  .bubble--loud { font-size: clamp(34px, var(--screen-w) * .044, 56px); }
  .composer { padding-bottom: 24px; }
  .pad-only { display: inline; }

  .statusbar {
    position: absolute;
    z-index: 70;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    height: var(--status-h);
    padding: 3px calc(var(--screen-r) * .62 + 4px) 0;
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
  }
  .statusbar__date { font-weight: 500; }
  .statusbar__icons { display: flex; align-items: center; gap: 6px; margin-left: auto; }
  .statusbar__icons svg { width: auto; height: 11.5px; }
  .statusbar__icons span { font-size: 12px; }
  .homebar {
    position: absolute;
    z-index: 70;
    left: 40%;
    bottom: 7px;
    display: block;
    width: 20%;
    height: 5px;
    border-radius: 3px;
    background: var(--ink);
    opacity: .82;
    pointer-events: none;
  }

  /* Quick Look opens inside the screen, over a dimmed chat */
  .ql {
    position: fixed;
    inset: 0;
    width: var(--screen-w);
    height: var(--screen-h);
    margin: auto;
    border-radius: var(--screen-r);
    background: rgba(0, 0, 0, .38);
  }
  .ql[open] { display: grid; place-items: center; }
  .ql::backdrop { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .ql__sheet { width: min(84%, 620px); max-height: calc(100% - 72px); border-radius: 16px; }
  .ql--buy .ql__sheet { width: min(84%, 440px); overflow-y: auto; }
  .ql--buy { background: rgba(0, 0, 0, .24); -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3); }

  /* Exporting changes the screen only */
  html.vt-export::view-transition-old(screen) { animation: vt-recede .38s cubic-bezier(.4, 0, .6, 1) both; }
  html.vt-export::view-transition-new(screen) { animation: vt-paper .7s cubic-bezier(.2, .85, .25, 1) .12s both; }
  html.vt-back::view-transition-old(screen) { animation: vt-drop .35s cubic-bezier(.4, 0, .6, 1) both; }
  html.vt-back::view-transition-new(screen) { animation: vt-fade .35s ease .1s both; }
  ::view-transition-group(screen) { overflow: clip; border-radius: var(--screen-r); }
}
@media screen and (min-width: 1100px) and (min-height: 660px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .ql[open] { animation: ql-dim .25s ease both; }
  .ql--buy[open] { animation: ql-frost .3s ease both; }
}
@keyframes ql-dim { from { background-color: transparent; } }
@keyframes ql-frost { from { background-color: transparent; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); } }
@media (prefers-reduced-motion: no-preference) {
  .ql--buy[open]::backdrop { animation: ql-frost .3s ease both; }
}
@keyframes desk-a { to { transform: translate(14vmax, 10vmax) scale(1.12); } }
@keyframes desk-b { to { transform: translate(-12vmax, -12vmax) scale(.9); } }
@media (prefers-reduced-motion: reduce) {
  .desk i { animation: none !important; }
  .desk { transition: none !important; }
}

/* ---------- Entrance (desktop) ----------
   html.pad-intro is set in inc/chat.php when the visitor comes from outside the site to the top of
   the chat. The iPad is lifted off the desk with its screen asleep while a reflection crosses the
   glass; then Messages opens from the middle of the screen and its light spreads over the desk.
   The opening exchange starts once the app is open (--intro-at). Reduce Motion skips all of it. */
@media screen and (min-width: 1100px) and (min-height: 660px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  html.pad-intro { --intro-at: 1.3s; }
  html.pad-intro .ipad { transform-origin: 50% 100%; animation: pad-lift 1.35s backwards; }
  html.pad-intro .ipad::before { animation: pad-shadow 1.35s ease-out backwards; }
  /* The sleeping screen: black glass under the app (the frame's screen is see-through), with a
     reflection crossing it. Gone once the app is open. */
  html.pad-intro .ipad::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    width: var(--screen-w);
    height: var(--screen-h);
    margin: auto;
    border-radius: var(--screen-r);
    background:
      linear-gradient(112deg, transparent 38%, rgba(255, 255, 255, .2) 47%, rgba(255, 255, 255, .05) 51%, transparent 60%) 100% 0 / 300% 100% no-repeat,
      linear-gradient(160deg, rgba(255, 255, 255, .06), transparent 45%) #000;
    opacity: 0;
    pointer-events: none;
    animation: pad-glass 1.8s linear backwards;
  }
  html.pad-intro .app { animation: app-open .62s cubic-bezier(.2, .85, .25, 1) 1.05s backwards; }
  html.pad-intro .desk { animation: desk-on 1.8s ease 1s backwards; }
  html.pad-intro .desk__glow { animation: glow-bloom 2.2s cubic-bezier(.2, .7, .2, 1) 1s backwards; }
}
@keyframes pad-lift {
  0% { transform: perspective(1800px) translateY(78%) rotateX(62deg) rotateZ(-2.5deg) scale(.9); animation-timing-function: cubic-bezier(.2, .62, .3, 1); }
  68% { transform: perspective(1800px) translateY(-1%) rotateX(-3.5deg) rotateZ(.25deg) scale(1.004); animation-timing-function: cubic-bezier(.45, 0, .4, 1); }
  100% { transform: perspective(1800px) translateY(0) rotateX(0) rotateZ(0) scale(1); }
}
@keyframes pad-shadow { 0%, 30% { opacity: 0; } }
@keyframes pad-glass {
  0%, 12% { opacity: 1; background-position: 100% 0, 0 0; }
  58% { background-position: 0 0, 0 0; }
  100% { opacity: 1; background-position: 0 0, 0 0; }
}
@keyframes app-open { from { opacity: 0; transform: scale(.22); } 40% { opacity: 1; } }
@keyframes desk-on { from { opacity: 0; } }
@keyframes glow-bloom { from { opacity: 0; scale: .45; } }

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed;
    z-index: 60;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(86vw, 360px);
    transform: translateX(-102%);
    transition: transform .3s cubic-bezier(.3, .8, .25, 1);
    box-shadow: var(--shadow-pop);
  }
  .is-threads-open .side { transform: none; }
  .is-threads-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .35); }
  .side__close { display: grid; }
  .chat__back { display: inline-flex; }
  .log { padding-inline: 14px; }
  .bubble { max-width: 82%; }
  .bubble--loud { max-width: min(94%, 11.5em); }
}

@media (max-width: 560px) {
  /* On phones the purchase sheet rises from the bottom */
  .ql--buy { width: 100%; margin: auto 0 0; }
  .ql--buy .ql__sheet { max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .buysheet__rows div { grid-template-columns: 1fr; gap: 2px; }
  .video { grid-template-columns: minmax(0, 1fr); gap: 18px; max-width: 300px; }
  .video .device { width: 230px; }
  .bubble--loud { font-size: 36px; }
  .composer { padding-inline: 10px; }
}


/* ---------- Print: always the PDF layout ---------- */

@page { margin: 14mm 12mm; }
@media print {
  html, body { background: #fff !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .side, .scrim, .chat__head, .exportbar, .composer, .skip, .ql { display: none !important; }
  .app { display: block; }
  .is-exported .log { width: 100%; max-width: none; margin: 0; padding: 0; box-shadow: none; }
  .msg { break-inside: avoid; }
  .device__screen video { display: none; }
  .device__screen { background: #fff url("/assets/video/texts2pdf-demo-poster.webp") center / cover; }
}
