/* Experience & Curiosity - styles adapted from the approved prototype.
   Mobile first: large tap targets, single column below 44rem, no fixed widths.
   Purple is the brand colour; the four comparison colours stay semantic
   (green = mutual interest, amber = discuss, red = limit, grey = no answer). */

:root {
  color-scheme: light;
  --ink: #221a2f;
  --muted: #5f5471;
  --brand: #5a2d8f;
  --brand-deep: #2c1745;
  --brand-mid: #7b4cc0;
  --brand-soft: #ece4f8;
  --paper: #ded2ee;
  --surface: #fbf9fe;
  --white: #fff;
  --line: #ddd3ea;
  --gold: #f6ead1;
  --amber: #fbefcb;
  --amber-ink: #654a12;
  --red: #fae2e4;
  --red-ink: #7d2428;
  --neutral: #e9e5ee;
  --neutral-ink: #4b4457;
  font: 16px/1.48 system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

h1, h2, h3, h4, p { margin: 0; }
h1, h2 { line-height: 1.12; letter-spacing: -0.035em; }
h1 { font-size: clamp(2rem, 5vw, 3.125rem); font-weight: 680; }
h2 { font-size: 1.55rem; font-weight: 680; }
h3 { font-size: 1.06rem; }
p + p { margin-top: 0.5rem; }
strong { font-weight: 680; }

.wrap { width: min(100% - 2rem, 66rem); margin-inline: auto; }

.bar { background: var(--brand-deep); color: white; flex: none; }
.bar .wrap {
  min-height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 680;
  line-height: 1.18;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid #cbb8e6;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--brand-deep);
  background: #b79ce0;
  flex: none;
}
.bar button { color: #fff; border-color: #8e6fb5; background: transparent; }
.bar-tools { display: flex; align-items: center; gap: 0.6rem; }

.page-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; }
main { padding-block: 2rem 3rem; }

button, select, input, textarea { font: inherit; color: inherit; }
button, a.action {
  min-height: 2.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.58rem 0.85rem;
  border: 1px solid #b6a8c9;
  border-radius: 0.65rem;
  background: var(--surface);
  font-weight: 650;
  cursor: pointer;
  text-align: center;
  line-height: 1.18;
  text-decoration: none;
}
button.primary { background: var(--brand); border-color: var(--brand); color: white; }
button.quiet { background: transparent; }
button.danger { border-color: #d9b3b6; color: var(--red-ink); }
button:disabled { opacity: 0.55; cursor: default; }
button:hover:not(:disabled), a.action:hover { box-shadow: inset 0 0 0 1px currentColor; }
:focus-visible { outline: 3px solid var(--brand-mid); outline-offset: 3px; }
/* Headings receive focus after navigation so screen readers announce the new
   screen; that programmatic focus should not draw a ring on every page change. */
h1:focus,
h1:focus-visible { outline: none; }
a { color: var(--brand); }

select, input:not([type='radio']), textarea {
  width: 100%;
  min-height: 2.8rem;
  border: 1px solid #b6a8c9;
  border-radius: 0.65rem;
  background: var(--surface);
  padding: 0.55rem 0.7rem;
}
label.field { display: grid; gap: 0.35rem; font-weight: 650; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { font-weight: 680; margin-bottom: 0.55rem; padding: 0; }

.muted, .small { color: var(--muted); }
.small { font-size: 0.875rem; }

.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-bottom: 1.65rem;
}
.hero p { margin-top: 0.55rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }
.stack { display: grid; gap: 1rem; }
.grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(15rem, 1fr); gap: 1rem; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(0.95rem, 4vw, 1.45rem); }

/* Disclosures (Partnership, Advanced): the summary is the card header. */
.disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:focus-visible { outline: 3px solid var(--brand-mid); outline-offset: 4px; border-radius: 0.5rem; }
.disclosure-title { font-size: 1.35rem; font-weight: 680; letter-spacing: -0.02em; }
.disclosure-card h1 { font-size: clamp(1.35rem, 4vw, 1.7rem); font-weight: 680; }
.disclosure > summary h1:focus { outline: none; }
.chev {
  width: 0.7rem;
  height: 0.7rem;
  border-right: 2.5px solid var(--brand);
  border-bottom: 2.5px solid var(--brand);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  flex-shrink: 0;
  margin-right: 0.25rem;
}
.disclosure[open] > summary .chev { transform: rotate(225deg); }
.disclosure-body { display: grid; gap: 0.9rem; margin-top: 1rem; }
.category-progress { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.category-progress li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.category-progress .counts { color: var(--muted); font-variant-numeric: tabular-nums; }
.section {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.85rem;
}
.partner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}
.partner:last-child { padding-bottom: 0; }
.avatar {
  display: grid;
  place-items: center;
  width: 2.55rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 680;
}
.partner h3 { overflow-wrap: anywhere; }
.pill {
  display: inline-block;
  border-radius: 2rem;
  background: var(--brand-soft);
  color: var(--brand-deep);
  padding: 0.22rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 680;
  line-height: 1.25;
}
.pill.pending { background: var(--gold); color: #624c26; }
.pill.ok { background: #def0e4; color: #1d5038; }
.profile-stats { margin: 0.75rem 0 1rem; display: grid; gap: 0.55rem; }
.profile-stats div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.55rem; }
.profile-stats dd, .profile-stats dt { margin: 0; }
.profile-stats dd { font-weight: 650; text-align: right; }
.feature { display: grid; gap: 0.8rem; }
.tinted { background: var(--brand-soft); }
.narrow { max-width: 43rem; margin-inline: auto; }
.panel { display: grid; gap: 1rem; }

/* --- question header: category, progress, then the question ------------- */
.q-top { margin-bottom: 0.9rem; }
.q-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.5rem;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.q-category {
  font-size: 0.78rem;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}
.q-count { font-weight: 650; font-size: 0.95rem; }
.q-question { margin-bottom: 1rem; }
.q-question h1 { font-size: clamp(1.7rem, 4.6vw, 2.4rem); }
.q-icon { display: block; width: 2.6rem; height: 2.6rem; margin-bottom: 0.45rem; }
.q-question .muted { margin-top: 0.45rem; }
.q-question .small { margin-top: 0.45rem; }
.row-icon { vertical-align: -0.2em; opacity: 0.9; }

.choice-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.48rem; }
.choice-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-row.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: grid;
  place-items: center;
  min-height: 3rem;
  padding: 0.35rem 0.25rem;
  border: 1px solid #b6a8c9;
  border-radius: 0.65rem;
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  font-weight: 650;
  line-height: 1.2;
}
.choice input:checked + span { background: var(--brand); color: white; border-color: var(--brand); }
.choice input:focus-visible + span { outline: 3px solid var(--brand-mid); outline-offset: 3px; }
/* Hard No: full width and red, so a limit can be recorded in one tap and never
   looks like the ordinary No beside it. */
