@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

:root {
  --ink: #172126;
  --ink-muted: #536167;
  --paper: #ffffff;
  --canvas: #f5f7f6;
  --rule: #d6ddda;
  --rule-strong: #aeb9b5;
  --accent: #8b1e3f;
  --accent-dark: #67132d;
  --selection: #086f68;
  --selection-soft: #e5f4f1;
  --focus: #b7791f;
  --error: #a12622;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  max-width: 100%;
  overflow-x: clip;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  letter-spacing: 0;
}

html.progressive-active {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  min-height: 100vh;
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  background: var(--paper);
}

body.intro-active {
  background: #fafaf7;
  color: #0f0f0f;
  font-family: 'IBM Plex Sans', -apple-system, system-ui, sans-serif;
  font-feature-settings: "ss01", "cv05";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.matrix-scroll:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 70%, white);
  outline-offset: 3px;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

mark {
  background: #f8e9a7;
  color: inherit;
  padding: 0.05em 0.2em;
}

.survey-logo-header {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(16px, 2.4vw, 24px) 32px 0;
}

.institution-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 32px);
}

.institution-logos img {
  display: block;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.logo-mit { height: 38px; }
.logo-harvard { height: 46px; }
.logo-northwestern { height: 30px; }

.page {
  width: 100%;
}

.page-inner {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.matrix-heading h1,
.status-inner h1 {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 500;
  line-height: 1.12;
}

.stage {
  display: grid;
  min-height: calc(100vh - 78px);
  grid-template-rows: auto 1fr auto;
}

.stage-body {
  display: grid;
  place-items: center;
  padding: 64px 32px;
}

.stage-card {
  width: 100%;
  max-width: 640px;
}

.identity-card {
  max-width: 560px;
}

.identity-card h1 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 500;
  line-height: 1.15;
}

.identity-card > p {
  margin: 0 0 28px;
  color: var(--ink-muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

#prolific-id-form {
  display: grid;
  gap: 10px;
}

#prolific-id-form label {
  font-weight: 700;
}

#prolific-id-input {
  width: 100%;
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: white;
  color: var(--ink);
}

#prolific-id-input:focus {
  border-color: var(--selection);
  outline: 3px solid var(--selection-soft);
}

#prolific-id-input[aria-invalid="true"] {
  border-color: var(--error);
}

.identity-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.consent {
  --consent-copy-width: 684px;
  width: 100%;
  max-width: min(1120px, calc(100vw - 64px));
}

.consent > h1 {
  margin: 0 0 24px;
  color: #0f0f0f;
  font-family: 'Fraunces', 'Playfair Display', Georgia, serif;
  font-size: clamp(30.6px, 3vw, 39.6px);
  font-variation-settings: "opsz" 48;
  font-weight: 400;
  line-height: 1.14;
}

.consent__layout {
  display: grid;
  grid-template-columns: minmax(0, var(--consent-copy-width)) auto;
  align-items: stretch;
  gap: clamp(16px, 2.5vw, 32px);
}

.consent__copy {
  display: flex;
  min-width: 0;
}

.consent .prose {
  max-width: none;
  color: #0f0f0f;
  font-family: 'IBM Plex Sans', -apple-system, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.62;
}

.consent .prose p {
  margin: 0;
}

.consent .prose p + p {
  margin-top: 16px;
}

.key-term {
  padding: 0 0.18em;
  border-radius: 3px;
  background: rgba(45, 74, 43, 0.08);
  color: #2d4a2b;
  font-weight: 650;
}

.key-term--negative {
  background: #f9e2e2;
  color: #7a2727;
}

.intro-active a {
  color: #2d4a2b;
}

.consent__study-lead {
  padding-top: 8px;
  color: #3a3a3a;
}

.consent__honesty-points {
  display: grid;
  gap: 10px;
  margin: 10px 0 0;
  padding-left: 24px;
}

.consent__honesty-points li {
  padding-left: 3px;
}

.consent__study-lead strong {
  color: #0f0f0f;
  font-weight: 700;
}

.consent__visual {
  position: relative;
  align-self: start;
  width: min(280px, 100%);
  height: auto;
  max-width: 280px;
  aspect-ratio: 9 / 16;
  margin: 0;
  overflow: hidden;
  border: 1px solid #c9c7bf;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(31, 38, 28, 0.18);
}

.consent__visual::after {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32);
  content: "";
  pointer-events: none;
}

