/* styles.css · PRISM Big Five · v0.01 · 2026-06-20
   FiLiCiTi design system (inherits poll_app dark theme + Filiciti font) */

@font-face {
  font-family: 'Filiciti';
  src: url('assets/font/Filiciti-Regular.otf') format('opentype'),
       url('assets/font/Filiciti-Regular.ttf') format('truetype');
  font-weight: normal; font-style: normal; font-display: swap;
}

:root {
  --bg-primary: #000000;
  --bg-secondary: rgba(31, 26, 74, 0.98);
  --panel: rgba(255, 255, 255, 0.04);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.12);
  --accent-yellow: #C7C11F;
  --accent-dark-yellow: #858130;
  --accent-cyan: #4496B5;
  --accent-green: #3B9D7D;
  --accent-red: #C0392B;
  --text-primary: #ffffff;
  --text-muted: #d3d7df;   /* brightened for legibility on black */
  --text-dim: #aab0bb;     /* secondary muted (footnotes) */
  /* trait colors — one per Big Five trait */
  --t-E: #C7C11F;   /* Extraversion  — yellow */
  --t-A: #3B9D7D;   /* Agreeableness — green  */
  --t-C: #4496B5;   /* Conscientiousness — cyan */
  --t-ES: #8E7CC3;  /* Emotional Stability — violet */
  --t-O: #E08E45;   /* Openness — amber */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Lexend', -apple-system, sans-serif;
  --transition: all 0.22s ease;
  --radius: 16px;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans); background: var(--bg-primary); color: var(--text-primary);
  line-height: 1.6; min-height: 100vh; -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .serif { font-family: var(--font-serif); font-weight: 700; line-height: 1.2; }
.brand { font-family: 'Filiciti', var(--font-sans); font-weight: 300; letter-spacing: 0.08em; color: var(--accent-yellow); }
a { color: var(--accent-cyan); }

.accent-bar { height: 5px; background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green), var(--accent-yellow)); }

/* ---------- Layout shell (mobile-first) ---------- */
.wrap { max-width: 620px; margin: 0 auto; padding: 22px 18px 80px; }

/* subtle brand header — this is a tool, not a pitch */
.app-head { text-align: center; margin: 8px 0 26px; }
.app-head .brand { font-size: 22px; }
.app-head .tool-name { font-family: var(--font-serif); font-weight: 700; font-size: 18px; letter-spacing: .04em; margin-top: 4px; }
.app-head .sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; letter-spacing: .3px; }

/* ---------- Cards / panels ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 22px; backdrop-filter: blur(6px);
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 22px; margin-bottom: 6px; }
.card h2.small { font-size: 18px; }
.lead { color: var(--text-muted); font-size: 16px; margin-bottom: 18px; }

.screen[hidden] { display: none !important; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
label.flabel { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 7px; }
label.flabel .opt-tag { color: var(--text-muted); font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%; padding: 14px 15px; font-size: 16px; /* 16px avoids iOS zoom */
  background: var(--panel-2); color: var(--text-primary);
  border: 1.5px solid var(--line); border-radius: 12px; font-family: var(--font-sans);
  transition: var(--transition);
}
input:focus { outline: none; border-color: var(--accent-cyan); }
input::placeholder { color: var(--text-muted); }

.checkrow { display: flex; gap: 12px; align-items: flex-start; margin-top: 4px; }
.checkrow input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto;
  width: 26px; height: 26px; margin-top: 1px; border: 1.5px solid var(--line);
  border-radius: 7px; background: var(--panel-2); cursor: pointer; position: relative; transition: var(--transition);
}
.checkrow input[type="checkbox"]:checked { background: var(--accent-green); border-color: var(--accent-green); }
.checkrow input[type="checkbox"]:checked::after {
  content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 800;
}
.checkrow input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }
.checkrow label { font-size: 14.5px; color: var(--text-muted); line-height: 1.55; cursor: pointer; }
.checkrow label strong { color: var(--text-primary); }
/* small inline "end-to-end encrypted / not stored" tag inside a consent label */
.checkrow label .opt-tag { display: block; margin-top: 2px; font-size: 12px; font-weight: 400;
  color: var(--accent-cyan); opacity: .85; }

