/* Enquiry form: one panel, opened from any "book" or "start a project" control
   on the site and also used as the page form on contact.html.
   Structure follows the lab's intake dialog -- fixed header, scrolling field
   grid, sticky action bar -- but on our own palette rather than the lab's.
   Everything is prefixed sq- to stay clear of the pages it lands on, and every
   colour is a token so the same rules can run light on contact.html. */

.sq-scope {
  --sq-panel: #0d1420;
  --sq-bar: rgba(255, 255, 255, .025);
  --sq-field: rgba(255, 255, 255, .04);
  --sq-field-hi: rgba(255, 255, 255, .07);
  --sq-line: rgba(255, 255, 255, .12);
  --sq-line-strong: rgba(255, 255, 255, .26);
  --sq-ink: #f7f9fc;
  --sq-dim: #a9b3c3;
  --sq-mute: #778397;
  --sq-grad: linear-gradient(90deg, #5361ff 0%, #a43dff 100%);
  --sq-accent: #9d7bff;
  --sq-ring: rgba(123, 92, 255, .3);
  --sq-bad: #ff8585;
  --sq-bad-bg: rgba(255, 122, 122, .1);
  --sq-bad-line: rgba(255, 122, 122, .42);
  --sq-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
/* contact.html: the page around it is white, so the same rules run light. */
.sq-light {
  --sq-panel: #fff;
  --sq-bar: #f7f9fc;
  --sq-field: #fff;
  --sq-field-hi: #fff;
  --sq-line: #dde4ee;
  --sq-line-strong: #b9c5d6;
  --sq-ink: #101828;
  --sq-dim: #475467;
  --sq-mute: #667a92;
  --sq-accent: #5361ff;
  --sq-ring: rgba(83, 97, 255, .18);
  --sq-bad: #c0392b;
  --sq-bad-bg: #fdf1f0;
  --sq-bad-line: #f0c4be;
}

/* ---------- modal shell ---------- */

.sq-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  font-family: inherit;
}
.sq-modal[hidden] { display: none; }

.sq-scrim {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, .66);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  border: 0;
  padding: 0;
  cursor: default;
  animation: sq-fade .2s ease-out both;
}
@keyframes sq-fade { from { opacity: 0; } to { opacity: 1; } }

.sq-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(672px, 100%);
  max-height: 92dvh;
  overflow: hidden;
  background: var(--sq-panel);
  color: var(--sq-ink);
  border: 1px solid var(--sq-line);
  border-radius: 18px;
  box-shadow: 0 30px 70px -12px rgba(0, 0, 0, .6);
  animation: sq-pop .22s ease-out both;
}
/* The gradient hairline along the top edge, same one the buttons use. */
.sq-panel:before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--sq-grad);
  z-index: 2;
}
@keyframes sq-pop {
  from { opacity: 0; transform: translateY(8px) scale(.975); }
  to { opacity: 1; transform: none; }
}

.sq-x {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 3;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--sq-line);
  border-radius: 8px;
  background: transparent;
  color: var(--sq-mute);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color .16s, border-color .16s;
}
.sq-x:hover { color: var(--sq-ink); border-color: var(--sq-line-strong); }

/* ---------- the form itself ---------- */

.sq-form { display: flex; flex-direction: column; min-height: 0; }

.sq-head {
  flex: 0 0 auto;
  padding: 22px 24px 20px;
  border-bottom: 1px solid var(--sq-line);
}
.sq-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 400 10px/1 var(--sq-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--sq-mute);
  margin-bottom: 9px;
}
.sq-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--sq-accent);
}
.sq-title {
  margin: 0;
  font-size: clamp(21px, 2.6vw, 27px);
  line-height: 1.14;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--sq-ink);
  padding-right: 40px;
}
.sq-sub { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--sq-dim); }
.sq-mail { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--sq-dim); }
.sq-mail a { color: var(--sq-accent); font-weight: 500; text-decoration: underline;
  text-underline-offset: 3px; }
.sq-copy {
  font: 400 10px/1 var(--sq-mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--sq-mute);
  background: transparent;
  border: 1px solid var(--sq-line);
  border-radius: 6px;
  padding: 3px 8px;
  margin-left: 6px;
  cursor: pointer;
  transition: color .16s, border-color .16s;
}
.sq-copy:hover { color: var(--sq-ink); border-color: var(--sq-line-strong); }

.sq-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 22px 24px;
}
.sq-wide { grid-column: 1 / -1; }

.sq-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
/* display:flex above would otherwise beat the [hidden] default, and the package
   and location questions are hidden for anything that is not a capture. */
.sq-field[hidden] { display: none; }
.sq-field > label {
  font: 400 10px/1.3 var(--sq-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--sq-mute);
}
.sq-field > label em { font-style: normal; color: var(--sq-accent); margin-left: 3px; }
.sq-field > label span { text-transform: none; letter-spacing: .02em; opacity: .75; }

