/* ==========================================================================
   Fonts and design tokens
   ========================================================================== */

@font-face {
  font-family: SPTGT;
  src: url('/assets/SPTGTSans-Regular.otf');
}

@font-face {
  font-family: SPTGT;
  src: url('/assets/SPTGTSans-SemiBold.otf');
  font-weight: 600;
}

:root {
  --bg: #121b23;
  --text: #f3f6f8;
  --muted: #9aaab7;
  --line: #ffffff20;
  --blue: #0084d5;
  --bright: #51baff;
  --input: #ffffff04;
  --selected: #0084d521;
  --error: #ffb4a9;
  color-scheme: dark;
}

html[data-theme=light] {
  --bg: #f6f8fa;
  --text: #1d252d;
  --muted: #576b7c;
  --line: #1d252d26;
  --bright: #006daf;
  --input: #fff;
  --selected: #0084d510;
  --error: #b33124;
  color-scheme: light;
}

/* ==========================================================================
   Base
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.875rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: SPTGT, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* Short pages (login, survey "thank you") keep the footer at the bottom of the screen.
   Flex items with auto side margins shrink to their content, so they are stretched back
   explicitly; `stretch` also respects the fixed side margins set at narrower breakpoints. */
body > header,
body > main,
body > footer {
  width: -webkit-fill-available;
  width: -moz-available;
  width: stretch;
}

body > main {
  flex: 1 0 auto;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button {
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--bright);
  outline-offset: 0.3125rem;
}

::selection {
  background: #0084d560;
}

[hidden] {
  display: none !important;
}

h1 {
  font-size: clamp(2.75rem, 4.7vw, 4.25rem);
  line-height: 1.07;
  letter-spacing: -0.125rem;
  font-weight: 600;
  margin: 1.5625rem 0;
}

.blue {
  color: var(--bright);
}

.muted,
footer a {
  color: var(--muted);
}

/* ==========================================================================
   Background: slow, diffuse light. No streaks or scroll-linked movement.
   ========================================================================== */

.ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.floating-light {
  background: var(--bg);
}

.floating-orb {
  position: absolute;
  width: 68vmax;
  height: 68vmax;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(0, 132, 213, .48) 0%,
    rgba(0, 132, 213, .29) 16%,
    rgba(0, 132, 213, .13) 32%,
    rgba(0, 132, 213, .035) 48%,
    transparent 66%
  );
  animation: float-light 17s ease-in-out infinite alternate;
  will-change: transform;
}

.orb-one {
  left: -39vmax;
  top: calc(55% - 34vmax);
}

.orb-two {
  width: 62vmax;
  height: 62vmax;
  right: -35vmax;
  top: calc(30% - 31vmax);
  opacity: .85;
  animation-name: float-light-far;
  animation-duration: 21s;
  animation-delay: -9s;
}

.floating-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 20%, rgba(18, 27, 35, .32) 55%, rgba(18, 27, 35, .12) 80%, transparent);
}

html[data-theme=light] .floating-orb {
  opacity: .38;
}

html[data-theme=light] .orb-two {
  opacity: .2;
}

