/* ==========================================================================
   Guest Experience Questionnaire — app styles
   Mirrors the "Guest Questionnaire" design-canvas component.
   ========================================================================== */

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

body {
  margin: 0;
  background: var(--cream-100);
  color: var(--ink-900);
  font: var(--text-body-style);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--text-title);
  letter-spacing: var(--tracking-title);
  line-height: var(--leading-title);
}

p { margin: 0; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--cream-100);
}

/* The form carries the panels and the action bar, so it has to stretch and
   stack like .app does — otherwise flex:1 on a panel has nothing to fill. */
#form {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* --------------------------------------------------------------- masthead */

.masthead {
  background: var(--forest-800);
  color: var(--cream-100);
  padding: var(--space-4) 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
}

.masthead__logo {
  height: 44px;
  width: auto;
  flex: none;
}

/* Text wordmark, shown only when the logo file is missing. */
.masthead__wordmark {
  flex: none;
  display: none;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 14px;
  border: 2px solid rgba(248, 246, 225, .55);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  font-size: 15px;
  letter-spacing: 0.12em;
}

.masthead__logo.is-missing { display: none; }
.masthead__logo.is-missing ~ .masthead__wordmark { display: flex; }

.masthead__titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 200px;
  min-width: 0;
}

.masthead__title {
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.masthead__tagline {
  font-family: var(--font-text);
  font-size: 14px;
  color: rgba(248, 246, 225, .72);
}

.masthead__step {
  flex: none;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--size-caption);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: var(--space-2) 14px;
  border-radius: var(--radius-pill);
  background: rgba(248, 246, 225, .14);
}

/* ------------------------------------------------------------------ pills */

.steps {
  display: flex;
  gap: var(--space-3);
  padding: 14px 20px 0;
  flex-wrap: wrap;
  background: var(--cream-100);
}

.pill {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  min-height: var(--tap-min);
  padding: 0 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 14px;
  letter-spacing: 0.04em;
  background: transparent;
  color: var(--forest-700);
  border: var(--border-width-hair) solid var(--sand-300);
  transition: background var(--transition-fast), color var(--transition-fast),
              border-color var(--transition-fast);
}

.pill:hover { border-color: var(--will-400); }

.pill[aria-selected="true"],
.pill[aria-pressed="true"] {
  background: var(--will-700);
  color: var(--cream-100);
  border-color: var(--will-700);
}

/* ------------------------------------------------------------------ sheet */

.sheet {
  flex: 1;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 20px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.sheet[hidden] { display: none; }

.intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.intro h1 {
  font-weight: var(--weight-black);
  font-size: 28px;
  text-transform: uppercase;
}

.intro p {
  max-width: 56ch;
  font-size: var(--size-body);
  line-height: var(--leading-body);
  color: var(--ink-700);
}

/* --------------------------------------------------------------- sections */

.section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section__title {
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  font-size: 14px;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--will-700);
}

.section__rule {
  flex: 1;
  height: 1px;
  background: var(--sand-300);
}

.grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* Flex bases matching the canvas layout. */
.col-260 { flex: 1 1 260px; min-width: 0; }
.col-240 { flex: 1 1 240px; min-width: 0; }
.col-200 { flex: 1 1 200px; min-width: 0; }
.col-320 { flex: 1 1 320px; min-width: 0; }
.col-full { flex: 1 1 100%; min-width: 0; }

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
}

.field__label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest-700);
}

.field__req {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 14px;
  color: var(--wont-600);
}

.field__hint {
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-500);
}

.field__error {
  font-family: var(--font-text);
  font-weight: var(--weight-semibold);
  font-size: 14px;
  line-height: 1.4;
  color: var(--wont-700);
}

.field__error[hidden] { display: none; }

.field input,
.field textarea,
.field select {
  width: 100%;
  border-radius: var(--radius-md);
  border: var(--border-width-hair) solid var(--sand-300);
  background: var(--paper-white);
  font-family: var(--font-text);
  font-size: var(--size-body);
  color: var(--ink-900);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.field input,
.field select {
  height: 50px;
  padding: 0 14px;
}

.field select { padding: 0 12px; }

.field textarea {
  padding: 13px 14px;
  line-height: var(--leading-body);
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--will-600);
  box-shadow: 0 0 0 2px var(--will-600);
}

