:root {
  --bg: #f7f1e8;
  --card: #fffaf2;
  --text: #2b2118;
  --muted: #6b5b4b;
  --primary: #c2562f;
  --primary-dark: #a3441f;
  --accent: #e0a03a;
  --line: #e6d9c6;
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .08);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17px/1.6 var(--sans); }
img { max-width: 100%; height: auto; }
a { color: var(--primary-dark); }
a:hover { color: var(--text); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0 0 16px; }
h1 { font-size: 48px; }
h2 { font-size: 36px; }
h3 { font-size: 22px; }
p { margin: 0 0 16px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--card); padding: 8px 12px; z-index: 10; }

.masthead { border-bottom: 1px solid var(--line); background: var(--bg); }
.masthead-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 12px; font: 700 18px/1 var(--serif); color: var(--text); text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 2px solid var(--primary); border-radius: 50%; font: 700 12px/1 var(--serif); color: var(--primary); letter-spacing: .04em; }
.masthead nav { display: flex; gap: 24px; }
.masthead nav a { color: var(--muted); text-decoration: none; font-size: 16px; }
.masthead nav a:hover { color: var(--text); }

.hero { padding-top: 48px; padding-bottom: 48px; }
.eyebrow { color: var(--primary); font-weight: 600; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.lede { color: var(--muted); font-size: 18px; max-width: 70ch; }
.share-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.share-msg { color: var(--muted); font-size: 14px; }

.btn, .btn-ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px; border-radius: var(--radius); font: 600 16px/1 var(--sans); cursor: pointer; text-decoration: none; }
.btn { background: var(--primary); color: #fff; border: 2px solid var(--primary); }
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border: 2px solid var(--line); }
.btn-ghost:hover { border-color: var(--text); }

/* The test card */
.test-shell { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 32px; margin-top: 24px; max-width: 760px; }
.test-progress { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.test-bar { flex: 1; height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; }
.test-bar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .25s ease; }
.test-q { font: 700 28px/1.2 var(--serif); margin-bottom: 24px; min-height: 2.4em; }
.test-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.test-scale button { min-height: 64px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); font: 600 14px/1.2 var(--sans); cursor: pointer; padding: 8px; }
.test-scale button:hover { border-color: var(--primary); }
.test-scale button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.test-nav { display: flex; justify-content: space-between; margin-top: 24px; }
.test-back { background: none; border: 0; color: var(--muted); font: 600 14px var(--sans); cursor: pointer; padding: 8px 0; }
.test-back:disabled { visibility: hidden; }
.test-note { color: var(--muted); font-size: 14px; margin: 16px 0 0; }

.test-count { font-weight: 600; color: var(--text); }
.test-mood { color: var(--primary); font-size: 14px; font-style: italic; margin: 0 0 8px; min-height: 1.6em; }
.test-scale button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: transform .12s ease, background .12s ease, border-color .12s ease; }
.test-scale button:active { transform: scale(.97); }
.test-scale kbd { font: 600 12px/1 var(--sans); color: var(--muted); }
.test-scale button[aria-pressed="true"] kbd { color: #fff; }
.test-keys { color: var(--muted); font-size: 12px; align-self: center; }

/* Reveal: the card back shivers while the scores are "weighed" */
.reveal { display: grid; justify-items: center; gap: 16px; padding: 32px 0; text-align: center; }
.reveal p { font: 700 22px/1.2 var(--serif); margin: 0; }
.tarot-back, .tarot-face-back { display: grid; place-items: center; background: var(--text) repeating-linear-gradient(45deg, rgba(224, 160, 58, .12) 0 2px, transparent 2px 14px); border-radius: 16px; color: var(--accent); font: 700 36px/1 var(--serif); }
.tarot-back { width: 180px; aspect-ratio: 2 / 3.3; box-shadow: var(--shadow-2); animation: weigh 1.8s ease-in-out; }
.tarot-back span, .tarot-face-back span { border: 2px solid var(--accent); border-radius: 50%; width: 72px; height: 72px; display: grid; place-items: center; font-size: 20px; }
@keyframes weigh { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-3deg) translateY(-4px); } 40% { transform: rotate(3deg) translateY(-8px); } 60% { transform: rotate(-2deg) translateY(-4px); } 80% { transform: rotate(1deg); } }

