:root {
  /* 0 = black page, 1 = light. main.js drives it from the color field's own fill, so the nav and
     page turn at the same moment as the background behind them */
  --lit: 0;
  --bg: color-mix(in srgb, var(--page) calc(var(--lit) * 100%), #000);
  --fg: color-mix(in srgb, var(--ink) calc(var(--lit) * 100%), var(--page));
  --page: #f5f6fb;
  --ink: #22272b;         /* the logo wordmark's ink */
  --muted: #86868b;
  --blue: #0a7cff;        /* sent bubble */
  --gray: #e9e9eb;        /* received bubble */
  --ti-1: #f4f3ef;        /* pale titanium, so the page stays pale */
  --ti-2: #d6d3cc;
  --ti-3: #a9a59d;
  --thick: 30px;          /* phone depth */
  --serif: "Newsreader", Georgia, serif;   /* mixr's voice, outside the phone */
  --sf: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; }
/* one screen, never scrolls: wheel, swipe, tap and keys step through slides (main.js) */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.4 var(--sf);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* page chrome: one contained row, brand left, actions right */
.top { position: fixed; inset: 0 0 auto; z-index: 5; color: var(--fg); }
.top-in {
  max-width: 1200px; margin: 0 auto; padding: 18px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.mark { width: 26px; height: 26px; }
.mark rect { fill: currentColor; }
.mark path { fill: var(--bg); }
.brand-name { font: 500 25px/1 var(--serif); font-optical-sizing: auto; letter-spacing: -.035em; }
/* trim each label to its cap height, so flex centering lines the serif up with the mark and pill */
.brand-name, .nav-link, .nav-cta { text-box: trim-both cap alphabetic; }
.top-actions { display: flex; align-items: center; gap: 28px; }
.nav-link { font: 400 15px/1 var(--serif); color: inherit; text-decoration: none; opacity: .7; transition: opacity .2s; }
.nav-link:hover { opacity: 1; }
.nav-cta {
  font: 500 15px/1 var(--serif); text-decoration: none;
  padding: 13px 20px; border-radius: 999px; background: var(--fg); color: var(--bg);
}
@media (max-width: 640px) { .nav-link { display: none; } .nav-cta { padding: 11px 16px; font-size: 14px; } }
.nav-link:focus-visible, .nav-cta:focus-visible, .brand:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 8px; }

.stage {
  position: fixed; inset: 0; height: 100dvh;
  overflow: hidden;
  perspective: 2200px;
  perspective-origin: 50% 40%;
}
/* living background: a WebGL field in the icon's colors (main.js) that spreads out on unlock */
.glow {
  position: absolute; inset: 0; pointer-events: none;
}
.glow canvas { display: block; width: 100%; height: 100%; }
/* no WebGL: a still version of the same palette, faded in on unlock */
.glow.nogl { background: radial-gradient(circle at 50% 55%, #ffe6cf, #ffd2ee 20%, #c9c4f6 40%, #bccbff 55%, #f5f6fb 80%); opacity: 0; }

/* hero: centered and compact, above the phone. The clip is a fixed band below the nav: as the
   phone pushes the hero up, the text slides out under that edge instead of fading.
   White on black, inverted where it crosses the phone. */
.hero-clip {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  mix-blend-mode: difference;
  -webkit-mask-image: linear-gradient(transparent 72px, #000 112px); mask-image: linear-gradient(transparent 72px, #000 112px);
}
.hero { position: absolute; top: 15svh; left: 0; right: 0; padding: 0 24px; text-align: center; color: #fff; }
.lede {
  font: 350 clamp(42px, 5.6vw, 84px)/1 var(--serif); font-optical-sizing: auto; letter-spacing: -.035em;
  text-wrap: balance;
}
.sub {
  margin: 20px auto 0; max-width: 30em;
  font: 400 clamp(18px, 1.5vw, 21px)/1.45 var(--serif); font-optical-sizing: auto;
  color: rgba(255, 255, 255, .62); text-wrap: pretty;
}
@media (max-width: 640px) { .hero { top: 13dvh; } }
.origin {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: calc(24px + env(safe-area-inset-bottom));
  text-align: center; font: 400 15px/1 var(--serif); color: #fff; opacity: .55;
  mix-blend-mode: difference; pointer-events: none;
}

/* slide position, right edge */
.dots {
  position: fixed; z-index: 5; right: clamp(10px, 2vw, 28px); top: 50%; translate: 0 -50%;
  display: flex; flex-direction: column; gap: 4px;
}
.dots button {
  width: 22px; height: 22px; border: 0; padding: 0; background: none; cursor: pointer;
  display: grid; place-items: center; color: var(--fg);
}
.dots button::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .3; transition: opacity .3s, scale .3s; }
.dots button[aria-current]::before { opacity: 1; scale: 1.25; }
.dots button:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; border-radius: 50%; }

/* tooltip pointing at the message field once the keypad is up; --hint-y is set from the field's position */
.hint {
  position: absolute; z-index: 2; top: var(--hint-y, 60%); right: calc(100% - var(--hint-x, 30%) + 18px);
  translate: 8px -50%; padding: 11px 16px; border-radius: 12px;
  background: var(--ink); color: #fff; white-space: nowrap;
  font: 400 19px/1 var(--serif); font-optical-sizing: auto; letter-spacing: -.01em;
  box-shadow: 0 10px 30px -10px rgba(34, 39, 43, .45);
  opacity: 0; transition: opacity .45s, translate .45s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}
.hint::after {
  content: ""; position: absolute; left: 100%; top: 50%; translate: -1px -50%;
  border: 8px solid transparent; border-left-color: var(--ink);
}
.hint.on { opacity: 1; translate: 0 -50%; }

.foot {
  position: fixed; z-index: 3; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom));
  max-width: 34rem; margin: 0 auto; padding: 0 20px;
  font: 400 13px/1.45 var(--serif); color: #6b6f78; text-align: center;
  opacity: 0; transition: opacity .5s; pointer-events: none;
}
/* the consent note shows on the number slide */
.end .foot { opacity: 1; pointer-events: auto; }
/* narrow: the zoomed phone fills the width and runs under the nav, so the chrome steps aside */
.top, .dots { transition: opacity .4s; }
@media (max-width: 699px) { .end .top, .end .dots { opacity: 0; pointer-events: none; } }
/* read receipt: "Delivered" and "Read" share one cell and cross-fade */
.receipt > span { grid-area: 1 / 1; }
.receipt .rd { opacity: 0; }

/* ── phone: designed at native iPhone points, scaled by --s ── */
.phone {
  --w: 426px; --h: 898px; --r: 68px;
  position: absolute; left: 50%; top: 50%;
  width: var(--w); height: var(--h);
  margin: calc(var(--h) / -2) 0 0 calc(var(--w) / -2);
  transform-style: preserve-3d;
  scale: var(--s, .7);
}
.body, .layer, .face { position: absolute; inset: 0; border-radius: var(--r); }
.body { transform-style: preserve-3d; }
.layer {
  background: linear-gradient(90deg, var(--ti-3), var(--ti-1) 12%, var(--ti-2) 50%, var(--ti-1) 88%, var(--ti-3));
  transform: translateZ(calc(var(--z) * 1px));
}
.layer.back {
  background: radial-gradient(120% 80% at 30% 20%, #f6f5f1, #e2dfd8 60%, #cfcbc3);
}
/* camera plateau and the mixr mark, on the back so they show before the phone flips */
.cam {
  position: absolute; right: 24px; top: 24px; width: 196px; height: 196px; border-radius: 56px;
  background: linear-gradient(145deg, #f3f1ec, #d9d6cf);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.7), 0 2px 6px rgba(0,0,0,.15);
  transform: translateZ(calc(var(--thick) * -1 - 2px)) rotateY(180deg);
}
.cam b { position: absolute; width: 74px; height: 74px; border-radius: 50%; background: radial-gradient(circle, #1d2433 0 28%, #0b0d12 30% 58%, #3a3d44 60% 66%, #c9c6bf 68%); box-shadow: 0 2px 4px rgba(0,0,0,.35); }
.cam b:nth-child(1) { left: 14px; top: 14px; }
.cam b:nth-child(2) { left: 14px; bottom: 14px; }
.cam b:nth-child(3) { right: 14px; top: 61px; }
.back-mark {
  position: absolute; left: 50%; top: 36%; width: 112px; height: 112px; margin: -56px 0 0 -56px;
  border-radius: 30px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
  transform: translateZ(calc(var(--thick) * -1 - 1px)) rotateY(180deg);
}
.btn { position: absolute; width: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--ti-3), var(--ti-1)); transform: translateZ(calc(var(--thick) / -2)); }
.btn.vol-up   { left: -4px; top: 250px; height: 86px; }
.btn.vol-down { left: -4px; top: 352px; height: 86px; }
.btn.power    { right: -4px; top: 290px; height: 128px; background: linear-gradient(270deg, var(--ti-3), var(--ti-1)); }

.face {
  padding: 4px;
  background: linear-gradient(135deg, #fbfaf7, var(--ti-2) 40%, #efede8 60%, var(--ti-3));
  box-shadow: 0 60px 120px -40px rgba(40, 40, 80, .4);
}
.screen {
  position: relative; height: 100%;
  border: 8px solid #000; border-radius: calc(var(--r) - 4px);
  background: #000; overflow: hidden;
  isolation: isolate;
}
/* glass sheen, moved by the scroll timeline */
.screen::after {
  content: ""; position: absolute; inset: -20%; z-index: 20; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,.16) 46%, transparent 54%);
  translate: var(--sheen, -40%) 0;
}

.punch { position: absolute; z-index: 15; top: 16px; left: 50%; width: 24px; height: 24px; translate: -50% 0; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #2a2f3a 0 18%, #050608 42%); }
.statusbar {
  position: absolute; z-index: 14; inset: 0 0 auto; height: 54px; padding: 0 30px 0 50px;
  display: flex; align-items: center; justify-content: space-between;
  font: 600 17px/1 var(--sf); letter-spacing: -.02em; color: #fff;
}
.statusbar .sys { display: flex; gap: 6px; align-items: center; }
.statusbar svg { fill: currentColor; }
.homebar { position: absolute; z-index: 14; bottom: 8px; left: 50%; width: 140px; height: 5px; translate: -50% 0; border-radius: 3px; background: #000; opacity: 0; }

.view { position: absolute; inset: 0; }
.off, .lock { pointer-events: none; }
.off { background: radial-gradient(140% 90% at 80% 0%, #1b1b20, #000 60%); z-index: 3; }

/* lock screen */
.lock {
  color: #fff; text-align: center; padding-top: 70px;
  background:
    radial-gradient(90% 60% at 20% 15%, #9fb6ff, transparent 70%),
    radial-gradient(80% 60% at 90% 45%, #f6a9dc, transparent 70%),
    radial-gradient(90% 60% at 30% 95%, #ffd2b3, transparent 70%),
    #b9b5f2;
  z-index: 2;
}
.lock-btn {
  position: absolute; bottom: 46px; width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: rgba(30, 30, 60, .22);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.lock-btn.left { left: 46px; }
.lock-btn.right { right: 46px; }
.swipe-text { position: absolute; left: 0; right: 0; bottom: 30px; font: 500 15px/1 var(--sf); opacity: .85; }
.lock-bar { position: absolute; bottom: 8px; left: 50%; width: 140px; height: 5px; translate: -50% 0; border-radius: 3px; background: #fff; }
/* the finger doing the swipe */
.touch {
  position: absolute; left: 50%; bottom: 0; width: 58px; height: 58px; margin-left: -29px;
  border-radius: 50%; background: rgba(255, 255, 255, .55);
  box-shadow: 0 0 0 1px rgba(255,255,255,.7), 0 8px 24px rgba(40, 30, 90, .25);
  opacity: 0;
}
.lock-date { font: 600 23px/1 var(--sf); letter-spacing: -.01em; opacity: .9; }
.lock-time { font: 700 112px/1 var(--sf); letter-spacing: -.04em; margin-top: 4px; }
.notif {
  position: absolute; left: 12px; right: 12px; top: 330px;
  display: flex; gap: 12px; padding: 15px 16px; align-items: center; text-align: left;
  border-radius: 24px; color: #000;
  background: rgba(250, 250, 255, .62);
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
  font-size: 17px; line-height: 1.3; letter-spacing: -.02em;
}
.notif-icon { position: relative; flex: none; width: 48px; height: 48px; }
.notif-icon img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.msg-badge {
  position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 5px;
  background: linear-gradient(#5ff777, #0abd2f) padding-box;
  box-shadow: 0 0 0 1.5px rgba(250,250,255,.9);
}
.msg-badge::after { content: ""; position: absolute; inset: 4px 3px 5px; border-radius: 50%; background: #fff; }
.notif-text { display: flex; flex-direction: column; min-width: 0; }
.notif-head { display: flex; justify-content: space-between; }
.notif-head b { font-weight: 600; }
.notif-head span { color: rgba(0,0,0,.45); font-size: 14px; }

/* ── Messages ── */
.chat { background: #fff; z-index: 1; display: flex; flex-direction: column; }
.nav {
  position: relative; z-index: 2; flex: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 54px 18px 8px; color: var(--blue);
  background: rgba(246, 246, 246, .86);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-bottom: .5px solid rgba(0,0,0,.18);
}
.video { justify-self: end; }
.contact { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #000; }
.avatar { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; }
.name { font-size: 12px; letter-spacing: 0; display: inline-flex; align-items: center; gap: 4px; }
.name svg { color: #bcbcc0; }

.thread { flex: 1; overflow: hidden; position: relative; }
.rail { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px 10px; display: flex; flex-direction: column; }
.stamp { text-align: center; color: var(--muted); font-size: 11px; line-height: 1.35; margin: 4px 0 12px; }
.stamp b { font-weight: 600; }

.b {
  position: relative; max-width: 74%;
  padding: 7px 13px 8px; border-radius: 19px;
  font-size: 17px; line-height: 22px; letter-spacing: -.43px;
  overflow-wrap: anywhere;
  margin-top: 2px;
}
.them { align-self: flex-start; background: var(--gray); color: #000; }
.me { align-self: flex-end; background: var(--blue); color: #fff; }
/* new speaker starts a new group */
.me + .them, .them + .me, .receipt + .them, .typing + .b { margin-top: 9px; }

/* tails, only on the last bubble of a group */
.b::before, .b::after { content: ""; position: absolute; bottom: 0; height: 22px; }
.me:not(:has(+ .me))::before  { right: -7px; width: 20px; background: var(--blue); border-bottom-left-radius: 16px 14px; }
.me:not(:has(+ .me))::after   { right: -26px; width: 26px; background: #fff; border-bottom-left-radius: 10px; }
.them:not(:has(+ .them))::before { left: -7px; width: 20px; background: var(--gray); border-bottom-right-radius: 16px 14px; }
.them:not(:has(+ .them))::after  { left: -26px; width: 26px; background: #fff; border-bottom-right-radius: 10px; }

.receipt { align-self: flex-end; display: grid; justify-items: end; color: var(--muted); font-size: 11px; font-weight: 500; margin: 3px 4px 0 0; }

.typing { align-self: flex-start; display: flex; gap: 4px; padding: 13px 14px; border-radius: 19px; background: var(--gray); position: relative; margin-top: 9px; }
.typing::before, .typing::after { content: ""; position: absolute; border-radius: 50%; background: var(--gray); }
.typing::before { left: -2px; bottom: -2px; width: 12px; height: 12px; }
.typing::after  { left: -7px; bottom: -7px; width: 6px; height: 6px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: #8e8e93; animation: dot 1.2s 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 } 30% { opacity: 1 } }

.b a { color: inherit; }

.compose { flex: none; display: flex; align-items: flex-end; gap: 9px; padding: 8px 12px 30px; background: #fff; }
.chat.kb .compose { padding-bottom: 8px; }

/* iOS phone pad */
.keypad {
  flex: none; height: 0; overflow: hidden;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px;
  background: #d2d5db; padding: 0 6px;
}
.chat.kb .keypad { padding: 7px 6px 34px; }
.key {
  height: 50px; border: 0; border-radius: 6px; background: #fff; color: #000;
  box-shadow: 0 1px 0 rgba(0,0,0,.3);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font: 400 27px/1 var(--sf); cursor: pointer; transition: background .25s, color .25s;
  -webkit-tap-highlight-color: transparent;
}
.key small { font: 700 10px/1 var(--sf); letter-spacing: .14em; margin-top: 2px; }
.key.blank, .key.del { background: none; box-shadow: none; }
.key.blank { pointer-events: none; }
.key.down { background: var(--blue); color: #fff; transition: none; }
.key.del.down { background: #bcc0c8; color: #000; }
.key:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.plus { flex: none; width: 36px; height: 36px; border-radius: 50%; background: #e9e9eb; color: #7d7d82; display: grid; place-items: center; }
.field {
  flex: 1; display: flex; align-items: center; min-height: 36px;
  border: .5px solid #c7c7cc; border-radius: 18px; padding: 0 4px 0 14px;
}
.typed { flex: 1; min-width: 0; display: flex; align-items: center; height: 34px; font: 17px/22px var(--sf); letter-spacing: -.43px; color: #000; padding: 6px 0; white-space: nowrap; }
.typed[data-empty]::before { content: "Text Message"; color: #b9b9be; }
/* fake caret: the field is driven by the on-screen keypad, not a native input */
.chat.kb .typed::after { content: ""; display: inline-block; width: 2px; height: 21px; margin-left: 1px; flex: none; background: var(--blue); border-radius: 1px; animation: blink 1s steps(1) infinite; }
.chat.kb .typed[data-empty]::after { order: -1; margin: 0 1px 0 0; }
@keyframes blink { 50% { opacity: 0; } }
.send { flex: none; border: 0; padding: 0; background: none; color: var(--blue); cursor: pointer; display: grid; transition: opacity .15s, scale .15s; }
.send svg { fill: currentColor; width: 28px; height: 28px; }
.send:disabled { opacity: 0; scale: .6; pointer-events: none; }
.send:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 50%; }

/* the "type here" moment */
.compose.ready .field { animation: invite 2.4s ease-in-out 2; }
/* joined: the thread is done, nothing more to type */
.compose.done { pointer-events: none; opacity: .5; }
@keyframes invite { 50% { box-shadow: 0 0 0 4px rgba(10,124,255,.12); } }

@media (prefers-reduced-motion: reduce) {
  .dots { display: none; }
  .typing i, .compose.ready .field { animation: none; }
}
