/* Kiosk styling.
 *
 * Sized for a touchscreen at arm's length: nothing here is smaller than 18px,
 * and every tappable target clears 60px. Colours come from the event's branding
 * at runtime via the custom properties below, so this file never needs editing
 * to rebrand an event. */

:root {
  --primary: #1f6feb;
  --accent: #f0b429;
  --background: #0b0d12;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --text: #f7f8fa;
  --text-dim: rgba(247, 248, 250, 0.62);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }

/* An author `display` rule outranks the browser's own [hidden] rule, so every
   element styled below that also gets toggled with `hidden` would stay on
   screen. For the full-viewport overlays here that is not cosmetic: a hidden
   overlay still swallows every tap, leaving the kiosk unusable. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--background);
  color: var(--text);
  font-family: var(--font);
  /* A guest dragging a finger down a list should not bounce the whole page,
     and a long press should not pop up a text-selection menu. */
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* --- Boot / terminal states --------------------------------------------- */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8vh 6vw;
  text-align: center;
}

.boot-text {
  font-size: clamp(20px, 3.2vw, 34px);
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 20ch;
}

/* --- Layout -------------------------------------------------------------- */

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(20px, 4vh, 48px) clamp(20px, 5vw, 64px);
  gap: clamp(12px, 2vh, 24px);
}

.masthead { text-align: center; }

.logo {
  max-height: clamp(48px, 9vh, 110px);
  width: auto;
  margin: 0 auto clamp(8px, 1.5vh, 20px);
  display: block;
}

.header-text {
  margin: 0;
  font-size: clamp(26px, 4.4vw, 56px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 6px 0 0;
  font-size: clamp(16px, 2vw, 24px);
  color: var(--text-dim);
}

/* --- Search field -------------------------------------------------------- */

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(64px, 9vh, 96px);
  padding: 0 24px;
  background: var(--surface);
  border: 2px solid var(--surface-strong);
  border-radius: var(--radius);
  font-size: clamp(24px, 3.4vw, 40px);
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
}

.search-placeholder { color: var(--text-dim); font-weight: 400; }
.search-value { color: var(--text); }

.caret {
  width: 3px;
  height: 1.1em;
  margin-left: 4px;
  background: var(--accent);
  animation: blink 1.1s steps(2, start) infinite;
}

@keyframes blink { to { visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
}

/* --- Results ------------------------------------------------------------- */

.results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 72px;
  padding: 14px 22px;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: clamp(19px, 2.3vw, 28px);
  text-align: left;
  cursor: pointer;
}

.result:active { background: var(--surface-strong); border-color: var(--primary); }
.result-name { font-weight: 600; }
.result-hint { color: var(--text-dim); font-size: 0.8em; white-space: nowrap; }

/* The typed portion of a matching name, so a guest can see why it matched. */
.result-name mark {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.no-match {
  margin: 0;
  padding: 18px;
  text-align: center;
  font-size: clamp(17px, 2vw, 24px);
  color: var(--text-dim);
}

/* --- Keyboard ------------------------------------------------------------ */

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.key {
  flex: 1 1 0;
  min-width: 0;
  min-height: clamp(52px, 8vh, 76px);
  padding: 0;
  background: var(--surface);
  border: none;
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 600;
  cursor: pointer;
}

.key:active { background: var(--primary); }
.key--wide { flex: 2 1 0; font-size: clamp(15px, 1.6vw, 20px); }
.key--space { flex: 4 1 0; }

/* --- Reveal -------------------------------------------------------------- */

.reveal {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(10px, 2vh, 22px);
}

.reveal-greeting {
  margin: 0;
  font-size: clamp(18px, 2.2vw, 28px);
  color: var(--text-dim);
}

.reveal-name {
  margin: 0;
  font-size: clamp(30px, 5.2vw, 68px);
  font-weight: 700;
  line-height: 1.1;
}

.reveal-table-wrap {
  margin: clamp(8px, 2vh, 24px) 0;
  padding: clamp(20px, 4vh, 44px) clamp(28px, 6vw, 72px);
  background: var(--surface);
  border: 3px solid var(--primary);
  border-radius: 24px;
}

.reveal-label {
  margin: 0 0 6px;
  font-size: clamp(15px, 1.7vw, 21px);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.reveal-table {
  margin: 0;
  font-size: clamp(40px, 8vw, 108px);
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
}

.reveal-extra {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 28px;
  margin: 0;
  font-size: clamp(15px, 1.7vw, 21px);
  color: var(--text-dim);
}

.reveal-extra div { display: flex; gap: 8px; }
.reveal-extra dt { font-weight: 400; }
.reveal-extra dd { margin: 0; font-weight: 600; color: var(--text); }

.reveal-tagline {
  margin: 0;
  font-size: clamp(17px, 2.1vw, 26px);
  color: var(--text-dim);
  max-width: 26ch;
}

.done {
  min-height: 68px;
  margin-top: clamp(8px, 2vh, 20px);
  padding: 0 clamp(36px, 7vw, 80px);
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font: inherit;
  font-size: clamp(18px, 2.1vw, 26px);
  font-weight: 700;
  cursor: pointer;
}

.done:active { filter: brightness(0.9); }

/* --- Sync indicator ------------------------------------------------------ */
/* Deliberately quiet: staff can spot a stale sync, guests never notice it. */

.sync {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: transparent;
  pointer-events: none;
}

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #35c46a;
}

.sync[data-state="stale"] .sync-dot { background: var(--accent); }
.sync[data-state="stale"] { color: var(--text-dim); }
.sync[data-state="offline"] .sync-dot { background: #e5534b; }
.sync[data-state="offline"] { color: var(--text-dim); }
