/* Race to Connect "Register Interest" popup (racetoconnect.html).
   Behavior lives in js/rtc-register.js. Several rules here undo the
   global `button, input` pill styling in style.css, which is meant for
   CTAs, not form fields. */

.rtc-dialog {
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2rem;
  background: #0b0b0b;
  color: #fff;
  overflow: auto;
  overscroll-behavior: contain;
  box-shadow: inset 0 0 48px rgba(255, 255, 255, 0.03), 0 24px 64px rgba(0, 0, 0, 0.6);
}
.rtc-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.rtc-dialog [hidden] {
  display: none !important;
}

.rtc-panel {
  position: relative;
  padding: 3rem 1.75rem 1.75rem;
  text-align: left;
}
@media (max-width: 419px) {
  .rtc-panel { padding: 2.75rem 1.25rem 1.25rem; }
}

.rtc-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  backdrop-filter: none;
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.7);
}
.rtc-close:hover {
  color: #fff;
}

/* Only the heading and intro are centered; the form itself reads
   left to right. */
.rtc-panel h2 {
  margin: 0 0 0.85rem;
  padding: 0 2.5rem;
  text-align: center;
  text-transform: none;
}
.rtc-intro {
  max-width: 28rem;
  margin: 0 auto 2.5rem;
  text-align: center;
  text-wrap: balance;
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
}

/* ── Fields ─────────────────────────────────────────────────────── */

.rtc-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1rem;
}
@media (min-width: 520px) {
  .rtc-row { grid-template-columns: 1fr 1fr; }
}

.rtc-field {
  margin-bottom: 1rem;
}
.rtc-field > label,
.rtc-legend {
  display: block;
  margin-bottom: 0.4rem;
  font-family: "Montserrat", sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
}

/* Fields and city tiles share one shape: 2.5rem tall with the same
   radius-to-height ratio as the site's buttons (1.25rem on 3rem). */
.rtc-field input {
  display: block;
  width: 100%;
  height: 2.5rem;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 1.05rem;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: none;
  color: #fff;
  /* 16px minimum stops iOS Safari zooming in on focus. */
  font-family: "Montserrat", sans-serif;
  font-size: 1rem;
  font-weight: 400;
  text-align: left;
  cursor: text;
  transition: background-color 0.2s, box-shadow 0.2s;
}
.rtc-field input:hover {
  background: rgba(255, 255, 255, 0.1);
}
/* No borders, so focus and error states are drawn as inset rings. */
.rtc-field input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px var(--accent-color);
}
.rtc-field input[aria-invalid="true"] {
  box-shadow: inset 0 0 0 1px #ff5c7a;
}

.rtc-error {
  min-height: 0;
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.3;
  color: #ff5c7a;
}
.rtc-error:empty {
  display: none;
}

/* ── Event choices ──────────────────────────────────────────────── */

.rtc-events {
  margin: 0.5rem 0 1.25rem;
}

/* Label on the left, "Select all" text link on the right. */
/* Label on the left, "Select all" text link on the right. */
.rtc-events-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}
.rtc-events-head .rtc-legend {
  margin-bottom: 0;
}

.rtc-select-all {
  flex-shrink: 0;
  white-space: nowrap;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  backdrop-filter: none;
  font-family: "Montserrat", sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--accent-color);
}
.rtc-select-all:hover {
  color: #fff;
}

/* Equal-width tiles in a fixed grid so the options line up. */
.rtc-cities {
  display: grid;
  /* minmax(0, ...) lets a column shrink below its text width instead of
     pushing "San Francisco" past the edge on narrow phones. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (min-width: 520px) {
  .rtc-cities { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Each city is a real checkbox, visually hidden but still used by
   keyboard and screen readers; the span next to it shows the state. */
.rtc-city {
  position: relative;
  cursor: pointer;
}
.rtc-city input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.rtc-city span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: 1.05rem;
  background: rgba(255, 255, 255, 0.07);
  font-family: "Montserrat", sans-serif;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  transition: background-color 0.2s, box-shadow 0.2s, color 0.2s;
  user-select: none;
}
/* Checkbox square, filled with the accent and a tick when checked. */
.rtc-city span::before {
  content: "";
  flex-shrink: 0;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 0.3rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  background: transparent center / 0.65rem no-repeat;
  transition: background-color 0.2s, box-shadow 0.2s;
}
.rtc-city:hover span {
  background: rgba(255, 255, 255, 0.1);
}
.rtc-city input:checked + span {
  background: color-mix(in srgb, var(--accent-color) 16%, transparent);
  box-shadow: inset 0 0 0 1px var(--accent-color);
  color: #fff;
}
.rtc-city input:checked + span::before {
  box-shadow: none;
  background-color: var(--accent-color);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.rtc-city input:focus-visible + span {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* ── Submit + messages ──────────────────────────────────────────── */

.rtc-submit {
  width: 100%;
  margin-top: 0.5rem;
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #000;
  backdrop-filter: none;
}
.rtc-submit:hover {
  /* Global .btn:hover would make the label accent-on-accent. */
  color: #000;
  border-color: var(--accent-color);
  filter: brightness(1.1);
}
.rtc-submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

.rtc-form-error {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  text-align: center;
  color: #ff5c7a;
}
.rtc-form-error:empty {
  display: none;
}

/* Off-screen trap field for bots (see the Apps Script). */
.rtc-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.rtc-success {
  padding: 1rem 0 0.5rem;
  text-align: center;
}
.rtc-success p {
  margin: 0 0 1.5rem;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.75);
}
