/* =========================================================================
   Your Number — the honest, free Enneagram
   Palette: terracotta #D85A30 · umber #4A1B0C · cream #FAECE7
            charcoal #2C2C2A · sage #8A9A7B
   Type: Fraunces (display) + Lora (body)
   ========================================================================= */

:root {
  --terracotta: #D85A30;
  --umber: #4A1B0C;
  --cream: #FAECE7;
  --charcoal: #2C2C2A;
  --sage: #8A9A7B;
  --ink: #2C2C2A;
  --muted: #6E5F55;
  --card: #FFF8F2;
  --shadow: 0 10px 30px rgba(74, 27, 12, 0.10), 0 2px 8px rgba(74, 27, 12, 0.06);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Lora", Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--charcoal);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(216, 90, 48, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(138, 154, 123, 0.14), transparent 60%),
    var(--cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Paper grain — a whisper, not a texture shout */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.masthead {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 1.6rem 2rem 0.4rem;
  position: relative;
  z-index: 1;
  justify-content: space-between;
}

.masthead-nav { margin-left: auto; }

.nav-link {
  background: none;
  border: none;
  padding: 0.5rem 0.4rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--terracotta);
  cursor: pointer;
  transition: color 0.25s ease;
  min-height: 44px;
}

.nav-link:hover { color: var(--umber); }
.nav-link:focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; border-radius: 6px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--umber);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
}

.brand-mark {
  width: 30px;
  height: 30px;
  color: var(--terracotta);
}

.brand em {
  font-style: italic;
  font-weight: 400;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
}

main {
  flex: 1;
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.view {
  width: 100%;
  animation: rise 0.5s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
  html { scroll-behavior: auto; }
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1.75rem 3.5rem;
}

.page-narrow { max-width: 640px; }

h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1.08;
  margin: 1.2rem 0 0.9rem;
  color: var(--umber);
  text-wrap: balance;
}

h1 em {
  font-style: italic;
  color: var(--terracotta);
}

.lede {
  font-size: 1.15rem;
  color: var(--ink);
  max-width: 34em;
  margin: 0 0 1.8rem;
}

.lede strong { color: var(--umber); }

.steps {
  display: grid;
  gap: 0.9rem;
  margin: 0 0 1.8rem;
}

.step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
}

.step-num {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--terracotta);
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
}

.step p { margin: 0.15rem 0 0; color: var(--ink); }

.cta { margin: 0 0 1.8rem; }

.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.7rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  min-height: 48px;
}

.btn:focus-visible {
  outline: 3px solid var(--sage);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--umber);
  color: var(--cream);
  box-shadow: 0 6px 18px rgba(74, 27, 12, 0.28);
}

.btn-primary:hover { background: #5d2410; transform: translateY(-1px); }
.btn-primary:active { transform: none; }

.btn-primary:disabled {
  background: #C9B8AC;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--umber);
  border: 2px solid var(--umber);
}

.btn-ghost:hover { background: rgba(74, 27, 12, 0.06); }

.pledge {
  margin: 0;
  padding: 1rem 1.3rem;
  border-left: 3px solid var(--sage);
  background: rgba(138, 154, 123, 0.12);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink);
  font-size: 0.98rem;
}

.pledge p { margin: 0; }

.subtle {
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
  margin: 0.7rem 0 0;
}

/* ---------- Quiz ---------- */

.quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.progress-label {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--umber);
  font-size: 1rem;
  margin: 0;
}

.progress-answered {
  font-style: italic;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(74, 27, 12, 0.10);
  overflow: hidden;
  margin-bottom: 1.6rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--terracotta), #E0794F);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.question-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.8rem 1.7rem 1.5rem;
  border-top: 4px solid var(--terracotta);
}

.kicker {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--terracotta);
  font-weight: 600;
  font-size: 1rem;
  margin: 0 0 0.4rem;
}

.question-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.65rem;
  line-height: 1.35;
  color: var(--ink);
  margin: 0 0 1.5rem;
  text-wrap: balance;
}

.options {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.option {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--cream);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 0.85rem 1.1rem;
  font-family: var(--font-body);
  font-size: 1.02rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  min-height: 52px;
}

.option:hover { background: #F5E3D8; transform: translateY(-1px); }

.option.selected {
  border-color: var(--terracotta);
  background: #FBE7DC;
  font-weight: 500;
}

.option.selected .option-dot {
  background: var(--terracotta);
  color: var(--cream);
}

.option-dot {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(74, 27, 12, 0.10);
  color: var(--umber);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-label { flex: 1; }

.quiz-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.footnote {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  margin: 1.4rem 0 0;
  text-align: center;
}

/* ---------- Result ---------- */

.reveal-kicker {
  text-align: center;
  font-size: 1.15rem;
  margin-top: 1.4rem;
}

.result-number {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(5rem, 18vw, 8rem);
  line-height: 1;
  text-align: center;
  color: var(--terracotta);
  margin: 0.2rem 0;
}

.result-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 4.5vw, 2.3rem);
  text-align: center;
  color: var(--umber);
  margin: 0.3rem 0 1.1rem;
}

.result-blurb {
  font-size: 1.08rem;
  color: var(--ink);
  max-width: 34em;
  margin: 0 auto 1.5rem;
}

.tie-note {
  text-align: center;
  font-style: italic;
  color: var(--terracotta);
  font-weight: 500;
  margin: 0 auto 1.2rem;
  max-width: 30em;
}

.result-stats {
  display: grid;
  gap: 0.7rem;
  margin: 0 0 1.8rem;
  padding: 0;
}