html[data-theme=light] .floating-veil {
  background: linear-gradient(90deg, transparent, #f6f8fa66 60%, transparent);
}

@keyframes float-light {
  from {
    transform: translate3d(-2vw, -5vh, 0) scale(.95);
  }
  to {
    transform: translate3d(10vw, 12vh, 0) scale(1.08);
  }
}

@keyframes float-light-far {
  from {
    transform: translate3d(3vw, 8vh, 0);
  }
  to {
    transform: translate3d(-8vw, -8vh, 0);
  }
}

/* ==========================================================================
   Header and footer
   ========================================================================== */

.topbar {
  max-width: 85rem;
  margin: auto;
  min-height: 6.875rem;
  padding: 1.875rem 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1.3125rem;
  font-weight: 600;
  font-size: 1.0625rem;
}

.logo {
  width: 4.5rem;
  height: 2.25rem;
  object-fit: contain;
}

.brand > span {
  padding-left: 1.25rem;
  border-left: 1px solid var(--line);
}

.brand-sub {
  display: block;
  font-size: 0.625rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.edition {
  font-size: 0.75rem;
  color: var(--muted);
}

.theme-button {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
}

.back-link {
  font-size: 0.75rem;
  color: var(--muted);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
}

footer {
  display: flex;
  justify-content: space-between;
  max-width: 78rem;
  margin: auto;
  border-top: 1px solid var(--line);
  padding: 1.75rem 0;
  font-size: 0.6875rem;
}

/* ==========================================================================
   Two-column layout and intro (survey and login pages)
   ========================================================================== */

.layout {
  max-width: 78rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.12fr;
  gap: 5.5rem;
  padding: 4.375rem 0 6.25rem;
  align-items: start;
}

.intro {
  position: sticky;
  top: 3rem;
  padding-top: 0.5rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.6875rem;
  letter-spacing: .07em;
  color: var(--muted);
}

.live-dot {
  height: 0.375rem;
  width: 0.375rem;
  border-radius: 50%;
  background: var(--bright);
  box-shadow: 0 0 0.9375rem #0084d5;
}

.event-name {
  font-size: 1.75rem;
  margin-top: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.0625rem;
}

.event-name > span:first-child {
  font-weight: 400;
}

.event-arrow {
  display: inline-block;
  font-size: 1.625rem;
  color: var(--bright);
  margin-left: 0.75rem;
}

.lead {
  font-size: 1.375rem;
  line-height: 1.5;
  margin: 0 0 1.0625rem;
}

.intro-copy {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.8;
}

.event-details {
  display: grid;
  gap: 0.3125rem;
  border-left: 2px solid var(--blue);
  padding-left: 1rem;
  margin-top: 1.5rem;
  font-size: 0.75rem;
}

.event-details span + span {
  color: var(--muted);
  font-size: 0.6875rem;
}

.event-details b {
  padding: 0 0.375rem;
}

.progress-block {
  max-width: 20rem;
  margin-top: 2.75rem;
}

.progress-caption,
.progress-note {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--muted);
}

.progress-caption span:last-child {
  color: var(--text);
}

.progress-track {
  height: 2px;
  background: var(--line);
  margin: 0.8125rem 0;
}

.progress-track span {
  display: block;
  width: calc(var(--progress, 0) * 100%);
  height: 100%;
  background: var(--bright);
  transition: width .4s;
}

/* ==========================================================================
   Form sections (survey and login forms)
   ========================================================================== */

.survey {
  min-width: 0;
}

.survey-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.375rem;
  font-size: 0.8125rem;
}

.small-label {
  font-size: 0.6875rem;
  color: var(--muted);
}

.question {
  padding: 2.0625rem 0 2.25rem;
  border-bottom: 1px solid var(--line);
  margin: 0;
  min-width: 0;
}

.section-tag,
.question-number {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  font-size: 0.6875rem;
  color: var(--bright);
  margin-bottom: 0.875rem;
}

.question-number span {
  color: var(--muted);
  font-size: 0.625rem;
}

.question-title {
  display: block;
  font-size: 1.4375rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.021875rem;
  margin: 0;
}

.required {
  font-size: 0.9375rem;
  color: var(--bright);
}

.hint {
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--muted);
  margin: 0.625rem 0 1.1875rem;
}

.text-input,
textarea,
.admin-select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  border-radius: 1rem;
  padding: 0.9375rem 1.0625rem;
  transition: border-color .2s;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: .7;
}

textarea {
  resize: vertical;
  min-height: 7.1875rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.text-input {
  font-size: 0.875rem;
}

.group-section .text-input {
  max-width: 20rem;
}

.options {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.375rem;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.8125rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9375rem;
  background: var(--input);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background .25s, border-color .25s, transform .25s;
}

.option:hover {
  background: var(--selected);
  border-color: #0084d580;
  transform: translateX(0.1875rem);
}

.option:has(input:checked) {
  background: var(--selected);
  border-color: var(--blue);
}

.option input {
  margin: 0;
  appearance: none;
  width: 1.0625rem;
  height: 1.0625rem;
  border: 1px solid var(--muted);
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
}

.option input:checked {
  border-color: var(--bright);
}

.option input:checked::after {
  content: '';
  width: 0.4375rem;
  height: 0.4375rem;
  background: var(--bright);
  border-radius: 50%;
}

.option input[type=checkbox] {
  border-radius: 0.1875rem;
}

.option input[type=checkbox]:checked::after {
  border-radius: 1px;
}

.rating-options {
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.rating-option {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 3.5rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--input);
  cursor: pointer;
  font-size: 1.25rem;
  transition: background .25s, transform .25s, border-color .25s;
}

.rating-option:hover {
  transform: translateY(-0.1875rem);
}

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

.rating-option:has(input:checked) {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.rating-option:has(input:focus-visible) {
  outline: 2px solid var(--bright);
  outline-offset: 0.25rem;
}

.rating-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.625rem;
  margin-top: 0.625rem;
}

.answer-caption {
  font-size: 0.75rem;
  color: var(--bright);
  min-height: 1.1875rem;
  margin-top: 0.5625rem;
}

.followup {
  margin-top: 1.25rem;
}

.followup label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.625rem;
}

.counter {
  font-size: 0.625rem;
  color: var(--muted);
  text-align: right;
  margin-top: 0.3125rem;
}

.submit-area {
  padding-top: 1.5625rem;
}

