/* Forms: the contact page and event RSVPs. Builds on site.css. */

.f-page {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding-block: max(36px, env(safe-area-inset-top, 0px)) max(28px, env(safe-area-inset-bottom, 0px));
}

.f-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  margin-bottom: 30px;
}

.f-lone {
  --w: 96px;
}

.f-lone .icon {
  width: 34px;
  stroke: var(--accent2);
}

.f-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: 0.03em;
}

.f-head p {
  margin: 0;
  color: var(--muted);
}

/* ---------- Fields ---------- */

.f-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.f-form[hidden] {
  display: none;
}

.f-field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.f-field > label,
.f-field legend {
  display: block;
  margin-bottom: 8px;
  padding: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.f-optional {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  color: var(--faint);
}

.f-optional[hidden] {
  display: none;
}

.f-form input[type="text"],
.f-form input[type="email"],
.f-form input[type="tel"],
.f-form input[type="number"],
.f-form textarea {
  display: block;
  width: 100%;
  padding: 11px 13px;
  border: 2px solid var(--rim);
  border-radius: 4px;
  background: var(--cell);
  color: var(--text);
  font: inherit;
  font-size: 17px; /* 16px or more stops iPhones zooming in */
  line-height: 1.4;
  transition: border-color 0.12s ease;
}

.f-form textarea {
  min-height: 120px;
  resize: vertical;
}

.f-form input:hover,
.f-form textarea:hover {
  border-color: #46525f;
}

.f-form input:focus,
.f-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.f-form input[aria-invalid="true"],
.f-form textarea[aria-invalid="true"] {
  border-color: var(--down);
}

.f-hint {
  margin: 7px 0 0;
  font-size: 14px;
  color: var(--faint);
}

.f-error {
  margin: 7px 0 0;
  font-size: 14px;
  color: var(--down);
}

.f-error[hidden] {
  display: none;
}

/* ---------- Topic chips: stretched hexagons ---------- */

.f-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.f-chips label {
  position: relative;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.f-chips input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  pointer-events: none;
}

.f-chips .chip {
  --cut: 13px;
  display: block;
  padding: 2px;
  background: var(--rim);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% 50%, calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 50%);
}

.f-chips .chip > span {
  display: block;
  padding: 9px 20px;
  background: var(--cell);
  clip-path: polygon(calc(var(--cut) - 1px) 0, calc(100% - var(--cut) + 1px) 0, 100% 50%, calc(100% - var(--cut) + 1px) 100%, calc(var(--cut) - 1px) 100%, 0 50%);
  font-size: 15px;
  line-height: 1.3;
  white-space: nowrap;
  transition: background-color 0.12s ease;
}

.f-chips label:hover .chip {
  background: #46525f;
}

.f-chips input:checked + .chip {
  background: var(--accent);
}

.f-chips input:checked + .chip > span {
  background: var(--core);
  font-weight: 700;
}

.f-chips input:focus-visible + .chip {
  background: var(--text);
}

.f-field[data-invalid="true"] .chip {
  background: var(--danger-rim);
}

/* ---------- Spam trap, Turnstile, send ---------- */

.f-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Turnstile only shows itself when it needs the visitor to tick a box. */
.f-turnstile:empty {
  display: none;
}

.f-send {
  align-self: flex-start;
  min-width: 150px;
  min-height: 50px;
  padding: 12px 34px;
  border: 0;
  background: var(--accent);
  color: #0d1a26;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.03em;
  cursor: pointer;
  clip-path: polygon(15px 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 15px 100%, 0 50%);
  -webkit-tap-highlight-color: transparent;
}

.f-send:hover {
  background: var(--accent2);
}

.f-send:focus {
  outline: none;
}

.f-send:focus-visible {
  background: var(--text);
}

.f-send[disabled] {
  background: var(--rim);
  color: var(--muted);
  cursor: progress;
}

.f-status {
  margin: -8px 0 0;
  min-height: 1.5em;
  color: var(--muted);
}

.f-status[data-tone="error"] {
  color: var(--down);
}

/* ---------- After sending ---------- */

.f-done {
  padding: 22px 22px 24px;
  border: 2px solid var(--rim);
  border-radius: 4px;
  background: var(--cell);
  text-align: center;
}

.f-done[hidden] {
  display: none;
}

.f-done:focus {
  outline: none;
}

.f-done h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
}

.f-done p {
  margin: 0;
  color: var(--muted);
}

.f-done strong {
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.f-link {
  margin-top: 14px;
  padding: 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.f-link:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.f-back {
  margin: 34px 0 0;
  text-align: center;
}

.f-back .back {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--accent);
  text-underline-offset: 3px;
}
