/* RTN survey. Branding lives in the tokens below (they match the main site). */
:root {
  --red: #c8102e;
  --red-dark: #a00d25;
  --red-soft: #fbeaed;
  --ink: #14171c;
  --ink-2: #3a3f47;
  --muted: #5f656f;
  --paper: #ffffff;
  --tint: #f5f3ef;
  --line: rgba(20, 23, 28, 0.12);
  --field-border: #8a8f98;
  --error: #9b0b24;
  --error-bg: #fdecef;
  --head: "Fraunces", Georgia, "Times New Roman", serif; /* same heading font as the main site */
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --card-w: 800px;
  --screen-w: 560px;
  --gutter: 16px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-2);
  background: var(--tint);
}

a {
  color: var(--red);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--red-dark);
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* Headings receive focus programmatically between screens; they are not controls. */
[tabindex="-1"]:focus {
  outline: none;
}

/* ---- Full-screen background (same misty valley as the main site's hero) ---- */

/* A fixed pseudo-element rather than background-attachment: fixed, which iOS ignores. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: #dfe3e2 url("img/bg-fog.webp") center 62% / cover no-repeat;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(236, 238, 239, 0.45) 0%, rgba(236, 238, 239, 0.1) 50%, rgba(15, 16, 17, 0.12) 100%);
}

/* Drifting fog over the background, as on the main site's hero: two seamless fog
 * tiles slide sideways, masked by a brightness map of the photo so fog only shows
 * where the photo is already misty. Sits above body::before, below body::after. */
.bg-mist {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask: url("img/bg-mist-mask-v2.webp") center 62% / cover no-repeat;
  mask: url("img/bg-mist-mask-v2.webp") center 62% / cover no-repeat;
}

.mist {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4800px;
  background-repeat: repeat-x;
  background-size: 1600px 100%;
  will-change: transform;
  /* Fade in and out at the top and bottom so the layer's edges never show as a line. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%);
}

.mist-a {
  background-image: url("img/fog-a-v2.webp");
  opacity: 1;
  animation: mist-drift 9s linear infinite;
}

.mist-b {
  top: 12%;
  background-image: url("img/fog-b-v2.webp");
  opacity: 0.8;
  animation: mist-drift 14s linear infinite reverse;
}

@keyframes mist-drift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-1600px, 0, 0);
  }
}

/* ---- Stage: the card is centred on the screen ---- */

.stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px var(--gutter);
}

/* Logo + card are centred as a group: auto margins above the logo and below the
 * card share the free space, and collapse to 0 (normal scrolling, nothing
 * clipped) when the card is taller than the screen. */
.stage-logo {
  flex: none;
  margin: auto 0 24px;
}

.stage-logo img {
  display: block;
  width: min(300px, 78vw);
  height: auto;
}

/* Round button, top right: back to the main website (frosted glass like the card). */
.site-exit {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 4px 18px rgba(15, 16, 17, 0.1);
  color: #0f1011;
  transition: background-color 0.2s;
}

.site-exit:hover {
  background: rgba(255, 255, 255, 0.9);
}

.site-exit svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* Phones: smaller button, and keep the logo clear of it. */
@media (max-width: 480px) {
  .site-exit {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }

  .stage-logo img {
    width: min(300px, calc(100vw - 120px));
  }
}

.stage > .card {
  margin: 0 0 auto;
}

