/* Enquiry form + call scheduler.
   Single source of truth: shared/css/forms.css — copied into each site at deploy time.
   Every colour comes from the host site's tokens, so the components inherit its identity.

   Required tokens: --surface --surface-2 --border --text --muted --accent
                    --accent-ink --danger --success --radius --font --font-display */

.form-grid {
  display: grid;
  gap: 1.05rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid .field--full { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }

.field label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.field label .req { color: var(--accent); }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.78rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  appearance: none;
}
.field textarea { min-height: 8.5rem; resize: vertical; line-height: 1.6; }

.field select {
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 1.05rem center, right 0.75rem center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
  cursor: pointer;
}

/* Fading --muted with opacity dropped placeholder contrast to 2.5:1 on the light
   theme. Mixing toward --text instead raises it in every theme: darker on light
   grounds, lighter on dark ones. */
.field input::placeholder,
.field textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, var(--text));
  opacity: 1;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--danger); }

.field-error { font-size: 0.8rem; color: var(--danger); min-height: 0; }
.field-error:empty { display: none; }

.field-hint { font-size: 0.8rem; color: var(--muted); }

/* Bots fill this; people never see it. */
.field--trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-banner {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--text);
}

.form-consent { font-size: 0.82rem; color: var(--muted); line-height: 1.6; }
.form-consent a { color: var(--text); }

form.is-busy { opacity: 0.72; pointer-events: none; }

/* -------------------------------------------------------------- success */

.form-success {
  display: grid;
  gap: 0.9rem;
  justify-items: start;
  padding: 2rem;
  border: 1px solid color-mix(in srgb, var(--success) 40%, var(--border));
  border-radius: calc(var(--radius) * 1.6);
  background: color-mix(in srgb, var(--success) 8%, var(--surface));
}
.form-success h3 { margin: 0; font-family: var(--font-display); font-size: 1.35rem; }
.form-success p { margin: 0; color: var(--muted); line-height: 1.7; }
.form-success .tick {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--success);
  color: var(--accent-ink);
  font-size: 1.2rem;
}
.form-success code {
  /* inline-block keeps the reference from breaking mid-token: it wraps to the
     next line whole rather than splitting across two. */
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ scheduler */

/* minmax(0,…) and min-width:0 stop the grid/flex `min-width: auto` default from
   letting the date strip push the page wider than its container. Without these,
   .date-strip's own overflow-x has nothing to scroll inside. */
.scheduler { display: grid; gap: 1.6rem; grid-template-columns: minmax(0, 1fr); }
.scheduler-step { min-width: 0; }

.scheduler-step {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.6);
  background: var(--surface);
}
@media (min-width: 720px) { .scheduler-step { padding: 1.85rem; } }

.scheduler-step > h3 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.scheduler-step > h3 .num {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  flex: none;
  border-radius: 50%;
  font-size: 0.8rem;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.scheduler-step > p { margin: 0 0 1.15rem 2.35rem; color: var(--muted); font-size: 0.88rem; line-height: 1.6; }

.scheduler-status { font-size: 0.88rem; color: var(--muted); padding: 0.4rem 0; }
.scheduler-status.is-error { color: var(--danger); }

.date-strip {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 0.25rem 0 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
/* The default scrollbar is a heavy dark bar on a light ground; tone it to the theme. */
.date-strip::-webkit-scrollbar { height: 6px; }
.date-strip::-webkit-scrollbar-track { background: transparent; }
.date-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.date-strip:hover::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 55%, var(--border)); }
.date-month {
  flex: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.35rem;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.date-chip {
  flex: none;
  display: grid;
  gap: 0.1rem;
  justify-items: center;
  width: 3.5rem;
  padding: 0.6rem 0.3rem;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.date-chip:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-1px); }
.date-chip-day { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.date-chip-num { font-size: 1.05rem; font-weight: 600; }
.date-chip.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.date-chip.is-selected .date-chip-day { color: inherit; opacity: 0.85; }

.slot-grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
}
.slot-chip {
  display: grid;
  gap: 0.12rem;
  justify-items: start;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.slot-chip:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-1px); }
.slot-chip-time { font-size: 0.98rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.slot-chip-local { font-size: 0.72rem; color: var(--muted); }
.slot-chip.is-selected { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.slot-chip.is-selected .slot-chip-local { color: inherit; opacity: 0.85; }

.slot-grid .muted, .date-strip .muted { margin: 0; color: var(--muted); font-size: 0.9rem; }

.scheduler-summary {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 1.35rem;
  padding: 0.9rem 1.05rem;
  border-radius: var(--radius);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.scheduler-summary strong { font-size: 0.98rem; }
.scheduler-summary span { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.scheduler-zone { font-size: 0.82rem; color: var(--muted); }

[hidden] { display: none !important; }