.consent__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.consent__play-cue {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(246, 246, 241, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.consent__visual:hover .consent__play-cue,
.consent__visual:focus-within .consent__play-cue {
  transform: translate(-50%, -50%) scale(1.04);
}

.consent__play-cue:focus-visible {
  outline: 3px solid rgba(45, 74, 43, 0.2);
  outline-offset: 3px;
}

.consent__visual.is-playing .consent__play-cue {
  opacity: 0.9;
}

.consent__play-icon {
  position: relative;
  display: block;
  width: 32px;
  height: 32px;
}

.consent__play-icon::before {
  position: absolute;
  top: 50%;
  left: 52%;
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 20px solid #2d4a2b;
  content: "";
  transform: translate(-42%, -50%);
}

.consent__visual.is-playing .consent__play-icon::before {
  left: 38%;
  width: 8px;
  height: 28px;
  border: 0;
  border-radius: 2px;
  background: #2d4a2b;
  box-shadow: 15px 0 0 #2d4a2b;
  transform: translate(-50%, -50%);
}

.card__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  max-width: var(--consent-copy-width);
  margin-top: 32px;
  font-size: 17px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  min-height: 44px;
  padding: 12px 24px;
  border: 1px solid #2d4a2b;
  border-radius: 2px;
  background: #2d4a2b;
  color: #f6f6f1;
  font-family: 'IBM Plex Sans', -apple-system, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn:hover {
  border-color: #1f3620;
  background: #1f3620;
}

.btn--ghost {
  border-color: #e0dfd9;
  background: transparent;
  color: #3a3a3a;
}

.btn--ghost:hover {
  border-color: #0f0f0f;
  background: transparent;
  color: #0f0f0f;
}

.fade-in {
  animation: intro-fade-in 360ms cubic-bezier(0.2, 0, 0, 1) both;
}

@keyframes intro-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.button {
  min-height: 46px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 700;
  cursor: pointer;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.button-primary:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.button-secondary {
  border-color: var(--rule-strong);
  background: white;
  color: var(--ink);
}

.matrix-page {
  padding: 38px 0 64px;
}

.matrix-heading {
  margin-bottom: 24px;
}

.matrix-instructions {
  display: grid;
  gap: 13px;
  max-width: 980px;
  color: var(--ink-muted);
  font-size: 0.96rem;
  line-height: 1.52;
}

.matrix-instructions p {
  margin: 0;
}

.matrix-instructions__lead {
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 700;
}

.matrix-instructions mark {
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.matrix-comprehension {
  display: grid;
  gap: 12px;
  max-width: 760px;
  margin: 22px 0 0;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.matrix-comprehension legend {
  padding: 0;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 750;
}

.matrix-comprehension__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.matrix-comprehension__choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 104px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: white;
  font-weight: 650;
  cursor: pointer;
}

.matrix-comprehension__choice:hover {
  background: #f3f7f5;
}

.matrix-comprehension__choice:has(input:checked) {
  border-color: var(--selection);
  background: var(--selection-soft);
  box-shadow: inset 0 0 0 1px var(--selection);
}

.matrix-comprehension__choice input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--selection);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.matrix-heading h1 {
  max-width: 920px;
  margin-bottom: 16px;
  font-size: 2rem;
}

.matrix-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  color: var(--ink-muted);
}

.matrix-meta--progress-only {
  margin-top: 16px;
}

.matrix-meta p {
  margin: 0;
}

.answer-progress {
  flex: 0 0 auto;
  margin-left: auto !important;
  color: var(--selection);
  font-weight: 750;
}

.matrix-scroll {
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  background: white;
  scrollbar-color: var(--rule-strong) transparent;
}

.comfort-matrix {
  width: min(1180px, calc(100% - 40px));
  min-width: 940px;
  margin: 0 auto;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.comfort-matrix th,
.comfort-matrix td {
  border-bottom: 1px solid var(--rule);
}

.comfort-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 76px;
  padding: 12px 10px;
  background: #eef1ef;
  color: #39464b;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
  vertical-align: middle;
}

.comfort-matrix thead .category-column {
  z-index: 4;
  width: 46%;
  padding-left: 18px;
  text-align: left;
}

.comfort-matrix tbody tr:nth-child(even) th,
.comfort-matrix tbody tr:nth-child(even) td {
  background: #fafbfa;
}

.comfort-matrix tbody tr:hover th,
.comfort-matrix tbody tr:hover td {
  background: #f3f7f5;
}

.progressive-row--revealing {
  animation: matrix-row-reveal 280ms cubic-bezier(0.2, 0, 0, 1) backwards;
}

@keyframes matrix-row-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.category-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 46%;
  min-height: 96px;
  padding: 16px 24px 16px 18px;
  background: white;
  text-align: left;
  vertical-align: middle;
  box-shadow: 1px 0 0 var(--rule);
}

.category-name {
  display: inline;
  max-width: 100%;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.category-examples {
  display: block;
  max-width: 520px;
  margin-top: 7px;
  color: var(--ink-muted);
  font-size: 0.84rem;
  font-weight: 450;
  line-height: 1.4;
}

.rating-cell {
  height: 96px;
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.radio-target {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 96px;
  cursor: pointer;
}

.radio-target:hover {
  background: var(--selection-soft);
}

.radio-target input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--selection);
  cursor: pointer;
}

.rating-cell:has(input:checked) {
  background: var(--selection-soft) !important;
  box-shadow: inset 0 0 0 2px var(--selection);
}

.comfort-matrix tr.is-missing .category-cell {
  box-shadow: inset 4px 0 0 var(--error), 1px 0 0 var(--rule);
}

.matrix-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  padding-top: 24px;
}

.form-error {
  margin: 0 auto 0 0;
  color: var(--error);
  font-weight: 700;
}

.submit-button {
  min-width: 170px;
}

.views-page {
  padding: 38px 0 72px;
}

