/* ainbox.app — one stylesheet for the whole public site.
 *
 * The Mac app is native AppKit: system fonts, semantic colours, nothing drawn by
 * hand where a system control exists. This is the web equivalent of that — the
 * system font stack, a small set of tokens that flip with prefers-color-scheme,
 * and no decoration that isn't carrying information.
 */

:root {
  color-scheme: light dark;

  --bg: #f2f2f5;
  --surface: #ffffff;
  --surface-2: rgba(120, 120, 128, 0.09);
  --border: rgba(0, 0, 0, 0.10);
  --separator: rgba(0, 0, 0, 0.08);

  --label: #16161a;
  --label-2: #55555c;
  --label-3: #7c7c85;

  --accent: #0066cc;          /* button fill; 5.5:1 against white text */
  --accent-hover: #0058b0;
  --accent-fg: #ffffff;
  --link: #0057ad;
  --focus: #0066cc;

  --warn-fill: rgba(180, 120, 0, 0.10);
  --warn-line: rgba(180, 120, 0, 0.28);

  --ok-fill: rgba(30, 140, 75, 0.12);
  --ok-fg: #17703a;           /* 5.1:1 on the tint above */

  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 28px rgba(0, 0, 0, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316;
    --surface: #1e1e22;
    --surface-2: rgba(140, 140, 150, 0.14);
    --border: rgba(255, 255, 255, 0.10);
    --separator: rgba(255, 255, 255, 0.08);

    --label: #f3f3f6;
    --label-2: #a5a5ae;
    --label-3: #82828c;

    --accent: #1f74dd;        /* 4.6:1 against white text */
    --accent-hover: #2a80ec;
    --accent-fg: #ffffff;
    --link: #78b6ff;
    --focus: #78b6ff;

    --warn-fill: rgba(255, 190, 70, 0.10);
    --warn-line: rgba(255, 190, 70, 0.26);

    --ok-fill: rgba(70, 200, 125, 0.16);
    --ok-fg: #5fd493;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.34);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

/* Author `display` beats the UA rule for [hidden], and half the states on the
   invite page are flex containers. Hidden means hidden. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 32px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- wordmark ---------------------------------------------------------- */

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--label-2);
  font-size: 15px;
  font-weight: 590;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.wordmark svg { display: block; }

a.wordmark:hover { color: var(--label); }

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

.card {
  width: 100%;
  max-width: 460px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card.wide { max-width: 620px; }

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 640;
  letter-spacing: -0.01em;
}

h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--label-2);
}

p { margin: 0; }

.lede {
  margin-top: 8px;
  color: var(--label-2);
}

.fine {
  margin-top: 16px;
  font-size: 13px;
  color: var(--label-3);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- who invited you --------------------------------------------------- */

.who {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--label-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---- offered spaces ---------------------------------------------------- */

.offers {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: var(--radius);
  overflow: hidden;
}

.offers li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
}

.offers li + li { border-top: 1px solid var(--separator); }

.offers .icon { flex: 0 0 auto; color: var(--label-3); }
.offers .icon svg { display: block; }

.offer-name {
  font-weight: 550;
  overflow-wrap: anywhere;
}

.offer-count {
  margin-left: auto;
  padding-left: 10px;
  color: var(--label-3);
  font-size: 14px;
  white-space: nowrap;
}

/* ---- buttons ----------------------------------------------------------- */

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 550;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--label);
}

.btn-secondary:hover { background: var(--surface-2); }

.btn:active { transform: translateY(0.5px); }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

a { color: var(--link); }

/* Each state's <h1> takes tabindex="-1" so script can move the reader's cursor to
   the answer when the state changes. It isn't a control, and Chrome paints it
   :focus-visible when the page is reached by keyboard — a ring around a heading
   reads as an editable field. Move the cursor; don't draw a box. */
h1[tabindex]:focus,
h1[tabindex]:focus-visible { outline: none; }

/* ---- little pieces ----------------------------------------------------- */

.hint {
  margin-top: 2px;
  padding: 10px 12px;
  border: 1px solid var(--warn-line);
  border-radius: 10px;
  background: var(--warn-fill);
  font-size: 14px;
  color: var(--label-2);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface-2);
  border-top-color: var(--label-3);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  .btn:active { transform: none; }
}

.loading-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--label-2);
}

.footer {
  max-width: 460px;
  text-align: center;
  font-size: 13px;
  color: var(--label-3);
}

.footer a { color: var(--label-2); }

/* ---- landing page ------------------------------------------------------ */

.hero h1 { font-size: 26px; }

.hero .lede { font-size: 17px; }

.rule {
  height: 1px;
  border: 0;
  margin: 4px 0;
  background: var(--separator);
}

.points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.points li {
  display: flex;
  gap: 10px;
  color: var(--label-2);
}

.points .dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: 9px;
  border-radius: 50%;
  background: var(--label-3);
}

.points b {
  color: var(--label);
  font-weight: 600;
}

@media (max-width: 400px) {
  body { padding: 24px 12px 32px; }
  .card { padding: 22px 18px; }
  h1 { font-size: 20px; }
}

/* ---- confirm page ------------------------------------------------------ */

/* The one bit of decoration on the site, and it is carrying information: this
   page's whole job is to say yes or no, and the tick says which before the
   heading is read. */
.avatar.ok {
  background: var(--ok-fill);
  color: var(--ok-fg);
}

.avatar.ok svg { display: block; }

/* Someone's email address, on screen as plain text and nowhere else. Long
   addresses break rather than push the card wide on a phone. */
.addr {
  font-weight: 600;
  color: var(--label);
  overflow-wrap: anywhere;
}

.fine .addr { color: var(--label-2); }

/* `.fine` carries its own margin for the invite card, where it is the last thing
   on the page. Here it is one paragraph among several in a flex stack, so let the
   stack's gap set the rhythm instead of adding to it. */
#state-confirmed > .fine,
#state-already > .fine,
#state-expired > .fine,
#state-failed > .fine { margin-top: 0; }