/* required consent row — slightly emphasized vs the optional opt-ins */
.checkrow-required { padding: 12px 14px; margin-top: 8px; border-radius: 12px;
  background: rgba(0,0,0,.18); border: 1px solid var(--line); }
.checkrow-required label { color: var(--text-primary); }

/* optional opt-in group */
.optins { margin-top: 14px; display: flex; flex-direction: column; gap: 12px;
  padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; }
.optins-cap { font-size: 12.5px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; }
.optin-field { margin: 2px 0 4px 38px; }   /* indent the revealed name input under its checkbox */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--panel-2); color: var(--text-primary); font-weight: 600; font-size: 15px;
  cursor: pointer; font-family: var(--font-sans); transition: var(--transition); text-decoration: none;
}
.btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent-cyan); border-color: var(--accent-cyan); color: #04121a; }
.btn.primary:hover { background: #57a9c8; color: #04121a; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; }
.btn-row { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

.msg { font-size: 13px; margin-top: 12px; min-height: 18px; }
.msg.err { color: var(--accent-red); }
.msg.ok { color: var(--accent-green); }

.privacy-box {
  background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; max-height: 220px; overflow-y: auto; margin-bottom: 16px;
  font-size: 13.5px; color: var(--text-muted); line-height: 1.7; white-space: pre-wrap;
}

/* ---------- Big Five intro (above the length picker) ---------- */
.bigfive-intro {
  margin-bottom: 22px; padding: 16px 18px; border-radius: 12px;
  background: rgba(68,150,181,.07); border: 1px solid var(--line);
  border-left: 3px solid var(--accent-cyan);
}
.bigfive-intro h2.small { margin-bottom: 6px; }
.bigfive-intro .lead { margin-bottom: 10px; font-size: 15px; }
.bigfive-link {
  display: inline-block; font-size: 14px; font-weight: 600; color: var(--accent-cyan);
  text-decoration: none; border-bottom: 1px solid rgba(68,150,181,.4); padding-bottom: 1px;
}
.bigfive-link:hover { border-bottom-color: var(--accent-cyan); }

/* ---------- Length picker ---------- */
.lengths { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.length-card {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  padding: 18px 18px; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--panel-2); color: var(--text-primary); cursor: pointer;
  transition: var(--transition); font-family: var(--font-sans);
}
.length-card:hover { border-color: var(--accent-cyan); }
.length-card .lc-badge {
  /* size-to-content so longer labels (e.g. DETAILED) never overflow/clip */
  flex: 0 0 auto; min-width: 54px; height: 50px; padding: 0 10px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; text-align: center; white-space: nowrap;
  font-family: var(--font-serif); font-weight: 800; font-size: 11.5px; text-transform: uppercase; letter-spacing: .02em;
  background: rgba(68,150,181,.18); color: var(--accent-cyan);
}
.length-card .lc-body { flex: 1; min-width: 0; }
.length-card .lc-name { display: block; font-family: var(--font-serif); font-weight: 700; font-size: 19px; }
.length-card .lc-meta { display: block; color: var(--text-muted); font-size: 14.5px; margin-top: 4px; line-height: 1.5; }
.length-card .lc-go { flex: 0 0 auto; color: var(--text-muted); font-size: 22px; }
.length-card.done { border-color: var(--accent-green); }
.length-card.done .lc-badge { background: rgba(59,157,125,.18); color: var(--accent-green); }
.length-note { color: var(--text-muted); font-size: 14px; margin-top: 18px; text-align: center; }

/* ---------- Questionnaire ---------- */
.qz-head { margin-bottom: 18px; }
.qz-progress-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.qz-bar-track { flex: 1; height: 10px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.qz-bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green)); width: 0; transition: width .35s cubic-bezier(.22,1,.36,1); }
.qz-count { font-size: 13px; font-weight: 700; color: var(--accent-cyan); flex: 0 0 auto; min-width: 58px; text-align: right; }
.qz-instrument { font-size: 13.5px; color: var(--text-muted); letter-spacing: .04em; }

