/* Brand tokens (U-LEAD). To rebrand, change only the two token blocks below. */

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/montserrat-cyrillic-500-normal.7d2f0315.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/montserrat-latin-500-normal.2b53300f.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/montserrat-cyrillic-600-normal.12fe2b17.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/montserrat-latin-600-normal.d857325c.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/montserrat-cyrillic-700-normal.c6880741.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/montserrat-latin-700-normal.f9d9e65b.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Palette */
  --color-mariner: #122042;
  --color-mariner-soft: #2c355f;
  --color-mariner-rgb: 18, 32, 66; /* same color as --color-mariner, for rgba() overlays */
  --color-blue: #4d64a9;
  --color-amber: #ecbc2d;
  --color-sky: #d0e7f9;
  --color-white: #ffffff;
  --color-error: #c83c3e;
  --color-error-dark: #953231;
  --color-error-tint: #f3dedd;
  --color-success: #427055;
  --color-success-tint: #e2ede8;
  --color-grey: #828b9c;
  --color-grey-dark: #565b66;
  --color-grey-light: #ccced5;
  --color-grey-tint: #e5e5ea;
  --color-dixie: #d7822c;
  --color-dixie-dark: #ab6827;
  --color-deluge: #7b6aa8;
  --color-deluge-dark: #645687;

  /* Typography */
  --font-heading: "Montserrat", Arial, sans-serif;
  --font-body: Arial, Helvetica, sans-serif;
}

:root {
  /* Semantic roles used by the rest of this file */
  --bg: var(--color-sky);
  --surface: var(--color-white);
  --text: var(--color-mariner);
  --text-muted: var(--color-grey-dark);
  --line: var(--color-grey-light);
  --header-bg: var(--color-mariner);
  --header-text: var(--color-white);
  --accent: var(--color-amber);
  --accent-ink: var(--color-mariner);
  --link: var(--color-blue);
  --focus: var(--color-blue);
  --danger: var(--color-error);
  --danger-ink: var(--color-error-dark);
  --success: var(--color-success);

  /* Chart series in brand order: blue, amber, then the additional color families, then dark shades. */
  --chart-1: var(--color-blue);
  --chart-2: var(--color-amber);
  --chart-3: var(--color-grey);
  --chart-4: var(--color-error);
  --chart-5: var(--color-dixie);
  --chart-6: var(--color-deluge);
  --chart-7: var(--color-success);
  --chart-8: var(--color-error-dark);
  --chart-9: var(--color-dixie-dark);
  --chart-10: var(--color-deluge-dark);
  /* Word cloud text colors: readable on white, never amber. */
  --chart-text-1: var(--color-blue);
  --chart-text-2: var(--color-success);
  --chart-text-3: var(--color-deluge-dark);
  --chart-text-4: var(--color-mariner);
  --chart-text-5: var(--color-dixie-dark);
  --chart-text-6: var(--color-grey-dark);

  --radius: 12px;
  --space: 8px;
  --tap: 48px;

  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-size: 1rem;
  line-height: 1.5;
  background: var(--bg);
}

a { color: var(--link); }

h1, h2, h3 {
  font-family: var(--font-heading);
  font-style: normal;
  font-weight: 700;
}

/* --- Top bar ------------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--space) * 2);
  padding: var(--space) calc(var(--space) * 2);
  background: var(--header-bg);
  color: var(--header-text);
}

.brand {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.lang-switch { display: flex; gap: 4px; }

.lang-switch__btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--space);
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--header-text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  cursor: pointer;
}

.lang-switch__btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.topbar :focus-visible { outline-color: var(--color-white); }

/* --- Page ---------------------------------------------------------------------- */

.page {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--space) * 3) calc(var(--space) * 2) calc(var(--space) * 4);
}

.page--narrow { max-width: 480px; }

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

h1:focus { outline: none; }

.question {
  margin: 0 0 calc(var(--space) * 3);
  font-size: 1.5rem;
  line-height: 1.25;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.conn {
  margin: 0;
  padding: var(--space) calc(var(--space) * 2);
  background: var(--color-grey-tint);
  color: var(--text);
  font-size: 0.875rem;
  text-align: center;
}

.conn[hidden], .form__error[hidden], .form [hidden] { display: none; }

.notice {
  margin: 0 0 calc(var(--space) * 2);
  padding: calc(var(--space) * 1.5) calc(var(--space) * 2);
  border-left: 4px solid var(--color-blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  font-size: 0.9375rem;
}

/* --- Forms --------------------------------------------------------------------- */

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

.field { display: flex; flex-direction: column; gap: 6px; }

.field__label { font-weight: 700; }

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

.form__hint--end { text-align: right; }

.form__error {
  margin: 0;
  padding: calc(var(--space) * 1.5) calc(var(--space) * 2);
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--danger-ink);
  font-size: 0.9375rem;
}

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
}

