/* =====================================================
   Inner Frontier — Sovereignty Audit
   ===================================================== */

/* --- Variables ---------------------------------------- */
:root {
  --bg:           #F7F4EF;
  --surface:      #FFFFFF;
  --navy:         #1C2B3A;
  --navy-mid:     #2C3E50;
  --gold:         #B8965A;
  --gold-light:   #F0E4CA;
  --sage:         #4A7A6D;
  --sage-light:   #D8EDEA;
  --rust:         #A85A3A;
  --plum:         #4A3A5A;
  --muted:        #7A8E9E;
  --border:       #DDD5C8;
  --error:        #C53030;
  --error-bg:     #FFF5F5;
  --text:         #2C3E50;

  --font-heading: 'Lora', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    16px;
  --shadow:       0 2px 16px rgba(28, 43, 58, 0.09);

  --max-w:        700px;
}

/* --- Reset -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; font-family: inherit; }

.hidden { display: none !important; }

/* --- Header ------------------------------------------- */
.site-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 1.125rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-logo {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.02em;
}

.site-header-logo {
  height: 70px;
  width: auto;
  object-fit: contain;
}

/* --- Main container ----------------------------------- */
main {
  padding: 3rem 1.5rem 6rem;
}

/* --- Intro panel -------------------------------------- */
.intro-panel {
  max-width: 580px;
  margin: 0 auto;
  text-align: center;
  padding: 4rem 1rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  color: var(--navy);
  line-height: 1.2;
  margin-bottom: 1.25rem;
}

.hero-lead {
  font-size: 1.0625rem;
  color: var(--navy-mid);
  line-height: 1.75;
  margin-bottom: 0.875rem;
}

.hero-time {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 2.5rem;
}

/* --- Form wrapper ------------------------------------- */
.form-wrapper {
  max-width: var(--max-w);
  margin: 0 auto;
}

/* --- Step progress ------------------------------------ */
.step-progress {
  display: flex;
  align-items: flex-start;
  margin-bottom: 2.5rem;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.step-label {
  font-size: 0.6875rem;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  font-weight: 500;
  transition: color 0.2s;
}

.step.active .step-circle  { background: var(--navy); border-color: var(--navy); color: #fff; }
.step.active .step-label   { color: var(--navy); font-weight: 600; }
.step.completed .step-circle { background: var(--sage); border-color: var(--sage); color: #fff; }
.step.completed .step-label  { color: var(--sage); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 17px 6px 0; /* vertically align with circle centres */
}

/* --- Form sections ------------------------------------ */
.form-section          { display: none; }
.form-section.active   { display: block; }

.section-intro {
  margin-bottom: 1.75rem;
}

.section-intro h2 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  color: var(--navy);
  margin-bottom: 0.375rem;
}

.section-intro p {
  font-size: 0.9375rem;
  color: var(--muted);
}

.section-intro strong { color: var(--navy-mid); }

/* --- Text fields -------------------------------------- */
.field {
  margin-bottom: 1.375rem;
}

.field label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.field input[type="text"],
.field input[type="email"] {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

  .checkbox-field {
    margin-bottom: 1.25rem;
  }

  .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text);
  }

  .checkbox-label input[type="checkbox"] {
    margin-top: 0.2rem;
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--navy);
  }

  .checkbox-label a {
    color: var(--navy);
    text-decoration: underline;
  }


/* --- Likert scale ------------------------------------- */
.likert-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.625rem;
  padding: 0 2px;
}

.questions-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.question-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.375rem 1rem;
  transition: border-color 0.15s;
}

.question-item.unanswered {
  border-color: var(--error);
  background: var(--error-bg);
}

.question-text {
  font-size: 0.9375rem;
  color: var(--navy);
  line-height: 1.55;
  margin-bottom: 0.875rem;
}

.q-num {
  font-weight: 600;
  color: var(--muted);
  margin-right: 4px;
}

.likert-row {
  display: flex;
  gap: 5px;
}

