/* Personality - styles. Token-driven, dark first. */

:root {
  --ground: #17141F;
  --raised: #201C2B;
  --text: #F3EDE3;
  --peach: #F2A17B;
  --lilac: #ABA0EA;

  --muted: #9d97ac;
  --border: #38334a;
  --focus: var(--peach);

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Karla', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1.25rem;
  --space-4: 2rem;
  --space-5: 3rem;

  --radius: 1rem;
  --radius-sm: 0.6rem;
  --max-width: 40rem;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground: #F4F0F4;
    --raised: #FCFAFC;
    --text: #221C2C;
    --peach: #B85328;
    --lilac: #644FAE;
    --muted: #6d6579;
    --border: #ddd4e2;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --ground: #F4F0F4;
  --raised: #FCFAFC;
  --text: #221C2C;
  --peach: #B85328;
  --lilac: #644FAE;
  --muted: #6d6579;
  --border: #ddd4e2;
  color-scheme: light;
}

/* ---------- Reset-ish ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
}

p { margin: 0; }

ul { margin: 0; padding: 0; list-style: none; }

button {
  font-family: var(--font-body);
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Visible focus, everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ---------- Layout ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-2) var(--space-4) var(--space-5);
}

.view {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.site-footer {
  padding: var(--space-3) var(--space-4) var(--space-4);
  text-align: center;
}

.site-footer p {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- Buttons and links ---------- */

.btn {
  /* Defense for .btn on an anchor whose parent is neither a flex nor a grid
     container, where an inline box would drop min-height. The one such anchor
     today, on 404.html, sits in a flex parent that already blockifies it, so
     this declaration changes nothing there. Keep it for the next one. */
  display: inline-block;
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  min-height: 44px;
  min-width: 44px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.btn-primary {
  background: var(--text);
  color: var(--ground);
}

.btn-primary:hover { transform: translateY(-1px); }

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

.btn-secondary:hover { border-color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-ghost:hover { color: var(--text); }

.link-btn {
  appearance: none;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-family: var(--font-body);
  text-align: left;
  align-self: flex-start;
  cursor: pointer;
  padding: 0.6rem 0.2rem;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover { color: var(--text); }

/* ---------- Intro ---------- */

.intro-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.intro-card h1 {
  font-size: clamp(2.2rem, 6vw, 3rem);
}

.lede {
  font-size: 1.1rem;
  color: var(--text);
  max-width: 34rem;
}

.intro-note {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Question view ---------- */

.question-card {
  background: var(--raised);
  border-radius: var(--radius);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.progress-text {
  color: var(--muted);
  font-size: 0.85rem;
}

.statement-pair {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.statement {
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.3;
}

input[type="range"] {
  width: 100%;
  height: 44px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--text);
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text);
  border: none;
}

.feedback-text {
  font-weight: 600;
  min-height: 1.5em;
}

.question-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
}

/* ---------- Reveal view ---------- */

.reveal-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.reveal-code {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.35em;
  color: var(--muted);
  text-transform: uppercase;
}

.reveal-name {
  font-size: clamp(2rem, 5vw, 2.6rem);
}

.reveal-line {
  font-size: 1.1rem;
  color: var(--muted);
}

.second-self-card {
  background: var(--raised);
  border-radius: var(--radius);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.second-self-kicker {
  color: var(--muted);
  font-size: 0.9rem;
}

#second-self-name {
  font-size: 1.6rem;
}

.blend-bar {
  display: flex;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin: var(--space-1) 0;
}

.blend-segment { height: 100%; }
.blend-peach { background: var(--peach); }
.blend-lilac { background: var(--lilac); }

.second-self-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* ---------- Type view ---------- */

.type-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.type-code {
  font-family: var(--font-display);
  letter-spacing: 0.35em;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 1rem;
}

.type-name {
  font-size: clamp(2rem, 5vw, 2.6rem);
}

.type-paragraph {
  font-size: 1.05rem;
  max-width: 36rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.chip-list li {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

.often-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.often-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.pill-list li {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

.asterisk-paragraph {
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 36rem;
}

.share-block {
  background: var(--raised);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.share-label { color: var(--muted); font-size: 0.9rem; }

.test-cta {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.test-cta-line { color: var(--muted); font-size: 0.9rem; }

/* ---------- Gallery view ---------- */

.gallery-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.gallery-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: var(--space-2);
}

.gallery-card {
  width: 100%;
  text-align: left;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  cursor: pointer;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
}

.gallery-card:hover { border-color: var(--text); }

.gallery-code {
  font-family: var(--font-display);
  letter-spacing: 0.2em;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.gallery-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.gallery-line {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
