/* ==========================================================================
   Holland RIASEC SPA — styles
   Design is locked in design/ui-spec.md. All colors come from CSS tokens;
   no hard-coded component colors. Base 16px mobile / 17px desktop.
   ========================================================================== */

@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   1. Theme tokens — light / dark / dusk / paper (+ forced light for print)
   -------------------------------------------------------------------------- */
:root,
html[data-theme='light'] {
  --bg: #f7f2e7;
  --surface: #fffdf8;
  --surface-2: #f1ead9;
  --text: #23252b;
  --text-muted: #565b64;
  --border: #e3dac7;
  --accent: #28604f;
  --accent-soft: #28604f1f;
  --on-accent: #fffdf8;
  --track: #e7e0cf;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 10px 30px -22px rgb(0 0 0 / 0.35);
  --focus-halo: #28604f44;
}

html[data-theme='dark'] {
  --bg: #151b24;
  --surface: #1d242f;
  --surface-2: #242d3a;
  --text: #e9edf4;
  --text-muted: #a6b0c0;
  --border: #2e3846;
  --accent: #7fb2ff;
  --accent-soft: #7fb2ff26;
  --on-accent: #10161f;
  --track: #2a3441;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px -22px rgb(0 0 0 / 0.8);
  --focus-halo: #7fb2ff44;
}

html[data-theme='dusk'] {
  --bg: #241b33;
  --surface: #2e2442;
  --surface-2: #382c50;
  --text: #f2ecff;
  --text-muted: #bfb3dc;
  --border: #443860;
  --accent: #e6b95c;
  --accent-soft: #e6b95c26;
  --on-accent: #241b33;
  --track: #3d3155;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px -22px rgb(0 0 0 / 0.85);
  --focus-halo: #e6b95c44;
}

html[data-theme='paper'] {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f2f2;
  --text: #000000;
  --text-muted: #2b2b2b;
  --border: #000000;
  --accent: #0033cc;
  --accent-soft: #0033cc1f;
  --on-accent: #ffffff;
  --track: #d9d9d9;
  --shadow: 0 0 0 1px #00000022;
  --focus-halo: #0033cc55;
}

/* Print always uses the light palette, per ui-spec §6 */
@media print {
  :root,
  html[data-theme] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f4f1e8;
    --text: #000000;
    --text-muted: #333333;
    --border: #888888;
    --accent: #0d4d3f;
    --accent-soft: #0d4d3f1f;
    --on-accent: #ffffff;
    --track: #e5e5e5;
    --shadow: none;
  }
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
@media (min-width: 1100px) {
  html { font-size: 17px; }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  overflow-x: hidden;
  transition: background-color 180ms cubic-bezier(.2, .7, .3, 1), color 180ms cubic-bezier(.2, .7, .3, 1);
}

h1, h2, h3 { line-height: 1.4; margin: 0 0 0.6em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }

.num, .holland-code, .quiz-count, .side-pct, .bar-value, .type-letter, .compat-pair {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  right: -9999px;
  top: 0;
  z-index: 50;
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
}
.skip-link:focus { right: 0; }

.container {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 16px;
}
@media (min-width: 768px) {
  .container { padding-inline: 24px; }
}

/* --------------------------------------------------------------------------
   3. Header / nav / theme switcher
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.brand-text { font-size: 1.02rem; }

.site-nav { display: flex; gap: 4px; margin-inline-start: auto; }
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.95rem;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current='page'] { color: var(--accent); font-weight: 700; }

.theme-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 34px;
  transition: background-color 140ms cubic-bezier(.2, .7, .3, 1), color 140ms cubic-bezier(.2, .7, .3, 1);
}
.theme-btn:hover { color: var(--text); }
.theme-btn[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.theme-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.25); }
.theme-btn[data-theme-value='light'] .theme-dot { background: #f7f2e7; }
.theme-btn[data-theme-value='dark'] .theme-dot { background: #151b24; }
.theme-btn[data-theme-value='dusk'] .theme-dot { background: #241b33; }
.theme-btn[data-theme-value='paper'] .theme-dot { background: #ffffff; }
[data-theme-value='dusk'] .theme-dot { border: 1px solid #e6b95c; }

@media (max-width: 640px) {
  .theme-btn { padding: 6px 8px; font-size: 0; gap: 0; }
  .theme-btn .theme-dot { width: 14px; height: 14px; }
}

/* --------------------------------------------------------------------------
   4. Shared pieces
   -------------------------------------------------------------------------- */
main.container { flex: 1; padding-block: 24px 40px; }
main:focus { outline: none; }

.view { animation: view-in 180ms cubic-bezier(.2, .7, .3, 1); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r, 22px);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 20px;
}
@media (min-width: 768px) {
  .card { padding: 28px; }
}

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  margin-bottom: 0.4em;
}