.likert-opt {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* Hide the native radio but keep it focusable */
.likert-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.likert-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 46px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.likert-opt:hover .likert-btn {
  border-color: var(--gold);
  background: var(--gold-light);
  color: var(--navy);
}

.likert-opt input:checked + .likert-btn {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.likert-opt input:focus-visible + .likert-btn {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* --- Domain cards ------------------------------------- */
.domains-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.domain-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.375rem;
}

.domain-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 1rem;
}

.slider-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.slider-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy-mid);
}

.slider-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.range-input {
  width: 100%;
  accent-color: var(--navy);
  cursor: pointer;
}

.slider-endpoints {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: 4px;
}

/* --- Buttons ------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.875rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.btn-primary:hover {
  background: var(--gold);
  border-color: var(--gold);
}

.btn-secondary {
  background: transparent;
  color: var(--navy);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--navy);
  background: rgba(28, 43, 58, 0.04);
}

.btn-secondary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-large {
  padding: 1rem 3rem;
  font-size: 1rem;
}

/* --- Form footer -------------------------------------- */
.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.submit-note {
  margin-top: 0.875rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- Results panel ------------------------------------ */
.results-panel {
  max-width: var(--max-w);
  margin: 0 auto;
}

.results-intro {
  margin-bottom: 1.75rem;
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.results-intro p {
  color: var(--navy-mid);
  line-height: 1.75;
  margin-bottom: 0.9rem;
}

.results-intro p:last-child {
  margin-bottom: 0;
}

.results-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.results-header h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.results-for {
  font-size: 0.9375rem;
  color: var(--muted);
}

/* Quadrant chart */
.quadrant-chart {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 5px 8px;
  margin-bottom: 1rem;
  max-width: 50%;
  margin-left: auto;
  margin-right: auto;
}

.chart-y-label {
  grid-column: 1;
  grid-row: 1;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  align-self: center;
}

.chart-y-ticks {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 0.6875rem;
  color: var(--muted);
}

.chart-grid {
  grid-column: 3;
  grid-row: 1;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 1 / 1;
  gap: 3px;
  background: rgba(28, 43, 58, 0.25);
  border-radius: var(--radius-sm);
  overflow: visible;
}

.q-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 0.75rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.45);
  padding: 0.625rem 0.5rem;
}

/* Highlight the user's current quadrant */
.chart-grid[data-active="conscious-frontier"]  .q-tl,
.chart-grid[data-active="sovereign-navigator"] .q-tr,
.chart-grid[data-active="passenger-trap"]      .q-bl,
.chart-grid[data-active="gilded-cage"]         .q-br {
  color: rgba(255, 255, 255, 0.95);
}

.q-tl { background: var(--rust); }
.q-tr { background: var(--sage); }
.q-bl { background: var(--plum); }
.q-br { background: var(--navy); }

.chart-dot-wrapper {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 5px;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: none;
}

.chart-dot {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 4px rgba(184, 150, 90, 0.35), 0 0 18px 4px rgba(184, 150, 90, 0.55);
}

.chart-dot-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.chart-x-ticks {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--muted);
  padding: 0 2px;
}

.chart-x-label {
  grid-column: 3;
  grid-row: 3;
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Quadrant card */
.quadrant-card {
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  margin-bottom: 1.25rem;
  color: #fff;
  text-align: center;
}

.quadrant-sovereign-navigator { background: var(--sage); }
.quadrant-gilded-cage         { background: var(--navy); }
.quadrant-conscious-frontier  { background: var(--rust); }
.quadrant-passenger-trap      { background: var(--plum); }

.quadrant-eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.75;
  margin-bottom: 0.5rem;
}

