/*
 * Kiosk styling. Built for one-handed use on a phone in daylight: large type,
 * 48px+ touch targets, high contrast, and no reliance on hover.
 */

:root {
  color-scheme: light dark;

  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #14171c;
  --ink-soft: #5b6471;
  --line: #dfe4ea;
  --accent: #1a6dd4;
  --accent-ink: #ffffff;
  --ok: #12855a;
  --warn-bg: #fff8e6;
  --warn-line: #f0d089;
  --danger: #c0392b;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .07);
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #191d24;
    --ink: #e9ecf1;
    --ink-soft: #99a3b2;
    --line: #2b323c;
    --accent: #4d9bff;
    --accent-ink: #07101d;
    --ok: #3ddc9a;
    --warn-bg: #2a2313;
    --warn-line: #5c4a1d;
    --danger: #ff7a6b;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ---------- masthead ---------- */

/*
 * Grid rather than flex so the logo can span both text rows without wrapping
 * the heading and status line in an extra element — they are siblings in the
 * markup on every page that uses this masthead.
 */
.masthead {
  padding: 12px 4px 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 14px;
  align-items: center;
}

.brandmark {
  grid-row: 1 / span 2;
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex: none;
}

.masthead h1 {
  grid-column: 2;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.masthead .status-line { grid-column: 2; }

@media (max-width: 360px) {
  .brandmark { width: 52px; height: 52px; }
  .masthead h1 { font-size: 23px; }
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--ink-soft);
  flex: none;
}
.dot.open   { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.dot.closed { background: var(--danger); }

/* ---------- cards ---------- */

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

.card h2 {
  font-size: 21px;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.lede {
  color: var(--ink-soft);
  margin: 0 0 18px;
  font-size: 15.5px;
}

/* ---------- panels ---------- */

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 16px;
  background: color-mix(in srgb, var(--ink) 3%, transparent);
}

.panel h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

.panel.warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
}
.panel.warn strong { display: block; margin-bottom: 2px; }

.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 18px;
  font-size: 15px;
}
.notice strong { display: block; margin-bottom: 2px; }

.events, .hours {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 15px;
}

.events li {
  display: flex;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.events li:last-child { border-bottom: none; }
.events .when {
  flex: none;
  width: 132px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.events .what { font-weight: 500; }
.events .where { display: block; font-weight: 400; color: var(--ink-soft); font-size: 13.5px; }

.hours li {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  color: var(--ink-soft);
}
.hours li.today {
  color: var(--ink);
  font-weight: 600;
}
.hours .day { text-transform: capitalize; }

/* ---------- slot grid ---------- */

.slotgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 9px;
  margin: 4px 0 0;
}

.slotgrid .slot {
  min-height: 52px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
}
.slotgrid .slot .stime { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
.slotgrid .slot .staken {
  /*
   * inline-block, not block, and it matters: the strike-through on a taken
   * tile propagates into in-flow descendants, and a child cannot cancel it
   * with text-decoration:none -- that only works on atomic inline boxes.
   * Without this the booking reference renders struck through and is
   * markedly harder to read at this size.
   */
  display: inline-block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-soft);
}
.slotgrid .slot.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.slotgrid .slot.taken {
  opacity: .42;
  cursor: not-allowed;
  text-decoration: line-through var(--ink-soft);
}
.slotgrid .slot.taken .staken { text-decoration: none; }

/*
 * A booking reference is data rather than a status word, so it drops the
 * uppercase treatment and takes the tabular face the times use. Tiles
 * carrying one are also dimmed a little less: "#12" has to stay legible at
 * 11.5px, where "TAKEN" only has to be recognisable.
 */
.slotgrid .slot .staken.sref {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
.slotgrid .slot.taken:has(.sref) { opacity: .62; }

.mailicon {
  width: 56px; height: 56px;
  margin: 4px auto 14px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 27px;
  line-height: 56px;
}

/* ---------- form ---------- */

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 6px;
}

input[type="text"], input[type="tel"], input[type="email"], input[type="date"] {
  width: 100%;
  font: inherit;
  font-size: 17px; /* >=16px keeps iOS from zooming on focus */
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
  color: var(--ink);
}
input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.hint {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 6px 0 0;
}

.field-error {
  color: var(--danger);
  font-size: 14.5px;
  font-weight: 500;
  margin: 14px 0 0;
}

.checkbox {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-weight: 400;
  font-size: 15px;
  margin: 18px 0 0;
  cursor: pointer;
}
.checkbox input {
  flex: none;
  width: 24px; height: 24px;
  margin: 0;
  accent-color: var(--accent);
}
.checkbox input:disabled { cursor: not-allowed; opacity: .5; }

/* ---------- waiver ---------- */

.waiver-scroll {
  max-height: 44vh;
  min-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--bg);
  font-size: 14.5px;
  line-height: 1.6;
}
.waiver-scroll p { margin: 0 0 12px; }
.waiver-scroll p:last-child { margin-bottom: 0; }
.waiver-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.scroll-hint { margin-top: 8px; }
.scroll-hint.done { color: var(--ok); font-weight: 500; }

