/* CoWeave — the guided assessment.
   The CoWeave family (purple, gold, Palatino) in a calmer, lighter room, with the
   Personal app's night palette for dark mode. One signature: the progress thread. */
:root {
  --bg: #f6f4f9;
  --surface: #ffffff;
  --surface-2: #f0ecf6;
  --ink: #1d1626;
  --muted: #6b6178;
  --line: #e2dbea;
  --gold: #a87a26;
  --gold-soft: #f5ead4;
  --accent: #6b4fc8;
  --accent-soft: #ece6fb;
  --danger: #b44a3e;
  --shadow: 0 1px 2px rgba(29, 22, 38, .06), 0 6px 22px rgba(29, 22, 38, .07);
  --radius: 16px;
  --serif: "Palatino", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0811; --surface: #151019; --surface-2: #1c1522; --ink: #f5f1e6; --muted: #a89cb8;
    --line: #2b2236; --gold: #d8b878; --gold-soft: #2a2113; --accent: #b195e8; --accent-soft: #1e162e;
    --danger: #e08a80; --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 8px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0811; --surface: #151019; --surface-2: #1c1522; --ink: #f5f1e6; --muted: #a89cb8;
  --line: #2b2236; --gold: #d8b878; --gold-soft: #2a2113; --accent: #b195e8; --accent-soft: #1e162e;
  --danger: #e08a80; --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 8px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 17px/1.6 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ── The bar and its thread ─────────────────────────────────────────────── */
.bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.2rem;
  padding: .9rem clamp(16px, 4vw, 2rem); position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.mark { font: 700 1.15rem/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: .01em; white-space: nowrap; }
.mark span { color: var(--gold); }
.mark em { font: 500 .72rem/1 var(--sans); font-style: normal; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-left: .4rem; }
.thread svg { display: block; width: 100%; height: 16px; overflow: visible; }
.thread path { fill: none; stroke-width: 2.2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.thread-base { stroke: var(--line); }
.thread-fill { stroke: url(#tw-weave); }
/* Progress is revealed by a clip that grows from the left. A dash pattern would be measured in
   screen pixels under non-scaling-stroke, and showed a stray piece at the end at 0%. */
.thread-clip { transform-box: view-box; transform-origin: 0 0; transform: scaleX(0); transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
@media (prefers-reduced-motion: reduce) { .thread-clip { transition: none; } }
.left { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 6.5em; text-align: right; }
.bar.quiet .thread, .bar.quiet .left { visibility: hidden; }
@media (max-width: 560px) { .mark em { display: none; } .bar { gap: .8rem; } }

/* ── The stage ──────────────────────────────────────────────────────────── */
main { flex: 1; width: 100%; max-width: 680px; margin: 0 auto; padding: clamp(1.5rem, 6vh, 4rem) 16px 4rem; outline: none; }
#stage:focus, #stage:focus-visible { outline: none; }
.screen { animation: enter .32s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.eyebrow { font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin: 0 0 .9rem; }
h1, h2 { font-family: var(--serif); font-weight: 700; line-height: 1.18; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 5.4vw, 2.9rem); letter-spacing: -.005em; }
h2 { font-size: clamp(1.45rem, 4vw, 1.9rem); }
.lede { font-size: 1.08rem; color: var(--muted); max-width: 34em; margin: 1rem 0 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

.facts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.6rem 0 0; padding: 0; list-style: none; }
.facts li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .38rem .85rem; font-size: .88rem; }
.facts li b { color: var(--gold); font-weight: 600; }

.note { margin: 1.8rem 0 0; padding: 1rem 1.1rem; background: var(--surface-2); border-radius: 12px; font-size: .94rem; }
.notice { margin: 1.8rem 0 .4rem; padding: 1.15rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: grid; gap: .65rem; }
.notice h2 { font: 700 .74rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin: 0 0 .1rem; }
.notice p { margin: 0; font-size: .94rem; line-height: 1.55; color: var(--muted); }
.notice p strong { color: var(--ink); font-weight: 600; }
.consent { display: flex; gap: .7rem; align-items: flex-start; margin: 1.2rem 0 0; font-size: .92rem; color: var(--muted); cursor: pointer; }
.consent input { margin-top: .3rem; accent-color: var(--accent); width: 1.05rem; height: 1.05rem; flex: none; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin-top: 2rem; }
.btn { appearance: none; border: 0; cursor: pointer; border-radius: 999px; padding: .85rem 1.6rem; font-weight: 600; font-size: 1rem;
  background: var(--ink); color: var(--bg); transition: transform .12s ease, opacity .12s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.link { appearance: none; background: none; border: 0; padding: .4rem .2rem; cursor: pointer; color: var(--muted); font-size: .92rem; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.link:hover { color: var(--ink); text-decoration-color: currentColor; }
.kbd { font: 600 .72rem/1 var(--sans); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: .18rem .38rem; color: var(--muted); }

/* ── Birth details ──────────────────────────────────────────────────────── */
.fields { display: grid; gap: 1.1rem; margin-top: 1.8rem; }
.field label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: .35rem; }
.field input[type=date], .field input[type=time], .field input[type=text] {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .85rem; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row input[type=text] { flex: 1 1 14rem; }
.check { display: inline-flex; gap: .45rem; align-items: center; font-size: .9rem; color: var(--muted); margin-top: .45rem; cursor: pointer; }
.check input { accent-color: var(--accent); }
.picks { display: grid; gap: .4rem; margin-top: .6rem; }
.pick { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .8rem; cursor: pointer; }
.pick:hover { border-color: var(--accent); }
.status { font-size: .88rem; color: var(--muted); margin-top: .5rem; min-height: 1.3em; }
.status.err { color: var(--danger); }

/* ── A question ─────────────────────────────────────────────────────────── */
.where { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-size: .8rem; color: var(--muted); letter-spacing: .02em; }
.where b { font-weight: 600; color: var(--ink); }
.aside { margin: 1.1rem 0 0; font-family: var(--serif); font-style: italic; color: var(--gold); font-size: 1.02rem; animation: enter .5s .1s both; }
.prompt { font-family: var(--serif); font-size: clamp(1.4rem, 4.2vw, 1.85rem); line-height: 1.3; margin: 1.3rem 0 0; text-wrap: balance; }
.how { font-size: .95rem; color: var(--ink); margin: 1rem 0 0; min-height: 1.5em; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.how strong { color: var(--gold); }
.how .step { font: 700 .68rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: .32rem .55rem; }
.how.nudge { animation: nudge .45s cubic-bezier(.2, .7, .2, 1); }
@keyframes nudge { 0% { transform: translateX(0); } 30% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 100% { transform: none; } }

/* The two-tap picture on the Enneagram introduction */
.demo { display: grid; gap: .45rem; max-width: 360px; margin-top: 1.6rem; }
.demo-opt { position: relative; display: flex; align-items: center; gap: .6rem; height: 2.6rem; padding: 0 .8rem; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); }
.demo-opt i { flex: 1; height: 6px; border-radius: 999px; background: var(--line); }
.demo-opt b { font: 700 .62rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; padding: .28rem .5rem; border-radius: 999px; }
.demo-opt em { font: 500 .72rem/1 var(--sans); font-style: normal; color: var(--muted); }
.demo-opt.most { border-color: var(--gold); }
.demo-opt.most b { background: var(--gold); color: var(--surface); }
.demo-opt.least { border-color: var(--accent); border-style: dashed; }
.demo-opt.least b { background: var(--accent-soft); color: var(--accent); }
.options { display: grid; gap: .7rem; margin-top: 1.4rem; }
.opt { position: relative; display: grid; grid-template-columns: 2rem 1fr; align-items: start; gap: .6rem; text-align: left; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow);
  font-size: 1.02rem; line-height: 1.5; transition: transform .14s ease, border-color .14s ease, background .14s ease; }
.opt:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.opt .key { width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; font: 600 .78rem/1 var(--sans);
  color: var(--muted); border: 1px solid var(--line); margin-top: .05rem; transition: all .14s ease; }
.opt .tag { position: absolute; top: -.62rem; right: .9rem; font: 700 .66rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  padding: .3rem .55rem; border-radius: 999px; opacity: 0; transform: translateY(4px) scale(.96); transition: all .18s cubic-bezier(.2, .7, .2, 1); }
.opt.most { border-color: var(--gold); background: color-mix(in srgb, var(--gold-soft) 70%, var(--surface)); }
.opt.most .key { background: var(--gold); border-color: var(--gold); color: var(--surface); }
.opt.most .tag { opacity: 1; transform: none; background: var(--gold); color: var(--surface); }
.opt.least { border-color: var(--accent); border-style: dashed; background: var(--surface-2); color: var(--muted); }
.opt.least .key { border-color: var(--accent); color: var(--accent); }
.opt.least .tag { opacity: 1; transform: none; background: var(--accent-soft); color: var(--accent); }
.opt.chosen { border-color: var(--gold); background: color-mix(in srgb, var(--gold-soft) 70%, var(--surface)); }
.opt.chosen .key { background: var(--gold); border-color: var(--gold); color: var(--surface); }
.options.sent .opt:not(.chosen):not(.most):not(.least) { opacity: .5; }
.foot { display: flex; justify-content: space-between; align-items: center; margin-top: 1.4rem; min-height: 2.2rem; }
.hints { font-size: .78rem; color: var(--muted); display: flex; gap: .6rem; align-items: center; }
@media (hover: none) { .hints { display: none; } }

/* ── Section intro ──────────────────────────────────────────────────────── */
.part { display: inline-flex; gap: .35rem; margin-bottom: 1.2rem; }
.part i { width: 2.2rem; height: 4px; border-radius: 999px; background: var(--line); }
.part i.on { background: var(--gold); }

/* ── Done ───────────────────────────────────────────────────────────────── */
.lenses { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; margin-top: 2rem; }
.lens { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .95rem 1rem; }
.lens h3 { margin: 0; font: 600 .72rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lens p { margin: .45rem 0 0; font-family: var(--serif); font-size: 1.15rem; line-height: 1.3; }
.lens .sub { font-family: var(--sans); font-size: .82rem; color: var(--muted); margin-top: .3rem; }
.lens.missing p { color: var(--muted); font-size: 1rem; }
a.lens { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
a.lens:hover, a.lens:focus-visible { border-color: var(--accent); }
a.lens:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lens .more { display: inline-block; margin-top: .6rem; font-size: .82rem; color: var(--accent); }
@media (prefers-reduced-motion: no-preference) { a.lens:hover { transform: translateY(-1px); } }
.actions a.btn { text-decoration: none; display: inline-block; }

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