/* Liquid glass card, matching the contact card on the main site. */
.card {
  position: relative;
  width: 100%;
  max-width: var(--card-w);
  padding: 28px 20px 24px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  -webkit-backdrop-filter: blur(26px) saturate(1.35);
  backdrop-filter: blur(26px) saturate(1.35);
  box-shadow: 0 24px 60px rgba(15, 16, 17, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

/* Without backdrop-filter the card needs to be near-opaque to stay readable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card {
    background: rgba(255, 255, 255, 0.94);
  }
}

@media (min-width: 640px) {
  .card {
    padding: 36px 48px 32px;
  }
}

.notice {
  color: var(--ink-2);
  text-align: center;
}

/* ---- Typography ---- */

h1 {
  margin: 0 0 16px;
  font-family: var(--head);
  font-size: 1.625rem;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

@media (min-width: 640px) {
  h1 {
    font-size: 2rem;
  }
}

p {
  margin: 0 0 16px;
}

.eyebrow {
  display: block;
  margin-bottom: 10px;
  font-family: var(--body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
}

.card--intro {
  text-align: center;
}

.card--intro .intro {
  max-width: 540px;
  margin: 0 auto 8px;
  text-align: left;
}

/* The second intro paragraph (contact details, early access) matches the fine print below it. */
.card--intro .intro p + p {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Intro: one-line promise, then the first question right away. */
.intro-lede {
  max-width: 540px;
  margin: 0 auto 28px;
  font-size: 1.0625rem;
  color: var(--ink-2);
}

.intro-question {
  max-width: 540px;
  margin: 0 auto;
  text-align: left;
}

.intro-question .question {
  margin-bottom: 20px;
}

#rtn-intro #rtn-start {
  margin: 0 auto 24px;
}

.card--intro .intro {
  margin-top: 8px;
}

.card--intro .intro p {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Thank-you screen */
.thanks-text {
  max-width: 540px;
  margin: 0 auto 28px;
}

.thanks-q {
  margin: 0 0 14px;
  font-weight: 600;
  color: var(--ink);
}

.thanks-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

a.btn {
  text-decoration: none;
}

/* Appointment page: the booking widget sits in the same glass card. */
.card--calendly {
  padding: 12px;
  overflow: hidden;
}

.card--calendly .calendly-inline-widget {
  border-radius: 12px;
  overflow: hidden;
}

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

.fineprint {
  max-width: 540px;
  margin: 0 auto 24px;
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: left;
}

.page-text {
  max-width: var(--screen-w);
  margin: 0 auto 20px;
  color: var(--muted);
  text-align: center;
}

/* ---- Card header: section title + progress ---- */

.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.section-title {
  margin: 0;
  font-family: var(--body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
}

.progress {
  margin: 0;
  flex: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

/* ---- Screen ---- */

.screen {
  max-width: var(--screen-w);
  margin: 0 auto;
}

.screen.is-entering {
  animation: rise 0.28s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen.is-entering,
  .mist {
    animation: none;
  }
  * {
    transition: none !important;
  }
}

.question {
  min-width: 0;
  margin: 0 0 28px;
  padding: 0;
  border: 0;
}

.question:last-of-type {
  margin-bottom: 8px;
}

.question legend {
  width: 100%;
  padding: 0;
  margin-bottom: 14px;
  font-family: var(--head);
  font-size: 1.1875rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
}

.question legend label {
  display: block;
}

.screen--single .question legend,
.screen--single .description {
  text-align: center;
}

.screen--single .question legend {
  font-size: 1.375rem;
}

@media (min-width: 640px) {
  .screen--single .question legend {
    font-size: 1.5rem;
  }
}

.optional {
  font-family: var(--body);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
}

.description {
  margin: -6px 0 14px;
  font-size: 0.9375rem;
  color: var(--muted);
}

.error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0 0 12px;
  padding: 8px 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--error);
  background: var(--error-bg);
  border-radius: 10px;
}

.error::before {
  content: "!";
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  font-size: 0.8125rem;
  line-height: 20px;
  text-align: center;
  color: #fff;
  background: var(--error);
  border-radius: 50%;
}

/* ---- Answer tiles ---- */

.options {
  display: grid;
  gap: 8px;
  font-size: 0.9375rem;
  line-height: 1.4;
}

/* Short answers sit two across so grouped screens stay on one screen. */
@media (min-width: 640px) {
  .screen--wide {
    max-width: 700px;
  }

  .options--grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .options--grid .other-input,
  .options--grid .max-note {
    grid-column: 1 / -1;
  }
}

.option {
  position: relative;
}

.option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.option label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 7px 14px 7px 8px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(20, 23, 28, 0.05);
  cursor: pointer;
  overflow-wrap: anywhere;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s, transform 0.15s;
}

.option .badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 50%;
}

.option .badge::before {
  content: attr(data-letter);
}

.option:hover input:not(:disabled) + label {
  border-color: var(--red);
}

.option input:focus-visible + label {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.option input:checked + label {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.option input:checked + label .badge {
  color: var(--red);
  background: #fff;
}

/* Multi-select shows a tick so it reads differently from single choice. */
.option input[type="checkbox"]:checked + label .badge::before {
  content: "✓";
}

.option input:disabled + label {
  color: var(--muted);
  background: var(--tint);
  box-shadow: none;
  cursor: not-allowed;
}

.option input:disabled + label .badge {
  color: var(--muted);
  background: var(--line);
}

/* Chips: compact pills that wrap, for longer multi-select lists (focus areas, customers, who weighs in). */
.options--chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.options--chips .option label {
  min-height: 44px;
  padding: 8px 16px 8px 10px;
  gap: 8px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.options--chips .option .badge {
  width: 22px;
  height: 22px;
  font-size: 0.75rem;
}

.options--chips .option .badge::before {
  content: "+";
}

.options--chips .other-input,
.options--chips .max-note {
  flex-basis: 100%;
}

.question.has-error .option label {
  border-color: #e7b3bc;
}

/* ---- Text fields ---- */

.text-input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(20, 23, 28, 0.05);
}

.text-input:hover:not(:disabled) {
  border-color: var(--field-border);
}

.text-input:focus-visible {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

/* Dropdown (state, role): same field look with a chevron. */
.select-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  cursor: pointer;
  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.5l5 5 5-5' fill='none' stroke='%2314171c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.has-error .select-input[aria-invalid="true"] {
  border-color: var(--error);
}

textarea.text-input {
  min-height: 10rem;
  resize: vertical;
}

.has-error .text-input[aria-invalid="true"] {
  border-color: var(--error);
}

.other-input {
  margin-top: 4px;
}

.other-input:disabled {
  background: var(--tint);
  border-color: var(--line);
}

.max-note {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.max-note:empty {
  display: none;
}

/* Honeypot: off-screen, not display:none, so naive bots still fill it. */
.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Card footer: dots + navigation ---- */

.card-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.dots {
  order: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dots li {
  width: 10px;
  height: 10px;
  background: var(--line);
  border-radius: 50%;
  transition: background-color 0.2s, transform 0.2s;
}

.dots li.is-done {
  background: var(--red);
  opacity: 0.45;
}

.dots li.is-current {
  background: var(--red);
  transform: scale(1.5);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.nav {
  order: 1;
  display: flex;
  width: 100%;
  gap: 12px;
}

.nav #rtn-next {
  margin-left: auto;
}

/* Phones: Back/Next stay in reach at the bottom of the screen on long screens. */
@media (max-width: 639px) {
  .card-bottom {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-left: -20px;
    margin-right: -20px;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    background: rgba(250, 251, 251, 0.92);
    border-radius: 0 0 22px 22px;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  .dots {
    display: none;
  }
}

@media (min-width: 640px) {
  .card-bottom {
    flex-direction: row;
    justify-content: space-between;
    gap: 16px;
  }

  /* back | dots | next on one line */
  .nav {
    display: contents;
  }

  .nav #rtn-back {
    order: 1;
  }

  .dots {
    order: 2;
    flex: 1;
  }

  .nav #rtn-next {
    order: 3;
    margin-left: 0;
  }
}

.form-status {
  margin-top: 16px;
  font-weight: 600;
  color: var(--error);
  text-align: center;
}

.form-status:empty {
  display: none;
}

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

/* Same as the main site's buttons: dark primary, white secondary, 10px corners. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  min-width: 48px;
  padding: 10px 24px;
  font: 500 0.9rem/1.2 var(--body);
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
  color: #fff;
  background: #0f1011;
}

.btn-primary:hover:not(:disabled) {
  color: #fff; /* keep the text white: link buttons would otherwise pick up the red a:hover colour */
  background: #2b2d30;
}

.btn-secondary {
  color: #0f1011;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.btn-secondary:hover:not(:disabled) {
  color: #0f1011;
  background: #f4f5f6;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#rtn-back[hidden] {
  display: block !important;
  visibility: hidden;
}
