/* Fuel Up Without the Wait — survey styles (mobile first, no build step) */

:root {
  --amber: #F59E0B;
  --amber-light: #FBBF24;
  --ink: #1F1F1F;
  --page: #1F2933;
  --shift: 28px; /* how far screens slide when they change */
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh; /* follows mobile browser bars, so nothing is cut off */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--page);
  color: #fff;
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Background photos ---------- */

.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--page); }

.bg__layer {
  position: absolute;
  inset: 0;
  display: none;           /* not rendered = not downloaded */
  opacity: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 0.6s ease;
}
.bg__layer.is-loaded { display: block; }                 /* current, previous and next screen */
.bg__layer.is-under  { opacity: 1; z-index: 1; transition: none; }
.bg__layer.is-active { opacity: 1; z-index: 2; }

/* Dark overlay (58–65% black) keeps white text above WCAG AA contrast on any photo. */
.bg__shade {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.62) 55%, rgba(0, 0, 0, 0.65) 100%);
}

/*
 * One block per screen: 900 px portrait crop for phones, 1920 px for wider screens,
 * WebP first with JPEG as the fallback. To force browsers to re-download a swapped
 * photo, add or bump a version on its URLs, e.g. q1-900.webp?v=2.
 */
.bg--welcome { background-image: url("../img/welcome-900.jpg"); background-image: image-set(url("../img/welcome-900.webp") type("image/webp"), url("../img/welcome-900.jpg") type("image/jpeg")); }
.bg--q1      { background-image: url("../img/q1-900.jpg");      background-image: image-set(url("../img/q1-900.webp") type("image/webp"), url("../img/q1-900.jpg") type("image/jpeg")); }
.bg--q2      { background-image: url("../img/q2-900.jpg");      background-image: image-set(url("../img/q2-900.webp") type("image/webp"), url("../img/q2-900.jpg") type("image/jpeg")); }
.bg--q3      { background-image: url("../img/q3-900.jpg");      background-image: image-set(url("../img/q3-900.webp") type("image/webp"), url("../img/q3-900.jpg") type("image/jpeg")); }
.bg--q4      { background-image: url("../img/q4-900.jpg");      background-image: image-set(url("../img/q4-900.webp") type("image/webp"), url("../img/q4-900.jpg") type("image/jpeg")); }
.bg--q5      { background-image: url("../img/q5-900.jpg");      background-image: image-set(url("../img/q5-900.webp") type("image/webp"), url("../img/q5-900.jpg") type("image/jpeg")); }
.bg--thanks  { background-image: url("../img/thanks-900.jpg");  background-image: image-set(url("../img/thanks-900.webp") type("image/webp"), url("../img/thanks-900.jpg") type("image/jpeg")); }

@media (min-width: 768px) {
  .bg--welcome { background-image: url("../img/welcome-1920.jpg"); background-image: image-set(url("../img/welcome-1920.webp") type("image/webp"), url("../img/welcome-1920.jpg") type("image/jpeg")); }
  .bg--q1      { background-image: url("../img/q1-1920.jpg");      background-image: image-set(url("../img/q1-1920.webp") type("image/webp"), url("../img/q1-1920.jpg") type("image/jpeg")); }
  .bg--q2      { background-image: url("../img/q2-1920.jpg");      background-image: image-set(url("../img/q2-1920.webp") type("image/webp"), url("../img/q2-1920.jpg") type("image/jpeg")); }
  .bg--q3      { background-image: url("../img/q3-1920.jpg");      background-image: image-set(url("../img/q3-1920.webp") type("image/webp"), url("../img/q3-1920.jpg") type("image/jpeg")); }
  .bg--q4      { background-image: url("../img/q4-1920.jpg");      background-image: image-set(url("../img/q4-1920.webp") type("image/webp"), url("../img/q4-1920.jpg") type("image/jpeg")); }
  .bg--q5      { background-image: url("../img/q5-1920.jpg");      background-image: image-set(url("../img/q5-1920.webp") type("image/webp"), url("../img/q5-1920.jpg") type("image/jpeg")); }
  .bg--thanks  { background-image: url("../img/thanks-1920.jpg");  background-image: image-set(url("../img/thanks-1920.webp") type("image/webp"), url("../img/thanks-1920.jpg") type("image/jpeg")); }
}