.primary-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  background: var(--blue);
  border: 0;
  border-radius: 1.125rem;
  color: #fff;
  padding: 1.1875rem 1.4375rem;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background .25s, box-shadow .25s, transform .25s;
}

.primary-button:hover {
  background: #087aba;
  box-shadow: 0 0.5rem 2.1875rem #0084d530;
  transform: translateY(-2px);
}

.primary-button:disabled {
  opacity: .6;
  cursor: progress;
}

.primary-button:disabled:hover {
  background: var(--blue);
  box-shadow: none;
  transform: none;
}

.primary-button > span:last-child {
  font-size: 1.4375rem;
  line-height: 1;
}

.submit-note {
  font-size: 0.6875rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
  margin: 1rem 0;
}

.field-error {
  font-size: 0.75rem;
  color: var(--error);
  margin: 0.5rem 0 0;
}

.field-error:empty {
  display: none;
}

.input-hint {
  margin: 0.5rem 0 0;
}

.input-hint:empty {
  /* Collapsed, not hidden: a live region must stay in the accessibility tree to be announced. */
  margin: 0;
}

.multiline {
  white-space: pre-line;
}

.invalid {
  border-color: var(--error) !important;
}

.success {
  padding: 5rem 0;
  min-height: 40.625rem;
}

.success-icon {
  font-size: 3.5rem;
  color: var(--bright);
  margin-bottom: 2.5rem;
}

.success h2 {
  font-size: 3.25rem;
  line-height: 1.15;
  letter-spacing: -0.09375rem;
}

.success p {
  color: var(--muted);
  line-height: 1.9;
  font-size: 0.875rem;
}

.secondary-button {
  display: block;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  padding: 0.75rem 1.125rem;
  font-size: 0.75rem;
}

.secondary-button:hover {
  border-color: var(--bright);
}

/* ==========================================================================
   Admin dashboard
   ========================================================================== */

.admin-main {
  max-width: 78rem;
  margin: 3.4375rem auto 5.625rem;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
}

.admin-top h1 {
  font-size: 2.75rem;
  margin: 0.75rem 0;
}

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

.admin-controls {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.admin-controls select {
  width: auto;
  font-size: 0.75rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.875rem;
  margin: 2.1875rem 0 3.125rem;
}

.stat {
  border-top: 1px solid var(--line);
  padding-top: 1.375rem;
}

.stat-value {
  font-size: 2.75rem;
  letter-spacing: -0.0625rem;
}

.stat-label {
  color: var(--muted);
  font-size: 0.75rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3.125rem;
  margin-bottom: 3.125rem;
}

.admin-grid h2,
.responses h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5625rem;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 2.1875rem;
  gap: 0.5rem;
  margin-bottom: 1.0625rem;
  font-size: 0.75rem;
}

.bar-track {
  grid-column: 1 / -1;
  height: 0.3125rem;
  background: var(--line);
}

.bar-fill {
  width: calc(var(--share, 0) * 100%);
  height: 100%;
  background: var(--blue);
  min-width: 0;
}

