@font-face {
  font-family: "Zen Maru Gothic";
  src: url("/fonts/zen-maru-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Zen Maru Gothic";
  src: url("/fonts/zen-maru-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* Charly's ink, from the app's Sumi theme */
  --ink: #121216;
  --ink-2: #1a1a20;
  --ink-3: #24242c;
  --line: #2f2f39;
  --paper: #f6f2ea;
  --text: #efebe4;
  --text-2: #bdb7ae;
  --text-3: #938d86;
  /* The one action color: the terminal Charly peeks over */
  --ver: #e4472f;
  --ver-btn: #cf3a22;
  /* Badge colors carry meaning only */
  --work: #5b8cf2;
  --test: #9373ee;
  --wait: #e9b949;
  --fail: #e4472f;
  --idle: #72727f;
  --ok: #8fc67a;

  --display: "Zen Maru Gothic", ui-rounded, system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 5vw, 72px);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--ink-3) var(--ink); }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ver-btn); color: #fff; }
a { color: inherit; text-underline-offset: .2em; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--ver); outline-offset: 3px; border-radius: 6px; }
.defs { position: absolute; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--paper); color: var(--ink); padding: 8px 14px; border-radius: 10px; z-index: 10; }
.skip:focus { top: 12px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* State colors: each state sets --c (badge) and --ci (icon ink on it). */
.st-working, [data-state="working"] { --c: var(--work); --ci: #fff; }
.st-testing, [data-state="testing"] { --c: var(--test); --ci: #fff; }
.st-waiting, [data-state="waiting"] { --c: var(--wait); --ci: #1b1a1f; }
.st-failed, [data-state="failed"] { --c: var(--fail); --ci: #fff; }
.st-idle, [data-state="idle"] { --c: var(--idle); --ci: #fff; }

/* ---------- Header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--gutter);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-cat { width: 34px; height: 34px; }
.wordmark { font: 700 1.6rem/1 var(--display); letter-spacing: -.01em; }
.lang { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.lang button {
  font: 600 .8rem/1 var(--body); letter-spacing: .02em;
  color: var(--text-3); background: none; border: 0; padding: 7px 11px; border-radius: 999px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--ink-3); color: var(--text); }

/* ---------- Avatar: Charly on his disc + a badge stuck outside it ---------- */
.av { position: relative; display: inline-block; width: 40px; aspect-ratio: 1; flex: 0 0 auto; }
.av .face { display: block; width: 100%; height: 100%; }
.av .badge {
  position: absolute; right: -9%; top: -9%;
  width: 44%; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c, var(--idle)); color: var(--ci, #fff);
  outline: 2.5px solid var(--halo, var(--ink));
  transition: background-color .4s var(--ease);
}
.av .badge svg { width: 62%; height: 62%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.av-xs { width: 18px; } .av-xs .badge { outline-width: 1.5px; }
.av-sm { width: 34px; }
.av-md { width: 46px; }
.eyes { transform-box: fill-box; transform-origin: 50% 50%; animation: blink 5.2s ease-in-out infinite; }
@keyframes blink { 0%, 90%, 100% { transform: scaleY(1); } 93% { transform: scaleY(.12); } 96% { transform: scaleY(1); } }

/* Pills: the badge, on its own */
.pill {
  display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%;
  background: var(--c); color: var(--ci); flex: 0 0 auto;
}
.pill svg { width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  padding: clamp(24px, 5vh, 64px) var(--gutter) clamp(64px, 10vh, 120px);
  min-height: calc(100svh - 80px);
}
h1 {
  font: 700 clamp(2.3rem, 4.4vw, 4.25rem)/1.06 var(--display);
  letter-spacing: -.025em; margin: 0 0 24px; text-wrap: balance;
}
.lede { color: var(--text-2); font-size: clamp(1.05rem, 1.25vw, 1.2rem); max-width: 34em; margin: 0 0 32px; }

.join { display: flex; flex-wrap: wrap; gap: 10px; max-width: 30rem; }
.join input[type="email"] {
  flex: 1 1 14rem; min-width: 0;
  font: inherit; color: var(--text); caret-color: var(--ver);
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px;
  transition: border-color .2s;
}
.join input::placeholder { color: var(--text-3); }
.join input:hover { border-color: #444450; }
.join input:focus-visible { outline: none; border-color: var(--ver); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ver) 30%, transparent); }
.join button {
  font: 700 1rem/1 var(--body); color: #fff; background: var(--ver-btn);
  border: 0; border-radius: 14px; padding: 15px 22px; cursor: pointer;
  transition: background-color .2s, transform .2s var(--ease);
}
.join button:hover { background: #b9321c; }
.join button:active { transform: scale(.97); }
.join button:disabled { opacity: .6; cursor: progress; }
.join .hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.note { flex-basis: 100%; margin: 4px 0 0; font-size: .9rem; color: var(--text-3); }
.join.done .note { color: var(--ok); }
.join.err .note { color: #ff8a73; }
.join.done input, .join.done button { display: none; }

/* The scene: one agent, every screen */
.scene {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto auto auto auto;
  column-gap: 16px;
}
.legend { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; }
.legend button {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 .875rem/1 var(--body); color: var(--text-2);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 13px 6px 6px; cursor: pointer;
  transition: color .3s, background-color .3s, border-color .3s;
}
.legend .dot {
  width: 22px; height: 22px; padding: 4px; border-radius: 50%;
  fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  background: var(--ink-3); color: var(--text-3);
  transition: background-color .3s, color .3s;
}
.legend button:hover { color: var(--text); border-color: #45454f; }
.legend button[aria-pressed="true"] { color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.legend button[aria-pressed="true"] .dot { background: var(--c); color: var(--ci); }

.big-av { grid-column: 1 / 5; grid-row: 2; align-self: start; width: 100%; max-width: 190px; justify-self: center; margin-top: 8px; --halo: var(--ink); }
.big-av .badge { outline-width: 5px; width: 34%; right: -4%; top: -4%; }
.big-av .ring, .av-xl .ring { position: absolute; inset: -9%; width: 118%; height: 118%; transform: rotate(-90deg); fill: none; stroke-width: 3; }
.big-av .ring circle { stroke: var(--test); stroke-linecap: round; stroke-dasharray: 295.3; stroke-dashoffset: 295.3; transition: stroke-dashoffset 1.2s var(--ease), opacity .3s; opacity: 0; }
[data-state="testing"] .big-av .ring circle { stroke-dashoffset: 147; opacity: 1; }

/* Mac */
.mac {
  grid-column: 5 / -1; grid-row: 2;
  background: #0d0d11; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.mac-bar { display: flex; align-items: center; gap: 7px; padding: 10px 12px; background: var(--ink-2); }
.mac-bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a3a44; }
.mac-proj { margin-left: 10px; font: 600 .75rem/1 var(--body); color: var(--text-3); }
.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--ink-2); overflow: hidden; }
.tab {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  padding: 8px 12px 9px; font-size: .78rem; color: var(--text-3); white-space: nowrap;
  border-right: 1px solid var(--line); --halo: var(--ink-2);
}
.tab.on { color: var(--text); background: #0d0d11; box-shadow: inset 0 2px 0 var(--ver); --halo: #0d0d11; }
.tab-t { overflow: hidden; text-overflow: ellipsis; }
.tab .agent { width: 12px; height: 12px; flex: 0 0 auto; }
.term {
  margin: 0; padding: 16px 18px 20px; min-height: 182px;
  font: 400 .78rem/1.65 var(--mono); color: #cfc9c0; white-space: pre-wrap;
}
.term .d { color: var(--text-3); }
.term .c { color: var(--c); }
.term .k { color: #d97757; }
.term .cur { display: inline-block; width: .6em; height: 1.1em; vertical-align: -.2em; background: var(--text-2); animation: cur 1.1s steps(1) infinite; }
@keyframes cur { 50% { opacity: 0; } }

/* iPhone */
.phone {
  grid-column: 7 / 12; grid-row: 3 / 5; margin-top: -64px; z-index: 2;
  background: #111114; border: 7px solid #26262c; border-radius: 42px;
  padding: 40px 14px 18px; position: relative; min-height: 290px;
  box-shadow: 0 40px 70px -24px rgba(0, 0, 0, .8); --halo: var(--ink-2);
}
.island { position: absolute; top: 10px; left: 50%; translate: -50% 0; width: 76px; height: 22px; border-radius: 12px; background: #000; }
.ph-proj { font: 700 1.5rem/1.1 var(--display); margin: 6px 4px 14px; letter-spacing: -.01em; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--ink-2); border-radius: 16px; }
.row-t { display: grid; min-width: 0; line-height: 1.3; }
.row-t strong { font-size: .95rem; }
.st-line { font-size: .82rem; color: var(--c); font-weight: 600; transition: color .4s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 4px; border-radius: 4px; background: var(--ink-3); margin: 12px 4px 0; overflow: hidden; opacity: 0; transition: opacity .3s; }
.bar i { display: block; height: 100%; width: 50%; background: var(--test); border-radius: inherit; }
[data-state="testing"] .bar { opacity: 1; }
.ask { margin: 14px 4px 10px; font-size: .9rem; line-height: 1.4; color: var(--text); min-height: 2.8em; }
.ph-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; opacity: 0; transition: opacity .3s; }
.ph-actions span { text-align: center; padding: 9px; border-radius: 12px; background: var(--ink-3); font-size: .85rem; font-weight: 600; color: var(--text-2); }
.ph-actions .ok { background: #4c7a3c; color: #fff; }
[data-state="waiting"] .ph-actions { opacity: 1; }

/* Watch */
.watch {
  grid-column: 2 / 6; grid-row: 3; align-self: start; justify-self: center; margin-top: 28px;
  width: 168px; aspect-ratio: 41 / 49; padding: 7px; border-radius: 44px; background: #26262c;
  box-shadow: 0 30px 50px -20px rgba(0, 0, 0, .8);
}
.w-face { height: 100%; border-radius: 38px; background: #000; display: grid; align-content: center; justify-items: center; gap: 10px; padding: 14px; text-align: center; --halo: #000; }
.w-face .av { width: 54px; }
.w-t { font: 700 .95rem/1.2 var(--body); color: var(--c); transition: color .4s; text-wrap: balance; }

.example { grid-column: 1 / 7; grid-row: 4; align-self: end; margin: 24px 0 0; font-size: .8rem; color: var(--text-3); }

/* Text that changes with the state fades in place */
[data-term], [data-phone], [data-ask], [data-watch] { transition: opacity .25s; }
.swap [data-term], .swap [data-phone], .swap [data-ask], .swap [data-watch] { opacity: 0; }

/* ---------- The five states ---------- */
.state {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px); align-items: center;
  max-width: 1180px; margin: 0 auto;
  padding: clamp(72px, 11vw, 150px) var(--gutter);
}
.state + .state { border-top: 1px solid var(--line); }
h2 {
  font: 700 clamp(1.75rem, 3vw, 2.7rem)/1.14 var(--display);
  letter-spacing: -.02em; margin: 0 0 20px; text-wrap: balance;
}
.pill-lg { font-size: .75em; vertical-align: .08em; margin-right: .35em; }
.sn { color: var(--c); white-space: nowrap; }
.copy p { color: var(--text-2); max-width: 34em; margin: 0 0 16px; }
.copy .fine { font-size: .9rem; color: var(--text-3); }

.restore { display: grid; gap: 20px; justify-items: start; }
.panel { background: var(--ink-2); border-radius: 18px; padding: 20px 22px 22px; }
.panel-t { margin: 0; font-weight: 700; font-size: .85rem; color: var(--text-3); }
.panel .restore-btn { margin-left: 0; }
.restore ol { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 1px solid var(--line); display: grid; gap: 22px; }
.restore li { position: relative; display: flex; align-items: center; gap: 14px; color: var(--text-2); }
.restore li::before { content: ""; position: absolute; left: -27px; width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.restore li .mono { color: var(--text-3); font-size: .9rem; }
.restore li.bad { color: var(--text); }
.restore li.bad::before { background: var(--fail); }
.restore li .pill { --c: var(--fail); --ci: #fff; font-size: 1rem; }
.restore li:nth-child(2) { color: var(--text); }
.restore li:nth-child(2)::before { background: var(--paper); box-shadow: 0 0 0 4px color-mix(in srgb, var(--paper) 25%, transparent); }
.restore-btn {
  display: inline-flex; align-items: center; gap: 10px; margin-left: 22px;
  padding: 11px 16px; border-radius: 14px; background: var(--paper); color: var(--ink); font-weight: 700;
}
.restore-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Trio: the same state on Mac, iPhone and Watch ---------- */
.trio { display: grid; gap: 18px; min-width: 0; }
.t-mac { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #0d0d11; }
.t-mac .tabs { border-bottom: 0; }
.t-mac .tab { padding: 12px 14px; font-size: .85rem; }
.t-mac .av-xs { width: 22px; }
.t-devices { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: end; }
.t-phone {
  position: relative; background: #111114; border: 6px solid #26262c; border-bottom: 0;
  border-radius: 36px 36px 0 0; padding: 38px 12px 44px; --halo: var(--ink-2);
  /* the phone continues below the frame: fade it out instead of cutting it */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent);
}
.t-phone .bar { opacity: 1; }
.t-ask { margin: 12px 4px 8px; font-size: .9rem; line-height: 1.35; color: var(--text); }
.t-err { color: #ff8a73; font-family: var(--mono); font-size: .8rem; }
.t-cmd { display: block; margin: 0 2px 10px; font: .78rem/1 var(--mono); background: #0d0d11; padding: 9px 10px; border-radius: 10px; }
.ph-actions.on { opacity: 1; }
.t-watch { width: 132px; aspect-ratio: 41 / 49; padding: 6px; border-radius: 36px; background: #26262c; }
.t-watch .w-face { border-radius: 31px; padding: 10px; gap: 6px; }
.t-watch .w-face .av { width: 42px; }
.t-watch .w-t { font-size: .8rem; }
.w-ok { font-size: .72rem; font-weight: 700; color: #fff; background: #4c7a3c; border-radius: 999px; padding: 4px 10px; }
/* Test ring around small avatars */
.ringed .ring { position: absolute; inset: -14%; width: 128%; height: 128%; transform: rotate(-90deg); fill: none; stroke-width: 7; overflow: visible; }
.ringed .ring .track { stroke: var(--ink-3); }
.ringed .ring .fill { stroke: var(--test); stroke-linecap: round; stroke-dasharray: 295.3; stroke-dashoffset: 295.3; animation: fillring 6s var(--ease) infinite; }
@keyframes fillring {
  0% { stroke-dashoffset: 295.3; stroke: var(--test); }
  70% { stroke-dashoffset: 0; stroke: var(--test); }
  74%, 96% { stroke-dashoffset: 0; stroke: var(--ok); }
  100% { stroke-dashoffset: 0; stroke: var(--ok); opacity: 0; }
}
.fail-vis { display: grid; gap: 22px; min-width: 0; }

/* ---------- Close: asleep ---------- */
.close {
  display: grid; justify-items: center; text-align: center;
  padding: clamp(80px, 12vw, 160px) var(--gutter) clamp(80px, 10vw, 130px);
  border-top: 1px solid var(--line);
}
.sleep { width: min(340px, 78vw); height: auto; margin-bottom: 28px; overflow: visible; }
.close h2 { font-size: clamp(2.2rem, 5vw, 4rem); }
.close > p { color: var(--text-2); max-width: 32em; margin: 0 0 32px; }
.close .join { justify-content: center; }
.close .note { text-align: center; }
.z { font-family: var(--display); font-weight: 700; fill: var(--paper); opacity: 0; transform-box: fill-box; animation: zfloat 3.6s ease-in-out infinite; }
.z2 { animation-delay: .55s; } .z3 { animation-delay: 1.1s; }
@keyframes zfloat { 0% { opacity: 0; transform: translateY(2px); } 18%, 55% { opacity: .9; transform: translateY(0); } 80%, 100% { opacity: 0; transform: translateY(-3px); } }
.breathe { transform-box: fill-box; transform-origin: 50% 100%; animation: breathe 3.8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.015, 1.045); } }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 28px var(--gutter) 36px; border-top: 1px solid var(--line);
  font-size: .875rem; color: var(--text-3);
}
.foot p { margin: 0; }

/* ---------- Narrow screens ---------- */
@media (max-width: 1400px) {
  .tab-3 { display: none; }
}
@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .state { grid-template-columns: minmax(0, 1fr); }
  .state .copy { order: -1; }
}
@media (max-width: 640px) {
  .legend { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; }
  .legend button { flex: 0 0 auto; }
  .big-av { grid-column: 1 / 6; max-width: 120px; justify-self: start; }
  .mac { grid-column: 1 / -1; grid-row: 3; margin-top: 24px; }
  .big-av { grid-row: 2; }
  .watch { grid-column: 7 / -1; grid-row: 2; width: 116px; border-radius: 32px; margin: 0; justify-self: end; }
  .w-face { border-radius: 27px; padding: 8px; gap: 6px; }
  .w-face .av { width: 36px; }
  .w-t { font-size: .78rem; }
  .phone { grid-column: 2 / 12; grid-row: 4; margin-top: -40px; }
  .example { grid-column: 1 / -1; grid-row: 5; }
  .term { min-height: 160px; font-size: .72rem; }
  .t-watch { width: 104px; border-radius: 28px; }
  .t-watch .w-face { border-radius: 24px; padding: 6px; }
  .t-watch .w-face .av { width: 32px; }
  .t-mac .tab:nth-child(3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .z { opacity: .85; }
  .ringed .ring .fill { stroke-dashoffset: 147; }
}
