/* Self-hosted so the page loads everywhere, including where Google Fonts is blocked. */
@font-face {
  font-family: "Geist";
  src: url("/fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --surface: #f4f4f5;
  --surface-2: #e9e9ec;
  --text: #16171b;
  --muted: #6b6d76;
  --line: #e4e4e8;
  --primary: #16171b;
  --primary-text: #ffffff;
  --ok: #16a34a;
  --bad: #dc2626;
  --bad-bg: #fdeeee;
  --card-shadow: 0 1px 2px rgba(16, 17, 20, 0.04), 0 8px 32px -12px rgba(16, 17, 20, 0.12);

  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1040px;
  --edge: max(var(--gutter), calc((100% - var(--max)) / 2));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141518;
    --surface: #1e1f23;
    --surface-2: #2a2b30;
    --text: #f2f2f4;
    --muted: #9a9ca5;
    --line: #2c2d32;
    --primary: #f2f2f4;
    --primary-text: #141518;
    --ok: #4ade80;
    --bad: #f87171;
    --bad-bg: #3a1d1d;
    --card-shadow: 0 0 0 1px #26272c;
  }
}
:root[data-theme="dark"] {
  --bg: #141518; --surface: #1e1f23; --surface-2: #2a2b30; --text: #f2f2f4; --muted: #9a9ca5;
  --line: #2c2d32; --primary: #f2f2f4; --primary-text: #141518; --ok: #4ade80; --bad: #f87171;
  --bad-bg: #3a1d1d; --card-shadow: 0 0 0 1px #26272c;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 8px; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }

/* ---------- header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px var(--edge);
  padding-top: max(20px, env(safe-area-inset-top));
}
.wordmark {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; font-weight: 600; letter-spacing: -0.01em;
}
.wordmark svg { width: 22px; height: 22px; }
.wordmark rect:first-child { fill: var(--text); }
.wordmark rect:last-child { fill: var(--bg); stroke: var(--text); stroke-width: 1.6; }
.site-header nav { display: flex; gap: 24px; font-size: 0.9rem; }
.site-header nav a { text-decoration: none; color: var(--muted); }
.site-header nav a:hover { color: var(--text); }

/* ---------- hero ---------- */

.hero {
  padding: clamp(32px, 8vw, 88px) var(--gutter) clamp(56px, 8vw, 96px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2.1rem, 5.6vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.04;
  max-width: 15ch;
  text-wrap: balance;
}
.lede {
  margin-top: 16px;
  max-width: 38ch;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--muted);
  text-wrap: balance;
}
.assurances { margin-top: 20px; font-size: 0.85rem; color: var(--muted); }

/* ---------- app card ---------- */

.app {
  width: 100%;
  max-width: 460px;
  margin-top: clamp(28px, 4vw, 40px);
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--card-shadow);
  text-align: left;
}
.app { scroll-margin-top: 12px; }
.app.dropping { border-color: var(--text); border-style: dashed; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 20px;
  border: 0; border-radius: 12px;
  font-weight: 500; font-size: 0.975rem;
  cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, opacity 0.15s, transform 0.08s;
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-wide { width: 100%; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { opacity: 0.88; }
.btn-secondary { background: var(--surface); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-quiet { background: transparent; color: var(--muted); min-height: 40px; padding: 0 12px; font-size: 0.9rem; }
.btn-quiet:hover { color: var(--text); background: var(--surface); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 0.85rem; border-radius: 9px; background: var(--surface); color: var(--text); }
.btn-small:hover { background: var(--surface-2); }

/* start */
.or {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 14px; font-size: 0.85rem; color: var(--muted);
}
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 8px; }
.code-input {
  flex: 1; min-width: 0;
  padding: 0 14px; min-height: 48px;
  font-size: 1.15rem; font-weight: 500; letter-spacing: 0.35em;
  font-variant-numeric: tabular-nums;
  background: var(--surface); border: 1px solid transparent; border-radius: 12px;
}
.code-input::placeholder { color: var(--muted); opacity: 0.45; }
.code-input:focus { outline: none; border-color: var(--text); background: var(--bg); }
.error {
  margin-top: 14px; padding: 10px 12px; border-radius: 10px;
  background: var(--bad-bg); color: var(--bad); font-size: 0.9rem;
}

/* waiting — the code is the one big moment */
.code-digits {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 8px; margin: 16px 0 20px;
}
.code-digits span {
  display: grid; place-items: center;
  aspect-ratio: 4 / 5;
  background: var(--surface);
  border-radius: 12px;
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i) * 45ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.qr-row { display: flex; align-items: center; gap: 16px; padding: 12px; border-radius: 14px; background: var(--surface); }
.qr { width: 96px; flex: none; padding: 8px; background: #fff; border-radius: 10px; }
.qr svg { display: block; width: 100%; height: auto; }
.qr-row p { font-size: 0.9rem; }
.waiting-pulse { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-size: 0.9rem; color: var(--muted); }
.waiting-pulse i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.wait-actions { display: flex; gap: 4px; margin: 10px 0 -6px -12px; }

/* connecting */
.view-connecting { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 48px 0; }
.spinner {
  width: 28px; height: 28px; margin-bottom: 12px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--text);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-title { font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; }

/* connected */
.connected-head { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.connected-head .muted { margin-top: 2px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 8px; vertical-align: 0.12em; }
.send-controls { padding: 16px 0; display: grid; gap: 8px; }
.pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.picker { position: relative; overflow: hidden; }
.picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.picker:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }
.text-form { display: flex; gap: 8px; }
.text-form textarea {
  flex: 1; min-width: 0; resize: none; field-sizing: content; max-height: 160px;
  min-height: 48px; padding: 12px 14px;
  background: var(--surface); border: 1px solid transparent; border-radius: 12px; font-size: 0.975rem;
}
.text-form textarea:focus { outline: none; border-color: var(--text); background: var(--bg); }
.text-form .btn { align-self: flex-end; }

.disconnected { margin: 16px 0; padding: 14px; border-radius: 12px; background: var(--surface); display: grid; gap: 12px; font-size: 0.925rem; }

.items-head { display: flex; align-items: center; justify-content: space-between; min-height: 36px; margin-top: 4px; }
.items-head h2 { font-size: 0.85rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.items { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; }
.item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.item-text { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.thumb { width: 44px; height: 44px; border-radius: 9px; overflow: hidden; background: var(--surface) center / 20px no-repeat; }
.thumb[data-kind="photo"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6d76' stroke-width='1.8'%3E%3Crect x='3' y='4' width='18' height='16' rx='3'/%3E%3Ccircle cx='9' cy='10' r='2'/%3E%3Cpath d='m21 17-5-5-9 8'/%3E%3C/svg%3E"); }
.thumb[data-kind="video"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6d76' stroke-width='1.8'%3E%3Crect x='3' y='5' width='14' height='14' rx='3'/%3E%3Cpath d='m17 10 4-2v8l-4-2'/%3E%3C/svg%3E"); }
.thumb[data-kind="file"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6d76' stroke-width='1.8'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3C/svg%3E"); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meta { min-width: 0; }
.name { font-weight: 500; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 0.8rem; color: var(--muted); }
.item[data-status="done"] .status { color: var(--ok); }
.item[data-status="failed"] .status { color: var(--bad); }
.text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.95rem; margin-top: 2px; }
.bar { height: 3px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--text); transition: width 0.15s linear; }
.item[data-status="done"] .bar, .item[data-status="failed"] .bar { display: none; }

/* While paired on a phone, keep the app at the top of the screen. */
@media (max-width: 720px) {
  body[data-session="active"] .hero h1,
  body[data-session="active"] .lede,
  body[data-session="active"] .assurances { display: none; }
  body[data-session="active"] .hero { padding-top: 8px; }
  body[data-session="active"] .app { margin-top: 0; }
  .site-header nav { display: none; }
  .app { padding: 20px; }
}

/* ---------- content ---------- */

.how, .faq { padding: clamp(56px, 8vw, 96px) var(--edge) 0; border-top: 1px solid var(--line); }
.how > h2, .faq > h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: clamp(24px, 3vw, 36px); }
.steps {
  list-style: none; padding: 0; margin: 0; counter-reset: step;
  display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: grid; place-items: center;
  width: 28px; height: 28px; margin-bottom: 14px;
  border-radius: 50%; background: var(--surface);
  font-size: 0.85rem; font-weight: 600;
}
.steps h3 { font-size: 1.05rem; margin-bottom: 6px; }
.steps p { color: var(--muted); max-width: 36ch; }

.faq { margin-top: clamp(56px, 8vw, 96px); padding-bottom: clamp(56px, 8vw, 96px); }
.faq details { border-bottom: 1px solid var(--line); max-width: 720px; }
.faq summary {
  cursor: pointer; list-style: none; position: relative;
  padding: 16px 32px 16px 0; font-weight: 500;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 4px; top: 50%;
  width: 8px; height: 8px; margin-top: -6px;
  border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg); transition: transform 0.2s;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq details p { padding: 0 0 18px; color: var(--muted); max-width: 62ch; }

.site-footer {
  padding: 24px var(--edge);
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 0.85rem; color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
