/*
 * Happiness evaluations – public form
 * White, black and a stripe of gold.
 *
 * Avenir Next is a licensed font and is not bundled: a locally installed
 * Avenir Next (macOS/iOS) is used, otherwise a system fallback.
 * To serve the web font to everybody, put the licensed files in
 * static/evaluations/fonts/ and add them to the src lists below, e.g.
 *   src: local("Avenir Next"), url("fonts/AvenirNext-Regular.woff2") format("woff2");
 * (only reference files that exist: production builds fail on missing files).
 */
@font-face {
  font-family: "AvenirNext";
  src: local("Avenir Next"), local("AvenirNext-Regular");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "AvenirNext";
  src: local("Avenir Next Medium"), local("AvenirNext-Medium");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "AvenirNext";
  src: local("Avenir Next Demi Bold"), local("AvenirNext-DemiBold");
  font-weight: 600;
  font-display: swap;
}

:root {
  --gold: rgb(190, 168, 108);
  --gold-soft: rgba(190, 168, 108, 0.14);
  --black: #0a0a0a;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --white: #ffffff;
  --error: #b42318;
  --radius: 2px;
  --font: "AvenirNext", "Avenir Next", "Avenir", "Helvetica Neue", Arial, system-ui, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header ------------------------------------------------------------ */
.masthead {
  background: var(--white);
  display: flex;
  justify-content: center;
  padding: 28px 16px 22px;
}
.masthead__logo { height: 92px; width: auto; display: block; }
.stripe { height: 6px; background: var(--gold); }

/* --- Layout ------------------------------------------------------------ */
.page {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 24px 80px;
  flex: 1;
}
.footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  text-align: center;
  padding: 28px 16px;
}

/* --- Typography -------------------------------------------------------- */
h1 {
  font-weight: 500;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--black);
}
h2 {
  font-weight: 600;
  font-size: 20px;
  letter-spacing: .01em;
  margin: 0;
  color: var(--black);
}
.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
}
.lead { font-size: 19px; color: var(--ink); margin: 0 0 16px; }
.hint { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.nowrap { white-space: nowrap; }
.req { color: var(--gold); font-weight: 600; }

.intro { margin-bottom: 48px; }
.intro__text { color: var(--ink); }
.intro__text p { margin: 0 0 12px; }

.message { text-align: center; padding: 40px 0; }
.message .lead { max-width: 520px; margin-left: auto; margin-right: auto; }

/* --- Progress bar (sticky gold line) ----------------------------------- */
.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: transparent;
  z-index: 10;
}
.progress__bar { height: 100%; width: 0; background: var(--gold); transition: width .25s ease; }

/* --- Sections ---------------------------------------------------------- */
.block {
  border-top: 1px solid var(--black);
  padding-top: 28px;
  margin-bottom: 56px;
}
.block--name { border-top: 0; padding-top: 0; margin-bottom: 40px; }
.block--name .question { padding-top: 0; }
.block__header { display: flex; align-items: baseline; gap: 16px; margin-bottom: 8px; }
.block__index {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: .1em;
  font-variant-numeric: tabular-nums;
}
.block__description { color: var(--muted); font-size: 15px; }
.block__description p { margin: 0 0 8px; }

/* --- Questions --------------------------------------------------------- */
.question { padding: 22px 0; border-bottom: 1px solid var(--line); }
.question:last-child { border-bottom: 0; }
.question fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.question__label {
  display: block;
  padding: 0;
  font-weight: 500;
  font-size: 17px;
  color: var(--black);
  margin-bottom: 14px;
}
.question__help { margin: -8px 0 14px; color: var(--muted); font-size: 14px; }
.question--error .question__label { color: var(--error); }
.error { color: var(--error); font-size: 14px; margin: 8px 0 0; }

.alert {
  border-left: 3px solid var(--error);
  background: #fdf3f2;
  padding: 14px 18px;
  margin-bottom: 32px;
  font-size: 15px;
}

/* Text inputs */
input[type="text"], textarea {
  width: 100%;
  font: inherit;
  color: var(--black);
  background: var(--white);
  border: 1px solid #cfcfcf;
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.question--error input[type="text"], .question--error textarea { border-color: var(--error); }

/* 1–10 scale */
.scale {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
}
.scale__option { position: relative; cursor: pointer; }
.scale__option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.scale__option span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  border: 1px solid #cfcfcf;
  border-radius: var(--radius);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--black);
  background: var(--white);
  transition: background .12s, color .12s, border-color .12s;
  user-select: none;
}
.scale__option:hover span { border-color: var(--gold); background: var(--gold-soft); }
.scale__option input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.scale__option input:checked + span {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
  box-shadow: inset 0 -3px 0 var(--gold);
}
.question--error .scale__option span { border-color: #e7b4ae; }

/* 1–10 scale with an optional "Don't know" choice next to it */
.scale-row { display: flex; gap: 14px; align-items: flex-start; }
.scale-main { flex: 1; min-width: 0; }
.scale__option--dk { flex: none; }
.scale__option--dk span {
  padding: 0 14px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--muted);
  border-style: dashed;
}
.scale__option--dk input:checked + span {
  background: var(--white);
  color: var(--black);
  border: 1px solid var(--black);
  box-shadow: inset 0 -3px 0 var(--gold);
}
.scale__legend {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: 8px;
}

/* --- Submit ------------------------------------------------------------ */
.submit { border-top: 1px solid var(--black); padding-top: 32px; }
.button {
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  background: var(--black);
  color: var(--white);
  font: inherit;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 14px;
  padding: 18px 36px;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 var(--gold);
  transition: background .15s, color .15s;
}
.button:hover { background: var(--gold); color: var(--black); }
.button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .masthead__logo { height: 72px; }
  .page { padding-top: 40px; }
  .scale { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .scale-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .scale__option--dk { width: 100%; }
  .scale__option span { height: 50px; }
  .button { width: 100%; }
}
