/*
 * Infinum brand tokens (https://infinum.com/brand/).
 * The typeface is Neue Haas Grotesk. It is licensed, so the font files are not
 * in this repository: a device that has the font uses it, all others fall back
 * to Helvetica or Arial, as the brand guidelines specify.
 */
:root {
  --red: #d82828;
  --black: #000;
  --white: #fff;
  --grey1: #f5f9ff;
  --grey2: #e4ebf5;
  --grey3: #c4cede;
  --grey4: #929eb2;
  --grey5: #525e6c;
  --olive30: #5a8772;
  --sky30: #6479c3;

  --font-display: 'Neue Haas Grotesk Display Pro', 'Neue Haas Grotesk Display', 'Helvetica Neue',
    Helvetica, Arial, sans-serif;
  --font-text: 'Neue Haas Grotesk Text Pro', 'Neue Haas Grotesk Text', 'Helvetica Neue', Helvetica,
    Arial, sans-serif;

  --radius: 10px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --bar-height: clamp(64px, 11vh, 112px);
}

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

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

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.4;
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-wrap: balance;
}

p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

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

.theme-stage {
  background: var(--black);
  color: var(--white);
}

.theme-paper {
  background: var(--white);
  color: var(--black);
}

/* Event lockup: The AI Collective Zagreb, hosted by Infinum. All sizes come
   from --lockup-height, which is the height of the AI Collective logo. */
.lockup {
  --lockup-height: 64px;
  display: flex;
  align-items: center;
  gap: calc(var(--lockup-height) * 0.28);
  font-family: var(--font-text);
}

.lockup img {
  display: block;
  width: auto;
  max-width: none;
}

.lockup-collective {
  position: relative;
  flex: none;
}

.lockup-collective img {
  height: var(--lockup-height);
}

/* The chapter name sits below the word "Collective" of the wordmark. */
.lockup-chapter {
  position: absolute;
  top: 80%;
  left: 47.5%;
  padding: 0.12em 0.55em;
  background: var(--white);
  color: var(--black);
  font-size: calc(var(--lockup-height) * 0.105);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

.lockup-divider {
  flex: none;
  width: 1px;
  height: var(--lockup-height);
  background: var(--grey5);
}

.lockup-host {
  display: grid;
  gap: calc(var(--lockup-height) * 0.11);
}

.lockup-hosted {
  color: var(--grey2);
  font-size: calc(var(--lockup-height) * 0.1);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.lockup-host img {
  height: calc(var(--lockup-height) * 0.25);
}

.qr {
  display: block;
  background: var(--white);
  line-height: 0;
}

.qr svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Controls */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 14px 24px;
  border: 0;
  border-radius: var(--radius);
  background: var(--red);
  color: var(--white);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.1s,
    background-color 0.15s;
}

.button:active:not(:disabled) {
  transform: scale(0.98);
}

.button:disabled {
  background: var(--grey2);
  color: var(--grey4);
  cursor: default;
}

.button-dark {
  background: var(--black);
}

/* A text button for the less important action next to a main button. */
.quiet-button {
  padding: 12px 20px;
  border: 0;
  background: transparent;
  color: var(--grey5);
  font: inherit;
  cursor: pointer;
}

.quiet-button:disabled {
  color: var(--grey3);
  cursor: default;
}

.button-wide {
  width: 100%;
}

.link-button {
  padding: 12px 0;
  border: 0;
  background: none;
  color: var(--grey5);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.text-link {
  color: inherit;
  text-underline-offset: 3px;
}

input[type='password'],
textarea {
  display: block;
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--grey3);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--black);
  font: inherit;
}

input[type='password']:focus,
textarea:focus {
  border-color: var(--black);
}

textarea {
  resize: vertical;
}

/* Home */

.home {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100dvh;
  padding: clamp(20px, 4vh, 56px) clamp(20px, 5vw, 96px);
}