.quadrant-name {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.quadrant-desc {
  font-size: 0.9375rem;
  opacity: 0.9;
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Score grid */
.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.score-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.score-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.5rem;
}

.score-value {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 0.375rem;
}

.score-scale {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Generic results block */
.results-block {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.375rem 1.5rem;
  margin-bottom: 1rem;
}

.results-block h3 {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.results-block > p {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* Domain gaps */
.gap-scale {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.625rem;
  text-align: right;
}

.gap-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gap-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.gap-rank {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.gap-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--navy);
}

.gap-meta {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Archetype cards */
.archetype-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.archetype-card {
  border-radius: var(--radius);
  padding: 1.125rem;
}

.archetype-card.primary   { background: var(--navy); color: #fff; }
.archetype-card.secondary { background: var(--bg); }

.archetype-role {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.375rem;
}

.archetype-card.primary   .archetype-role { opacity: 0.65; }
.archetype-card.secondary .archetype-role { color: var(--muted); }

.archetype-card-name {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.625rem;
  line-height: 1.25;
}

.archetype-card.secondary .archetype-card-name { color: var(--navy); }

.archetype-dominance {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.625rem;
  border-radius: 99px;
  margin-bottom: 0.75rem;
}

.archetype-card.primary   .archetype-dominance { background: rgba(255,255,255,0.2); color: #fff; }
.archetype-card.secondary .archetype-dominance { background: var(--gold-light); color: var(--navy); }

.archetype-card-desc {
  font-size: 0.875rem;
  line-height: 1.55;
}

.archetype-card.primary   .archetype-card-desc { opacity: 0.85; }
.archetype-card.secondary .archetype-card-desc { color: var(--navy-mid); }

@media (max-width: 600px) {
  .archetype-cards { grid-template-columns: 1fr; }
}

/* AI report body */
.report-body {
  font-size: 0.9375rem;
  color: var(--navy-mid);
  line-height: 1.7;
}

.report-body p + p {
  margin-top: 0.875rem;
}

/* Margin between last report section and first help-body */
.report-section:last-of-type {
  margin-bottom: 1.25rem;
}

/* Report placeholder */
.report-placeholder {
  border-color: var(--gold);
  border-style: dashed;
  background: #FFFAF2;
}

.report-placeholder h3 {
  color: var(--gold);
}

/* Help at the Inner Frontier block */
.help-block {
  background: var(--gold-light);
  border-color: var(--gold);
  margin-bottom: 1.25rem;
}

.help-block h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.help-eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.375rem;
}

.help-block .help-body {
  font-size: 0.9375rem;
  color: var(--navy-mid);
  line-height: 1.7;
  margin-bottom: 0.875rem;
}

.help-block .help-body:last-of-type {
  margin-bottom: 0;
}

.help-link {
  color: var(--navy);
  font-weight: 600;
  text-underline-offset: 2px;
}

.help-link:hover {
  color: var(--gold);
}

/* Tooltips for Inner Frontier terms */
.tooltip-term {
  position: relative;
  display: inline;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 1px;
  cursor: help;
}

.tooltip-term::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: white;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  line-height: 1.4;
  white-space: normal;
  max-width: 20rem;
  min-width: 10rem;
  overflow-wrap: anywhere;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 999;
}

.tooltip-term:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Results footer */
.results-footer {
  text-align: center;
  margin-top: 2rem;
}

/* --- Responsive --------------------------------------- */
@media (max-width: 600px) {
  main { padding: 2rem 1rem 4rem; }

  /* Hide step labels on small screens to prevent overflow */
  .step-label { display: none; }
  .step-circle { width: 28px; height: 28px; font-size: 0.75rem; }
  .step-line { margin-top: 13px; }

  .slider-row { grid-template-columns: 1fr; gap: 1.125rem; }
  .score-grid { grid-template-columns: 1fr; }

  .likert-btn { height: 36px; font-size: 0.8125rem; }

  .form-footer { gap: 0.75rem; }
  .form-footer .btn { flex: 1; }

  .arch-label { width: 130px; font-size: 0.8125rem; }

  .gap-item { flex-wrap: wrap; }
  .gap-meta { width: 100%; }
}