/* ---------- signature ---------- */

.sig-block { margin-top: 22px; }

.sig-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.sig-head label { margin: 0; }

#sigCanvas {
  display: block;
  width: 100%;
  height: 200px;
  margin-top: 8px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--card);
  touch-action: none; /* let us handle the drawing gesture, not the browser */
  cursor: crosshair;
}
#sigCanvas.signed { border-style: solid; border-color: var(--accent); }

.link {
  background: none;
  border: none;
  padding: 4px;
  font: inherit;
  font-size: 14px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- buttons ---------- */

button.primary, button.ghost {
  font: inherit;
  font-size: 16.5px;
  font-weight: 600;
  min-height: 52px;
  padding: 14px 20px;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  margin-top: 22px;
}
button.primary:disabled {
  opacity: .45;
  cursor: not-allowed;
}
button.primary:not(:disabled):active { transform: translateY(1px); }

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  margin-top: 22px;
}

.actions {
  display: flex;
  gap: 12px;
}
.actions button.ghost { flex: 0 0 34%; }
.actions button.primary { flex: 1; }

.spinner {
  width: 17px; height: 17px;
  border: 2.5px solid color-mix(in srgb, var(--accent-ink) 40%, transparent);
  border-top-color: var(--accent-ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  button.primary:active { transform: none; }
}

/* ---------- result ---------- */

.result { text-align: center; }

.check {
  width: 56px; height: 56px;
  margin: 4px auto 14px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: var(--ok);
  font-size: 30px;
  line-height: 56px;
  font-weight: 700;
}

.pin-display {
  font: 700 clamp(42px, 15vw, 62px)/1.1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.1em;
  padding: 22px 12px;
  margin: 6px 0 12px;
  border: 2px solid var(--accent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  user-select: all;
}

.expiry {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0 0 18px;
}

.result .panel.warn { text-align: left; }
.result .hint { text-align: left; }

/* ---------- footer ---------- */

.foot {
  margin-top: 24px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* ---------- month calendar ---------- */

/* The booking flow is a narrow column; a month grid needs room. */
.shell.wide { max-width: 980px; }

.monthbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.monthbar h2 {
  margin: 0;
  font-size: 19px;
  text-align: center;
  flex: 1;
}

.monthbar button {
  min-width: 44px;
  padding: 8px 12px;
  font-size: 17px;
  line-height: 1;
}

.monthgrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.dow {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  text-align: center;
  padding: 4px 0 6px;
}

.daycell {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--card);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
}

/* A day you can book is a link, and should feel like one. */
a.daycell:hover { border-color: var(--accent); }
a.daycell.nolink { cursor: default; }

.daycell.outside { opacity: .38; }
.daycell.past { opacity: .55; }
.daycell.closed { background: color-mix(in srgb, var(--ink) 4%, transparent); }

.daynum {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.dayclosed, .dayfree {
  font-size: 11px;
  color: var(--ink-soft);
}
.dayfree { color: var(--ok); }

/*
 * One bar per busy period. Times are trimmed ("9–11 AM") because a month grid
 * has no room for "9:00 AM – 11:00 AM" seven times across, and the full range
 * is on the tooltip.
 */
.block {
  font-size: 10.5px;
  line-height: 1.35;
  padding: 2px 5px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.block.booked {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--ink);
}

.block.reserved {
  background: color-mix(in srgb, var(--warn-line) 40%, transparent);
  color: var(--ink);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.legend .swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}
.legend .booked { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.legend .reserved { background: color-mix(in srgb, var(--warn-line) 40%, transparent); }
.legend .closedsw { background: color-mix(in srgb, var(--ink) 12%, transparent); }

/*
 * On a phone a seven-column grid cannot hold time ranges, so the cells become
 * compact: the date, and a dot per busy period. Tapping still opens the day.
 */
@media (max-width: 620px) {
  .daycell { min-height: 58px; padding: 4px 3px; }
  .block {
    font-size: 0;
    padding: 0;
    height: 5px;
    border-radius: 3px;
  }
  .dayclosed, .dayfree { font-size: 9.5px; }
}

/* ---------- month picker on the booking page ---------- */

.monthbar h3 {
  margin: 0;
  font-size: 17px;
  text-align: center;
  flex: 1;
  white-space: nowrap;
}

/*
 * The shared `button.ghost` rule is full-width and outranks a bare class, so
 * this has to be at least as specific or the arrows stretch and squeeze the
 * month name onto two lines.
 */
button.monthnav {
  width: auto;
  flex: 0 0 auto;
  min-width: 46px;
  min-height: 46px;
  padding: 8px 14px;
  font-size: 17px;
}
button.monthnav[disabled] { opacity: .35; cursor: not-allowed; }

/*
 * The booking shell is 560px wide, so seven columns leave about 66px each --
 * not room for "9–11 AM" even once. Busy periods are therefore drawn as bars
 * at every width here, not just on phones, with the times on the tooltip.
 */
.monthgrid.picker { gap: 3px; }

.monthgrid.picker .daycell {
  min-height: 62px;
  padding: 5px 4px;
  font: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.monthgrid.picker .block {
  font-size: 0;
  padding: 0;
  height: 4px;
  border-radius: 2px;
}

.monthgrid.picker .dayclosed,
.monthgrid.picker .dayfree { font-size: 10px; }

/*
 * Only a day that can actually be booked looks pressable. Everything else --
 * closed, already gone, or past the end of the booking window -- is drawn as
 * plain text and is not a button at all, so it cannot be tabbed to either.
 */
.daycell.bookable {
  cursor: pointer;
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}
.daycell.bookable .daynum { color: var(--ink); }
.daycell.bookable:hover { border-color: var(--accent); }
.daycell.bookable:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.daycell.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
}

/* Inside the month, but outside the window you are allowed to book. */
.daycell.outofwindow { opacity: .45; }

.legend .bookable {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
}

.chosenday {
  margin: 18px 0 0;
  font-size: 15.5px;
  font-weight: 700;
}

@media (max-width: 420px) {
  .monthgrid.picker .daycell { min-height: 52px; padding: 4px 2px; }
  .monthgrid.picker .dayclosed,
  .monthgrid.picker .dayfree { font-size: 9px; }
}

/* ---------- children ---------- */

.kids {
  margin: 22px 0 4px;
  padding: 14px 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.kids legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Each child is visually a card, so three of them do not read as one long
   undifferentiated run of nine inputs. */
.kid {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 12px 14px;
  margin-bottom: 12px;
  background: color-mix(in srgb, var(--ink) 3%, transparent);
}

.kid-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.kid-n {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
}

.kid label { margin-top: 10px; }
.kid label:first-of-type { margin-top: 2px; }

.linkish {
  background: none;
  border: 0;
  padding: 4px 2px;
  font: inherit;
  font-size: 13.5px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

#addChildBtn[disabled] { opacity: .5; cursor: not-allowed; }

.foot-links {
  margin: 18px 0 0;
  text-align: center;
  font-size: 14px;
}
.foot-links a { color: var(--accent); }
/* ---------- duration picker ---------- */

.pickhead {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  margin: 16px 0 8px;
}

.durgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 9px;
}

.durgrid .dur {
  min-height: 52px;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
}
.durgrid .dur .dlen { display: block; font-weight: 600; font-size: 14.5px; }
.durgrid .dur .duntil {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.durgrid .dur.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}