.q-item { padding: 4px 0 2px; }
.q-text { font-family: var(--font-serif); font-size: 22px; font-weight: 700; line-height: 1.3; }
.q-prefix { color: var(--text-muted); font-weight: 600; font-size: 14px; display: block; margin-bottom: 8px; font-family: var(--font-sans); }
.q-prompt { color: var(--text-muted); font-size: 13px; margin-top: 10px; }

.likert { display: flex; gap: 10px; margin-top: 24px; }
/* numbers-only squares — clean, centered; endpoint meaning lives in .likert-ends */
.likert-btn {
  flex: 1 1 0; min-width: 0; aspect-ratio: 1 / 1; max-height: 64px; padding: 0;
  border: 1.5px solid var(--line); border-radius: 13px;
  background: var(--panel-2); color: var(--text-primary); cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-sans);
}
.likert-btn:hover { border-color: var(--accent-cyan); }
.likert-btn.selected { background: var(--accent-cyan); border-color: var(--accent-cyan); color: #fff; }
.likert-btn .lk-num { font-family: var(--font-serif); font-weight: 800; font-size: 22px; line-height: 1; }
.likert-ends { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 11px; margin-top: 10px; }

.qz-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.qz-nav .btn { flex: 1; }

.qz-jump { margin-top: 16px; text-align: center; }
.qz-jump button {
  background: transparent; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer;
  text-decoration: underline; font-family: var(--font-sans);
}

/* ---------- Results ---------- */
.dominant {
  text-align: center; padding: 22px 18px; border-radius: 14px; margin-bottom: 20px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.dominant .dom-cap { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--text-muted); }
.dominant .dom-name { font-family: var(--font-serif); font-weight: 800; font-size: 30px; margin: 6px 0; }
.dominant .dom-desc { color: var(--text-primary); font-size: 14.5px; line-height: 1.7; max-width: 460px; margin: 0 auto; }
.dominant .dom-co { color: var(--text-muted); font-size: 12.5px; margin-top: 10px; }

.chart-box { margin: 8px 0 22px; }
#radar-canvas { max-width: 100%; }

.trait-bars { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.tb-row {}
.tb-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.tb-name { font-size: 14px; font-weight: 600; }
.tb-val { font-size: 13px; font-weight: 700; }
.tb-band { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-left: 8px; }
.tb-track { height: 26px; border-radius: 9px; background: rgba(255,255,255,.07); overflow: hidden; position: relative; }
.tb-fill { height: 100%; border-radius: 9px; width: 0; transition: width .6s cubic-bezier(.22,1,.36,1); }

.integrity {
  margin: 22px 0 4px; padding: 14px 16px; border-left: 3px solid var(--accent-dark-yellow);
  background: rgba(199,193,31,.06); border-radius: 0 10px 10px 0;
  font-size: 13px; color: var(--text-muted); line-height: 1.7;
}
.bands-legend { font-size: 12px; color: var(--text-muted); margin-top: 14px; line-height: 1.7; }

.facets { margin-top: 18px; }
.facets summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-cyan); padding: 6px 0; }
.facet-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 12px; }
.facet-item { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); padding: 5px 0; border-bottom: 1px solid var(--line); }
.facet-item .fv { color: var(--text-primary); font-weight: 600; }

.prepared-for {
  font-family: var(--font-serif); font-weight: 600; font-size: 15px; color: var(--accent-cyan);
  margin: 2px 0 14px;
}
.email-block { margin-top: 6px; padding: 16px 16px 4px; border-radius: 12px;
  background: rgba(68,150,181,.06); border: 1px solid var(--line); }