/* ---------- Progress bar ---------- */

.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 5;
  height: 4px;
  background: rgba(255, 255, 255, 0.22);
}
.progress__fill {
  width: 0;
  height: 100%;
  background: var(--amber-light);
  border-radius: 0 2px 2px 0;
  transition: width 0.4s ease;
}

/* ---------- Screens ---------- */

.stage { position: relative; z-index: 1; flex: 1 1 auto; min-height: 0; }

.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
  padding-bottom: 12px;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
}
.screen.is-active,
.screen.is-leaving { display: flex; }
.screen.is-active  { animation: screen-in 0.42s cubic-bezier(0.22, 0.61, 0.36, 1) 0.16s both; }
.screen.is-leaving { animation: screen-out 0.26s ease both; pointer-events: none; }
.stage.is-back { --shift: -28px; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(var(--shift)); }
  to   { opacity: 1; transform: none; }
}
@keyframes screen-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(calc(var(--shift) * -1)); }
}

/* Left-aligned, vertically centred; `margin: auto 0` keeps tall content scrollable. */
.screen__inner { width: 100%; max-width: 680px; margin: auto 0; }

.title,
.question { margin: 0; font-weight: 700; text-wrap: balance; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 0 28px rgba(0, 0, 0, 0.45); }
.title:focus,
.question:focus { outline: none; }

.title    { font-size: clamp(2rem, 1.25rem + 3.6vw, 3.75rem); line-height: 1.1; letter-spacing: -0.01em; }
.question { font-size: clamp(1.25rem, 0.95rem + 1.7vw, 2.125rem); line-height: 1.28; }

.lead {
  margin: 0.9em 0 0;
  font-size: clamp(1.0625rem, 0.95rem + 0.55vw, 1.375rem);
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--amber-light);
}

.note { margin: 1.5rem 0 0; font-size: 0.875rem; color: rgba(255, 255, 255, 0.86); }

/* ---------- Buttons ---------- */

