/* Caply landing page. It speaks the language of Apple's devices, not of a
   website. The numbers come from Apple's Human Interface Guidelines and are
   listed with their source in docs/APPLE-SPECS.md:
   - titles use the tvOS text styles (a screen you watch films on): Title 1
     76/96, Title 2 57/66, Title 3 48/56; on a phone, the iOS ones: Large
     Title 34/41, Title 1 28/34;
   - reading sizes are the iOS text styles: Title 2 22/28, Title 3 20/25,
     Body 17/22, Subhead 15/20, Footnote 13/18, each with SF's tracking;
   - letter spacing is Inter's own, not San Francisco's: each typeface has
     its spacing table, and Apple's numbers only suit Apple's letters. Inter's
     author gives tracking = -0.0223 + 0.185 x e^(-0.1745 x size), in em:
     13 -> -0.04px, 15 -> -0.13px, 17 -> -0.22px, 20 -> -0.33px, 22 -> -0.4px,
     then -0.022em for titles. Sizes and line heights stay Apple's;
   - colours are the current system colours in dark mode;
   - a button that stands alone is a capsule, 52pt tall, with a press state;
   - glass is for controls floating over content, never for content.
   Nothing moves on scroll: things move when the visitor touches them. */

@font-face {
  font-family: "Inter";
  src: url("assets/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --blue: #0091ff;          /* system blue, dark */
  --link: #5cb8ff;          /* system blue, dark, increased contrast */
  --text: #f5f5f7;
  --text-2: rgba(235, 235, 245, 0.6);
  --text-3: rgba(235, 235, 245, 0.3);
  --card: #1c1c1e;          /* system gray 6, dark */
  --card-2: #2c2c2e;        /* system gray 5, dark */
  --hairline: rgba(84, 84, 88, 0.65);
  --label: #fff;
  --label-2: rgba(235, 235, 245, 0.6);
  --fill: rgba(120, 120, 128, 0.36);
  --fill-2: rgba(120, 120, 128, 0.24);
  --separator: rgba(84, 84, 88, 0.65);
  --gutter: max(80px, env(safe-area-inset-left), env(safe-area-inset-right));   /* tvOS side inset */
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: #000;
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.22px;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

/* ── The name ───────────────────────────────────────────────────────────── */
.top { display: grid; place-items: center; padding: max(28px, env(safe-area-inset-top)) var(--gutter) 0; }
.mark { font-size: 26px; font-weight: 500; letter-spacing: -0.06em; line-height: 1.1; }
/* Logo on trial: the mark before the name. Remove these two rules to go back. */
.mark { display: inline-flex; align-items: center; gap: 0.34em; }
.mark::before { content: ""; flex: none; width: 0.84em; aspect-ratio: 1; background: currentColor; -webkit-mask: url("assets/logo.svg") center / contain no-repeat; mask: url("assets/logo.svg") center / contain no-repeat; }

/* ── The page's own island: there once the first button has scrolled away ─ */
.bar {
  position: fixed;
  z-index: 20;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  height: 44px;
  padding: 0 6px 0 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(22, 22, 24, 0.72);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.16), 0 10px 30px rgba(0, 0, 0, 0.35);
  translate: -50% 0;
  transform-origin: 50% 0;
  transition: opacity 0.22s ease, transform 0.36s cubic-bezier(0.22, 1, 0.36, 1), filter 0.22s ease, visibility 0s;
}
.bar[hidden] { display: flex; visibility: hidden; opacity: 0; transform: scale(0.72); filter: blur(6px); transition-delay: 0s, 0s, 0s, 0.36s; }
.bar span { font-size: 19px; font-weight: 500; letter-spacing: -0.06em; }
.bar a {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.13px;
  white-space: nowrap;
  transition: transform 0.1s ease-out, filter 0.15s ease;
}
/* a 44pt target around a 32pt button */
.bar a { position: relative; }
.bar a::after { content: ""; position: absolute; inset: -6px; }
.bar a:hover { filter: brightness(1.1); }
.bar a:active { transform: scale(0.96); }

/* ── Sections ───────────────────────────────────────────────────────────── */
.hero, .block {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 160px var(--gutter) 160px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  text-align: center;
}
/* Le même rythme que la page AirPods Pro d'Apple, mesuré sur 1440 px : 160 au-dessus
   et 160 au-dessous de chaque section (216 sous la première) ; 96 et 96 sur
   téléphone. Des valeurs fixes, pas liées à la hauteur de l'écran. */
.hero { padding-top: clamp(64px, 11vh, 120px); padding-bottom: 216px; }
@media (max-width: 760px) {
  .block { padding: 96px var(--gutter) 96px; }
  .hero { padding-bottom: 196px; }
}
/* Title sizes are tvOS Title 1 (76) and Title 2 (57), bold. Their line height
   is the one Apple sets on large titles that run over two lines (1.05 at 80,
   1.08 at 48), not the 96pt leading meant for a TV across the room. */
h1, .closing h2 { font-size: 76px; line-height: 1.05; font-weight: 700; letter-spacing: -0.022em; }
h2 { max-width: 16em; font-size: 57px; line-height: 1.07; font-weight: 700; letter-spacing: -0.022em; }
.closing h2 { max-width: 10em; }
/* iOS Title 2: 22/28 regular. */
.lead {
  max-width: 30em;
  margin-top: 16px;
  color: var(--text-2);
  font-size: 22px;
  line-height: 28px;
  font-weight: 400;
  letter-spacing: -0.4px;
}
/* The one button. Alone on the page, so a capsule; the Large control size
   (52pt); Headline type (17/22 semibold); and always a press state. */
.btn {
  margin-top: 32px;
  height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.22px;
  white-space: nowrap;
  transition: transform 0.1s ease-out, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.fine { margin-top: 16px; color: var(--text-2); font-size: 13px; line-height: 18px; letter-spacing: -0.04px; }   /* Footnote */
.only-touch { display: none; }
@media (hover: none) { .only-mouse { display: none; } .only-touch { display: inline; } }

/* Segmented controls and keycaps on the page are the notch's own. */
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-radius: 999px; }
.seg button { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.keycap { vertical-align: 1px; }

/* ── The film, and the bar under it (as in the lab) ─────────────────────── */
.player { width: 100%; }
.player-hero { margin-top: clamp(40px, 6vh, 72px); border-radius: 28px; }
.under { width: 100%; margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.under-seg { flex: none; width: 200px; height: 32px; padding: 2px; background: var(--fill-2); }
.under-seg .seg-thumb { top: 2px; left: 2px; height: calc(100% - 4px); width: calc((100% - 4px) / 2); background: #636366; }
.under-seg button { font-size: 13px; letter-spacing: -0.04px; }
.hint { color: var(--text-2); font-size: 13px; letter-spacing: -0.04px; line-height: 26px; }
.hint .keycap { margin: 0 2px; }
/* Sound. A film on a page starts silent: nobody should be surprised by audio.
   The button sits at the bottom right of the film: glass, because it floats
   over the film, and 44pt, the smallest comfortable target. A click on the
   film itself does the same. Nothing is written over the picture. */
.player-hero > video { cursor: pointer; }
.player .sound {
  position: absolute;
  z-index: 2;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--k-glass);
  -webkit-backdrop-filter: var(--k-glass-filter);
  backdrop-filter: var(--k-glass-filter);
  box-shadow: var(--k-glass-edge);
  color: #fff;
  transition: transform 0.12s ease-out;
}
.player .sound:active { transform: scale(0.92); }
.sound svg { width: 20px; height: 20px; }
.sound[aria-pressed="false"] .sound-on, .sound[aria-pressed="true"] .sound-off { display: none; }

/* ── The three modes: a row of cards, after Apple's feature rows ─────────────
   Measured on apple.com/airpods-pro at 1440: cards 20 px apart, the picture
   with a 28 px corner, then under it a 17/25 line whose first words are the
   title, in semibold and the text colour, and the rest in grey. On a phone the
   row slides sideways and the next card peeks in. */
.modes { width: 100%; margin-top: clamp(40px, 6vh, 64px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; text-align: left; }
.modes figure { margin: 0; display: block; }
.modes .player { aspect-ratio: 4 / 3; border-radius: 28px; }
.modes .player > img { object-position: 50% 35%; }
.modes .captions { bottom: 8%; font-size: clamp(14px, 4.8cqw, 19px); }
.modes figcaption { margin-top: 20px; padding-inline: 4px; color: var(--text-2); font-size: 17px; line-height: 25px; font-weight: 400; letter-spacing: -0.374px; }
.modes figcaption b { color: var(--text); font-weight: 600; }
/* each card rises into place, one after the other */
@media (prefers-reduced-motion: no-preference) {
  .js .modes figure { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1); }
  .js .modes.is-in figure { opacity: 1; transform: none; }
  .js .modes.is-in figure:nth-child(2) { transition-delay: 0.1s; }
  .js .modes.is-in figure:nth-child(3) { transition-delay: 0.2s; }
}
@media (max-width: 760px) {
  .modes { display: flex; gap: 16px; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
  .modes::-webkit-scrollbar { display: none; }
  .modes figure { flex: 0 0 min(82vw, 380px); scroll-snap-align: start; }
  .modes .player { border-radius: 22px; }
}

/* ── Questions: a message thread ──────────────────────────────────────────
   Drawn after Messages on iOS in dark mode: system blue for what you send, dark
   grey for what you receive, 17 pt text on a 22 pt line, 18 pt corners, and the
   tail that curls out of the bottom corner, drawn as the classic pair of pieces. A question and its answer sit close; exchanges breathe.
   No frame, no header: just the thread. */
.chat-section { --im-blue: #0a84ff; --im-grey: #262629; --im-page: #000; }
.chat { width: min(520px, 100%); margin-top: clamp(32px, 5vh, 52px); display: flex; flex-direction: column; gap: 14px; text-align: left; isolation: isolate; }
.qa { display: flex; flex-direction: column; gap: 8px; isolation: isolate; }
.msg {
  position: relative;
  width: fit-content;
  max-width: 75%;
  margin: 0;
  padding: 7px 14px 8px;
  border-radius: 18px;
  font-size: 17px;
  font-weight: 400;
  line-height: 22px;
  letter-spacing: -0.24px;
  text-wrap: balance;   /* the bubble hugs its lines, no empty half */
}
.msg-q { align-self: flex-end; background: var(--im-blue); color: #fff; }
.msg-a { align-self: flex-start; background: var(--im-grey); color: #fff; }
.msg::before, .msg::after { content: ""; position: absolute; bottom: 0; height: 20px; z-index: -1; }
.msg-q::before { right: -8px; width: 20px; background: var(--im-blue); border-bottom-left-radius: 15px; }
.msg-q::after { right: -10px; width: 10px; background: var(--im-page); border-bottom-left-radius: 10px; }
.msg-a::before { left: -8px; width: 20px; background: var(--im-grey); border-bottom-right-radius: 15px; }
.msg-a::after { left: -10px; width: 10px; background: var(--im-page); border-bottom-right-radius: 10px; }
/* The thread starts with Caply's hello and the questions as suggested replies.
   A tap sends one: it becomes a blue bubble, Caply types, then answers. */
.chat-hello { display: none; }
.js .chat-hello { display: block; }
.js .qa:not(.is-asked) { display: none; }
.js .qa .msg-a[hidden] { display: none; }
.js .qa .msg-q { cursor: pointer; }
.chat-suggest { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-top: 4px; }
.chat-suggest:empty { display: none; }
.chip {
  min-height: 44px;
  padding: 10px 14px 11px;
  border: 1px solid rgba(10, 132, 255, 0.6);
  border-radius: 22px;
  background: none;
  color: #409cff;
  font: 400 17px/22px var(--font);
  letter-spacing: -0.24px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease-out;
}
.chip:hover { background: rgba(10, 132, 255, 0.16); }
.chip:active { transform: scale(0.97); }
.msg-typing { display: flex; align-items: center; gap: 4px; padding: 14px 13px; }
.msg-typing i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.5); }
@media (prefers-reduced-motion: no-preference) {
  .msg.is-new { animation: msg-in 0.2s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .msg-q.is-new { transform-origin: 100% 100%; }
  .msg-a.is-new { transform-origin: 0 100%; }
  .msg-typing i { animation: msg-dot 0.9s ease-in-out infinite; }
  .msg-typing i:nth-child(2) { animation-delay: 0.14s; }
  .msg-typing i:nth-child(3) { animation-delay: 0.28s; }
}
@keyframes msg-in { from { opacity: 0; transform: translateY(8px) scale(0.9); } }
@keyframes msg-dot { 0%, 60%, 100% { opacity: 0.35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@media (max-width: 600px) {
  .msg { max-width: 82%; }
  /* the replies slide sideways under the thumb */
  .chat-suggest { flex-direction: row; flex-wrap: nowrap; justify-content: flex-start; align-items: center; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); padding-bottom: 6px; scroll-snap-type: x proximity; }
  .chat-suggest::-webkit-scrollbar { display: none; }
  .chip { flex: none; scroll-snap-align: start; }
}

/* Phones and dark browsers */
/* The page is already dark: a browser set to darken pages must leave it alone. */
:root { color-scheme: dark; }
html { -webkit-tap-highlight-color: transparent; }
:focus:not(:focus-visible) { outline: none; }
/* The logo as a picture, not a mask: nothing a browser recolours. */
.mark::before { background: url("assets/logo-white.svg") center / contain no-repeat; -webkit-mask: none; mask: none; }

/* A browser that recolours pages */
/* Some phone browsers darken every page, even a dark one: black cut-outs turn
   white, greys turn black, pictures are dimmed. So: say twice that the page is
   dark only; draw the logo in the page, in the text colour; give each bubble
   one tail in its own colour instead of a black cut-out; and give every card
   an edge, so it still shows if its fill is flattened. */
:root { color-scheme: only dark; }
@media (prefers-color-scheme: dark) { :root { color-scheme: only dark; } }
.mark::before { content: none; }
.mark-logo { flex: none; width: 0.84em; height: 0.84em; }

/* ── The end of the page: the name, two links, a footnote ───────────────── */
.foot {
  margin-top: 0;
  padding: 0 var(--gutter) max(40px, env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: 14px;
  color: var(--text-2);
  font-size: 13px;
  letter-spacing: -0.04px;
  text-align: center;
}
.foot .mark { color: var(--text); font-size: 22px; margin-bottom: 10px; }
.foot-links { display: flex; gap: 22px; color: var(--text); }
.foot-links a, .foot .mark { padding: 13px 0; }
.foot a:hover { color: var(--text); }

/* Narrower than a desktop: smaller side insets, Title 2 and Title 3 sizes. */
@media (max-width: 1068px) {
  :root { --gutter: max(40px, env(safe-area-inset-left), env(safe-area-inset-right)); }
  h1, .closing h2 { font-size: 57px; line-height: 1.07; }
  h2 { font-size: 48px; line-height: 1.08; }
}
/* A phone: the iOS text styles. Large Title 34/41 bold, Title 1 28/34 bold,
   Title 3 20/25 for the lead, 20pt margins. */
@media (max-width: 600px) {
  :root { --gutter: max(20px, env(safe-area-inset-left), env(safe-area-inset-right)); }
  h1, .closing h2 { font-size: 34px; line-height: 1.12; letter-spacing: -0.75px; }
  h2 { font-size: 28px; line-height: 1.14; letter-spacing: -0.59px; }
  .lead { font-size: 20px; line-height: 25px; letter-spacing: -0.33px; }
  /* room for the notch's settings on a small film */
  .player-hero { aspect-ratio: 1 / 1; border-radius: 22px; }
  .under { justify-content: center; }
  .under-seg { width: 100%; height: 44px; }
  .under-seg button { font-size: 15px; }
  .thread { border-radius: 32px; padding-inline: 16px; }
  .msg { max-width: 84%; }
  .player .sound { right: 10px; bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .bar { transition-duration: 0.01s; } }
@media (prefers-reduced-transparency: reduce) { .bar, .player .sound { background: #1c1c1e !important; -webkit-backdrop-filter: none; backdrop-filter: none; } }
