/* W1: Summit Passport components (shared/ui-contract.md).
   Load order: /css/tokens.css → /css/components.css → /css/motion.css. Dark-only. */
:root {
  /* Control edges need 3:1 non-text contrast (WCAG 1.4.11). --glow-line (.35) is decorative only. */
  --edge: rgba(95, 245, 217, .55);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body.bay {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  background: var(--bay-deep) var(--bay-gradient) fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.bay > :not(.plankton) { position: relative; z-index: 1; width: 100%; max-width: var(--content-max); }

:focus-visible { outline: 2px solid var(--glow-core); outline-offset: 3px; }
a { color: var(--glow); }
button { font: inherit; color: inherit; }

/* Ambient plankton (dots are created by motion.startPlankton; animated in motion.css) */
.plankton { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.plankton i {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: var(--glow); box-shadow: 0 0 8px var(--glow); opacity: .2;
}

/* Brand header: CAIS first (on a white plate), OAM second */
.brand { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0 var(--space-4); }
.brand-plate {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--plate); box-shadow: var(--shadow-glow); overflow: hidden;
}
.brand-cais { display: block; width: 34px; height: auto; }
.brand-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.brand-summit { font-size: var(--fs-xs); font-weight: var(--fw-medium); letter-spacing: .08em; color: var(--ink-soft); }
.brand-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.brand-with { font-size: var(--fs-xs); color: var(--ink-mute); }
.lang-toggle {
  flex: none; min-width: var(--tap); min-height: var(--tap); padding: 0 var(--space-3);
  border: 1px solid var(--edge); border-radius: var(--radius-pill); background: var(--glow-wash);
  color: var(--glow); font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: .06em; cursor: pointer;
}
.lang-toggle:hover { background: rgba(95, 245, 217, .16); }

/* Layout */
.screen { display: flex; flex-direction: column; gap: var(--space-4); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.muted { font-size: var(--fs-sm); color: var(--ink-mute); }

.foot { margin-top: auto; padding-top: var(--space-6); text-align: center; font-size: var(--fs-sm); }
.foot-link { display: inline-block; min-height: var(--tap); padding: 0 var(--space-3); line-height: var(--tap); color: var(--ink-soft); }

/* ---------- Form components ---------- */
.chip {
  align-self: flex-start; max-width: 100%; padding: 6px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--glow-line); background: var(--glow-wash); color: var(--glow);
  font-size: var(--fs-sm); line-height: 1.35; overflow-wrap: anywhere;
}
.q { margin: 0; padding: 0; font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: 1.3; color: var(--ink); }

/* 5-orb rating: each orb is a 44px tap target drawing a 40px glowing circle */
.orbs { min-width: 0; margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.orbs > legend.q { margin-bottom: var(--space-3); }
.orbs-row { display: flex; justify-content: space-between; gap: var(--space-2); max-width: 300px; }
.orb {
  position: relative; display: grid; place-items: center; width: var(--tap); height: var(--tap);
  padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.orb::before {
  content: ""; width: var(--orb); height: var(--orb); border-radius: 50%; border: 1.5px solid var(--edge);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.orb.is-on::before {
  border-color: transparent;
  background: radial-gradient(circle, var(--glow-core) 0%, var(--glow-mid) 45%, rgba(47, 224, 194, 0) 72%);
  box-shadow: 0 0 14px rgba(95, 245, 217, .45);
}
.orb[aria-pressed="true"]::before { box-shadow: 0 0 0 2px var(--edge), 0 0 18px rgba(95, 245, 217, .6); }

/* Text fields and selects (16px font stops iOS zooming on focus) */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field-label { font-size: var(--fs-sm); color: var(--ink-soft); }
.field-input {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: var(--radius-md);
  border: 1px solid var(--edge); background-color: rgba(2, 10, 18, .6); color: var(--ink);
  font: inherit; font-size: 16px; line-height: 1.4;
}
textarea.field-input { min-height: 88px; resize: vertical; }
.field-input::placeholder { color: var(--ink-mute); }
.field-input:focus { outline: none; border-color: var(--glow); box-shadow: var(--shadow-glow); }
select.field-input {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--glow) 50%), linear-gradient(135deg, var(--glow) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
select.field-input option { background: var(--bay-mid); color: var(--ink); }
.field.is-invalid .field-input { border-color: var(--warn); }
.field-error { font-size: var(--fs-sm); color: var(--warn); }

/* Checkbox (native input stays focusable and screen-reader visible) */
.check { position: relative; display: flex; align-items: flex-start; gap: var(--space-3); min-height: var(--tap); padding: var(--space-2) 0; cursor: pointer; }
.check input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.check-box {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin-top: 1px;
  border: 1.5px solid var(--edge); border-radius: 7px;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.check input:checked + .check-box { background: var(--glow); border-color: var(--glow); box-shadow: var(--shadow-glow); }
.check input:checked + .check-box::after {
  content: ""; width: 6px; height: 11px; border: solid var(--bay-deep); border-width: 0 2.5px 2.5px 0;
  transform: translateY(-1px) rotate(45deg);
}
.check input:focus-visible + .check-box { outline: 2px solid var(--glow-core); outline-offset: 3px; }
.check-label { font-size: var(--fs-sm); line-height: 1.45; color: var(--ink); }

/* Buttons */
.btn-glow {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2); width: 100%;
  min-height: 52px; padding: 12px 20px; border: 1.5px solid var(--glow); border-radius: var(--radius-md);
  background: transparent; color: var(--glow); font-size: var(--fs-md); font-weight: var(--fw-semibold);
  line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer;
  box-shadow: 0 0 18px rgba(95, 245, 217, .25) inset;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn-glow:hover { background: var(--glow-wash); }
.btn-glow:active { transform: scale(.98); }
.btn-glow:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-glow.is-busy { opacity: .75; cursor: progress; pointer-events: none; }
/* .btn-ghost and friends set display, which beats the UA [hidden] rule. */
[hidden] { display: none !important; }

.btn-ghost {
  display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 10px 16px;
  border: 1px solid transparent; border-radius: var(--radius-md); background: transparent;
  color: var(--ink-soft); font-size: var(--fs-sm); font-weight: var(--fw-medium); text-decoration: none; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--edge); color: var(--glow); }

/* Notices */
.notice {
  padding: var(--space-3) var(--space-4); border: 1px solid var(--glow-line); border-radius: var(--radius-md);
  background: var(--glow-wash); color: var(--ink); font-size: var(--fs-sm); line-height: 1.45;
}
.notice[data-tone="info"] { border-color: var(--glow-line); }
.notice[data-tone="warn"] { border-color: rgba(255, 180, 162, .5); background: rgba(240, 90, 60, .10); color: var(--warn); }
.notice[data-tone="ok"] { border-color: var(--glow); color: var(--glow-core); }

/* ---------- Passport stamps (glowing ink) ---------- */
.stamp {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: var(--stamp); height: var(--stamp); border-radius: 50%; border: 2px dashed var(--glow-line);
  color: var(--ink-mute); text-align: center; line-height: 1.1; user-select: none;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: .04em;
}
.stamp-id { font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.stamp-date { font-size: 9px; opacity: .85; }
.stamp[data-state="empty"] { border-color: var(--glow-line); }
.stamp[data-state="empty"] .stamp-date { visibility: hidden; }
.stamp[data-state="landed"] {
  transform: rotate(-12deg); border: 2px solid var(--glow); color: var(--glow-core);
  background: radial-gradient(circle, rgba(95, 245, 217, .18) 0%, rgba(95, 245, 217, .04) 60%, transparent 72%);
  box-shadow: 0 0 14px rgba(95, 245, 217, .35), inset 0 0 10px rgba(95, 245, 217, .25);
  text-shadow: 0 0 6px rgba(95, 245, 217, .7);
}
.stamp[data-state="landed"]::before { /* inner ring = rubber-stamp double border */
  content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 1px solid rgba(95, 245, 217, .45);
}
.stamp[data-state="syncing"] { transform: rotate(-12deg); border: 2px dashed var(--glow); color: var(--glow); }
.stamp[data-bay="closing"][data-state="landed"] {
  border-color: var(--glow-core); box-shadow: 0 0 22px rgba(185, 255, 241, .55), inset 0 0 12px rgba(185, 255, 241, .3);
}
.stamp--hero { width: var(--stamp-hero); height: var(--stamp-hero); }
.stamp--hero .stamp-id { font-size: var(--fs-2xl); }
.stamp--hero .stamp-date { font-size: var(--fs-sm); }
.stamp--hero[data-state="landed"]::before { inset: 8px; }

/* Hero stamp + burst rings share one stage so the rings center on the stamp */
.stamp-stage { position: relative; display: grid; place-items: center; padding: var(--space-5) 0; }
.burst { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.burst-ring {
  grid-area: 1 / 1; width: var(--stamp-hero); height: var(--stamp-hero); border-radius: 50%;
  border: 2px solid var(--glow); opacity: 0;
}

/* Progress ring */
.ring {
  --p: 0; flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: conic-gradient(var(--glow) calc(var(--p) * 1turn), rgba(255, 255, 255, .1) 0);
  box-shadow: var(--shadow-glow);
}
.ring-label {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--bay-mid); font-size: var(--fs-sm); font-weight: var(--fw-semibold);
}

/* Passport: three bays (+ Closing Night) */
.passport {
  display: flex; flex-direction: column; gap: var(--space-5); padding: var(--space-4);
  border: 1px solid var(--glow-line); border-radius: var(--radius-lg); background: rgba(2, 10, 18, .45);
  transition: box-shadow var(--dur-stamp) var(--ease-out), border-color var(--dur-stamp) var(--ease-out);
}
.passport.is-explorer {
  border-color: var(--glow);
  box-shadow: 0 0 0 1px rgba(95, 245, 217, .35), 0 0 32px rgba(95, 245, 217, .35), inset 0 0 24px rgba(95, 245, 217, .12);
}
.bay-group { display: flex; flex-direction: column; gap: var(--space-3); }
.bay-title { margin: 0; font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: .1em; color: var(--ink-soft); }
.stamp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--stamp), 1fr));
  gap: var(--space-3); justify-items: center;
}

/* Session list (room picker, "on now") */
.session-list { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.session-item {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "id title" "id meta";
  column-gap: var(--space-3); align-items: center; width: 100%; min-height: 56px;
  padding: var(--space-3) var(--space-4); border: 1px solid var(--edge); border-radius: var(--radius-md);
  background: rgba(2, 10, 18, .5); color: var(--ink); text-align: left; cursor: pointer;
}
.session-item:hover { border-color: var(--glow); background: var(--glow-wash); }
.session-id { grid-area: id; min-width: 5em; white-space: nowrap; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--glow); }
.session-title { grid-area: title; font-weight: var(--fw-semibold); line-height: 1.3; overflow-wrap: anywhere; }
.session-meta { grid-area: meta; font-size: var(--fs-xs); color: var(--ink-mute); }
