/* /meet: book a call (lib/meet-page.js). Aashish's pixel town (game/meet-town.js) with the
   form in a panel beside it on a wide screen, and the town as a strip along the bottom of a
   phone. The same paper, ink and lime as /bio. */
@font-face {
  font-family: 'Anton';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/anton-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/inter-latin.woff2') format('woff2');
}

:root {
  --paper: #f5f2ea;
  --card: #fffdf7;
  --ink: #0f1f1a;
  --soft: #52645d;
  --line: #0f1f1a;
  --lime: #c9f558;
  --green: #2fbf5b;
  --on-green: #ffffff;
  --coral: #ff7a59;
  --locked: #d9d6cc;
  --shadow: #0f1f1a;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101a17;
    --card: #1a2622;
    --ink: #f0ece2;
    --soft: #9fb0a7;
    --line: #3a4a44;
    --locked: #2a3531;
    --shadow: #000;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1.2px);
  background-size: 18px 18px;
  color: var(--ink);
  font: 16px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
[hidden] { display: none !important; }

/* The form is paper whatever the hour: the same cream as his speech bubble and the office,
   so over the night town it reads as a lit sheet rather than a dark slab. */
.panel {
  --paper: #f5f2ea; --card: #fffdf7; --ink: #0f1f1a; --soft: #52645d; --line: #0f1f1a; --shadow: #0f1f1a;
  color: var(--ink); color-scheme: light;
}

/* By night the form is the same deep blue-black as the night over the town and the bars, not
   the site's green: charcoal cards, a soft cream for the words, the lime for what is picked. */
@media (prefers-color-scheme: dark) {
  .panel {
    --paper: #0e1117; --card: #171b24; --ink: #f0ece2; --soft: #9aa3b2; --line: #2c333f; --shadow: #04070a;
  }
}

/* ---------- a phone: the town fills the screen, the form is a sheet along the bottom ---------- */
.town { position: fixed; inset: 0; overflow: hidden; background: #6fae47; }
#town-canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.panel {
  position: fixed; z-index: 6; left: 0; right: 0; bottom: 0;
  max-height: 60vh; max-height: 60dvh; overflow: auto; overscroll-behavior: contain;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--paper);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1.2px);
  background-size: 18px 18px;
  border-top: 3px solid var(--ink); border-radius: 22px 22px 0 0;
}
.panel::before { content: ''; display: block; width: 44px; height: 5px; margin: 0 auto 8px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 25%, transparent); }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 12px; }
.sheet-title { font: 20px/1 Anton, Impact, sans-serif; text-transform: uppercase; letter-spacing: 0.02em; }
.sheet-step { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--soft); }
.head { display: none; }
/* the keyboard is up: every line of the sheet counts */
body.kb .panel { padding-top: 8px; padding-bottom: 10px; }
body.kb .panel::before { display: none; }
body.kb .sheet-head { margin-bottom: 8px; }
body.kb .panel .step { margin-bottom: 10px; }
/* one step at a time */
.panel[data-stage] .step, .panel[data-stage] .field { display: none; }
.panel[data-stage="1"] [data-stage~="1"], .panel[data-stage="2"] [data-stage~="2"], .panel[data-stage="3"] [data-stage~="3"],
.panel[data-stage="4"] [data-stage~="4"], .panel[data-stage="5"] [data-stage~="5"] { display: block; }
.panel .step { margin-bottom: 12px; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nav-btn {
  border: 2px solid var(--line); border-radius: 10px; background: var(--card); padding: 10px 14px;
  font-weight: 800; font-size: 14px; cursor: pointer; box-shadow: 2px 2px 0 var(--shadow); white-space: nowrap;
}
.nav-btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.nav-btn--next { background: var(--ink); color: var(--paper); margin-left: auto; }
.nav-hint { font-size: 13px; font-weight: 700; color: var(--soft); text-align: right; margin-left: auto; }
.panel[data-stage="done"] .nav, .panel[data-stage="done"] .sheet-step { display: none; }

.back { font-size: 13px; font-weight: 700; color: var(--soft); text-decoration: none; }
.back:hover { color: var(--ink); }
.head h1 { font: 40px/0.98 Anton, Impact, sans-serif; text-transform: uppercase; letter-spacing: 0.01em; margin: 10px 0 8px; }
.lede { margin: 0; color: var(--soft); font-size: 14px; max-width: 42ch; }

/* ---------- the form ---------- */
.step {
  border: 2px solid var(--line); border-radius: 14px; background: var(--card);
  box-shadow: 4px 4px 0 var(--shadow); padding: 16px; margin: 0 0 18px; min-width: 0;
}
.step[disabled] { opacity: 0.55; }
legend, .lbl { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; }
legend { float: left; width: 100%; margin-bottom: 12px; padding: 0; }
legend + * { clear: both; }
.n {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: var(--ink); color: var(--paper); font: 13px/1 Anton, Impact, sans-serif;
}
.tz { margin-left: auto; font-weight: 600; font-size: 12px; color: var(--soft); }
.muted { margin: 0; color: var(--soft); font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--line); background: var(--paper); border-radius: 10px;
  padding: 8px 11px; font-size: 14px; font-weight: 700; cursor: pointer; line-height: 1.15;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
  box-shadow: 2px 2px 0 var(--shadow);
}
.chip small { display: block; font-weight: 600; font-size: 11px; color: var(--soft); text-transform: uppercase; letter-spacing: 0.06em; }
.chip:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shadow); }
.chip[aria-checked="true"] { background: var(--lime); color: #0f1f1a; }
.chip[aria-checked="true"] small { color: #33443d; }

.field { display: block; margin-bottom: 16px; }
.field:last-of-type { margin-bottom: 0; }
.field input, .field textarea {
  display: block; width: 100%; margin-top: 8px; padding: 11px 12px;
  border: 2px solid var(--line); border-radius: 10px; background: var(--paper); font-size: 16px;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--lime); }
.field.ok input, .field.ok textarea { border-color: var(--green); }
.hint { display: block; margin-top: 6px; font-size: 12px; color: var(--soft); }
.hint.bad { color: var(--coral); font-weight: 700; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- in the town: his speech bubble, the count, and the button on the step ---------- */
.say {
  position: absolute; left: 0; top: 0; z-index: 4; margin: 0; white-space: nowrap;
  background: #fffdf7; color: #0f1f1a; border: 2px solid #0f1f1a; border-radius: 10px;
  padding: 4px 10px; font-size: 13px; font-weight: 700; box-shadow: 2px 2px 0 #0f1f1a;
  transition: opacity 0.2s; will-change: transform; pointer-events: none;
}
.hud {
  position: absolute; left: 10px; top: 10px; z-index: 3; margin: 0;
  background: rgba(15, 31, 26, 0.82); color: #f5f2ea; border-radius: 99px;
  padding: 5px 11px; font-size: 12px; font-weight: 700; letter-spacing: 0.01em;
}
.go {
  position: absolute; left: 0; top: 0; z-index: 3;
  height: 40px; padding: 0 14px;
  border: 2px solid #0f1f1a; border-radius: 10px; cursor: not-allowed;
  background: #d9d6cc; color: #52645d;
  font: 17px/1 Anton, Impact, sans-serif; letter-spacing: 0.04em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  box-shadow: 3px 3px 0 #0f1f1a; transform-origin: 50% 100%;
  will-change: transform;
}
.go .lock { font-size: 13px; }
.go.ready { background: var(--green); color: var(--on-green); cursor: pointer; }
.go.ready .lock { display: none; }
.go.ready:hover { filter: brightness(1.06); }
.go.ready:active { box-shadow: 1px 1px 0 #0f1f1a; }
.go.busy { cursor: progress; opacity: 0.85; }
.go.carried { pointer-events: none; box-shadow: 3px 7px 0 rgba(15, 31, 26, 0.55); }
.go:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }

.status { min-height: 1.4em; margin: 0 0 16px; font-size: 14px; font-weight: 600; color: var(--coral); }

/* ---------- lights down: the moment the button is green ---------- */
.bar {
  position: absolute; left: 0; right: 0; height: 0; z-index: 7; background: #04070a;
  transition: height 1.1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bar--top { top: 0; }
.bar--bottom { bottom: 0; }
body.cinema .bar { height: 11vh; }
body.cinema .hud { opacity: 0; transition: opacity 0.6s; }
.panel { transition: opacity 0.9s; }
body.cinema .panel { opacity: 0.38; }
body.cinema .panel:hover, body.cinema .panel:focus-within, body.cinema .panel[data-stage="done"] { opacity: 1; }
body.cinema .go.ready { animation: beacon 1.6s ease-in-out infinite; }
@keyframes beacon {
  0%, 100% { box-shadow: 3px 3px 0 #0f1f1a, 0 0 0 5px rgba(201, 245, 88, 0.35), 0 0 34px 8px rgba(201, 245, 88, 0.55); filter: brightness(1); }
  50% { box-shadow: 3px 3px 0 #0f1f1a, 0 0 0 8px rgba(201, 245, 88, 0.5), 0 0 60px 18px rgba(201, 245, 88, 0.8); filter: brightness(1.2); }
}

/* ---------- booked ---------- */
.done {
  text-align: center; border: 2px solid var(--line); border-radius: 16px; background: var(--card);
  box-shadow: 5px 5px 0 var(--shadow); padding: 28px 18px 24px; margin: 0 0 32px;
  animation: pop 0.5s var(--ease);
}
.done h2 { font: 34px/1 Anton, Impact, sans-serif; text-transform: uppercase; margin: 0 0 10px; }
.done .when { font-weight: 800; font-size: 18px; margin: 0 0 6px; }
.done p { margin: 0 0 6px; color: var(--soft); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.btn {
  display: inline-block; padding: 10px 14px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); text-decoration: none; font-weight: 800; font-size: 14px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.btn--zoom { background: #2d8cff; color: #fff; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* ---------- a proper screen: the town fills the window, the form floats over the park ---------- */
@media (min-width: 960px) {
  .panel {
    top: 50%; right: 32px; left: auto; bottom: auto; transform: translateY(-50%);
    width: min(500px, 36vw); max-height: calc(100vh - 56px);
    padding: 26px 26px 20px;
    background-color: color-mix(in srgb, var(--paper) 90%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
    border: 2px solid var(--line); border-radius: 18px; box-shadow: 6px 6px 0 var(--shadow);
    scrollbar-width: thin;
  }
  .panel::before, .sheet-head, .nav { display: none; }
  .head { display: block; margin-bottom: 16px; }
  .panel[data-stage] .step, .panel[data-stage] .field { display: block; }
  .panel .step { background: color-mix(in srgb, var(--card) 88%, transparent); padding: 16px; margin-bottom: 14px; }
  .hud { left: 16px; top: 16px; font-size: 13px; padding: 7px 13px; }
  .say { font-size: 14px; padding: 5px 12px; }
  .go { height: 46px; font-size: 20px; padding: 0 16px; }
  .step--you { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
  .step--you .field { margin: 0; }
  .field--wide { grid-column: 1 / -1; }
  .field textarea { min-height: 72px; }
  .done { margin: 0; }
}

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