.btn,
.answer {
  font-family: inherit;
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.2;
  color: var(--ink);
  background: var(--amber);
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.btn:focus-visible,
.answer:focus-visible { background: var(--amber-light); outline: 3px solid #fff; outline-offset: 3px; }
.btn:active,
.answer:active { transform: scale(0.985); }
@media (hover: hover) {
  .btn:hover,
  .answer:hover { background: var(--amber-light); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  min-width: 152px;
  padding: 0 32px;
  border-radius: 999px;
}

.start-row { display: flex; align-items: center; gap: 16px; margin-top: 1.75rem; }

.key-hint { display: none; font-size: 0.8125rem; color: rgba(255, 255, 255, 0.8); }
@media (hover: hover) and (pointer: fine) { .key-hint { display: inline; } }

.answers { display: flex; flex-direction: column; gap: 12px; margin-top: 1.5rem; }

.answer {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 10px 18px;
  border-radius: 16px;
  text-align: left;
}
.answer__key {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid rgba(31, 31, 31, 0.6);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.3);
  font-size: 0.8125rem;
  font-weight: 700;
}
.answer.is-selected { background: var(--amber-light); box-shadow: 0 0 0 3px #fff; }
.answer.is-selected::after { content: "\2713"; margin-left: auto; font-weight: 700; }

.status { margin: 14px 0 0; min-height: 1.5em; font-size: 0.9375rem; font-weight: 600; }
.status:empty { display: none; }
.retry { display: flex; margin-top: 12px; }  /* its own row */

/* ---------- Optional sign-up on the thank-you screen ---------- */

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.signup { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid rgba(255, 255, 255, 0.28); }
.signup__title { margin: 0; font-size: 1.125rem; font-weight: 600; color: var(--amber-light); }
.signup__text { margin: 0.3rem 0 0; font-size: 0.9375rem; color: rgba(255, 255, 255, 0.94); }
.signup__row { display: flex; flex-direction: column; gap: 10px; margin-top: 0.85rem; }
.signup__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 52px;
  padding: 0 18px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font: inherit;
  font-size: 1rem;   /* 16px: smaller text makes iOS zoom the page on focus */
}
.signup__input::placeholder { color: rgba(255, 255, 255, 0.7); }
.signup__input:focus { outline: 3px solid var(--amber-light); outline-offset: 1px; border-color: transparent; }
.signup__btn { min-height: 52px; min-width: 0; padding: 0 26px; font-size: 1rem; }
.signup__btn[disabled] { opacity: 0.7; cursor: progress; }
.signup__hint { margin: 0.6rem 0 0; font-size: 0.8125rem; color: rgba(255, 255, 255, 0.8); }
.signup .status { margin-top: 0.4rem; }
.signup__done { margin: 1.5rem 0 0; padding-top: 1.25rem; border-top: 1px solid rgba(255, 255, 255, 0.28); font-size: 1.0625rem; font-weight: 600; color: var(--amber-light); }
.signup__done:focus { outline: none; }

.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 12px 0 0;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.88);
  font: inherit;
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.back:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }
@media (hover: hover) { .back:hover { color: #fff; } }

/* ---------- Footer: its own row at the bottom, so it can never sit on top of the buttons ---------- */

.footer {
  position: relative;
  z-index: 1;
  flex: none;
  padding: 6px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}
.footer a { color: rgba(255, 255, 255, 0.75); text-decoration: none; }
.footer a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 3px; }
@media (hover: hover) { .footer a:hover { color: #fff; text-decoration: underline; } }

/* ---------- Honeypot and noscript ---------- */

.trap { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.noscript {
  position: fixed;
  left: 16px; right: 16px; bottom: 56px;
  z-index: 10;
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--amber);
  color: var(--ink);
  font-weight: 600;
  text-align: center;
}

/* ---------- Larger screens ---------- */

@media (min-width: 600px) {
  /* Text sits on the left on wide screens, so that side gets the darker end of the overlay. */
  .bg__shade { background: linear-gradient(90deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.62) 45%, rgba(0, 0, 0, 0.56) 100%); }
  .screen { padding-left: clamp(40px, 9vw, 168px); padding-right: 40px; }
  .answers { flex-direction: row; gap: 16px; }
  .signup__row { flex-direction: row; max-width: 520px; }
  .answer { flex: 1 1 0; max-width: 240px; min-height: 64px; }
  .question { line-height: 1.25; }
}

/* ---------- Short screens (small phones, landscape) ---------- */

@media (max-height: 700px) {
  .screen { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  .title { font-size: clamp(1.75rem, 1.1rem + 3vw, 2.75rem); }
  .question { font-size: clamp(1.1875rem, 0.95rem + 1.2vw, 1.625rem); }
  .answers { margin-top: 1.1rem; }
  .eyebrow { margin-bottom: 0.4rem; }
  .back { margin-top: 2px; }
  #screen-thanks .lead { margin-top: 0.6em; font-size: 0.9375rem; }
  .signup { margin-top: 0.9rem; padding-top: 0.8rem; }
  .signup__text { font-size: 0.875rem; }
  .signup__row { gap: 8px; margin-top: 0.6rem; }
  .signup__input, .signup__btn { min-height: 46px; }
  .signup__hint { margin-top: 0.4rem; font-size: 0.75rem; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .screen.is-active { animation: none; }
  .screen.is-leaving { display: none; }
  .bg__layer,
  .progress__fill,
  .btn,
  .answer { transition: none; }
}
