/*
 * The New Type A · onboarding styles.
 * Every colour is a custom property. The light values are the theme tokens in
 * contracts/options-v1.json; the dark set is switched on with ?theme=dark.
 */
:root {
  --canvas: #FAF6F0;
  --surface: #FFFFFF;
  --ink: #2B2622;
  --muted: #7A6F66;
  --line: #E7DED3;
  --accent: #B5411F;
  --accent-ink: #FFFFFF;
  --radius: 16px;
  --font: ui-rounded, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --accent-soft: #FBE6DD;
  --accent-text: #B5411F;
  --focus: #2B2622;
  --dot: #D8CDC0;
  --private-bg: #EFE8F5;
  --private-ink: #4B3A63;
  --shared-bg: #E4F0E6;
  --shared-ink: #2F5A38;
  --notice-bg: #FFF3D6;
  --notice-ink: #5E4508;
  --error-bg: #FBE1DC;
  --error-ink: #7A1F0E;
  --group-bg: #F1ECE4;
  --shadow: rgba(43, 38, 34, 0.14);
  --fade-from: rgba(250, 246, 240, 0);
  --placeholder-ink: #4A423B;

  --stack-1: #E8C7A6;
  --stack-2: #C9B8E0;
  --stack-3: #B9D8C2;
  --stack-4: #A9CDD6;
  --stack-5: #F0CF8E;
  --stack-6: #E9B5AC;
  --tint-1: #F6E7D7;
  --tint-2: #ECE5F5;
  --tint-3: #E3F1E7;
  --tint-4: #DDEDF1;
  --tint-5: #FAEED2;
  --tint-6: #F8E2DE;
}

[data-theme="dark"] {
  --canvas: #111111;
  --surface: #1C1C1E;
  --ink: #FFFFFF;
  --muted: #A3A3A8;
  --line: #333336;
  --accent: #F26B43;
  --accent-ink: #1A0D08;

  --accent-soft: #3A1E14;
  --accent-text: #FF9A7A;
  --focus: #FFFFFF;
  --dot: #4A4A4E;
  --private-bg: #2C2438;
  --private-ink: #D9C8F2;
  --shared-bg: #1D2E21;
  --shared-ink: #B5E0BD;
  --notice-bg: #33290F;
  --notice-ink: #F5DFA0;
  --error-bg: #3B1711;
  --error-ink: #FFC2B5;
  --group-bg: #232325;
  --shadow: rgba(0, 0, 0, 0.5);
  --fade-from: rgba(17, 17, 17, 0);
  --placeholder-ink: #E4E4E7;

  --stack-1: #6B4E36;
  --stack-2: #4E416B;
  --stack-3: #36574A;
  --stack-4: #2F5560;
  --stack-5: #6B5626;
  --stack-6: #6B3A36;
  --tint-1: #33271D;
  --tint-2: #29233A;
  --tint-3: #1E2E28;
  --tint-4: #1B2D33;
  --tint-5: #332A14;
  --tint-6: #33201E;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1:focus-visible { outline: none; }

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

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 0 20px 132px; }
.app.is-profile { padding-bottom: 48px; }
.loading { padding: 48px 0; color: var(--muted); }

/* ---------- demo person switcher ---------- */
.people {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.people-label { margin-right: 4px; }
.person {
  min-height: 36px; padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: transparent; color: var(--ink); font-weight: 600; font-size: 14px;
}
.person[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--canvas); }