.home .lockup {
  --lockup-height: clamp(56px, 7.5vw, 120px);
}

/* One entrance when the page loads: the text comes up line after line, and
   the QR code comes in. */
.home h1,
.home-subtitle,
.home-lede,
.home-url,
.home-actions {
  animation: rise 0.7s var(--ease) both;
}

.home-subtitle {
  animation-delay: 0.08s;
}

.home-lede {
  animation-delay: 0.16s;
}

.home-url {
  animation-delay: 0.22s;
}

.home-actions {
  animation-delay: 0.28s;
}

.home .qr {
  animation: qr-in 0.8s 0.2s var(--ease) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.5em);
  }
}

@keyframes qr-in {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}

.home-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(24px, 5vw, 96px);
  padding-block: clamp(16px, 3vh, 48px);
}

.home h1 {
  font-size: clamp(56px, 9.5vw, 168px);
  letter-spacing: -0.025em;
  line-height: 0.96;
}

.home-subtitle {
  margin-top: 0.5em;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.3vw, 40px);
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.15;
}

.home-lede {
  max-width: 26em;
  margin-top: clamp(24px, 5vh, 64px);
  font-size: clamp(18px, 1.7vw, 30px);
  line-height: 1.3;
}

.home-url {
  margin-top: 0.5em;
  color: var(--grey3);
  font-size: clamp(18px, 1.7vw, 30px);
  overflow-wrap: anywhere;
}

.home-url strong {
  color: var(--white);
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: clamp(24px, 4vh, 48px);
  font-size: clamp(16px, 1.2vw, 20px);
}

/* The button is for a visitor on a phone, who cannot scan a code on the same screen. */
.home-open-quiz {
  display: none;
}

.home .qr {
  width: min(38vw, 62vh);
}

@media (max-width: 760px) {
  .home-body {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .home-open-quiz {
    display: inline-flex;
  }

  .home .qr {
    width: min(100%, 320px);
  }
}

/* Quiz (participant, phone) */

.quiz-header {
  padding: 16px 20px;
  background: var(--black);
}

.quiz-header .lockup {
  --lockup-height: 52px;
  justify-content: center;
}

.quiz {
  max-width: 600px;
  margin-inline: auto;
  padding: 24px 20px 56px;
  overflow-x: clip;
}

/* A new screen comes in from the side that matches the direction: from the
   right for "forward", from the left for "back". */
.quiz > * {
  animation: screen-in 0.32s var(--ease) both;
}

.quiz[data-direction='back'] > * {
  animation-name: screen-in-back;
}

.quiz > .progress {
  animation: none;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
}

@keyframes screen-in-back {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }
}

.quiz h1 {
  font-size: clamp(24px, 6.4vw, 32px);
  line-height: 1.15;
}

.quiz-note {
  margin: 16px 0 24px;
  padding-inline: 0;
  color: var(--grey5);
}

noscript .quiz-note {
  max-width: 600px;
  margin-inline: auto;
  padding-inline: 20px;
}

.progress {
  margin-bottom: 24px;
}

.progress-text {
  color: var(--grey5);
  font-size: 15px;
}

.progress-track {
  height: 4px;
  margin-top: 8px;
  background: var(--grey2);
}

.progress-fill {
  width: calc(var(--value, 0) * 100%);
  height: 100%;
  background: var(--red);
  transition: width 0.5s var(--ease);
}

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

.question legend {
  width: 100%;
  padding: 0;
}

.statement {
  margin-top: 12px;
  color: var(--grey5);
}

.options {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border: 1.5px solid var(--grey3);
  border-radius: var(--radius);
  line-height: 1.3;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.option input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid var(--grey4);
  border-radius: 50%;
  background: var(--white);
  appearance: none;
  transition:
    border-width 0.15s,
    background-color 0.15s;
}

.option input:checked {
  border: 6px solid var(--white);
  background: var(--red);
}

