/* My Type Quiz — design system
   Palette: ivory #FAF6F1 · ink #252329 · berry #8F3156 (selection & primary actions only)
   Type: DM Serif Text (display) · DM Sans (body) — self-hosted, OFL */

@font-face {
  font-family: 'DM Serif Text';
  src: url('/fonts/DMSerifText-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'DM Serif Text';
  src: url('/fonts/DMSerifText-400i.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('/fonts/DMSans-variable.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --paper: #FAF6F1;
  --card: #FFFFFF;
  --ink: #252329;
  --ink-soft: #5A545E;
  --ink-faint: #8A828D;
  --berry: #8F3156;
  --berry-deep: #712542;
  --berry-tint: #F6E7EE;
  --line: #E9DFD4;
  --gold: #B98A2F;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(37, 35, 41, .05), 0 8px 24px rgba(37, 35, 41, .06);
  --serif: 'DM Serif Text', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: var(--berry); }

h1, h2, h3, .serif { font-family: var(--serif); font-weight: 400; line-height: 1.15; }
h1 { font-size: clamp(1.7rem, 6vw, 2.4rem); margin: 0 0 .4em; letter-spacing: .01em; }
h2 { font-size: clamp(1.25rem, 4.5vw, 1.6rem); margin: 0 0 .5em; }
h3 { font-size: 1.1rem; margin: 0 0 .4em; }
p { margin: 0 0 1em; }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff;
  padding: .5rem 1rem; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- shell ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1024px; margin: 0 auto; padding: 14px 20px 10px;
}
.wordmark {
  font-family: var(--serif); font-size: 1.45rem; color: var(--ink);
  text-decoration: none; letter-spacing: .02em;
}
.wordmark span { color: var(--berry); }
.site-header nav a {
  color: var(--ink-soft); text-decoration: none; font-size: .92rem; margin-left: 18px;
}
.site-header nav a:hover { color: var(--berry); }

main { display: block; }
.view { max-width: 560px; margin: 0 auto; padding: 8px 20px 96px; }
.view-wide { max-width: 720px; margin: 0 auto; padding: 8px 20px 96px; }

.site-footer {
  border-top: 1px solid var(--line); margin-top: 24px;
  padding: 28px 20px 40px; text-align: center;
}
.site-footer nav a {
  color: var(--ink-soft); text-decoration: none; font-size: .85rem; margin: 0 9px;
  display: inline-block; padding: 4px 0;
}
.site-footer nav a:hover { color: var(--berry); }
.site-footer p { color: var(--ink-faint); font-size: .78rem; margin: 12px 0 0; }

/* ---------- quiz ---------- */
.lede { color: var(--ink-soft); font-size: 1.02rem; margin: 0 0 1.1em; }

.pool-row { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; flex-wrap: wrap; }
.pool-row .pool-label { font-size: .9rem; color: var(--ink-soft); font-weight: 500; }
.segmented { display: inline-flex; background: #F1E9E0; border-radius: 999px; padding: 3px; }
.segmented button {
  border: 0; background: transparent; border-radius: 999px;
  padding: 7px 16px; font-size: .9rem; font-weight: 500; color: var(--ink-soft);
}
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.segmented button:focus-visible { outline: 2px solid var(--berry); outline-offset: 2px; }

.face-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 16px;
}
@media (min-width: 480px) { .face-grid { grid-template-columns: repeat(3, 1fr); } }

.face {
  position: relative; border: 0; padding: 0; background: #EFE7DD;
  border-radius: var(--radius); overflow: hidden; aspect-ratio: 1;
  outline: 3px solid transparent; outline-offset: -3px;
  transition: outline-color .15s ease;
}
.face img { width: 100%; height: 100%; object-fit: cover; }
.face .face-alt { position: absolute; left: -9999px; }
.face[aria-pressed="true"] { outline-color: var(--berry); }
.face[aria-pressed="true"]::after {
  content: ''; position: absolute; inset: 0;
  box-shadow: inset 0 0 0 3px var(--berry); border-radius: var(--radius);
  pointer-events: none;
}
.face .check {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px;
  border-radius: 50%; background: var(--berry); color: #fff;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.face[aria-pressed="true"] .check { display: flex; }
.face:focus-visible { outline-color: var(--berry-deep); }
.face.loading { background: #EFE7DD; }

.quiz-bar {
  padding: 6px 0 14px; margin: 0 -4px;
}

/* First-set outcome preview: beside the grid on desktop, below it on phones */
.quiz-layout { display: block; }
@media (min-width: 1024px) {
  .view-quiz { max-width: 960px; }
  .quiz-layout { display: grid; grid-template-columns: minmax(0, 560px) 300px; gap: 40px; align-items: start; justify-content: center; }
}
.preview-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin: 18px 0 0;
}
@media (min-width: 1024px) { .preview-card { margin-top: 0; } }
.preview-art { background: #EFE7DD; padding: 24px 12px 18px; display: flex; justify-content: center; }
.preview-body { padding: 18px 20px 16px; }
.preview-body .type-kicker { margin-bottom: 4px; }
.preview-body h2 { font-size: 1.35rem; margin: 0 0 6px; }
.preview-body > p { font-size: .92rem; color: var(--ink-soft); margin: 0 0 10px; }
.preview-link { font-weight: 600; font-size: .92rem; text-decoration: none; }
.preview-link:hover { text-decoration: underline; }
.preview-note { border-top: 1px solid var(--line); margin: 12px 0 0 !important; padding-top: 10px; font-size: .8rem; color: var(--ink-faint); }

/* Portrait comparison: single column on phones so each image keeps its full caption */
.compare-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare-row .reco { margin: 0; }
.reco figcaption { font-size: .8rem; color: var(--ink-soft); margin: 6px 0 0; }
@media (max-width: 560px) { .compare-row { grid-template-columns: 1fr; } }
.progress-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .82rem; color: var(--ink-soft); margin-bottom: 8px; padding: 0 4px;
}
.progress-track { height: 4px; border-radius: 4px; background: #EBE1D5; overflow: hidden; margin: 0 4px 12px; }
.progress-fill { height: 100%; background: var(--berry); border-radius: 4px; transition: width .3s ease; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; border: 0; font-weight: 600; text-decoration: none;
  padding: 13px 26px; font-size: 1rem; line-height: 1.2;
}
.btn-primary { background: var(--berry); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--berry-deep); }
.btn-primary:disabled { background: #C9B8C1; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-faint); }
.btn-secondary { background: var(--ink); color: #fff; }
.btn-small { padding: 9px 18px; font-size: .88rem; }
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--berry); outline-offset: 2px; }

.fine-print { font-size: .8rem; color: var(--ink-faint); text-align: center; margin: 12px 0 0; }
.age-note {
  display: flex; gap: 8px; align-items: flex-start; justify-content: center;
  font-size: .8rem; color: var(--ink-faint); margin: 14px 0 0; text-align: center;
}

/* ---------- result ---------- */
.result-hero { text-align: center; padding: 18px 0 6px; }
.type-kicker { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--berry); font-weight: 700; margin-bottom: 8px; }
.type-name { font-size: clamp(2rem, 8.5vw, 2.9rem); margin: 0 0 6px; }
.type-comment { color: var(--ink-soft); max-width: 42ch; margin: 0 auto 1.2em; }
.type-faces { display: flex; justify-content: center; gap: 12px; margin: 10px 0 20px; }
.type-face {
  width: 30%; max-width: 132px; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line); aspect-ratio: 1; background: #EFE7DD;
}
.type-face img { width: 100%; height: 100%; object-fit: cover; }
.type-face:nth-child(2) { transform: translateY(-8px); }

