@font-face { font-family: "Geist"; src: url("fonts/Geist.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/GeistMono.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Swarm Sans"; src: url("fonts/SwarmSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --page: #0A0A0A; --ink: #FAFAFA; --soft: #D4D4D4; --muted: #A3A3A3; --faint: #8F8F8F;
  --panel: #111111; --surface: #1A1A1A; --hover: #242424; --line: #262626; --control: #6B6B6B;
  --error: #FF8A80; --on-ink: #0A0A0A; --edge: #3A3A3A; --edge-strong: #5A5A5A; --off: #8A8A8A;
  --pop: #161616; --pop-line: #333333; --pop-shadow: 0 18px 50px rgba(0,0,0,0.55); --open: #7BD88F;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1); --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  color-scheme: dark;
}
/* The swarm.security light tone, used when the phone or computer is set to light. */
@media (prefers-color-scheme: light) {
  :root {
    --page: #F4F4F4; --ink: #0A0A0A; --soft: #2E2E2E; --muted: #535353; --faint: #696969;
    --panel: #FEFEFE; --surface: #F1F1F1; --hover: #E8E8E8; --line: #E2E2E2; --control: #858585;
    --error: #B3261E; --on-ink: #FEFEFE; --edge: #C9C9C9; --edge-strong: #9A9A9A; --off: #707070;
    --pop: #FEFEFE; --pop-line: #D6D6D6; --pop-shadow: 0 18px 50px rgba(0,0,0,0.14); --open: #1F8A3B;
    color-scheme: light;
  }
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--page); color: var(--ink); font: 16px/1.5 "Geist", "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: inherit; }
button { font: inherit; color: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, .back, .cta { transition: transform 120ms var(--ease-out), opacity 120ms var(--ease-out); }
button:active:not(:disabled), .back:active, .cta:active { transform: scale(0.97); opacity: 0.86; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: calc(16px + env(safe-area-inset-top)) max(clamp(16px, 4vw, 40px), env(safe-area-inset-right)) 16px max(clamp(16px, 4vw, 40px), env(safe-area-inset-left)); }
.brand { display: flex; align-items: center; min-height: 44px; }
.brand img { height: 24px; width: auto; display: block; }
.back { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 15px; text-decoration: none; white-space: nowrap; }
.back:hover { color: var(--ink); }

/* One card with three panes on wide screens. */
.shell {
  width: min(1060px, calc(100% - 32px)); margin: clamp(8px, 4vh, 40px) auto 32px;
  display: grid; grid-template-columns: 280px minmax(0, 1fr) 236px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
}
.shell > section { padding: 24px; min-width: 0; }
.meta { border-right: 1px solid var(--line); }
.slots { border-left: 1px solid var(--line); }
.details, .done { display: none; }
.shell[data-step="details"] { grid-template-columns: 320px minmax(0, 1fr); max-width: 820px; }
.shell[data-step="details"] .month, .shell[data-step="details"] .slots { display: none; }
.shell[data-step="details"] .details { display: block; }
.shell[data-step="done"] { grid-template-columns: minmax(0, 1fr); max-width: 560px; }
.shell[data-step="done"] > section:not(.done) { display: none; }
.shell[data-step="done"] .done { display: block; padding: 36px; }

/* Left pane */
.faces { display: flex; margin-bottom: 12px; }
.face { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--on-ink); font: 700 13px "Swarm Sans", "Geist", sans-serif; border: 2px solid var(--panel); }
.face + .face { margin-left: -12px; }
.who { color: var(--muted); font-size: 15px; }
h1 { font: 700 26px/1.15 "Swarm Sans", "Geist", sans-serif; letter-spacing: -0.02em; margin-top: 4px; }
.hostpick { display: flex; gap: 4px; margin-top: 16px; padding: 4px; background: var(--surface); border-radius: 12px; }
.hostpick button { flex: 1; min-height: 40px; padding: 0 8px; border: 0; border-radius: 9px; background: none; color: var(--soft); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.hostpick button:hover { color: var(--ink); }
.hostpick button[aria-checked="true"] { background: var(--ink); color: var(--on-ink); }
.shell[data-step="details"] .hostpick { display: none; }
.facts { list-style: none; margin-top: 16px; display: grid; gap: 12px; }
.facts li { display: flex; align-items: center; gap: 12px; color: var(--soft); font-size: 15px; }
.facts svg { flex: none; width: 18px; height: 18px; color: var(--muted); }
.facts .when { color: var(--ink); font-weight: 600; align-items: flex-start; }
.facts .when svg { margin-top: 4px; }
.note { margin-top: 16px; color: var(--faint); font-size: 13px; }
.shell[data-step="details"] .note { display: none; }

/* Searchable zone picker */
.facts .tzrow { align-items: flex-start; }
.tzrow svg { margin-top: 12px; }
.combo { position: relative; flex: 1; min-width: 0; }
.combo-close { display: none; }
.combo input { width: 100%; min-height: 44px; padding: 0 36px 0 12px; border-radius: 10px; border: 1px solid transparent; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 8l4.5 4.5L14.5 8' fill='none' stroke='%23999' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; color: var(--soft); font: inherit; font-size: 16px; text-overflow: ellipsis; cursor: pointer; }
.combo input:hover { background-color: var(--hover); }
.combo input:focus { background: var(--surface); border-color: var(--control); outline: none; color: var(--ink); cursor: text; }
.combo ul { position: absolute; z-index: 20; left: 0; width: max(100%, 300px); top: calc(100% + 6px); max-height: 300px; overflow-y: auto; list-style: none; padding: 8px; background: var(--pop); border: 1px solid var(--pop-line); border-radius: 12px; box-shadow: var(--pop-shadow); }
.combo li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; color: var(--soft); }
.combo li small { color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.combo li[aria-selected="true"], .combo li:hover { background: var(--hover); color: var(--ink); }
.combo li.none { cursor: default; color: var(--faint); }
.combo li.none:hover { background: none; }

/* Month */
.month-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.month h2 { font-size: 16px; font-weight: 600; }
.nav { display: flex; gap: 4px; }
.nav button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; cursor: pointer; }
.nav button:hover:not(:disabled) { background: var(--surface); }
.nav button:disabled { opacity: 0.3; cursor: default; }
.nav svg { width: 18px; height: 18px; }
.dow, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.dow { margin-top: 16px; }
.dow span { text-align: center; font-size: 12px; color: var(--faint); }
.days { margin-top: 8px; min-height: 260px; }
.shell.is-loading .days, .shell.is-loading .times { opacity: 0.5; transition: opacity 140ms var(--ease-out); }
.note-times { display: none; }
.day { aspect-ratio: 1; width: 100%; max-width: 48px; min-height: 40px; justify-self: center; border-radius: 999px; border: 0; display: grid; place-items: center; font-size: 15px; font-variant-numeric: tabular-nums; position: relative; background: none; color: var(--off); }
.day.open { background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; }
.day.open:hover { background: var(--hover); }
.day.today::after { content: ""; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.day[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.status { margin-top: 12px; color: var(--muted); font-size: 14px; min-height: 21px; }

/* Times */
.slots-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slots h2 { font-size: 16px; font-weight: 600; white-space: nowrap; }
.slots h2 span { color: var(--muted); font-weight: 400; }
.clock { display: flex; padding: 4px; background: var(--surface); border-radius: 9px; }
.clock button { min-height: 40px; min-width: 44px; padding: 0 8px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 13px; cursor: pointer; }
.clock button[aria-checked="true"] { background: var(--hover); color: var(--ink); }
.times { margin-top: 12px; display: grid; gap: 8px; max-height: 470px; min-height: 120px; overflow-y: auto; padding-right: 4px; }
.time { min-height: 46px; border-radius: 10px; border: 0; background: var(--surface); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.time:hover { background: var(--hover); }
.times .empty { color: var(--muted); font-size: 14px; }

/* Details */
form label { display: block; margin-top: 16px; margin-bottom: 8px; font-size: 15px; line-height: 24px; font-weight: 500; }
form label:first-of-type { margin-top: 0; }
.opt { color: var(--faint); font-weight: 400; }
form input, form textarea { width: 100%; min-height: 46px; padding: 12px 12px; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--control); border-radius: 10px; }
form textarea { resize: vertical; min-height: 88px; }
form input::placeholder { color: var(--faint); }
form [aria-invalid="true"] { border-color: var(--error); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.err { margin-top: 12px; color: var(--error); font-size: 15px; }
.field-err { margin-top: 8px; color: var(--error); font-size: 14px; }
.retry { margin-left: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--edge); background: none; font-weight: 600; cursor: pointer; }
.actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.ghost { min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--edge); background: none; font-weight: 600; cursor: pointer; }
.ghost:hover { border-color: var(--ink); }
.go { min-height: 48px; padding: 0 28px; border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-weight: 600; cursor: pointer; }
.go:disabled { opacity: 0.5; cursor: progress; }
.fine { color: var(--faint); font-size: 13px; margin-top: 12px; }
.details .fine { text-align: right; }

/* Done */
.done-flock { width: 52px; margin-bottom: 12px; }
.done h2 { font: 700 26px/1.2 "Swarm Sans", "Geist", sans-serif; letter-spacing: -0.02em; }
.done p { margin-top: 12px; color: var(--soft); }
.done a.meet { color: var(--ink); font-weight: 600; word-break: break-all; }
.cta { display: inline-flex; align-items: center; min-height: 46px; margin-top: 20px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--edge-strong); text-decoration: none; font-weight: 600; }

.foot { margin-top: auto; padding: 20px clamp(16px, 4vw, 40px) calc(28px + env(safe-area-inset-bottom)); color: var(--faint); font-size: 13px; text-align: center; }
.foot a { color: var(--muted); }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 280px minmax(0, 1fr); }
  .slots { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .times { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-height: none; }
}
@media (max-width: 720px) {
  .shell, .shell[data-step="details"] { grid-template-columns: minmax(0, 1fr); width: calc(100% - 32px); margin-top: 4px; }
  .faces, .meta > .note { display: none; }
  h1 { font-size: 22px; }
  .facts { grid-template-columns: auto auto; justify-content: start; column-gap: 20px; margin-top: 12px; }
  .facts .tzrow, .facts .when { grid-column: 1 / -1; }
  .note-times { display: block; margin-top: 12px; color: var(--faint); font-size: 13px; }
  .days { min-height: 0; gap: 4px; margin-top: 4px; }
  .dow { margin-top: 12px; gap: 4px; }
  .day { max-width: 40px; min-height: 36px; font-size: 15px; }
  .month { padding-top: 16px !important; padding-bottom: 8px !important; }
  .slots { padding-top: 16px !important; }
  .meta { padding-bottom: 16px !important; }
  .status:empty { display: none; }
  .combo.open { position: fixed; inset: 0; z-index: 50; background: var(--panel); padding: calc(12px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; animation: sheetIn 240ms var(--ease-sheet); }
  .combo.open .combo-close { display: inline-flex; align-self: flex-end; min-height: 44px; align-items: center; padding: 0 12px; border: 0; background: none; font-weight: 600; cursor: pointer; }
  .combo.open ul { position: static; width: 100%; max-height: none; flex: 1; box-shadow: none; border: 0; padding: 0; }
  .shell[data-step="details"] .actions { position: sticky; bottom: 0; z-index: 5; margin: 24px -16px -20px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); flex-direction: row; }
  .shell[data-step="details"] .actions button { flex: 1; }
  .meta { border-right: 0; border-bottom: 1px solid var(--line); }
  .shell > section { padding: 20px 16px; }
  .combo ul { width: 100%; }
  .details .fine { text-align: left; }
}
@keyframes sheetIn { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
/* Rule 141: under Reduce Motion, slides become a short fade and pressing stops scaling. */
@media (prefers-reduced-motion: reduce) {
  button:active:not(:disabled), .back:active, .cta:active { transform: none; }
  .combo.open { animation: fadeIn 140ms linear; }
}

/* Rule 158: lists scroll without a visible bar. */
.times, .combo ul { scrollbar-width: none; }
.times::-webkit-scrollbar, .combo ul::-webkit-scrollbar { display: none; }
