/* 6:30: two worlds. Pure black is the calculator at 2 AM; the orange field is the voice,
   matching the App Store screenshots. One family (the system's SF), committed weights. */
:root {
  --black: #000;
  --orange: #ff9f0a;          /* iOS system orange (dark). Text on black: 10.2:1 */
  --ink: #fff;
  --muted: #a3a3a3;           /* on black: 8.4:1 */
  --rule: #262626;
  --surface: #0d0d0d;      /* a step off black, for framed objects */
  --on-orange: #000;          /* on orange: 10.2:1 */
  --on-orange-muted: #4d2f00; /* a darker orange, not gray. On orange: 6.9:1 */
  --on-orange-rule: rgb(0 0 0 / 0.16);

  --key-digit: #333;          /* oklch(0.31 0 0), as in the app */
  --key-function: #5c5c5c;    /* oklch(0.47 0 0) */

  --measure: 38rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section: clamp(4.5rem, 11vw, 9rem);
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  background: var(--black);
  color: var(--ink);
  font-family: var(--font);
  font-size: 100%;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}

body { margin: 0; }

::selection { background: var(--orange); color: var(--black); }

a { color: var(--orange); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 4px; }

.wrap {
  width: min(100% - 2 * var(--gutter), 72rem);
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.5rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.125rem;
}
.brand img { width: 2.25rem; height: 2.25rem; border-radius: 22.37%; }
.site-nav { display: flex; gap: 1.5rem; font-size: 0.9375rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }

/* App Store badge: Apple's artwork, unmodified */
.badge { display: inline-block; line-height: 0; border-radius: 0.6rem; }
.badge img { display: block; height: 3.25rem; width: auto; transition: filter 200ms var(--ease-out); }
.badge:hover img { filter: brightness(1.2); }
.availability {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin: 0;
}
.availability small { font-size: 0.9375rem; color: var(--muted); }

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  display: grid;
  gap: clamp(3.5rem, 7vw, 5rem);
  align-items: center;
  padding-block: clamp(2rem, 6vw, 5rem) var(--section);
}
@media (min-width: 60rem) {
  .hero { grid-template-columns: 1fr minmax(20rem, 23rem); }
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 6.4vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0;
  text-wrap: balance;
}
.hero .lede {
  color: var(--muted);
  font-size: clamp(1.125rem, 1.6vw, 1.3125rem);
  line-height: 1.55;
  max-width: 31rem;
  margin: 1.75rem 0 2.5rem;
  text-wrap: pretty;
}
.hero .lede strong { color: var(--ink); font-weight: 500; }

/* ── Demo calculator ──────────────────────────────────── */
.demo { margin: 0; justify-self: center; width: min(100%, 23rem); }
.calc {
  background: var(--black);
  border: 1px solid var(--rule);
  border-radius: 3rem;
  padding: 1.25rem 1.125rem 1.125rem;
  box-shadow: 0 0 0 0.5rem var(--surface), 0 2rem 5rem -1rem color-mix(in srgb, var(--orange) 12%, transparent);
}
.screen {
  height: 9.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  padding: 0 0.6rem 0.75rem;
  text-align: right;
}
.expr {
  margin: 0;
  min-height: 1.6em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1.0625rem;
  color: var(--muted);
  white-space: nowrap;
}
.expr.is-confirmation { color: var(--orange); }
.main {
  margin: 0;
  width: 100%;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 4.25rem; /* the script shrinks it when a line is too long */
  line-height: 1.05;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
}
.period { font-size: 0.45em; font-weight: 400; margin-left: 0.15em; letter-spacing: 0; }

.keys {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
.key {
  aspect-ratio: 1 / 0.94;
  border: 0;
  padding: 0;
  border-radius: 999px;
  background: var(--key-digit);
  color: var(--ink);
  font: 400 10cqi/1 var(--font-display);
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: filter 220ms var(--ease-out), background-color 220ms var(--ease-out), color 220ms var(--ease-out);
}
.key svg { width: 1em; height: 1em; }
.key.fn { background: var(--key-function); font-size: 8.5cqi; }
.key.op { background: var(--orange); font-size: 11.5cqi; }
.key.op.is-armed { background: var(--ink); color: var(--orange); }
.key:hover { filter: brightness(1.18); }
.key:active, .key.is-pressed { filter: brightness(1.6); transition-duration: 0ms; }
.key:focus-visible { outline-offset: 2px; border-radius: 999px; }

/* "Now press =": the page's one invitation */
.key.is-inviting { animation: invite 1.8s var(--ease-out) infinite; }
@keyframes invite {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--orange) 75%, transparent); }
  70%  { box-shadow: 0 0 0 0.9rem color-mix(in srgb, var(--orange) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--orange) 0%, transparent); }
}

.demo figcaption {
  margin-top: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9375rem;
  min-height: 1.6em;
  text-wrap: balance;
}

/* ── The meme, rebuilt ────────────────────────────────── */
.meme {
  display: grid;
  gap: clamp(3rem, 6vw, 5rem);
  align-items: center;
  padding-block: var(--section);
  border-top: 1px solid var(--rule);
}
@media (min-width: 60rem) {
  .meme { grid-template-columns: minmax(20rem, 25rem) 1fr; }
}
.meme-copy h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 1.5rem;
  text-wrap: balance;
}
.meme-copy p {
  color: var(--muted);
  font-size: clamp(1.0625rem, 1.4vw, 1.25rem);
  line-height: 1.6;
  max-width: 32rem;
  margin: 0 0 1rem;
  text-wrap: pretty;
}
.meme-copy strong { color: var(--ink); font-weight: 500; }

