/*
 * One stylesheet, no framework. The portal is four screens and will be opened once by a few
 * hundred people on hotel wifi; a 200KB bundle to render a form would be the wrong trade.
 */

:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #4f2bd0;
  --brand-2: #7c4ddb;
  --brand-ink: #ffffff;
  --brand-soft: #efeaff;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.18);
  --ring: 0 0 0 3px rgba(79,43,208,.22);
  --ok-bg: #ecfdf5;
  --ok-ink: #047857;
  --bad-bg: #fef2f2;
  --bad-ink: #b91c1c;
  --warn-bg: #fffbeb;
  --warn-ink: #92400e;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #171a21;
    --ink: #f3f4f6;
    --muted: #9ca3af;
    --line: #2a2f3a;
    --brand-soft: #241a46;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -16px rgba(0,0,0,.7);
    --ring: 0 0 0 3px rgba(124,77,219,.35);
    --ok-bg: #052e22;
    --ok-ink: #6ee7b7;
    --bad-bg: #3b0d0d;
    --bad-ink: #fca5a5;
    --warn-bg: #3a2c05;
    --warn-ink: #fcd34d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  /* `env(safe-area-inset-*)`: installed to a home screen this runs full-bleed, and on a notched
     phone the sign-in button would otherwise sit under the home indicator. */
  padding: max(20px, env(safe-area-inset-top)) 16px calc(56px + env(safe-area-inset-bottom));
}

.wrap { max-width: 620px; margin: 0 auto; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}

/* ── the sign-in header ─────────────────────────────────────────────────────────────────── */

.brand { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff; flex: 0 0 auto;
}
.brand__name { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }

/* Which event, and the way out of a wrong one. */
.eventline {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 18px; padding: 9px 12px;
  background: var(--brand-soft); border-radius: 9px;
  font-size: 13px; font-weight: 600;
}
.eventline .linkbtn { margin-left: auto; }

.hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }

h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 16px; margin: 0 0 12px; }
p.sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }

input, textarea, select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  /*
   * 16px MINIMUM on the inputs, and that is not a style choice: iOS Safari zooms the whole page
   * in when a focused field is smaller, and the speaker is then fighting a zoomed layout while
   * typing a six-digit code.
   */
  font: inherit;
  font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}

/* The code field: wide, spaced, unmistakable. */
input.code {
  letter-spacing: .5em;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  padding: 14px 13px;
}
textarea { resize: vertical; min-height: 96px; }

.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

button {
  font: inherit;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--brand);
  color: var(--brand-ink);
  cursor: pointer;
  /* 44px is the smallest thing a thumb reliably hits. */
  min-height: 46px;
  transition: filter .15s, opacity .15s;
}
button:hover:not([disabled]) { filter: brightness(1.07); }
button:active:not([disabled]) { filter: brightness(.94); }
button:focus-visible { outline: none; box-shadow: var(--ring); }
button[disabled] { opacity: 0.55; cursor: default; }
button.ghost { background: transparent; color: var(--muted); border-color: var(--line); }

/* A primary action owns its row — on a phone it is the whole width. */
button.primary { width: 100%; }

/* A link that is really a button. Used for "Change" and "Use a different address". */
.linkbtn {
  background: none; border: 0; padding: 4px 2px; min-height: 0;
  color: var(--brand); font-weight: 600; font-size: 13px;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.linkbtn.block { display: block; width: 100%; margin-top: 12px; text-align: center; }

.msg { border-radius: 10px; padding: 11px 13px; font-size: 14px; margin-bottom: 16px; }
.msg.ok { background: var(--ok-bg); color: var(--ok-ink); }
.msg.bad { background: var(--bad-bg); color: var(--bad-ink); }
.msg.warn { background: var(--warn-bg); color: var(--warn-ink); }

.who { display: flex; gap: 14px; align-items: center; }
.who img, .who .initials {
  width: 64px; height: 64px; border-radius: 50%;
  object-fit: cover; background: var(--line);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--muted); flex: 0 0 auto;
}
.who .name { font-size: 18px; font-weight: 700; }
.who .meta { color: var(--muted); font-size: 14px; }

.session { border-top: 1px solid var(--line); padding: 12px 0; }
.session:first-of-type { border-top: 0; }
.session .when { font-size: 13px; color: var(--muted); }
.session .title { font-weight: 600; margin: 2px 0; }
.session .role {
  display: inline-block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--brand); font-weight: 700;
}

.badge-box { text-align: center; }
.badge-box img { max-width: 260px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

.todo { margin: 0; padding-left: 18px; color: var(--warn-ink); font-size: 14px; }

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 28px; }
/* ── small screens ───────────────────────────────────────────────────────────────────────
   The layout is one column everywhere, so there is little to change — but a phone is where
   this is actually opened, from a link in an email, standing in a hotel lobby. */
@media (max-width: 460px) {
  body { padding-left: 12px; padding-right: 12px; }
  .card { padding: 18px 16px; border-radius: 14px; }
  h1 { font-size: 21px; }
  /* Side by side, these two become two half-width targets. Stacked, each is a full one. */
  .row { flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.hidden { display: none !important; }
