/*
 * Viasat in-flight survey page (/survey/)
 * Same look as the landing page: the background image, white logo, white text and one white button.
 * Three pages (or one, with data-layout="single"), top-aligned. No animations.
 * Question types: 1–5 scales with end labels, a multi-select (Q5), attribute rating rows (Q6), form fields and selects.
 */

/* ---------- Tokens (match landing.css) ---------- */
:root {
  --bg: #173d55;
  --scrim: rgba(6, 28, 48, 0.3);
  --white: #ffffff;
  --text-soft: rgba(255, 255, 255, 0.85);
  --text-faint: rgba(255, 255, 255, 0.7);
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.16);
  --glass-line: rgba(255, 255, 255, 0.3);
  --button-text: #0d3047;
  --button-hover: #e4f2f3;
  --error: #ffd27a;

  --font: "Ubuntu Sans", "Ubuntu", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --vh: 1vh;
  color-scheme: dark; /* native date pickers and suggestion lists follow the dark page */
}
@supports (height: 1svh) {
  :root { --vh: 1svh; }
}

/* ---------- Base ---------- */
html {
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: inherit; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: calc(100 * var(--vh));
  background-color: var(--bg);
  background-image: linear-gradient(var(--scrim), var(--scrim)), url("../assets/background.jpg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  color: var(--white);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.nowrap { white-space: nowrap; }

/* ---------- Layout: logo, then the survey column, legal links at the bottom ---------- */
.page-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  min-height: calc(100 * var(--vh));
  padding: clamp(20px, calc(4 * var(--vh)), 48px) clamp(24px, 8vw, 64px) clamp(20px, calc(4 * var(--vh)), 40px);
}

.logo-link {
  display: block;
  border-radius: 6px;
}
.logo-link:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 6px;
}
.logo {
  display: block;
  width: auto;
  height: clamp(28px, calc(4.5 * var(--vh)), 36px);
}

.survey,
.thanks {
  width: 100%;
  max-width: 28rem;
  padding-top: clamp(20px, calc(4 * var(--vh)), 48px);
}

/* Page titles and the questions on a page */
.page-title {
  margin: 0;
  font-size: clamp(24px, calc(0.6vw + 20px), 30px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.page-title:focus { outline: none; }
.page-intro {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--text-faint);
}
.survey-page {
  display: grid;
  gap: clamp(26px, calc(5 * var(--vh)), 40px);
}
.survey-page + .survey-page { margin-top: clamp(40px, calc(7 * var(--vh)), 64px); } /* one-page layout */
.q { min-width: 0; }
.q-text {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  text-wrap: balance;
}
.q-text .optional { font-size: 15px; }
.q-note {
  margin: -6px 0 12px;
  font-size: 13px;
  color: var(--text-faint);
}
.scale-ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 22rem;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-faint);
}
.scale-ends + .q-note { margin-top: 4px; }
.scale-readout {
  min-height: 1.3em;
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--white);
}
.scale-readout:empty { display: none; }
.q-error {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--error);
}
.q-error:empty { display: none; }
.q.is-invalid .scale-btn,
.q.is-invalid .option { border-color: var(--error); }
.q.is-invalid .option-na,
.q.is-invalid .scale-na { border-color: transparent; }

/* ---------- Progress ---------- */
.progress {
  margin-bottom: clamp(16px, calc(3 * var(--vh)), 28px);
}
.progress-label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.progress-track {
  height: 4px;
  border-radius: 999px;
  background: var(--glass-line);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--white);
}