.views-heading {
  position: relative;
  margin-bottom: 20px;
}

.views-heading h1 {
  max-width: 760px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.12;
}

.views-progress {
  position: absolute;
  right: 0;
  bottom: 2px;
  margin: 0 !important;
}

.view-estimate-list {
  max-width: 960px;
}

.view-estimate-item {
  padding: 28px 0 30px;
  border-top: 1px solid var(--rule-strong);
}

.view-estimate-item:last-child:not([hidden]) {
  border-bottom: 1px solid var(--rule-strong);
}

.view-estimate-item--revealing {
  animation: matrix-row-reveal 280ms cubic-bezier(0.2, 0, 0, 1) backwards;
}

.view-estimate-form {
  display: grid;
  gap: 18px;
}

.view-estimate-form h2 {
  max-width: 900px;
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.48;
}

.view-content-type {
  display: grid;
  gap: 6px;
  padding: 14px 18px;
  border-left: 4px solid var(--selection);
  background: #f3f7f5;
}

.view-content-type strong {
  font-size: 1rem;
}

.view-content-type span {
  color: var(--ink-muted);
  font-size: 0.88rem;
  line-height: 1.42;
}

.views-response {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.views-input {
  width: min(100%, 18rem);
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: white;
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 650;
}

.views-input:focus {
  border-color: var(--selection);
  box-shadow: 0 0 0 3px var(--selection-soft);
  outline: 0;
}

.views-input:disabled {
  background: #f4f6f5;
  color: var(--ink);
  opacity: 1;
}

.views-suffix {
  color: var(--ink-muted);
  font-size: 1.08rem;
  font-weight: 650;
}

.views-error {
  margin: -8px 0 0;
  color: var(--error);
  font-weight: 650;
}

.view-estimate-actions {
  display: flex;
  justify-content: flex-end;
}

.view-submit {
  min-width: 160px;
}

.feedback-page {
  padding: 56px 0 80px;
}

.feedback-inner {
  max-width: 900px;
}

#feedback-form {
  display: grid;
  gap: 20px;
}

#feedback-form label {
  max-width: 820px;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1.25;
}

#feedback-response {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  padding: 14px 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: white;
  color: var(--ink);
  line-height: 1.5;
}

#feedback-response:focus {
  border-color: var(--selection);
  box-shadow: 0 0 0 3px var(--selection-soft);
  outline: 0;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
}

.completion-card {
  max-width: 640px;
}

.completion-card h1 {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 500;
  line-height: 1.12;
}

.completion-message {
  margin: 0;
  color: var(--ink-muted);
  font-size: 1.04rem;
  line-height: 1.55;
}

.completion-code {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  margin: 28px 0;
  padding: 18px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: #f0f7f0;
}

.completion-code span {
  grid-column: 1 / -1;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.completion-code strong {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 2rem;
  letter-spacing: 0;
}

.completion-actions {
  display: flex;
  justify-content: flex-end;
}

.completion-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.status-inner {
  padding: 80px 0;
  text-align: center;
}

.status-inner p {
  color: var(--ink-muted);
  font-size: 1.08rem;
}

.status-inner .button {
  margin-top: 16px;
}

.loading-status,
.fatal-error {
  margin: 20vh auto;
  padding: 0 20px;
  text-align: center;
}

.fatal-error {
  color: var(--error);
  font-weight: 700;
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 780px) {
  .institution-logos {
    gap: 16px;
  }

  .logo-mit { height: 32px; }
  .logo-harvard { height: 40px; }
  .logo-northwestern { height: 25px; }

  .stage-body {
    padding: 48px 16px;
  }

  .consent {
    max-width: 640px;
  }

  .consent__layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .matrix-heading h1 {
    font-size: 1.82rem;
  }

  .matrix-instructions {
    font-size: 0.93rem;
  }

  .matrix-comprehension__choices {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .matrix-comprehension__choice {
    min-width: 0;
    justify-content: center;
  }

  .views-heading h1 {
    padding-right: 0;
    font-size: 1.82rem;
  }

  .views-progress {
    position: static;
    margin-top: 10px !important;
    text-align: left;
  }

  .consent__visual {
    width: min(100%, 360px);
    height: auto;
    margin: 0 auto;
  }

  .matrix-page {
    padding-top: 28px;
  }

  .matrix-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .comfort-matrix {
    width: 940px;
    margin: 0;
  }

  .comfort-matrix thead .category-column,
  .category-cell {
    width: 250px;
  }

  .category-cell {
    padding-right: 14px;
  }

  .category-examples {
    font-size: 0.78rem;
  }

  .matrix-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .view-estimate-actions .button {
    width: 100%;
  }

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

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

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

@media (max-width: 480px) {
  .page-inner {
    width: min(100% - 28px, 1120px);
  }

  .institution-logos {
    gap: 16px;
  }

  .card__actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .card__actions .btn {
    width: 100%;
  }

  .completion-code {
    grid-template-columns: 1fr;
  }

  .completion-code .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }

  .progressive-row--revealing {
    animation: none;
  }

  .view-estimate-item--revealing {
    animation: none;
  }
}