.choice.hard-no { grid-column: 1 / -1; }
.choice.hard-no span { border-color: #c88f93; background: var(--red); color: var(--red-ink); }
.choice.hard-no input:checked + span { background: #b3261e; border-color: #b3261e; color: white; }
.role-block { display: grid; gap: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }
.role-block:first-of-type { border-top: 0; padding-top: 0; }
.rating-guide { margin-top: 0.48rem; color: var(--muted); font-size: 0.875rem; }
.progress { display: block; width: 100%; height: 0.55rem; accent-color: var(--brand); margin-top: 0.3rem; }

.rows { list-style: none; margin: 0; padding: 0; }
.review-row {
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
}
.review-row button { flex-shrink: 0; }
.invite-row .actions { justify-content: end; }

.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem 1rem; margin-top: 0.65rem; }
.compare p { overflow-wrap: anywhere; }
/* One header for both names; every row below is nameless. */
.compare-head {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
  margin-top: 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
  font-weight: 680;
}
.compare-head span { overflow-wrap: anywhere; }
.compare .direction { font-size: 0.78rem; font-weight: 680; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.15rem; }
.match { border: 1px solid var(--line); border-radius: 0.7rem; padding: 0.7rem 0.75rem; }
.match-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.65rem;
}
.match h4 { font-size: 0.94rem; line-height: 1.25; }
.match-heading p.small { margin-top: 0.1rem; color: var(--muted); }
.match-status {
  display: inline-block;
  max-width: 100%;
  border-radius: 1rem;
  padding: 0.24rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
}
.match-status.compatible { background: #def0e4; color: #1d5038; }
.match-status.discuss { background: var(--amber); color: var(--amber-ink); }
.match-status.incompatible { background: var(--red); color: var(--red-ink); }
.match-status.unanswered { background: var(--neutral); color: var(--neutral-ink); }

.sticky-actions {
  /* Pinned to the bottom of the window, not to the end of the scroll: the three
     navigation buttons stay reachable however long the question is. */
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--paper);
  padding: 0.6rem max(0.75rem, calc(50vw - 21.5rem));
  padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  margin-top: 0;
}
.sticky-actions button { flex: 1 1 auto; }
/* Room for the pinned bar so the last card is never hidden behind it. */
.narrow.has-action-bar { padding-bottom: 5.75rem; }
/* The page footer no longer holds the bar, so give the dialog room to breathe. */