/* ---------- Questions ---------- */
.step {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.question {
  padding: 0;
  margin-bottom: clamp(16px, calc(3 * var(--vh)), 26px);
  font-size: clamp(21px, calc(0.6vw + 18px), 26px);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.question:focus { outline: none; }
.question .eyebrow,
.q-text .eyebrow {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.hint {
  margin: -8px 0 18px;
  font-size: 15px;
  color: var(--text-faint);
}
.hint + .options,
.hint + .fields { margin-top: 0; }

/* Answer pills */
.options {
  position: relative; /* keeps the visually hidden radios inside the group */
  display: grid;
  gap: 8px;
}
.options-row {
  grid-template-columns: 1fr 1fr;
  max-width: 18rem;
}
.options-row .option { justify-content: center; }
.options-row .option::after { display: none; }
.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 8px 16px 8px 18px;
  border: 1.5px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.option::after {
  /* check mark, drawn only when the option is selected */
  content: "";
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
}
.option-na {
  min-height: 40px;
  margin-top: 2px;
  border-color: transparent;
  background: transparent;
  color: var(--text-faint);
  font-weight: 400;
  justify-content: center;
}
.option-na::after { display: none; }

@media (hover: hover) {
  .option:hover { background: var(--glass-strong); }
  .option-na:hover { background: var(--glass); color: var(--white); }
}
input:checked + .option {
  border-color: var(--white);
  background: var(--white);
  color: var(--button-text);
}
input:checked + .option::after {
  background: var(--button-text) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 13px no-repeat;
}
input:checked + .option-na {
  border-color: var(--white);
  background: var(--white);
  color: var(--button-text);
  font-weight: 500;
}
input:focus-visible + .option {
  outline: 3px solid var(--white);
  outline-offset: 3px;
}

/* Attribute ratings (Q6): one row per attribute, 1–5 and N/A */
.scale-legend {
  margin: -4px 0 14px;
  font-size: 13px;
  color: var(--text-faint);
}
.attrs {
  display: grid;
  gap: 14px;
}
.attr-label {
  margin: 0 0 7px;
  font-size: 15px;
  font-weight: 500;
}
.scale {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  max-width: 22rem;
}
.scale-btn {
  display: grid;
  place-items: center;
  height: 42px;
  border: 1.5px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.scale-na {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  border-color: transparent;
}
@media (hover: hover) {
  .scale-btn:hover { background: var(--glass-strong); }
}
input:checked + .scale-btn {
  border-color: var(--white);
  background: var(--white);
  color: var(--button-text);
}
input:focus-visible + .scale-btn {
  outline: 3px solid var(--white);
  outline-offset: 2px;
}
.field-open { margin-top: 18px; }
.block { padding-top: 4px; }

/* ---------- Flight details ---------- */
.fields {
  display: grid;
  gap: 14px;
}
.q .fields { margin-top: 4px; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field { min-width: 0; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
}
.optional {
  font-weight: 400;
  color: var(--text-faint);
}
.field input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1.5px solid var(--glass-line);
  border-radius: 14px;
  background: var(--glass);
  color: var(--white);
  font: inherit;
  font-size: 16px; /* 16px or larger keeps iOS from zooming the page when a field is focused */
}
.field input::placeholder { color: rgba(255, 255, 255, 0.45); }
#flight-number,
#origin,
#destination { text-transform: uppercase; } /* display only; the value is sent as typed, upper-cased by survey.js */
#flight-number::placeholder,
#origin::placeholder,
#destination::placeholder { text-transform: none; }
.field input:focus {
  outline: none;
  border-color: var(--white);
  background: var(--glass-strong);
}
.field input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}
.field input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.8;
  cursor: pointer;
}
.field textarea,
.field select {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--glass-line);
  border-radius: 14px;
  background: var(--glass);
  color: var(--white);
  font: inherit;
  font-size: 16px;
}
.field textarea {
  min-height: 84px;
  resize: vertical;
}
.field textarea::placeholder { color: rgba(255, 255, 255, 0.45); }
.field select {
  height: 48px;
  padding: 0 44px 0 16px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  cursor: pointer;
}
.field select option { color: #0d3047; background: #ffffff; }
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--white);
  background-color: var(--glass-strong);
}
.field.is-invalid input { border-color: var(--error); }

/* Email updates */
.consent {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px 12px;
  align-items: start;
}
.consent input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--white);
  cursor: pointer;
}
.consent input:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}
.consent label {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text-soft);
  cursor: pointer;
}
.consent label a {
  color: var(--white);
  text-decoration: underline;
}
.consent .field-error { grid-column: 1 / -1; }
.contact-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-faint);
}
.field-error,
.form-error {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--error);
}
.field-error:empty,
.form-error:empty { display: none; }
.form-error {
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(255, 210, 122, 0.6);
  border-radius: 12px;
  background: rgba(6, 28, 48, 0.75);
  color: var(--white);
  text-align: center;
}

/* ---------- Buttons ---------- */
.actions {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin-top: clamp(20px, calc(4 * var(--vh)), 36px);
}
.cta {
  display: inline-flex;
  vertical-align: top;
  align-items: center;
  justify-content: center;
  min-width: 11rem;
  height: 52px;
  padding: 0 40px;
  border: 0;
  border-radius: 999px;
  background: var(--white);
  color: var(--button-text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(4, 22, 40, 0.25);
}
.cta:hover:not(:disabled) { background: var(--button-hover); }
.cta:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.cta[aria-busy="true"]:disabled {
  opacity: 0.75;
  cursor: progress;
}
.cta:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 4px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px 6px 6px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-faint);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.back svg {
  width: 18px;
  height: 18px;
}
.back:hover { color: var(--white); }
.back:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

/* ---------- Thank-you ---------- */
.thanks {
  text-align: center;
  padding-top: clamp(40px, calc(12 * var(--vh)), 120px);
}
.thanks h1 {
  margin: 0;
  font-size: clamp(28px, calc(1.2vw + 20px), 40px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.thanks h1:focus { outline: none; }
.thanks-note {
  margin: 12px 0 0;
  font-size: 17px;
  color: var(--text-soft);
}

/* ---------- Legal links ---------- */
.legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  margin-top: clamp(32px, calc(6 * var(--vh)), 56px);
  font-size: 13px;
}
.legal a,
.legal button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-faint);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.legal a:hover,
.legal button:hover {
  color: var(--white);
  text-decoration: underline;
}
.legal a:focus-visible,
.legal button:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 3px;
  border-radius: 3px;
}