.option input:focus-visible {
  outline: none;
}

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

.option:has(input:focus-visible) {
  outline: 3px solid var(--sky30);
  outline-offset: 2px;
}

.option-number {
  flex: none;
  min-width: 1ch;
  font-weight: 700;
}

.question textarea {
  margin-top: 24px;
}

.counter {
  margin-top: 6px;
  color: var(--grey5);
  font-size: 15px;
  text-align: right;
}

.form-error {
  margin-top: 16px;
  padding: 12px 16px;
  border-left: 4px solid var(--red);
  background: var(--grey1);
}

.form-notice {
  margin-top: 12px;
  padding: 10px 14px;
  border-left: 4px solid var(--olive30);
  background: var(--grey1);
}

/* The main button, with the back button below it. */
.form-actions {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-top: 24px;
}

.form-actions .button {
  width: 100%;
}

/* Summary after the last question */

.done-mark {
  display: block;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
}

.done-mark circle {
  fill: var(--red);
  transform-box: fill-box;
  transform-origin: center;
  animation: pop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}

.done-mark path {
  fill: none;
  stroke: var(--white);
  stroke-dasharray: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
  animation: draw 0.35s 0.3s ease-out both;
}

@keyframes pop {
  from {
    transform: scale(0);
  }
}

@keyframes draw {
  from {
    stroke-dashoffset: 1;
  }
}

.quiz h2 {
  margin-top: 40px;
  font-size: 21px;
}

.summary {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.summary-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--grey2);
}

.summary-question {
  grid-column: 1 / -1;
  color: var(--grey5);
  font-size: 15px;
  line-height: 1.3;
}

.summary-answer {
  margin-top: 4px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.summary-answer .muted {
  font-weight: 400;
}

.summary-item .link-button {
  padding: 4px 0;
}

/* Results (presenter, projector) */

html:has(.slides) {
  scroll-snap-type: y mandatory;
}

.slides-note {
  padding: clamp(24px, 5vh, 72px) clamp(20px, 5vw, 96px);
  color: var(--grey3);
}

.slide {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: clamp(24px, 5vh, 64px) clamp(20px, 5vw, 96px) calc(var(--bar-height) + clamp(16px, 4vh, 48px));
  scroll-snap-align: start;
}

/* Only the current slide shows its content. results.js sets `is-active` on
   the slide that covers the middle of the screen, and `is-entering` for the
   time of its entrance. */
.slide > * {
  transition: opacity 0.25s;
}

.slide:not(.is-active) > * {
  opacity: 0;
}

.slide.is-active > .slide-meta,
.slide.is-active > h2 {
  animation: rise 0.6s var(--ease) both;
}

.slide.is-active > h2 {
  animation-delay: 0.05s;
}

.slide.is-active > .closing {
  animation: rise 1s 0.1s var(--ease) both;
}

/* The short pulse on a value that a new answer changed. */
@keyframes bump {
  40% {
    transform: scale(1.16);
  }
}

@keyframes flash {
  from {
    filter: brightness(1.8);
  }
}

.slide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 1.5em;
  color: var(--grey4);
  font-size: clamp(14px, 1.2vw, 20px);
}

.slide h2 {
  max-width: 30em;
  margin-top: 0.4em;
  font-size: clamp(26px, 3.2vw, 60px);
  line-height: 1.08;
}

.slide-empty {
  margin-top: clamp(24px, 5vh, 56px);
  color: var(--grey3);
  font-size: clamp(18px, 1.7vw, 30px);
}

/* Bars: one hue, value at the tip, square at the baseline, rounded at the data end. */
.bars {
  display: grid;
  gap: clamp(14px, 3.2vh, 40px);
  margin: auto 0;
  padding: clamp(24px, 4vh, 48px) 0 0;
  list-style: none;
}

.bar-label {
  display: block;
  font-size: clamp(17px, 1.9vw, 32px);
  line-height: 1.2;
}