.sq-field input,
.sq-field select,
.sq-field textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--sq-ink);
  background: var(--sq-field);
  border: 1px solid var(--sq-line);
  border-radius: 9px;
  padding: 10px 12px;
  transition: border-color .16s, box-shadow .16s, background-color .16s;
  -webkit-appearance: none;
  appearance: none;
}
.sq-field textarea { resize: vertical; min-height: 118px; line-height: 1.6; }
.sq-field input::placeholder,
.sq-field textarea::placeholder { color: var(--sq-mute); opacity: .8; }
.sq-field input:hover,
.sq-field select:hover,
.sq-field textarea:hover { border-color: var(--sq-line-strong); }
.sq-field input:focus,
.sq-field select:focus,
.sq-field textarea:focus {
  outline: 0;
  border-color: var(--sq-accent);
  background: var(--sq-field-hi);
  box-shadow: 0 0 0 3px var(--sq-ring);
}
/* The native arrow goes with appearance:none, so it is drawn back on. */
.sq-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%23778397' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.sq-field select option { background: var(--sq-panel); color: var(--sq-ink); }

/* Marked by script after a rejected submit, never by :invalid, so a field the
   visitor has not reached yet is never painted as a mistake. */
.sq-field.is-bad input,
.sq-field.is-bad textarea { border-color: var(--sq-bad); }
.sq-err { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--sq-bad); }

.sq-count {
  margin: 2px 0 0;
  text-align: right;
  font: 400 10px/1 var(--sq-mono);
  letter-spacing: .06em;
  color: var(--sq-mute);
}

.sq-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.sq-chip {
  font: 400 10px/1 var(--sq-mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--sq-mute);
  background: transparent;
  border: 1px solid var(--sq-line);
  border-radius: 999px;
  padding: 8px 13px;
  cursor: pointer;
  transition: color .16s, border-color .16s, background-color .16s;
}
.sq-chip:hover { color: var(--sq-ink); border-color: var(--sq-line-strong); }
.sq-chip[aria-pressed="true"] {
  color: #fff;
  background: var(--sq-grad);
  border-color: transparent;
}

.sq-pot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- action bar ---------- */

.sq-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 24px;
  border-top: 1px solid var(--sq-line);
  background: var(--sq-bar);
}
.sq-note {
  margin: 0;
  min-width: 0;
  font: 400 10px/1.5 var(--sq-mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--sq-mute);
}
.sq-note.is-bad {
  font-family: inherit;
  font-size: 13.5px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--sq-bad);
}
.sq-note a { color: inherit; }
.sq-acts { display: flex; align-items: center; gap: 9px; flex: none; }
.sq-cancel {
  font: 400 11px/1 var(--sq-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--sq-mute);
  background: transparent;
  border: 1px solid var(--sq-line);
  border-radius: 999px;
  padding: 12px 17px;
  cursor: pointer;
  transition: color .16s, border-color .16s;
}
.sq-cancel:hover { color: var(--sq-ink); border-color: var(--sq-line-strong); }
.sq-send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 11px/1 var(--sq-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  background: var(--sq-grad);
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  cursor: pointer;
  transition: filter .16s, transform .16s;
}
.sq-send:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.sq-send:disabled { opacity: .6; cursor: default; }

/* ---------- sent, and could-not-send ---------- */

.sq-done { padding: 44px 24px; display: flex; flex-direction: column; gap: 14px; }
.sq-done .sq-kicker { margin: 0; color: var(--sq-accent); }
.sq-done h2 {
  margin: 0;
  font-size: clamp(21px, 2.6vw, 27px);
  line-height: 1.14;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--sq-ink);
}
.sq-done p { margin: 0; max-width: 46ch; font-size: 14.5px; line-height: 1.6; color: var(--sq-dim); }
.sq-opt {
  margin: 6px 0 0 !important;
  padding-top: 18px;
  border-top: 1px solid var(--sq-line);
  max-width: none !important;
  font-size: 13.5px !important;
}
.sq-done-btns { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 2px; }
.sq-done-btns a,
.sq-done-btns button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 11px/1 var(--sq-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 13px 20px;
  text-decoration: none;
  cursor: pointer;
  transition: .16s;
}
.sq-done-btns .sq-cal { color: #fff; background: var(--sq-grad); border: 0; }
.sq-done-btns .sq-cal:hover { filter: brightness(1.1); }
.sq-done-btns .sq-ghost {
  color: var(--sq-dim);
  background: transparent;
  border: 1px solid var(--sq-line);
  font-weight: 400;
}
.sq-done-btns .sq-ghost:hover { color: var(--sq-ink); border-color: var(--sq-line-strong); }

.sq-panel :focus-visible,
.sq-inline :focus-visible { outline: 2px solid var(--sq-accent); outline-offset: 2px; }

html.sq-open, html.sq-open body { overflow: hidden; }

/* ---------- as a page form ---------- */

.sq-inline {
  background: var(--sq-panel);
  border: 1px solid var(--sq-line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.sq-inline .sq-form { max-height: none; }
.sq-inline .sq-grid { overflow: visible; }
.sq-inline .sq-head { padding-top: 24px; }

@media (max-width: 720px) {
  .sq-modal { padding: 0; align-items: flex-end; }
  .sq-panel { width: 100%; max-height: 94dvh; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .sq-grid { grid-template-columns: 1fr; padding: 20px; }
  .sq-head, .sq-foot { padding-left: 20px; padding-right: 20px; }
  .sq-foot { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .sq-acts { justify-content: stretch; }
  .sq-acts .sq-send { flex: 1; justify-content: center; }
  .sq-note { text-align: center; }
  .sq-done { padding: 36px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .sq-panel, .sq-scrim { animation: none; }
  .sq-send:hover:not(:disabled) { transform: none; }
}