.section-label { font-size: 1.02rem; margin-top: 26px; }

.lead { font-size: 1.05rem; color: var(--text-muted); max-width: 60ch; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms cubic-bezier(.2, .7, .3, 1), background-color 140ms cubic-bezier(.2, .7, .3, 1), opacity 140ms;
}
.btn:hover { background: var(--accent-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }

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

.btn-lg { min-height: 54px; padding-inline: 34px; font-size: 1.06rem; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 0.88rem; font-weight: 600; }

.disclaimer {
  margin-top: 22px;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.9;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 50%;
  transform: translateX(50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.92rem;
  z-index: 60;
  box-shadow: var(--shadow);
}

/* --------------------------------------------------------------------------
   5. Home
   -------------------------------------------------------------------------- */
.hero-card { max-width: 760px; margin-inline: auto; }
.hero-title { font-size: clamp(1.7rem, 6vw, 2.5rem); margin-bottom: 0.35em; }

.hero-points {
  list-style: none;
  margin: 14px 0 4px;
  display: grid;
  gap: 8px;
}
.hero-points li { position: relative; padding-inline-start: 26px; color: var(--text-muted); font-size: 0.97rem; }
.hero-points li::before {
  content: '';
  position: absolute;
  inset-inline-start: 4px;
  top: 0.62em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.length-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.length-card {
  text-align: start;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  min-height: 84px;
  transition: border-color 140ms cubic-bezier(.2, .7, .3, 1), background-color 140ms cubic-bezier(.2, .7, .3, 1);
}
.length-card:hover { background: var(--surface-2); }
.length-card[aria-checked='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.length-card .lc-title { font-weight: 700; font-size: 1.04rem; }
.length-card .lc-hint { color: var(--text-muted); font-size: 0.86rem; }
.length-card .lc-count { color: var(--accent); font-weight: 700; }

.home-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

/* --------------------------------------------------------------------------
   6. Quiz
   -------------------------------------------------------------------------- */
.quiz-layout { display: grid; gap: 16px; }
@media (min-width: 1100px) {
  .quiz-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
}

.quiz-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.quiz-count { font-weight: 700; font-size: 0.95rem; white-space: nowrap; color: var(--text-muted); }

.progress-inline {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms cubic-bezier(.2, .7, .3, 1);
}

.question-card { max-width: 720px; }
.question-kicker { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.5em; }
.question-text {
  font-size: clamp(1.22rem, 4.4vw, 1.65rem);
  font-weight: 700;
  margin-bottom: 1.2em;
  min-height: 2.2em;
}
.question-text:focus { outline: none; }

.scale { margin-top: 6px; }
.scale-buttons {
  display: flex;
  gap: 8px;
  direction: rtl; /* value 1 on the right … value 5 on the left */
}
.scale-btn {
  flex: 1;
  min-width: 44px;
  min-height: 52px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background-color 140ms cubic-bezier(.2, .7, .3, 1), border-color 140ms cubic-bezier(.2, .7, .3, 1), transform 140ms cubic-bezier(.2, .7, .3, 1);
}
.scale-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.scale-btn[aria-checked='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.scale-labels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 8px;
  text-align: center;
}
.scale-label { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }
.scale-label--active { color: var(--text); font-weight: 700; }

@media (max-width: 400px) {
  .scale-labels .scale-label { visibility: hidden; }
  .scale-labels .scale-label--first,
  .scale-labels .scale-label--last { visibility: visible; font-size: 0.72rem; }
}

.quiz-bottom { display: flex; justify-content: flex-start; margin-top: 20px; }

.quiz-side { position: sticky; top: 78px; }
@media (max-width: 1099px) {
  .quiz-side { display: none; }
}
.side-title { font-size: 1rem; }
.side-pct { font-size: 2.4rem; font-weight: 800; color: var(--accent); line-height: 1.2; margin: 0; }
.side-pct-unit { font-size: 1.2rem; margin-inline-start: 2px; }
.side-bar { height: 10px; background: var(--track); border-radius: 999px; overflow: hidden; margin: 8px 0 16px; }
.side-bar-fill { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 180ms cubic-bezier(.2, .7, .3, 1); }

.side-letters { list-style: none; display: grid; gap: 6px; margin-bottom: 16px; }
.side-letters li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.side-letters .sl-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--track);
  flex: none;
}
.side-letters li.is-done .sl-dot { background: var(--accent); }
.side-letters .sl-letter { font-weight: 800; color: var(--text); }
.side-hint { font-size: 0.82rem; color: var(--text-muted); margin: 10px 0 0; }

/* --------------------------------------------------------------------------
   7. Result
   -------------------------------------------------------------------------- */
#result-body { display: grid; gap: 16px; }

.result-head { text-align: center; }
.holland-code {
  font-size: clamp(3rem, 12vw, 5.5rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0;
  line-height: 1.15;
}
.code-names { font-size: 1.06rem; font-weight: 700; margin-top: 4px; }
.code-note { font-size: 0.84rem; color: var(--text-muted); margin: 8px auto 0; max-width: 56ch; }

.result-grid { display: grid; gap: 16px; }
@media (min-width: 860px) {
  .result-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
}

.viz-card h2, .bars-card h2 { font-size: 1.05rem; }
.hexagon-wrap { width: 100%; max-width: 360px; margin-inline: auto; }
.hexagon-wrap svg { width: 100%; height: auto; display: block; }

.hex-grid { stroke: var(--border); fill: none; stroke-width: 1; }
.hex-axis { stroke: var(--border); stroke-width: 1; }
.hex-axis-outer { stroke: var(--text-muted); fill: none; stroke-width: 1.4; stroke-dasharray: 3 3; }
.hex-poly { fill: var(--accent); fill-opacity: 0.16; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.hex-dot { fill: var(--accent); }
.hex-label-letter { fill: var(--text); font-size: 15px; font-weight: 800; }
.hex-label-name { fill: var(--text-muted); font-size: 10.5px; }
.hex-scale-note { fill: var(--text-muted); font-size: 9.5px; }

.bars { display: grid; gap: 14px; }
.bar-row { display: grid; gap: 6px; }
.bar-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.95rem;
}
.bar-letter { font-weight: 900; color: var(--accent); font-size: 1.02rem; }
.bar-name { color: var(--text); }
.bar-value { margin-inline-start: auto; font-weight: 800; }
.bar-share { color: var(--text-muted); font-size: 0.8rem; }
.bar-track {
  position: relative;
  height: 14px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0; /* fills from the right in RTL */
  width: var(--v, 0%);
  background: var(--accent);
  border-radius: inherit;
  transition: width 200ms cubic-bezier(.2, .7, .3, 1);
}
.bar-fill.is-low { background: var(--text-muted); opacity: 0.55; }
.bars-note { font-size: 0.82rem; color: var(--text-muted); margin-top: 12px; }

.compat-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.compat-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
  padding: 4px 16px;
  font-weight: 800;
  font-size: 1rem;
}
.compat-pair { font-weight: 800; color: var(--text-muted); letter-spacing: 0.08em; }
.compat-desc { color: var(--text-muted); margin: 0; }

.type-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }
.type-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface-2);
}
.type-card--low { background: transparent; border-style: dashed; }
.type-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.type-icon { width: 34px; height: 34px; color: var(--accent); flex: none; }
.type-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.type-letter { font-weight: 900; color: var(--accent); font-size: 1.15rem; }
.type-card h3 { font-size: 1.05rem; margin: 0; }
.type-rank { margin-inline-start: auto; font-size: 0.78rem; color: var(--text-muted); }
.type-def { font-size: 0.94rem; margin-bottom: 0.6em; }
.type-meta { font-size: 0.87rem; color: var(--text-muted); margin-bottom: 0.5em; }
.type-meta strong { color: var(--text); }
.type-strengths { list-style: none; display: grid; gap: 4px; font-size: 0.87rem; color: var(--text-muted); }
.type-strengths li { padding-inline-start: 16px; position: relative; }
.type-strengths li::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0.66em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.jobs { display: grid; gap: 18px; }
.jobs-combo {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 18px;
  padding: 16px;
}
.jobs h3 { font-size: 1rem; margin-bottom: 0.4em; }
.job-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.job-chips li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.88rem;
}

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* --------------------------------------------------------------------------
   8. About / footer
   -------------------------------------------------------------------------- */
#view-about article { max-width: 760px; margin-inline: auto; }
.prose h2 { font-size: 1.12rem; margin-top: 1.4em; }
.prose p, .prose li { color: var(--text-muted); }
.prose strong { color: var(--text); }
.type-legend { list-style: none; display: grid; gap: 8px; margin-top: 10px; }
.type-legend li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 8px;
}
.type-legend .tl-letter { font-weight: 900; color: var(--accent); min-width: 1.6em; }
.type-legend .tl-name { font-weight: 700; color: var(--text); }
.type-legend .tl-def { font-size: 0.9rem; }

.site-footer { border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.86rem; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
  align-items: center;
  padding-block: 16px;
}
.footer-inner p { margin: 0; }

/* --------------------------------------------------------------------------
   9. Motion & print
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@page { margin: 14mm; }

@media print {
  .site-header, .site-footer, .no-print, .skip-link, .toast { display: none !important; }
  body { background: #fff; }
  main.container { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #999; break-inside: avoid; page-break-inside: avoid; }
  .view[hidden] { display: none !important; }
  .holland-code { color: var(--accent); }
  .type-card, .jobs-combo, .bar-row { break-inside: avoid; }
  a { text-decoration: none; }
}