.chat {
  margin: 0;
  width: min(100%, 25rem);
  justify-self: center;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 2rem;
  padding: 1.25rem 1.25rem 1.5rem;
}
.chat-head {
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.chat-head strong { display: block; color: var(--ink); font-size: 1rem; font-weight: 600; }
.chat-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.bubble {
  max-width: 80%;
  padding: 0.6rem 0.95rem;
  border-radius: 1.25rem;
  font-size: 1.0625rem;
  line-height: 1.35;
}
.bubble.them { align-self: flex-start; background: var(--rule); border-bottom-left-radius: 0.375rem; }
.bubble.me { align-self: flex-end; padding: 0; background: none; width: 68%; }

/* The "screenshot": the 6:30 display and the top of the keypad, cut off like a phone grab */
.snap {
  display: block;
  container-type: inline-size;
  background: var(--black);
  border: 1px solid var(--rule);
  border-radius: 1.25rem;
  border-bottom-right-radius: 0.375rem;
  overflow: hidden;
  height: 0;
  padding-bottom: 92%;
  position: relative;
}
.snap-display {
  position: absolute;
  inset: 8% 9% auto auto;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 26cqi;
  line-height: 1;
  letter-spacing: -0.02em;
}
.snap-keys {
  position: absolute;
  inset: 44% 6% auto 6%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4cqi;
}
.snap-keys i {
  font-style: normal;
  aspect-ratio: 1 / 0.94;
  border-radius: 999px;
  background: var(--key-digit);
  display: grid;
  place-items: center;
  font: 400 8cqi/1 var(--font-display);
}
.snap-keys .fn { background: var(--key-function); font-size: 6.5cqi; }
.snap-keys .op { background: var(--orange); font-size: 9cqi; }

/* Enhances an already-visible chat: plays once when scrolled into view */
.chat.is-playing .bubble { animation: arrive 520ms var(--ease-out) backwards; }
.chat.is-playing .bubble:nth-child(2) { animation-delay: 700ms; }
.chat.is-playing .bubble:nth-child(3) { animation-delay: 1700ms; }
@keyframes arrive {
  from { opacity: 0; transform: translateY(0.75rem) scale(0.96); }
}
@media (prefers-reduced-motion: reduce) {
  .chat.is-playing .bubble { animation: none; }
}

/* ── Orange field ─────────────────────────────────────── */
.field { background: var(--orange); color: var(--on-orange); }
.field ::selection { background: var(--black); color: var(--orange); }
.field a { color: var(--on-orange); }
.field :focus-visible { outline-color: var(--black); }

.math { padding-block: var(--section); }
.math h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 clamp(2.5rem, 5vw, 4rem);
}
.sums { list-style: none; margin: 0; padding: 0; }
.sums li {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.3em;
  align-items: baseline;
  padding-block: clamp(1.1rem, 2.4vw, 1.75rem);
  border-top: 1px solid var(--on-orange-rule);
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 7.5vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
}
.sums li:last-child { border-bottom: 1px solid var(--on-orange-rule); }
.sums .in { font-weight: 200; }
.sums .out { font-weight: 600; }
.sums p {
  grid-column: 1 / -1;
  margin: 0.9rem 0 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  letter-spacing: 0;
  line-height: 1.5;
  color: var(--on-orange-muted);
  font-weight: 500;
  max-width: 30rem;
  text-wrap: pretty;
}
@media (min-width: 52rem) {
  .sums li { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr) minmax(0, 5fr); }
  .sums .in { text-align: right; padding-right: 0.3em; }
  .sums p { grid-column: auto; margin: 0; align-self: center; padding-left: 1.5rem; }
}

/* ── Facts ────────────────────────────────────────────── */
.facts { padding-block: var(--section); }
.fact {
  display: grid;
  gap: 1rem 3rem;
  padding-block: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--rule);
}
.fact:last-child { border-bottom: 1px solid var(--rule); }
@media (min-width: 52rem) {
  .fact { grid-template-columns: 5fr 6fr; align-items: baseline; }
}
.fact h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.4vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}
.fact p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1.4vw, 1.25rem);
  line-height: 1.6;
  max-width: 34rem;
  text-wrap: pretty;
}
.fact p strong { color: var(--ink); font-weight: 500; }

/* ── Sign-off ─────────────────────────────────────────── */
.signoff { padding-block: var(--section); }
.signoff .kicker {
  margin: 0 0 1rem;
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  font-weight: 500;
  color: var(--on-orange-muted);
  letter-spacing: -0.01em;
}
.signoff h2 {
  font-family: var(--font-display);
  font-size: clamp(3.25rem, 10vw, 6rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  font-weight: 700;
  margin: 0 0 clamp(2.5rem, 5vw, 3.5rem);
  text-wrap: balance;
}
.signoff .availability small { color: var(--on-orange-muted); font-weight: 500; }

/* ── Documents ────────────────────────────────────────── */
.doc { max-width: var(--measure); padding-block: 3rem 6rem; }
.doc h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}
.doc .updated { color: var(--muted); margin: 0 0 3rem; }
.doc h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin: 2.75rem 0 0.75rem; }
.doc p, .doc li { color: var(--ink); text-wrap: pretty; }
.doc ul { padding-left: 1.25rem; }
.doc li + li { margin-top: 0.5rem; }
.doc .lede { font-size: 1.25rem; color: var(--ink); }
.doc kbd { font: inherit; color: var(--orange); font-weight: 600; }
.doc .get-app { margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid var(--rule); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 2rem 3rem;
  color: var(--muted);
  font-size: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }
.field + .wrap .site-footer { border-top: 0; }

@media (prefers-reduced-motion: reduce) {
  .key, .badge img { transition: none; }
  .key.is-inviting { animation: none; box-shadow: 0 0 0 3px var(--ink); }
}
