/* the haugen project
   layout: one narrow left-aligned column, generous vertical rhythm, hairlines instead of boxes.
   one accent (a muted violet), charts in a toned-down pink / purple / blue family. */
:root {
  --bg: #f6f6f3;
  --ink: #141414;
  --muted: #76767a;
  --faint: #b9b9bc;
  --line: #dfdfdb;
  --accent: #82439d;
  --accent-soft: rgba(130, 67, 157, .13);
  --dot: rgba(20, 20, 20, .25);
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Consolas, monospace;
  /* charts: four ordinal steps pink -> purple -> blue with lightness always light -> strong,
     a pink/blue pair for two-sided answers, and a neutral gray for "same" / "it depends" */
  --seq-1: #da9cb6; --seq-2: #af78b7; --seq-3: #755db1; --seq-4: #29499b;
  --seq-ink-1: #141414; --seq-ink-2: #141414; --seq-ink-3: #ffffff; --seq-ink-4: #ffffff;
  --div-a: #c75b90; --div-a-ink: #141414; --div-b: #3b5eb2; --div-b-ink: #ffffff;
  --mid: #a3a3a8; --mid-ink: #141414;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #110f15; --ink: #ecebee; --muted: #918c99; --faint: #4d4856; --line: #29252f;
    --accent: #ce99e5; --accent-soft: rgba(206, 153, 229, .15); --dot: rgba(236, 232, 240, .28);
    --seq-1: #753353; --seq-2: #8f5598; --seq-3: #9882d4; --seq-4: #9bbafb;
    --seq-ink-1: #ecebee; --seq-ink-2: #ecebee; --seq-ink-3: #110f15; --seq-ink-4: #110f15;
    --div-a: #e281ad; --div-a-ink: #110f15; --div-b: #7d9de3; --div-b-ink: #110f15;
    --mid: #5c5863; --mid-ink: #ecebee;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.6; font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--faint); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

.page { max-width: 720px; margin: 0 auto; padding-inline: 20px; padding-block: 48px 80px; display: flex; flex-direction: column; gap: 72px; }

.mast { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.mast a { text-decoration: none; }
.mast .name { color: var(--ink); }

.label { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.statement { font-family: var(--serif); font-weight: 400; font-size: clamp(38px, 7.4vw, 64px); line-height: 1.04; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
.statement em { color: var(--accent); }
.lede { color: var(--muted); max-width: 52ch; margin: 0; }
.hero { display: flex; flex-direction: column; gap: 24px; }

/* the index of works */
.index { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.work { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: baseline; padding-block: 22px; border-bottom: 1px solid var(--line); text-decoration: none; }
.work .no { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.work .title { font-family: var(--serif); font-size: 30px; line-height: 1.1; }
.work .desc { grid-column: 2; color: var(--muted); font-size: 15px; margin-top: -8px; }
.work .go { font-family: var(--mono); font-size: 13px; color: var(--accent); }
a.work:hover .title { font-style: italic; }
.work.pending { color: var(--faint); }
.work.pending .title, .work.pending .desc { color: var(--faint); }

.foot { font-family: var(--mono); font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }

/* survey */
.section { display: flex; flex-direction: column; gap: 22px; }
.section h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; margin: 0; }
.section h2 .label { display: block; margin-bottom: 6px; font-size: 12px; }
.section p { margin: 0; color: var(--muted); max-width: 56ch; }

.ends, .srow, .rrow { display: grid; grid-template-columns: 112px 1fr 32px; gap: 14px; align-items: center; }
.ends .labels { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.srows { display: flex; flex-direction: column; gap: 4px; }
.word { font-size: 15px; font-weight: 500; min-width: 0; }
.track { position: relative; height: 38px; cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.track::before { content: ""; position: absolute; left: 9px; right: 9px; top: 50%; height: 1px; background: var(--line); }
.track i { position: absolute; top: 50%; width: 1px; height: 7px; margin-top: -3px; background: var(--faint); }
.track .hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.track:hover .hint { color: var(--muted); }
.thumb { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--accent); pointer-events: none; }
.val { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.lineup { position: relative; border-top: 1px solid var(--ink); min-height: 56px; }
.lineup .tag { position: absolute; transform: translateX(-50%); font-family: var(--mono); font-size: 11px; white-space: nowrap; color: var(--ink); }
.lineup .tag::before { content: ""; position: absolute; left: 50%; top: -6px; width: 1px; height: 5px; background: var(--ink); }
.lineup .empty { padding-top: 14px; font-family: var(--mono); font-size: 12px; color: var(--faint); }

/* choice rows (flaws, pairs, box) */
.qrows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.qrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding-block: 12px; border-bottom: 1px solid var(--line); }
.qrow .q { min-width: 0; }
.qrow .q b { font-weight: 500; }
.opts { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.opt { font-family: var(--mono); font-size: 12px; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.opt:hover { color: var(--ink); border-color: var(--faint); }
.opt[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pair .opt { font-family: var(--sans); font-size: 14px; }

.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.btn { font-family: var(--mono); font-size: 14px; background: var(--ink); color: var(--bg); border: 0; padding: 12px 22px; cursor: pointer; border-radius: 0; }
.btn:disabled { opacity: .3; cursor: not-allowed; }
.status { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.status.err { color: #c2410c; }

/* results */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.stat { padding-block: 14px; padding-right: 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.1; }
.stat span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.rrow { grid-template-columns: 112px 1fr 48px; }
.rtrack { position: relative; height: 30px; }
.rtrack::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.rtrack .iqr { position: absolute; top: 9px; bottom: 9px; background: var(--accent-soft); }
.rtrack .pt { position: absolute; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: var(--dot); }
.rtrack .med { position: absolute; top: 5px; bottom: 5px; width: 2px; margin-left: -1px; background: var(--accent); }
.rtrack .you { position: absolute; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; border: 1.5px solid var(--ink); }
.rnum { font-family: var(--mono); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.bars { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: center; padding-block: 12px; border-bottom: 1px solid var(--line); }
.stack { display: flex; gap: 2px; height: 22px; overflow: hidden; }
.stack div { height: 100%; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px; overflow: hidden; white-space: nowrap; min-width: 0; }
.stack.empty { background: var(--line); border-radius: 3px; }
.stack div:first-child { border-radius: 3px 0 0 3px; }
.stack div:last-child { border-radius: 0 3px 3px 0; }
.stack div[style*="width:0%"] { display: none; }
.keys { display: flex; flex-wrap: wrap; gap: 14px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.keys span { display: inline-flex; align-items: center; gap: 6px; }
.keys i { width: 10px; height: 10px; display: inline-block; }
.pairres { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); gap: 12px; align-items: center; padding-block: 12px; border-bottom: 1px solid var(--line); }
.pairres .a { text-align: right; }
.pairres .win { font-weight: 600; color: var(--accent); }
.note { font-family: var(--mono); font-size: 12px; color: var(--faint); }

@media (max-width: 540px) {
  .page { gap: 56px; padding-block: 32px 64px; }
  .srow, .ends { grid-template-columns: 1fr 32px; }
  .srow .word { grid-column: 1 / -1; margin-bottom: -6px; }
  .ends > div:first-child { display: none; }
  .rrow { grid-template-columns: 1fr 40px; }
  .rrow .word { grid-column: 1 / -1; margin-bottom: -6px; }
  .qrow, .bar-row { grid-template-columns: 1fr; gap: 8px; }
  .opts { justify-content: flex-start; }
  .work { grid-template-columns: 40px 1fr; }
  .work .go { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .lineup .tag { transition: left .18s ease; }
  .stack div { transition: width .4s ease; }
}

.field { font-family: var(--sans); font-size: 18px; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 8px 0; width: 100%; max-width: 360px; }
.field::placeholder { color: var(--faint); }
.field:focus { outline: none; border-bottom-color: var(--accent); }

/* compass: quiz */
.lens { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.len { display: grid; grid-template-columns: 110px 1fr auto; gap: 16px; align-items: baseline; padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.len b { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.1; }
.len span { color: var(--muted); font-size: 15px; }
.len em { font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.len:hover b { font-style: italic; }
.len[aria-pressed="true"] b { color: var(--accent); font-style: italic; }
.len[aria-pressed="true"] em { color: var(--accent); }
.progress { display: flex; flex-direction: column; gap: 8px; }
.progress .label { display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; }
.progress .label > span:first-child { white-space: nowrap; }
.pbar { height: 2px; background: var(--line); }
.pbar div { height: 100%; background: var(--accent); width: 0; }
.section p.qtext { color: var(--ink); max-width: none; }
.qtext { font-family: var(--serif); font-size: clamp(28px, 5.2vw, 40px); line-height: 1.15; margin: 0; min-height: 3.45em; text-wrap: balance; }
.answers { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.ans { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 13px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 17px; text-align: left; cursor: pointer; }
.ans kbd { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.ans:hover { color: var(--accent); }
.ans[aria-pressed="true"] { color: var(--accent); font-weight: 500; }
.ans[aria-pressed="true"]::after { content: "●"; font-size: 10px; margin-left: auto; padding-left: 8px; }
.qnav { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.link { font: inherit; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.link:hover { color: var(--ink); text-decoration-color: var(--accent); }
.link:disabled { opacity: .3; cursor: default; }

/* compass: results */
.matches { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.match { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding-block: 14px; border-bottom: 1px solid var(--line); }
.match b { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; }
.match .pct { font-family: var(--mono); font-size: 13px; color: var(--accent); align-self: center; }
.match span { grid-column: 1 / -1; color: var(--muted); font-size: 15px; }
.match:first-child b { color: var(--accent); }
.axisgroup { display: flex; flex-direction: column; gap: 2px; }
.axisgroup h3 { font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.arow { display: grid; grid-template-columns: 130px 1fr 130px; gap: 14px; align-items: center; padding-block: 6px; }
.arow .pole { font-size: 14px; line-height: 1.25; min-width: 0; }
.arow .pole.r { text-align: right; }
.arow .pole i { display: block; font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.arow .pole.lean { color: var(--accent); }
.arow .pole.lean i { color: var(--accent); }
.atrack { position: relative; height: 44px; }
.atrack::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.atrack .mid { position: absolute; left: 50%; top: 14px; bottom: 14px; width: 1px; background: var(--faint); }
.atrack .lean { position: absolute; top: 50%; height: 3px; margin-top: -1.5px; background: var(--accent-soft); }
.atrack .pt { position: absolute; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--dot); }
.atrack .me { position: absolute; top: 50%; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%; background: var(--accent); z-index: 2; }
.atrack .them { position: absolute; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--bg); z-index: 1; }
.atrack .them.low span { top: 12px; }
.atrack .them span { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 10px; white-space: nowrap; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 12px; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.chip:hover { color: var(--ink); border-color: var(--faint); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.you { color: var(--accent); border-color: var(--accent); cursor: default; }
.ptable { width: 100%; border-collapse: collapse; font-size: 15px; }
.ptable th { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--muted); text-align: left; padding: 0 12px 8px 0; border-bottom: 1px solid var(--line); }
.ptable td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.ptable td.m { white-space: nowrap; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ptable tr.you td:first-child { color: var(--accent); }

@media (max-width: 540px) {
  .len { grid-template-columns: 1fr auto; }
  .len span { grid-column: 1 / -1; grid-row: 2; margin-top: -6px; }
  .arow { grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .arow .atrack { grid-column: 1 / -1; grid-row: 2; }
  .arow .pole.r { grid-column: 2; grid-row: 1; }
}

.simtable td.sim, .simtable td.self { text-align: center; font-family: var(--mono); font-size: 12px; padding: 8px 6px; border: 2px solid var(--bg); border-radius: 4px; }
.simtable td.self { color: var(--faint); }
.simtable th { text-align: center; padding: 0 6px 8px; white-space: nowrap; }
.simtable td:first-child { white-space: nowrap; }
.simgrid-wrap { overflow-x: auto; }

/* shared: opt-in checkbox */
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--ink); cursor: pointer; max-width: 56ch; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin-top: 4px; flex: none; }
.check span i { display: block; font-style: normal; color: var(--muted); font-size: 14px; }

/* spectrum results */
.bigscore { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.bigscore b { font-family: var(--serif); font-weight: 400; font-size: clamp(64px, 12vw, 104px); line-height: .9; color: var(--accent); }
.bigscore span { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.drows { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.drow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 44px; gap: 16px; align-items: center; padding-block: 14px; border-bottom: 1px solid var(--line); }
.drow .dl b { display: block; font-weight: 500; }
.drow .dl span { color: var(--muted); font-size: 14px; }
.dbar { height: 10px; background: var(--line); border-radius: 3px; overflow: hidden; }
.dbar div { height: 100%; background: var(--accent); border-radius: 3px; }
.dnum { font-family: var(--mono); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.callout { border-left: 2px solid var(--accent); padding: 2px 0 2px 16px; color: var(--muted); max-width: 60ch; }

/* iq */
.qhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.timer { font-family: var(--mono); font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.timer.low { color: var(--div-a); }
.mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; width: min(100%, 360px); border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); color: var(--ink); }
.mgrid > div { aspect-ratio: 1; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); display: flex; align-items: center; justify-content: center; }
.mgrid svg, .mopt svg { width: 100%; height: 100%; display: block; }
.mgrid .q { font-family: var(--serif); font-size: 44px; color: var(--accent); }
.mopts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: min(100%, 420px); }
.mopt { aspect-ratio: 1; padding: 6px; border: 1px solid var(--line); background: none; color: var(--ink); cursor: pointer; border-radius: 4px; position: relative; }
.mopt:hover { border-color: var(--faint); }
.mopt[aria-pressed="true"] { border: 2px solid var(--accent); padding: 5px; }
.mopt kbd { position: absolute; top: 4px; left: 6px; font-family: var(--mono); font-size: 10px; color: var(--faint); }
.prompt { font-size: 20px; line-height: 1.45; margin: 0; max-width: 56ch; }
.prompt.seq { font-family: var(--mono); font-size: 24px; letter-spacing: .02em; }
.qnav .nav-r { display: flex; gap: 18px; }
