/* Palette and card language follow enneagram-scaled-test so the two quizzes read as one family. */
:root {
  --bg: #f6f1e8;
  --ink: #201b17;
  --muted: #625a51;
  --card: #fffaf1;
  --raised: #ffffff;
  --line: #d8cab8;
  --track: #e9dfd1;
  --accent: #2f3a2f;
  --on-accent: #ffffff;
  --accent-2: #87643a;
  --danger: #9d3d2f;
  --focus: #1f6feb;
  --anxious: #b5543c;
  --secure: #2f6b4f;
  --avoidant: #3d5a80;
  --low: #e9dfd1;
  --moderate: #dccbb0;
  --high: #c9b18c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181512;
    --ink: #f1e9dd;
    --muted: #b6aa9a;
    --card: #221e1a;
    --raised: #2b2621;
    --line: #3f372f;
    --track: #352e27;
    --accent: #e7dccb;
    --on-accent: #1a1714;
    --accent-2: #d2ac78;
    --danger: #e58a77;
    --focus: #79b8ff;
    --anxious: #e08a72;
    --secure: #73b896;
    --avoidant: #8eaad3;
    --low: #352e27;
    --moderate: #4a3f33;
    --high: #625240;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); line-height: 1.5; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Headings and legends take focus only so screen readers announce the new view. */
[tabindex="-1"]:focus { outline: none; }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 800; }
.skip-link:focus { top: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app-shell { max-width: 880px; margin: 0 auto; padding: 0 16px; }
#app { padding-top: 8px; outline: none; }
.site-header { max-width: 880px; margin: 0 auto; padding: 14px 16px 6px; display: flex; justify-content: space-between; gap: 10px; }
.pill-link { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); text-decoration: none; font-weight: 800; font-size: .8rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 32px rgba(32, 27, 23, .07); padding: 22px; margin-top: 14px; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; margin: 0; }
h1 { font-size: clamp(2.1rem, 7vw, 3.6rem); line-height: .98; letter-spacing: -.01em; }
.h-section, h2 { font-size: clamp(1.4rem, 4vw, 1.75rem); line-height: 1.15; margin-bottom: 8px; }
h3 { font-size: 1.05rem; }
.eyebrow { margin: 0 0 10px; text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: var(--muted); font-weight: 700; }
.lede { max-width: 660px; color: var(--muted); font-size: 1.05rem; }
.fine { color: var(--muted); font-size: .88rem; }
.warn { color: var(--danger); font-weight: 700; }
.prose ul, .pattern ul { padding-left: 1.2em; margin: 8px 0 0; }
.prose li, .pattern li { margin: 4px 0; }
kbd { font-family: ui-monospace, monospace; font-size: .85em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0 5px; background: var(--raised); }

/* buttons */
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 800; font-size: .95rem; text-decoration: none; cursor: pointer; touch-action: manipulation; }
button.secondary, .button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button.small, .button.small { min-height: 38px; padding: 0 14px; font-size: .85rem; }
button:disabled { opacity: .45; cursor: not-allowed; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }

/* home */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mode-card { display: flex; flex-direction: column; }
.mode-card h2 { margin-bottom: 6px; }
.mode-card .button-row { margin-top: auto; padding-top: 14px; }
.meta { font-size: .85rem; font-weight: 700; color: var(--muted); margin: 0; }
.status { margin: 8px 0 0; font-size: .85rem; font-weight: 700; color: var(--accent-2); }
.status.done { color: var(--secure); }

/* quiz */
.view-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.text-link { font-weight: 700; font-size: .9rem; }
.chip { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.progress { padding: 14px 18px; }
.progress-top { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-weight: 700; font-size: .85rem; }
.bar { height: 10px; background: var(--track); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.bar > div { height: 100%; background: var(--accent-2); transition: width .2s; }
.instructions { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-family: Georgia, serif; font-size: clamp(1.25rem, 4vw, 1.6rem); line-height: 1.3; margin-bottom: 18px; }
.q-number { color: var(--muted); }
.options { display: grid; gap: 8px; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); }
.options-3 { --cols: 3; }
.options-na { --cols: 1; margin-top: 10px; }
.option { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 88px; padding: 12px 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--raised); cursor: pointer; text-align: center; font-weight: 700; font-size: .88rem; line-height: 1.25; }
.options-na .option { min-height: 52px; flex-direction: row; color: var(--muted); }
.option:hover { border-color: var(--accent-2); }
.option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.option .key { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); font-size: .85rem; }
.option.selected { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent); }
@media (prefers-color-scheme: dark) { .option.selected { color: #1a1714; } }
.option.selected .key { border-color: currentColor; }
.nav-row { display: flex; gap: 10px; margin-top: 14px; }
.nav-row > * { flex: 1; }
.quiz-tools { margin: 6px 0 4px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; font-size: .9rem; color: var(--muted); font-weight: 600; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent-2); }
.shortcuts { margin-top: 10px; font-size: .9rem; color: var(--muted); }
.shortcuts summary { cursor: pointer; font-weight: 700; }

/* review */
.review-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; }
.review-list button { width: 100%; display: grid; grid-template-columns: 2.2em 1fr auto; gap: 10px; align-items: center; text-align: left; border-radius: 14px; background: var(--raised); color: var(--ink); border-color: var(--line); font-weight: 500; padding: 10px 14px; min-height: 52px; }
.r-num { color: var(--muted); font-weight: 800; }
.r-answer { font-size: .82rem; font-weight: 800; color: var(--accent-2); text-align: right; }
.r-answer.missing { color: var(--danger); }
.empty { color: var(--muted); }

