/* Legion intake. One question at a time. */

:root {
  color-scheme: dark;
  --paper: #000;
  --ink: #fff;
  --muted: #9a9a9a;
  --line: #333;
  --error: #ff8d84;
  --size-display: clamp(1.875rem, 1.05rem + 2.5vw, 3rem);
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --measure: 40rem;
  --font: "Inter Tight", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; }

html, body { background: var(--paper); min-height: 100%; }

body {
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

.frame {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding:
    max(var(--gutter), env(safe-area-inset-top))
    max(var(--gutter), env(safe-area-inset-right))
    max(var(--gutter), env(safe-area-inset-bottom))
    max(var(--gutter), env(safe-area-inset-left));
}

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

footer { justify-content: flex-end; }

.wordmark,
.lockup {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  width: max-content;
  line-height: 1;
  text-decoration: none;
  color: inherit;
}

.wordmark {
  font-size: 2rem;
}

.mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.4em;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.wordmark img,
.lockup img {
  width: auto;
  height: 1.25em;
  display: block;
  transform: translateY(-0.11em);
}

.motto {
  width: 0;
  min-width: 100%;
  margin-top: 0.72em;
  overflow: hidden;
  font-size: 0.36em;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
}

.motto span {
  display: inline-block;
  white-space: nowrap;
}

.intro { display: none; }

html.intro-pending .wordmark,
html.intro-pending .nav,
html.intro-pending .menu-toggle,
html.intro-pending main,
html.intro-pending footer,
html.intro-pending .more {
  opacity: 0;
}

html.intro-pending .menu-toggle { pointer-events: none; }

html.intro-pending .intro {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: 5;
  background: var(--paper);
}

.lockup {
  position: relative;
  font-size: min(10vw, 17vh);
  will-change: transform;
}

.lockup .mark { gap: 0; }

.intro .motto {
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
  max-height: none;
  opacity: 0;
}

html.intro-expand .intro .motto {
  opacity: 1;
  transition: opacity 0.85s ease 0.08s;
}

.intro .motto span {
  letter-spacing: 0;
  transition: letter-spacing 1s cubic-bezier(0.22, 1, 0.36, 1);
}

html.intro-expand .intro .motto span {
  letter-spacing: var(--motto-track, 0px);
}

.intro .lockup-word {
  display: grid;
  grid-template-columns: 0fr;
  opacity: 0;
  transition:
    grid-template-columns 1s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.8s ease;
}

.lockup-word span {
  overflow: hidden;
  min-width: 0;
  padding: 0.18em 0.2em 0.22em 0.4em;
  margin: 0 -0.2em -0.22em 0;
  white-space: nowrap;
}

html.intro-expand .intro .lockup-word {
  grid-template-columns: 1fr;
  opacity: 1;
}

html.intro-pending .intro {
  transition: background-color 0.9s ease;
}

html.intro-reveal .intro {
  background: transparent;
  pointer-events: none;
}

html.intro-reveal .nav,
html.intro-reveal .menu-toggle,
html.intro-reveal main,
html.intro-reveal footer,
html.intro-reveal .more {
  animation: settle 1.15s ease both;
}

html.intro-reveal main { animation-delay: 0.05s; }
html.intro-reveal .nav,
html.intro-reveal .menu-toggle,
html.intro-reveal footer,
html.intro-reveal .more { animation-delay: 0.28s; }

@keyframes settle {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html.intro-reveal .nav,
  html.intro-reveal .menu-toggle,
  html.intro-reveal main,
  html.intro-reveal footer,
  html.intro-reveal .more { animation: none; }
}

.nav { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: flex-end; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.menu-check {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 641px) {
  .menu-check { display: none; }
}

.menu-toggle {
  display: none;
  position: relative;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.menu-bars,
.menu-bars::before,
.menu-bars::after {
  display: block;
  width: 1.25rem;
  height: 1px;
  background: currentColor;
}

.menu-bars { position: relative; }

.menu-bars::before,
.menu-bars::after {
  content: "";
  position: absolute;
  left: 0;
  transition: transform 0.2s ease, top 0.2s ease;
}

.menu-bars::before { top: -0.4rem; }
.menu-bars::after { top: 0.4rem; }

.menu-check:focus-visible + .menu-toggle {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

.menu-check:checked + .menu-toggle .menu-bars { background: transparent; }

.menu-check:checked + .menu-toggle .menu-bars::before {
  top: 0;
  transform: rotate(45deg);
}

.menu-check:checked + .menu-toggle .menu-bars::after {
  top: 0;
  transform: rotate(-45deg);
}

.menu {
  display: none;
}

.menu a {
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(1.85rem, 8vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.menu a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.menu a.menu-mail {
  margin-top: auto;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  width: 100%;
}

.more {
  padding:
    0.25rem
    max(var(--gutter), env(safe-area-inset-right))
    max(var(--gutter), env(safe-area-inset-bottom))
    max(var(--gutter), env(safe-area-inset-left));
}

.more p {
  max-width: 38rem;
  margin-inline: auto;
}

.more p + p { margin-top: 0.75rem; }

.thesis a,
.page a,
.more a { text-underline-offset: 0.18em; }

.quiet { color: var(--muted); text-decoration: none; }
a.quiet:hover, button.quiet:hover { color: var(--ink); }

main {
  display: grid;
  align-content: center;
  padding-block: 3rem;
}

main:has(.done:not([hidden])) {
  align-content: start;
  padding-block: 2.5rem 3rem;
}

main:has([data-thesis]:not([hidden])),
main:has(.page) {
  align-content: start;
  padding-block: 2.5rem 3rem;
}

.thesis,
.page {
  width: 100%;
  max-width: 32rem;
  justify-self: center;
  margin-inline: auto;
}

.thesis h1,
.page h1 {
  font-size: clamp(2rem, 1.2rem + 2.2vw, 2.75rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.thesis .lead,
.page .lead {
  margin-top: 1.15rem;
  font-size: 1.3125rem;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.beat { margin-top: 2.75rem; }

.beat h2 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.beat p,
.ways p,
.work {
  line-height: 1.55;
}

.beat p { margin-top: 0.7rem; }
.beat p + p { margin-top: 0.9rem; }

.work {
  margin-top: 1rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.7rem;
}

.work strong { font-weight: 600; }

.work li::marker { color: var(--muted); }

.fold summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.fold summary h2 { margin: 0; }

.fold summary::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  margin-top: -0.2rem;
  flex: none;
}

.fold[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 0.15rem;
}

.ways {
  margin-top: 1.35rem;
  display: grid;
  gap: 1.6rem;
}

.ways h3 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.ways p { margin-top: 0.3rem; }

.faq {
  margin-top: 1.25rem;
  display: grid;
  gap: 1.25rem;
}

.faq h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.faq p { margin-top: 0.35rem; }

.specialties {
  margin-top: 2rem;
  display: grid;
  gap: 0.9rem;
  padding: 0;
  list-style: none;
}

.specialties li { display: grid; gap: 0.15rem; }
.specialties span { color: var(--muted); }

.thesis:not([hidden]) + form { margin-top: 3.25rem; }

.step {
  width: 100%;
  max-width: var(--measure);
  justify-self: center;
  margin-inline: auto;
}
.step[hidden] { display: none; }

.count {
  color: var(--muted);
  margin-bottom: 1rem;
  font-variant-numeric: tabular-nums;
}

.question {
  font-size: var(--size-display);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.field {
  margin-top: 2.25rem;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.field:focus-within { border-bottom-color: var(--ink); }

.field input,
.field textarea {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  font: inherit;
  font-size: var(--size-display);
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: var(--ink);
  caret-color: var(--ink);
  background: none;
  border: 0;
  outline: none;
  padding: 0 0 0.45rem;
  resize: none;
  overflow: hidden;
}

.suggest-slot {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  display: grid;
}

.suggest,
.field .suggest-slot textarea {
  grid-area: 1 / 1;
  width: 100%;
  flex: none;
}

.suggest {
  color: var(--muted);
  font-size: var(--size-display);
  line-height: 1.25;
  letter-spacing: -0.03em;
  padding: 0 0 0.45rem;
  pointer-events: none;
  text-wrap: balance;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.suggest.is-out {
  opacity: 0;
  transform: translateY(0.3rem);
}

.suggest-slot.has-text .suggest { display: none; }

.next {
  font-size: var(--size-display);
  line-height: 1.25;
  padding-bottom: 0.45rem;
  color: var(--muted);
}

.field:focus-within .next,
.next:hover { color: var(--ink); }

.below {
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
}

.below .error { color: var(--error); }

.hint { margin-top: 0.75rem; color: var(--muted); }
.hint.error { color: var(--error); }

.choices {
  margin-top: 2rem;
  display: grid;
  gap: 0.5rem;
}

.choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  cursor: pointer;
}

.choice:hover { border-color: #6a6a6a; }

.choice:has(input:checked) {
  border-color: var(--ink);
  background: #141414;
}

.choice input { accent-color: var(--ink); width: 1rem; height: 1rem; }

.choice .text { display: grid; gap: 0.15rem; }
.choice .what { color: var(--muted); font-size: 0.95rem; }

.choice:has(input:focus-visible) {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

.toggle {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
}

.toggle label {
  cursor: pointer;
  color: var(--muted);
  font-size: var(--size-display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.toggle label + label::before {
  content: "/";
  margin-right: 0.85rem;
  color: #3a3a3a;
  font-weight: 400;
}

.toggle label:hover { color: var(--ink); }

.toggle label:has(input:checked) { color: var(--ink); }

.toggle span {
  display: inline-block;
  border-bottom: 1px solid transparent;
  padding-bottom: 0.08em;
}

.toggle label:has(input:checked) span { border-bottom-color: currentColor; }

.toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

.toggle label:has(input:focus-visible) span {
  outline: 1px solid var(--ink);
  outline-offset: 6px;
}

.step:has(.toggle) .question {
  margin-top: 2rem;
  font-size: clamp(1.35rem, 0.9rem + 1.2vw, 1.75rem);
}

.step .lead {
  margin-top: 0.65rem;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.4;
}

kbd {
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
}

.step-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.continue {
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.55rem 1rem;
}

.continue:disabled { opacity: 0.35; cursor: default; }

.send {
  margin-left: auto;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1;
}

.send:disabled { opacity: 0.35; cursor: default; }

.drop {
  position: relative;
  margin-top: 1.75rem;
  min-height: 6.5rem;
  display: grid;
  place-items: center;
  padding: 1.35rem 1.25rem;
  border: 1px solid #3a3a3a;
  border-radius: 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.drop:hover,
.drop.is-over,
.drop:focus-within,
.drop.has-file { border-color: var(--ink); }

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

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

.drop.has-file .drop-input { pointer-events: none; }

.drop-copy {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  max-width: 100%;
  pointer-events: none;
}

.drop-title {
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.drop-types {
  color: var(--muted);
  font-size: 0.95rem;
}

.drop-title[hidden],
.drop-picked[hidden] { display: none; }

.drop-picked {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.35rem 1rem;
  max-width: 100%;
  color: var(--ink);
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  line-height: 1.25;
  pointer-events: auto;
}

.drop-picked span {
  overflow-wrap: anywhere;
}

.done p { margin-top: 1.25rem; max-width: 32rem; }

.done .lead { margin-top: 0.85rem; }

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 640px) {
  kbd { display: none; }

  header {
    position: relative;
    z-index: 41;
    align-items: flex-start;
    justify-content: space-between;
  }

  .wordmark {
    align-items: flex-start;
    font-size: 1.6rem;
  }

  .nav,
  footer { display: none; }

  .menu-check { display: block; }

  .wordmark,
  .menu-toggle { position: relative; z-index: 2; }

  .menu-toggle {
    display: inline-flex;
    margin-top: 0.1rem;
  }

  .menu-check:checked ~ .menu {
    display: flex;
    position: fixed;
    z-index: 1;
    inset: 0;
    flex-direction: column;
    gap: 1.35rem;
    background: var(--paper);
    padding:
      7.5rem
      max(var(--gutter), env(safe-area-inset-right))
      max(var(--gutter), env(safe-area-inset-bottom))
      max(var(--gutter), env(safe-area-inset-left));
  }

  html:has(.menu-check:checked) { overflow: hidden; }

  main { padding-block: 2.25rem 1.75rem; }

  .field {
    margin-top: 1.75rem;
    gap: 0.75rem;
  }

  .choices { margin-top: 1.5rem; }

  .choice {
    padding: 0.8rem 0.85rem;
    gap: 0.7rem;
  }

  .step .lead { font-size: 1.05rem; }

  .drop { min-height: 5.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .suggest, .drop, .menu-bars::before, .menu-bars::after { transition: none; }
}