.response-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.tabs {
  display: flex;
  gap: 0.3125rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.8125rem 1rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.tab.active {
  border-bottom-color: var(--blue);
  color: var(--text);
}

.response-item {
  border-bottom: 1px solid var(--line);
  padding: 1.25rem 0;
}

.response-item summary {
  cursor: pointer;
  display: flex;
  gap: 1.25rem;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  font-size: 0.8125rem;
}

.response-item summary::-webkit-details-marker {
  display: none;
}

.response-item summary::after {
  content: '+';
  color: var(--bright);
  font-size: 1.375rem;
}

.response-item[open] summary::after {
  content: '−';
}

/* Text written by respondents must not reorder the text around it. */
.response-group,
.comment-text,
.response-body dd {
  unicode-bidi: isolate;
}

.response-meta {
  color: var(--muted);
  font-size: 0.6875rem;
}

.response-body {
  padding: 1.25rem 0;
  max-width: 50rem;
}

.response-body dt {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 1.0625rem;
}

.response-body dd {
  margin: 0.3125rem 0;
  font-size: 0.875rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty {
  padding: 3.125rem 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.comment-card {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.comment-card p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Motion: scroll reveal and reading progress (driven by js/core/motion.js)
   ========================================================================== */

/* Hiding is instant (the section is measured before it is hidden); only revealing is animated. */
.scroll-reveal {
  opacity: .01;
  transform: translate3d(0, 1.625rem, 0);
}

.scroll-reveal.is-visible,
.scroll-reveal:focus-within {
  opacity: 1;
  transform: none;
  transition: opacity .7s ease, transform .85s cubic-bezier(.16, 1, .3, 1);
}

.scroll-reveal.is-visible .options > label {
  animation: option-arrive .6s both;
  animation-delay: calc(var(--option-index, 0) * 45ms);
}

@keyframes option-arrive {
  from {
    opacity: .15;
    translate: 0 0.625rem;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

.reading-progress {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 2px;
  background: var(--blue);
  transform: scaleX(var(--read-progress, 0));
  transform-origin: left;
  z-index: 20;
  pointer-events: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (min-width: 1500px) {
  .layout {
    gap: 6.875rem;
    padding-top: 5.3125rem;
  }
}

/* Wider than the 1440px design: element sizes stay the same, the page fills the window
   with the side margins it has at 1440px. */
@media (min-width: 1441px) {
  .topbar {
    max-width: none;
    margin-inline: 2.5rem;
  }

  .layout,
  .admin-main,
  footer {
    max-width: none;
    margin-inline: 6rem;
  }
}

@media (max-width: 1359px) {
  .layout,
  .admin-main,
  footer {
    margin-left: 3.5rem;
    margin-right: 3.5rem;
  }

  .layout {
    gap: 3.75rem;
  }

  .topbar {
    margin: 0;
  }
}

@media (max-width: 980px) {
  .layout {
    gap: 2.25rem;
    margin-left: 2rem;
    margin-right: 2rem;
    grid-template-columns: .9fr 1.1fr;
  }

  .topbar {
    padding: 1.5625rem 2rem;
  }

  h1 {
    font-size: 2.8125rem;
  }

  .lead {
    font-size: 1.1875rem;
  }

  .question-title {
    font-size: 1.3125rem;
  }

  .event-name {
    font-size: 1.5625rem;
  }

  .admin-main,
  footer {
    margin-left: 2rem;
    margin-right: 2rem;
  }

  .admin-top {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 5.3125rem;
    padding: 1.25rem 1.375rem;
  }

  .brand {
    gap: 0.75rem;
    font-size: 0.875rem;
  }

  .brand > span {
    padding-left: 0.75rem;
  }

  .brand-sub {
    font-size: 0.5rem;
  }

  .logo {
    width: 4rem;
    height: 1.875rem;
  }

  .edition {
    display: none;
  }

  .theme-button {
    width: 2.25rem;
    height: 2.25rem;
  }

  .layout {
    display: block;
    margin: 0 1.5rem;
    padding: 2.1875rem 0 3.75rem;
  }

  .intro {
    position: relative;
    top: 0;
    padding: 0 0 2rem;
  }

  .eyebrow {
    font-size: 0.625rem;
  }

  .event-name {
    font-size: 1.5rem;
  }

  h1 {
    font-size: 2.875rem;
    margin: 1.1875rem 0;
  }

  .lead {
    font-size: 1.125rem;
  }

  .intro-copy {
    display: none;
  }

  .progress-block {
    margin-top: 1.75rem;
    max-width: none;
  }

  .survey-heading {
    padding-top: 0.9375rem;
  }

  .question {
    padding: 1.75rem 0;
  }

  .question-title {
    font-size: 1.375rem;
  }

  .hint {
    font-size: 0.75rem;
  }

  .option {
    padding: 0.9375rem 0.8125rem;
    min-height: 3.125rem;
  }

  .option:hover {
    transform: none;
  }

  .group-section .text-input {
    max-width: none;
  }

  .desktop-break {
    display: none;
  }

  footer {
    margin: 0 1.5rem;
    padding: 1.5rem 0;
    font-size: 0.625rem;
  }

  .admin-main {
    margin: 2.1875rem 1.5rem 3.75rem;
  }

  .admin-top h1 {
    font-size: 2.25rem;
  }

  .stats {
    gap: 0.875rem;
  }

  .stat-value {
    font-size: 2.0625rem;
  }

  .stat-label {
    font-size: 0.625rem;
  }

  .admin-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .response-meta {
    font-size: 0.625rem;
  }

  .response-item summary {
    gap: 0.625rem;
  }

  .tab {
    padding: 0.75rem 0.5625rem;
  }

  .response-header {
    align-items: start;
    flex-direction: column;
  }

  .success {
    min-height: 28.125rem;
    padding: 2.8125rem 0;
  }

  .success h2 {
    font-size: 2.75rem;
  }

  .floating-orb {
    opacity: .85;
  }

  .orb-two {
    opacity: .65;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .floating-orb {
    will-change: auto;
  }

  .scroll-reveal {
    opacity: 1;
    transform: none;
  }

  .option:hover,
  .rating-option:hover,
  .primary-button:hover {
    transform: none;
  }
}

@media print {
  .scroll-reveal {
    opacity: 1;
    transform: none;
  }

  .scroll-reveal.is-visible .options > label {
    animation: none;
  }
}