.field input::placeholder,
.field textarea::placeholder { color: var(--ink-300); }

/* Only flags a field the guest has actually failed to fill. */
.field.is-invalid input,
.field.is-invalid textarea,
.field.is-invalid select {
  border-color: var(--wont-600);
  box-shadow: 0 0 0 2px rgba(205, 31, 40, .18);
}

/* ------------------------------------------------------------------ chips */

.chipset {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.chipset__label {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--forest-700);
}

.chipset__items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* --------------------------------------------------------------- consents */

.consent {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4) 18px;
  background: var(--will-50);
  border: var(--border-width-hair) solid var(--will-400);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.consent input {
  width: 22px;
  height: 22px;
  flex: none;
  margin: 2px 0 0;
  accent-color: var(--will-700);
}

.consent span {
  font-size: var(--size-body-min);
  line-height: 1.5;
  color: var(--ink-900);
}

/* ------------------------------------------------------------- rating row */

.rating {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4) 18px;
  background: var(--paper-white);
  border: var(--border-width-hair) solid var(--sand-300);
  border-radius: var(--radius-md);
}

.rating__label {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--size-body-min);
  line-height: 1.25;
  color: var(--forest-800);
}

.rating__dots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.dot {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--size-body);
  background: var(--cream-100);
  color: var(--forest-700);
  border: var(--border-width-hair) solid var(--sand-300);
  transition: background var(--transition-fast), color var(--transition-fast),
              border-color var(--transition-fast);
}

.dot:hover { border-color: var(--will-400); }

/* Filled up to and including the chosen score. */
.dot.is-on {
  background: var(--will-700);
  color: var(--cream-100);
  border-color: var(--will-700);
}

.rating__caption {
  flex: 1 1 100%;
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-500);
}

/* ------------------------------------------------------------------- done */

.done {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.done[hidden] { display: none; }

.done__inner {
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

/* The cream wordmark needs a dark ground to read against the cream page. */
.done__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 26px;
  border-radius: var(--radius-lg);
  background: var(--forest-800);
}

.done__mark img { height: 54px; width: auto; }

.done h1 {
  font-weight: var(--weight-black);
  font-size: 26px;
  line-height: 1.2;
  text-transform: uppercase;
}

.done p {
  font-size: var(--size-body);
  line-height: var(--leading-body);
  color: var(--ink-700);
}

.done__stamp {
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  font-size: var(--size-caption);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--will-700);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--will-50);
  border: var(--border-width-hair) solid var(--will-400);
}

/* -------------------------------------------------------------- action bar */

.bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 20px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: var(--cream-100);
  border-top: var(--border-width-hair) solid var(--sand-300);
}

.bar[hidden] { display: none; }

.bar__note {
  flex: 1 1 140px;
  font-size: 14px;
  color: var(--ink-500);
}

.bar__note.is-error {
  font-weight: var(--weight-semibold);
  color: var(--wont-700);
}

.btn {
  min-height: 50px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--size-body-min);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              color var(--transition-fast);
}

.btn--primary {
  padding: 0 26px;
  border: var(--border-width-strong) solid var(--forest-800);
  background: var(--forest-800);
  color: var(--cream-100);
}

.btn--primary:hover:not(:disabled) {
  background: var(--forest-700);
  border-color: var(--forest-700);
}

.btn--ghost {
  border: var(--border-width-strong) solid var(--forest-800);
  background: transparent;
  color: var(--forest-800);
}

.btn--ghost:hover:not(:disabled) {
  background: rgba(46, 64, 52, .06);
}

.btn:disabled {
  opacity: .6;
  cursor: progress;
}

.btn[hidden] { display: none; }

@media (max-width: 420px) {
  .bar { gap: var(--space-2); }
  .bar__note { flex: 1 1 100%; order: -1; }
  .bar .btn { flex: 1 1 auto; }
}

/* Respect a reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}