/* Result: a tarot card that flips over, plus the seven scores */
.result { --sin: var(--accent); display: grid; grid-template-columns: 280px 1fr; gap: 32px; align-items: start; }
.tarot-wrap { perspective: 1200px; }
.tarot { position: relative; aspect-ratio: 2 / 3.3; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
.result.is-flipped .tarot { transform: rotateY(180deg); }
.tarot-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 16px; box-shadow: var(--shadow-2); }
.tarot-face-front { transform: rotateY(180deg); background: var(--text); color: var(--card); padding: 12px; border: 3px solid var(--sin); }
.tarot-inner { height: 100%; border: 2px solid var(--accent); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; padding: 24px 16px; }
.tarot-num { font: 700 22px/1 var(--serif); color: var(--accent); }
.tarot-glyph { width: 96px; height: 96px; color: var(--sin); }
.arch { display: grid; gap: 4px; background: var(--bg); border-left: 4px solid var(--sin); border-radius: 0 var(--radius) var(--radius) 0; padding: 12px 16px; }
.arch-label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.arch strong { font: 700 22px/1.2 var(--serif); }
.crowd { font-weight: 600; color: var(--primary-dark); }
.compare { background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px 16px; }
.compare p { margin: 0; }
.scores .track { position: relative; }
.scores .ghost { position: absolute; top: -3px; bottom: -3px; width: 3px; margin-left: -1px; background: var(--text); border-radius: 2px; }
.challenge { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.challenge h3 { margin-bottom: 8px; }
.challenge p { color: var(--muted); }
.challenge-row { display: flex; gap: 8px; margin-bottom: 8px; }
.challenge-row input { flex: 1; min-width: 0; min-height: 48px; border: 2px solid var(--line); border-radius: var(--radius); padding: 0 16px; font: 400 16px var(--sans); background: #fff; color: var(--text); }
.challenge-msg { font-size: 14px; min-height: 1.6em; }
.friend-banner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 24px; }
.friend-banner p { margin: 0; font-weight: 600; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); font: 400 12px var(--sans); text-decoration: underline; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .tarot, .tarot-back, .test-scale button { transition: none; animation: none; } }
.tarot-name { font: 700 36px/1.1 var(--serif); }
.tarot-latin { font: italic 400 16px/1 var(--serif); color: var(--accent); }
.tarot-foot { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #cdbfae; }
.result-body h2 { font-size: 28px; }
.result-body .result-kicker { color: var(--primary); font-weight: 600; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.scores { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 12px; }
.scores li { display: grid; grid-template-columns: 96px 1fr 48px; align-items: center; gap: 12px; font-size: 14px; }
.scores .track { height: 12px; background: var(--line); border-radius: 12px; overflow: hidden; }
.scores .fill { display: block; height: 100%; background: var(--muted); }
.scores li.top .fill { background: var(--primary); }
.scores li.top { font-weight: 600; }
.scores .pct { text-align: right; color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* The seven sins */
.sins-strip { padding-top: 64px; padding-bottom: 48px; border-top: 1px solid var(--line); }
.section-lede { color: var(--muted); max-width: 70ch; }
.sin-list { list-style: none; padding: 0; margin: 32px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; }
.sin-item { display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.sin-num { font: 700 22px/1 var(--serif); color: var(--primary); padding-top: 4px; }
.sin-item h3 { margin-bottom: 8px; }
.sin-item .latin { font: italic 400 16px var(--serif); color: var(--muted); }
.sin-item p { color: var(--muted); }
.sin-item .virtue { margin: 0; font-size: 14px; }
.sin-item .virtue strong { color: var(--text); }

.prose-band { padding-top: 48px; padding-bottom: 48px; }
.prose { max-width: 70ch; }
.prose h2 { font-size: 28px; margin-top: 48px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 32px; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 16px; }
.prose li { margin-bottom: 8px; }

.faq { padding-top: 48px; padding-bottom: 64px; max-width: calc(70ch + 48px); }
.faq-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.faq-item summary { cursor: pointer; padding: 16px 24px; font-weight: 600; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; float: right; color: var(--primary); font-weight: 600; }
.faq-item[open] summary::after { content: '\2212'; }
.faq-item p { padding: 0 24px 16px; margin: 0; color: var(--muted); }

.prose-page { padding-top: 32px; padding-bottom: 64px; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.crumbs a { color: var(--muted); }
.updated { color: var(--muted); font-size: 14px; margin-top: 32px; }

.colophon { border-top: 1px solid var(--line); background: var(--card); padding: 48px 0 32px; }
.colophon-row { display: grid; gap: 12px; }
.colophon-brand { display: inline-flex; align-items: center; gap: 12px; font: 700 18px/1 var(--serif); margin: 0; }
.colophon-note { color: var(--muted); font-size: 14px; max-width: 70ch; margin: 0; }
.colophon nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.colophon nav a { color: var(--text); font-size: 14px; }
.colophon-copy { color: var(--muted); font-size: 14px; margin: 0; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 30px; }
  h2 { font-size: 28px; }
  .wrap { padding: 0 16px; }
  .masthead nav { gap: 16px; }
  .masthead nav a:not(:first-child) { display: none; }
  .hero { padding-top: 32px; }
  .test-shell { padding: 24px 16px; }
  .test-q { font-size: 22px; }
  .test-scale { grid-template-columns: 1fr; }
  .test-scale button { min-height: 48px; }
  .result { grid-template-columns: 1fr; }
  .tarot { max-width: 260px; margin: 0 auto; }
  .result-actions .btn, .result-actions .btn-ghost { width: 100%; }
  .challenge-row { flex-direction: column; }
  .test-keys { display: none; }
  .tarot-wrap { max-width: 240px; width: 100%; margin: 0 auto; }
  .sin-list { grid-template-columns: 1fr; }
  .scores li { grid-template-columns: 80px 1fr 40px; }
}