.finding {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin: 0 0 14px; box-shadow: var(--shadow);
}
.finding .finding-label { font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px; }
.finding p { margin: 0; }
.finding .count { font-weight: 700; color: var(--berry); }

.action-row { display: flex; gap: 10px; margin: 18px 0; }
.action-row .btn { flex: 1; }

.card-block {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin: 26px 0 0; box-shadow: var(--shadow);
}
.card-block .sample-tag {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px; margin-bottom: 10px;
}
.price-line { font-weight: 700; }
.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }

.notice {
  border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; font-size: .92rem;
  background: var(--berry-tint); border: 1px solid #E8CCDA; color: var(--berry-deep);
}
.notice-neutral { background: #F3EDE5; border-color: var(--line); color: var(--ink-soft); }

/* ---------- share sheet / modal ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(37,35,41,.42); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--card); border-radius: 18px 18px 0 0; width: 100%; max-width: 520px;
  padding: 22px 22px 30px; max-height: 86vh; overflow: auto;
}
.sheet h2 { margin-bottom: 4px; }
.consent-list { list-style: none; margin: 14px 0; padding: 0; }
.consent-list li {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
}
.consent-list input { margin-top: 4px; accent-color: var(--berry); width: 18px; height: 18px; }
.consent-list .consent-name { font-weight: 600; font-size: .94rem; }
.consent-list .consent-desc { color: var(--ink-soft); font-size: .82rem; }
.share-link-row { display: flex; gap: 8px; margin: 14px 0; }
.share-link-row input {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: .88rem; background: var(--paper); color: var(--ink);
  min-width: 0;
}

/* ---------- static pages ---------- */
.page { max-width: 680px; margin: 0 auto; padding: 28px 20px 80px; }
.page h1 { margin-top: 12px; }
.page h2 { margin-top: 1.6em; }
.page ul { padding-left: 1.2em; }
.page li { margin-bottom: .4em; }
.toc-chip { color: var(--ink-faint); font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }

.faq details {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px;
}
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 10px 0 0; color: var(--ink-soft); }

.report-section { margin: 26px 0; }
.pattern-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  border-bottom: 1px solid var(--line); padding: 10px 2px;
}
.pattern-row .pattern-name { font-weight: 600; text-transform: capitalize; }
.pattern-row .pattern-count { color: var(--ink-soft); font-size: .88rem; white-space: nowrap; }
.reco-row { display: flex; gap: 12px; }
.reco { flex: 1; }
.reco img { border-radius: 10px; border: 1px solid var(--line); aspect-ratio: 1; object-fit: cover; width: 100%; }
.reco p { font-size: .8rem; color: var(--ink-soft); margin: 6px 0 0; }

table.cmp { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.cmp th, table.cmp td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.cmp th { color: var(--ink-faint); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- states ---------- */
.center-state { text-align: center; padding: 64px 0; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 14px;
  border: 3px solid var(--line); border-top-color: var(--berry);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box { background: #FBEBE7; border: 1px solid #EFC9C2; color: #7C3A2D; border-radius: 12px; padding: 14px 16px; margin: 16px 0; }

/* ---------- print ---------- */
@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body { background: #fff; }
  .view, .page { max-width: none; padding: 0; }
}

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