.stat {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: baseline;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0.9rem 1.2rem;
}

.stat dt {
  font-style: italic;
  color: var(--muted);
  font-size: 0.98rem;
  margin: 0;
}

.stat dd {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--umber);
  margin: 0;
  text-align: right;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: stretch;
  max-width: 340px;
  margin: 0 auto 0.6rem;
}

.result-actions .btn { width: 100%; }

/* ---------- Score profile ---------- */

.score-section { margin: 0 0 1.6rem; }

.score-heading {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--terracotta);
  margin: 0 0 0.2rem;
}

.score-note {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  margin: 0 0 0.8rem;
}

.scorebars {
  display: grid;
  gap: 0.45rem;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.score-label {
  flex: none;
  width: 150px;
  font-size: 0.92rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-row.top .score-label { font-weight: 600; color: var(--umber); }

.score-track {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(74, 27, 12, 0.10);
  overflow: hidden;
}

.score-fill {
  display: block;
  height: 100%;
  background: var(--sage);
  border-radius: 999px;
  transition: width 0.6s ease;
}

.score-row.top .score-fill { background: var(--terracotta); }

.score-val {
  flex: none;
  width: 26px;
  text-align: right;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
}

.score-row.top .score-val { color: var(--umber); }

/* ---------- Close call ---------- */

.close-panel {
  margin: 0 0 1.6rem;
  padding: 1rem 1.3rem;
  border-left: 3px solid var(--sage);
  background: rgba(138, 154, 123, 0.14);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.close-panel h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--umber);
  margin: 0 0 0.4rem;
}

.close-panel p { margin: 0 0 0.3rem; font-size: 0.98rem; color: var(--ink); }

.close-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.7rem 0 0.4rem;
}

.close-picks .pick {
  font-size: 0.95rem;
  padding: 0.55rem 1.1rem;
  min-height: 42px;
}

.chosen-note {
  font-weight: 500;
}

.close-list {
  list-style: none;
  margin: 0.4rem 0 0.2rem;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.close-list li {
  background: var(--cream);
  border-left: 3px solid var(--terracotta);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  font-size: 0.98rem;
  color: var(--ink);
}

.close-rule {
  font-style: italic;
  color: var(--terracotta);
  font-weight: 500;
}

/* ---------- Extended pass ---------- */

.extended-block {
  margin: 0 0 1.6rem;
  padding: 1rem 1.3rem;
  border-left: 3px solid var(--terracotta);
  background: rgba(216, 90, 48, 0.08);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.extended-block h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--umber);
  margin: 0 0 0.4rem;
}

.extended-block p {
  margin: 0 0 0.8rem;
  font-size: 0.98rem;
  color: var(--ink);
}

.growth-block {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.4rem 0.6rem;
  margin: 0 0 1.6rem;
}

.growth-block h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--terracotta);
  margin: 0 0 0.3rem;
}

.growth-block p {
  margin: 0 0 1rem;
  font-size: 0.98rem;
  color: var(--ink);
}

/* ---------- All nine types modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(74, 27, 12, 0.38);
}

.modal-panel {
  position: relative;
  background: var(--card);
  border-radius: 20px;
  border-top: 4px solid var(--terracotta);
  box-shadow: 0 24px 60px rgba(74, 27, 12, 0.28);
  max-width: 880px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.6rem 1.8rem 1.8rem;
}

.modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  font-size: 1.5rem;
  line-height: 1;
  background: transparent;
  border: none;
  color: var(--umber);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  transition: color 0.2s ease, background 0.2s ease;
}

.modal-close:hover { color: var(--terracotta); background: rgba(216, 90, 48, 0.10); }

.modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  color: var(--umber);
  margin: 0.2rem 0 0.3rem;
  padding-right: 2rem;
}

.modal-title em { font-style: italic; color: var(--terracotta); }

.modal-intro {
  font-style: italic;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 0.9rem;
}

.types-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.8rem;
}

.type-card {
  background: var(--cream);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(74, 27, 12, 0.07);
  padding: 1rem 1.1rem;
  display: flex;
  gap: 0.85rem;
}

.type-card-num {
  flex: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--terracotta);
  width: 40px;
  text-align: center;
}

.type-card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--umber);
  margin: 0 0 0.15rem;
}

.type-card-triad {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.45rem;
}

.type-card p {
  font-size: 0.9rem;
  color: var(--ink);
  margin: 0.25rem 0;
}

.type-card strong { color: var(--umber); }

.type-card-blurb { font-style: italic; }

/* ---------- Footer ---------- */

.colophon {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1.5rem 2.6rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.colophon p { margin: 0.2rem 0; }

.colophon strong { color: var(--umber); }

.colophon-small {
  font-size: 0.85rem;
  font-style: italic;
}

.colophon a {
  color: var(--terracotta);
  text-decoration: none;
  font-style: normal;
  transition: color 0.3s ease;
}

.colophon a:hover { color: var(--umber); }

/* ---------- Responsive ---------- */

@media (max-width: 520px) {
  body { font-size: 16px; }
  .masthead { flex-direction: column; gap: 0.2rem; padding: 1.2rem 1.2rem 0.3rem; align-items: flex-start; }
  .masthead-nav { margin-left: 0; }
  .page { padding: 1rem 1.1rem 2.8rem; }
  .question-text { font-size: 1.4rem; }
  .stat { flex-direction: column; gap: 0.15rem; }
  .stat dd { text-align: left; }
  .modal-panel { padding: 1.2rem 1rem 1.4rem; }
}