.bar-line {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-top: 0.4em;
  font-size: clamp(17px, 1.9vw, 32px);
}

.bar-fill {
  flex: none;
  width: calc(var(--share, 0) * (100% - 8em));
  min-width: 3px;
  height: clamp(12px, 2.2vh, 24px);
  border-radius: 0 4px 4px 0;
  background: var(--red);
  transition: width 0.6s var(--ease);
}

/* Entrance: the bars grow from the baseline, one after the other. */
.slide:not(.is-active) .bar-fill {
  width: 3px;
  transition: none;
}

.slide.is-entering .bar-fill {
  transition-duration: 0.9s;
  transition-delay: calc(var(--i, 0) * 90ms);
}

.bar-row.is-bumped .bar-fill,
.column.is-bumped .column-fill {
  animation: flash 0.8s ease-out;
}

.bar-row.is-bumped .bar-value {
  transform-origin: left center;
  animation: bump 0.5s var(--ease);
}

.bar-value {
  white-space: nowrap;
}

.bar-share,
.column-share {
  font-variant-numeric: tabular-nums;
}

.bar-count {
  margin-left: 0.7em;
  color: var(--grey4);
  font-size: 0.7em;
  font-variant-numeric: tabular-nums;
}

/* Columns for the scale question. */
.scale {
  margin: auto 0;
  padding-top: clamp(24px, 4vh, 48px);
}

.scale-statement {
  color: var(--grey4);
  font-size: clamp(16px, 1.5vw, 26px);
}

.columns {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  /* No gap: the plots touch, so their bottom borders make one baseline. */
  margin: clamp(8px, 2vh, 24px) 0 0;
  padding: 0;
  list-style: none;
}

.column {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.column-plot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  height: clamp(150px, 36vh, 440px);
  border-bottom: 1px solid var(--grey5);
  font-size: clamp(17px, 1.9vw, 32px);
}

.column-value {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.35em;
  line-height: 1.15;
}

.column-count {
  color: var(--grey4);
  font-size: 0.7em;
  font-variant-numeric: tabular-nums;
}

.column-fill {
  flex: none;
  width: clamp(16px, 2vw, 28px);
  height: calc(var(--share, 0) * (100% - 3em));
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: var(--red);
  transition: height 0.6s var(--ease);
}

.slide:not(.is-active) .column-fill {
  height: 3px;
  transition: none;
}

.slide.is-entering .column-fill {
  transition-duration: 0.9s;
  transition-delay: calc(var(--i, 0) * 90ms);
}

.column.is-bumped .column-value {
  transform-origin: center bottom;
  animation: bump 0.5s var(--ease);
}

.column-number {
  margin-top: 0.5em;
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 34px);
  font-weight: 700;
}

.column-label {
  max-width: 11em;
  padding-inline: 0.4em;
  color: var(--grey2);
  font-size: clamp(13px, 1.3vw, 22px);
  line-height: 1.2;
  text-wrap: balance;
}

/* Open answers */
.open-answers {
  margin-top: clamp(24px, 4vh, 48px);
}

.bubbles {
  margin: 0;
  padding: 0;
  columns: 3 300px;
  column-gap: 16px;
  list-style: none;
}

.bubble {
  margin-bottom: 16px;
  padding: 0.7em 0.9em;
  border-radius: 4px 18px 18px 18px;
  background: var(--white);
  color: var(--black);
  font-size: clamp(16px, 1.5vw, 26px);
  line-height: 1.3;
  overflow-wrap: anywhere;
  break-inside: avoid;
}

/* A new answer has a red ring that fades. */
.bubble.is-new {
  animation: fresh 2.6s ease-out;
}

@keyframes fresh {
  from {
    box-shadow: 0 0 0 5px var(--red);
  }

  to {
    box-shadow: 0 0 0 5px rgb(216 40 40 / 0);
  }
}

.slide-closing {
  justify-content: center;
}