/* ---------- Misc ---------- */
.loading { text-align: center; color: var(--text-muted); padding: 48px 10px; }
.loading .pulse { font-size: 38px; color: var(--accent-cyan); animation: pulse 1.6s infinite; display: block; margin-bottom: 10px; }
@keyframes pulse { 0%,100%{opacity:.35} 50%{opacity:1} }

.footnote { text-align: center; color: var(--text-dim); font-size: 12.5px; margin-top: 28px; line-height: 1.6; }
.footnote a { color: var(--text-dim); text-decoration: underline; }

/* tablet+ niceties */
@media (min-width: 560px) {
  .facet-grid { grid-template-columns: 1fr 1fr; gap: 8px 24px; }
}

/* ── Filled report template (light, one-page) — fed to Save-image + Print/PDF ── */
.report-sheet {
  position: absolute; left: -10000px; top: 0;
  width: 760px; padding: 40px 44px; box-sizing: border-box;
  background: #ffffff; color: #1b1b1f;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.rpt-head { border-bottom: 2px solid #1b1b1f; padding-bottom: 14px; margin-bottom: 22px; }
.rpt-brand { font-family: 'Filiciti', Georgia, serif; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: #555; }
.rpt-title { font-size: 26px; font-weight: 700; margin-top: 4px; }
.rpt-sub { font-size: 13px; color: #666; margin-top: 4px; }
.rpt-dom { margin-bottom: 24px; }
.rpt-dom-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #999; }
.rpt-dom-name { font-size: 30px; font-weight: 800; margin: 2px 0 8px; }
.rpt-dom-desc { font-size: 14px; line-height: 1.55; color: #333; max-width: 62ch; }
.rpt-dom-co { font-size: 12.5px; color: #777; margin-top: 6px; font-style: italic; }
.rpt-chart { text-align: center; margin: 4px 0 18px; }
.rpt-chart canvas { display: inline-block; }
.rpt-bars { margin: 8px 0 22px; }
.rpt-row { margin-bottom: 14px; }
.rpt-row-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.rpt-name { font-size: 14px; font-weight: 600; }
.rpt-val { font-size: 15px; font-weight: 800; }
.rpt-band { font-size: 11px; font-weight: 500; color: #999; margin-left: 6px; }
.rpt-track { height: 12px; background: #ededf0; border-radius: 6px; overflow: hidden; }
.rpt-fill { height: 100%; border-radius: 6px; }
.rpt-legend { font-size: 12px; color: #555; line-height: 1.5; border-top: 1px solid #e3e3e8; padding-top: 14px; }
.rpt-integrity { font-size: 12px; color: #666; font-style: italic; margin-top: 10px; }
.rpt-foot { font-size: 11px; color: #999; margin-top: 22px; border-top: 1px solid #e3e3e8; padding-top: 12px; }

/* print: show ONLY the filled report (never the dark on-screen layout) */
@media print {
  @page { size: A4; margin: 14mm; }
  html, body { background: #fff !important; }
  body * { visibility: hidden !important; }
  #report, #report * { visibility: visible !important; }
  #report.report-sheet {
    position: absolute !important; left: 0 !important; top: 0 !important;
    width: 100% !important; padding: 0 !important;
  }
  .rpt-fill, .rpt-track, .rpt-dom-name, .rpt-val,
  .rpt-head, .rpt-legend, .rpt-foot {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}

/* ---------- Closing survey (state-proxy questions) ---------- */
.survey-q { padding: 14px 0 6px; border-top: 1px solid var(--line); }
.survey-q:first-child { border-top: none; }
.survey-qtext { font-family: var(--font-serif); font-size: 17px; font-weight: 700; line-height: 1.35; margin-bottom: 4px; }
.survey-q .likert { margin-top: 14px; }
/* survey buttons share the main numbers-only square style (.likert-btn) */