/* ---------- top bar ---------- */
.topbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; height: 56px; }
.icon-btn {
  width: 44px; height: 44px; margin-left: -10px; border: 0; border-radius: 50%;
  background: transparent; display: grid; place-items: center;
}
.icon-btn svg { width: 24px; height: 24px; stroke: var(--ink); fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[hidden] { display: block; visibility: hidden; }
.dots { display: flex; justify-content: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.dot.is-current { background: var(--ink); width: 22px; border-radius: 999px; }
.dot.is-done { background: var(--muted); }

/* ---------- headline ---------- */
.headline { font-size: 30px; line-height: 1.15; font-weight: 800; letter-spacing: -0.01em; margin-top: 8px; }
.helper { margin-top: 8px; color: var(--muted); font-size: 16px; }
.helper.is-limit { color: var(--accent-text); font-weight: 700; }
.mode-note { margin-top: 6px; font-size: 13px; color: var(--muted); }

.banner { margin-top: 12px; padding: 10px 14px; border-radius: 12px; font-size: 14px; background: var(--notice-bg); color: var(--notice-ink); }
.banner.is-error { background: var(--error-bg); color: var(--error-ink); }

/* ---------- vibe tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 24px; margin-top: 28px; padding-right: 8px; }
.tile { display: block; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; border-radius: 22px; }
.tile-stack { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; }
.tile-back {
  position: absolute; inset: 0; border-radius: 22px; background: var(--stack-color);
  transform: translate(8px, 5px) rotate(4deg); transform-origin: 60% 60%;
}
.tile-img {
  position: absolute; inset: 0; border-radius: 22px; overflow: hidden;
  background: var(--tint-color); box-shadow: 0 6px 16px var(--shadow);
  transition: transform 120ms ease;
}
.tile-img img, .tile-img svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile-placeholder {
  display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 12px;
  color: var(--placeholder-ink); font-size: 11.5px; line-height: 1.35; overflow: hidden;
  border: 1.5px dashed var(--stack-color); border-radius: 22px;
}
.tile-placeholder-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.tile-check {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); display: none; place-items: center;
  box-shadow: 0 0 0 3px var(--canvas);
}
.tile-check svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.tile-label { display: block; margin-top: 14px; font-size: 16px; font-weight: 500; }
.tile[aria-pressed="true"] .tile-img { box-shadow: 0 0 0 3px var(--canvas), 0 0 0 6px var(--accent); }
.tile[aria-pressed="true"] .tile-check { display: grid; }
.tile[aria-pressed="true"] .tile-label { font-weight: 700; }
.tile:active .tile-img { transform: scale(0.98); }
li:nth-child(1) > .tile { --stack-color: var(--stack-1); --tint-color: var(--tint-1); }
li:nth-child(2) > .tile { --stack-color: var(--stack-2); --tint-color: var(--tint-2); }
li:nth-child(3) > .tile { --stack-color: var(--stack-3); --tint-color: var(--tint-3); }
li:nth-child(4) > .tile { --stack-color: var(--stack-4); --tint-color: var(--tint-4); }
li:nth-child(5) > .tile { --stack-color: var(--stack-5); --tint-color: var(--tint-5); }
li:nth-child(6) > .tile { --stack-color: var(--stack-6); --tint-color: var(--tint-6); }
li:nth-child(even) > .tile .tile-back { transform: translate(8px, 5px) rotate(-4deg); }

/* ---------- chips ---------- */
.group { margin-top: 28px; }
.group-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.group-sub { margin-top: 4px; color: var(--muted); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 10px 18px 10px 12px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 16px; font-weight: 500; text-align: left;
}
.chip .check { width: 16px; height: 16px; flex: none; stroke: var(--accent-text); fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }
.chip[aria-pressed="true"] .check { opacity: 1; }
.chip.is-quiet { background: transparent; border-style: dashed; }
.chip.is-quiet[aria-pressed="true"] { border-style: solid; }
.chip.is-disclosure { padding-left: 18px; }
.chip.is-disclosure[aria-expanded="true"] { border-color: var(--ink); }
.divider { height: 1px; background: var(--line); margin: 16px 0 0; }

.card { margin-top: 16px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.card .group-title { font-size: 17px; }
.card-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.hint { margin-top: 14px; font-size: 14px; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.is-private { background: var(--private-bg); color: var(--private-ink); }
.badge.is-shared { background: var(--shared-bg); color: var(--shared-ink); }
.badge.is-plain { background: var(--group-bg); color: var(--muted); }

.disclosure {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  text-align: left; font-size: 17px; font-weight: 700; margin-top: 28px;
}
.disclosure-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.disclosure .chev { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform 120ms ease; }
.disclosure[aria-expanded="true"] .chev { transform: rotate(180deg); }
.disclosure-body { padding: 4px 2px 0; }
.disclosure.is-inline { margin-top: 14px; padding: 12px 14px; font-size: 15px; }

/* ---------- bottom bar ---------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 28px 20px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, var(--fade-from), var(--canvas) 38%);
}
.bottombar-inner { max-width: 440px; margin: 0 auto; }
.primary {
  display: block; width: 100%; min-height: 56px; padding: 14px 24px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: 19px; font-weight: 700;
}
.primary.is-skip { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.primary:active { transform: scale(0.99); }
.primary[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.primary[aria-disabled="true"]:active { transform: none; }
.secondary {
  min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); font-weight: 700; font-size: 15px;
}

/* ---------- profile ---------- */
.profile-head { padding-top: 22px; }
.section { margin-top: 20px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 20px; font-weight: 800; }
.sub { margin-top: 16px; }
.sub-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 700; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tag { display: inline-flex; align-items: center; min-height: 34px; padding: 5px 14px; border-radius: 999px; background: var(--accent-soft); font-size: 15px; font-weight: 600; }
.tag.is-plain { background: var(--group-bg); color: var(--muted); font-weight: 500; }
.empty { margin-top: 10px; color: var(--muted); font-size: 15px; }

.previews { margin-top: 36px; }
.previews > h2 { font-size: 24px; font-weight: 800; line-height: 1.2; }
.pick-title { font-size: 19px; font-weight: 800; margin-top: 2px; }
.pick-blurb { color: var(--muted); font-size: 15px; margin-top: 2px; }
.list { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.list-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 700; }
.list li { margin-top: 8px; font-size: 15px; }
.list li span { display: block; color: var(--muted); font-size: 14px; }
.private-note { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--private-bg); color: var(--private-ink); font-size: 14px; }
.group-card { background: var(--group-bg); border-style: dashed; }
.quote { margin-top: 10px; padding: 14px 16px; border-radius: 14px; background: var(--surface); font-size: 16px; }
.quote p + p { margin-top: 8px; }
.fine { margin-top: 12px; font-size: 13px; color: var(--muted); }
.actions { margin-top: 28px; display: flex; gap: 10px; flex-wrap: wrap; }

@media (min-width: 420px) {
  .headline { font-size: 34px; }
}

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