.closing {
  max-width: 17em;
  font-family: var(--font-display);
  font-size: clamp(34px, 5.4vw, 108px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.03;
  text-wrap: balance;
}

.results-bar {
  position: fixed;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: var(--bar-height);
  padding: 8px clamp(20px, 5vw, 96px);
  border-top: 1px solid var(--grey5);
  background: var(--black);
}

.results-bar .lockup {
  --lockup-height: calc(var(--bar-height) - 30px);
}

.results-status {
  color: var(--grey3);
  font-size: clamp(14px, 1.2vw, 20px);
  text-align: center;
}

.results-status.is-stale {
  color: var(--white);
  font-weight: 700;
}

/* Red and pulsing while the quiz accepts answers, grey when it does not. */
.live-dot {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.6em;
  border-radius: 50%;
  background: var(--grey5);
  vertical-align: 0.05em;
}

.results-status.is-live .live-dot {
  background: var(--red);
  animation: live 2s ease-out infinite;
}

@keyframes live {
  from {
    box-shadow: 0 0 0 0 rgb(216 40 40 / 0.7);
  }

  to {
    box-shadow: 0 0 0 0.65em rgb(216 40 40 / 0);
  }
}

.participants {
  display: inline-block;
}

.participants.is-bumped {
  animation: bump 0.5s var(--ease);
}

/* The link back to the quiz is for a participant who looks at the results on
   a phone. The projector does not show it. */
.results-back {
  display: none;
  font-size: 15px;
}

.results-join {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  color: var(--grey3);
  font-size: clamp(14px, 1.2vw, 20px);
  line-height: 1.25;
  text-align: right;
}

.results-join strong {
  color: var(--white);
  overflow-wrap: anywhere;
}

.qr-small {
  flex: none;
  width: calc(var(--bar-height) - 16px);
}

@media (max-width: 760px) {
  .results-bar {
    grid-template-columns: 1fr auto;
  }

  .results-bar .lockup,
  .results-join {
    display: none;
  }

  .results-back {
    display: inline;
  }

  .results-status {
    text-align: left;
  }
}

/* Admin */

.admin {
  max-width: 760px;
  margin-inline: auto;
  padding: 32px 20px 72px;
}

.admin h1 {
  font-size: 32px;
}

.admin h2 {
  margin-bottom: 12px;
  font-size: 21px;
}

.admin-login {
  max-width: 400px;
}

.admin-login h1 {
  margin-bottom: 24px;
}

.stack {
  display: grid;
  gap: 10px;
}

.stack .button {
  margin-top: 8px;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 24px;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
}

.admin-nav .link-button {
  color: inherit;
}

.notice {
  margin-bottom: 24px;
  padding: 12px 16px;
  border-left: 4px solid var(--black);
  background: var(--grey1);
}

.notice-error {
  border-left-color: var(--red);
}

.panel {
  padding: 24px 0;
  border-top: 1px solid var(--grey3);
}

.panel p + form,
.panel p + table {
  margin-top: 16px;
}

.muted {
  color: var(--grey5);
}

.status {
  font-weight: 700;
}

.status::before {
  display: inline-block;
  width: 0.65em;
  height: 0.65em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: var(--grey4);
  content: '';
}

.status-open::before {
  background: var(--olive30);
}

.count-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.count-table th,
.count-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--grey2);
  text-align: left;
  vertical-align: top;
}

.count-table th {
  color: var(--grey5);
  font-weight: 400;
}

.count-table th:last-child,
.count-table td:last-child {
  padding-left: 16px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.danger {
  margin-top: 20px;
}

.danger summary {
  color: var(--red);
  font-weight: 700;
  cursor: pointer;
}

.danger p {
  margin: 12px 0 16px;
}

.moderation {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.moderation li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--grey2);
}

.moderation p {
  padding: 10px 0;
  overflow-wrap: anywhere;
}

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