.input:focus-visible { border-color: var(--color-mariner); outline-offset: 0; }

.input--area { min-height: 132px; resize: vertical; line-height: 1.4; }

.input--code {
  min-height: 64px;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
}

.form__actions {
  position: sticky;
  bottom: 0;
  margin: 0 calc(var(--space) * -2);
  padding: calc(var(--space) * 1.5) calc(var(--space) * 2) calc(var(--space) * 1.5 + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
}

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

.btn {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 0 calc(var(--space) * 3);
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn--secondary {
  margin-top: calc(var(--space) * 3);
  border-color: var(--color-mariner);
  background: var(--surface);
  color: var(--text);
}

.btn:disabled {
  border-color: transparent;
  background: var(--color-grey-tint);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* --- Multiple choice ------------------------------------------------------------ */

.choices { display: flex; flex-direction: column; gap: calc(var(--space) * 1.25); }

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: calc(var(--space) * 1.5);
  min-height: 56px;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.choice:has(:checked) { border-color: var(--color-mariner); }

.choice__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice__marker {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-grey);
  border-radius: 50%;
  background: var(--surface);
}

.choice--multi .choice__marker { border-radius: 6px; }

.choice__input:checked + .choice__marker {
  border-color: var(--color-mariner);
  background: var(--accent);
}

.choice__input:checked + .choice__marker::after {
  content: "";
  width: 10px;
  height: 6px;
  margin-top: -2px;
  border-left: 3px solid var(--accent-ink);
  border-bottom: 3px solid var(--accent-ink);
  transform: rotate(-45deg);
}

.choice__input:focus-visible + .choice__marker {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.choice__text { overflow-wrap: anywhere; }

/* --- Scale ---------------------------------------------------------------------- */

.scale {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.scale + .scale { margin-top: calc(var(--space) * 1); }

.scale__statement {
  padding: 0;
  margin-bottom: calc(var(--space) * 1.25);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.scale__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space);
}

.scale__opt { position: relative; display: block; cursor: pointer; }

.scale__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.scale__num {
  display: grid;
  place-items: center;
  min-height: var(--tap);
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-family: var(--font-heading);
  font-weight: 700;
}

.scale__input:checked + .scale__num {
  border-color: var(--color-mariner);
  background: var(--accent);
  color: var(--accent-ink);
}

.scale__input:focus-visible + .scale__num {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.scale__ends {
  display: flex;
  justify-content: space-between;
  gap: calc(var(--space) * 2);
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* --- Confirmation (the "echo") -------------------------------------------------- */

.echo {
  position: relative;
  display: grid;
  place-items: center;
  width: 144px;
  height: 144px;
  margin: calc(var(--space) * 4) auto calc(var(--space) * 3);
}

.echo__ring {
  position: absolute;
  border: 2px solid var(--success);
  border-radius: 50%;
  animation: echo-out 700ms ease-out backwards;
}

.echo__ring--1 { inset: 28px; --ring-opacity: 0.8; animation-delay: 100ms; }
.echo__ring--2 { inset: 14px; --ring-opacity: 0.5; animation-delay: 250ms; }
.echo__ring--3 { inset: 0; --ring-opacity: 0.25; animation-delay: 400ms; }

.echo__core {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success);
}

.echo__check {
  width: 26px;
  height: 14px;
  margin-top: -5px;
  border-left: 5px solid var(--color-white);
  border-bottom: 5px solid var(--color-white);
  transform: rotate(-45deg);
}

@keyframes echo-out {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: var(--ring-opacity); transform: scale(1); }
}

.done__title {
  margin: 0 0 var(--space);
  font-size: 1.5rem;
  line-height: 1.25;
  text-align: center;
}

.done__text {
  margin: 0;
  color: var(--text-muted);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .echo__ring { animation: none; opacity: var(--ring-opacity); }
}

@media (min-width: 480px) {
  .form__actions { margin: 0; padding-inline: 0; }
}