/* results */
.summary-card h1 { margin-bottom: 10px; }
.scores { display: grid; gap: 16px; margin-top: 14px; }
.score-row { --c: var(--accent-2); }
[data-category="anxious"] { --c: var(--anxious); }
[data-category="secure"] { --c: var(--secure); }
[data-category="avoidant"] { --c: var(--avoidant); }
.score-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.score-name { font-weight: 800; font-size: 1.05rem; }
.score-value { font-weight: 800; font-variant-numeric: tabular-nums; }
.of { color: var(--muted); font-weight: 600; }
.score-track { position: relative; height: 14px; background: var(--track); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.segs { position: absolute; inset: 0; display: flex; }
.seg { border-right: 2px solid var(--card); }
.seg:nth-child(1) { background: var(--low); }
.seg:nth-child(2) { background: var(--moderate); }
.seg:nth-child(3) { background: var(--high); border-right: 0; }
.score-fill { position: relative; height: 100%; background: var(--c); border-radius: 999px; min-width: 14px; }
.banded .score-fill { opacity: .9; }
.score-row .fine { margin: 6px 0 0; }
.score-row.incomplete .score-value { color: var(--muted); }
.band { display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--c); color: var(--ink); font-weight: 800; font-size: .8rem; }
.pattern-list { display: grid; gap: 10px; margin-top: 12px; }
.pattern { border: 1px solid var(--line); border-left: 6px solid var(--c); border-radius: 16px; padding: 12px 16px; background: var(--raised); }
.pattern summary { cursor: pointer; font-family: Georgia, serif; font-weight: 700; font-size: 1.2rem; }
.pattern-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; margin-top: 8px; }
.pattern h3 { font-family: inherit; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* 2×2 model */
.matrix { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; margin-top: 16px; align-items: stretch; }
.axis { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; align-items: center; justify-content: center; text-align: center; }
.axis.row { writing-mode: vertical-rl; transform: rotate(180deg); padding: 0 2px; }
.quadrant { flex-direction: column; gap: 4px; min-height: 110px; border-radius: 16px; background: var(--raised); color: var(--ink); border: 1px solid var(--line); font-weight: 800; }
.quadrant[aria-pressed="true"] { background: var(--track); box-shadow: inset 0 0 0 2px var(--ink); }
.quadrant.match { border: 3px dashed var(--accent-2); }
.q-name { font-family: Georgia, serif; font-size: 1.1rem; }
.q-tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.quadrant-detail { margin-top: 14px; padding: 14px 16px; border-radius: 16px; background: var(--raised); border: 1px solid var(--line); }
.quadrant-detail p { margin: 6px 0 0; }
.alias { font-family: Inter, system-ui, sans-serif; font-weight: 500; font-size: .85rem; color: var(--muted); }

/* footer */
.site-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-bottom: 32px; margin-top: 28px; }
.footer-card { margin-top: 0; }
.footer-card h2 { font-size: 1.15rem; }
.footer-card p { font-size: .9rem; }
.notice { margin-top: 20px; }

@media (max-width: 720px) {
  .card { padding: 18px; border-radius: 18px; }
  .mode-grid, .site-footer, .pattern-grid { grid-template-columns: 1fr; }
  .options { --cols: 1; }
  .options-3 { --cols: 1; }
  .option { flex-direction: row; justify-content: flex-start; min-height: 54px; padding: 10px 14px; text-align: left; font-size: .95rem; }
  .nav-row { position: sticky; bottom: 0; z-index: 10; background: var(--bg); padding: 10px 0; margin-bottom: 0; }
  .review-list button { grid-template-columns: 2em 1fr; }
  .r-answer { grid-column: 2; text-align: left; }
  .quadrant { min-height: 92px; padding: 8px; }
  .q-name { font-size: .98rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