.status { min-height: 1.4rem; }
.save-state { font-size: 0.8rem; color: #d9c9f0; border-color: transparent; background: transparent; padding: 0; min-height: 0; }
.save-state.error { color: #ffd9db; }
.save-state button { min-height: 0; padding: 0.15rem 0.4rem; font-size: 0.8rem; color: #fff; border-color: #a98c8e; }

.notice {
  border: 1px solid #ded0ef;
  background: #f6f2fd;
  border-radius: 0.7rem;
  padding: 0.7rem 0.8rem;
  font-size: 0.9rem;
}
.notice p + p { margin-top: 0.35rem; }
.notice.warn { border-color: #e5d3ab; background: #fdf6e6; }

.kv { display: grid; gap: 0.3rem; font-size: 0.875rem; }
.kv div { display: flex; justify-content: space-between; gap: 1rem; }

.copy-link { display: flex; gap: 0.5rem; }
.copy-link input { min-width: 0; }
.code-badge { font-family: ui-monospace, monospace; font-size: 1.05rem; letter-spacing: 0.08em; font-weight: 680; }

.match-list { display: grid; gap: 0.7rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem; }

footer { margin-top: 1.25rem; color: var(--muted); font-size: 0.85rem; }

dialog {
  width: min(100% - 1.5rem, 34rem);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--ink);
  padding: 1.15rem;
  background: var(--surface);
}
dialog::backdrop { background: #2c174599; }
.auth { max-width: 28rem; }
.dialog-body { display: grid; gap: 1rem; }

.spinner-note { font-size: 0.9rem; color: var(--muted); }

@media (max-width: 44rem) {
  main { padding-top: 1.35rem; }
  .grid { grid-template-columns: 1fr; }
  .hero { align-items: start; margin-bottom: 1.15rem; }
  .hero .actions { width: 100%; }
  .hero .actions button { flex: 1 1 auto; }
  .bar .wrap { min-height: 3.7rem; }
  .invite-row { display: grid; }
  .invite-row .actions { justify-content: start; }
}

@media (max-width: 23rem) {
  .wrap { width: calc(100% - 1.25rem); }
  .partner { grid-template-columns: auto minmax(0, 1fr); }
  .partner button { grid-column: 2; justify-self: start; }
  .choice-row { gap: 0.3rem; }
  .choice span { font-size: 0.875rem; }
  .bar button { padding-inline: 0.55rem; }
  .compare { grid-template-columns: 1fr; }
}

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