/* =====================================================================
   Sensory Profile — styles
   Calm, clinical, mobile-first. No external dependencies.
   ===================================================================== */

:root {
  --bg:        #f5f2ec;
  --surface:   #ffffff;
  --ink:       #20262b;
  --ink-soft:  #5a6671;
  --line:      #e3ddd2;
  --line-soft: #efe9df;

  --accent:    #2f7d72;   /* calm teal-green */
  --accent-d:  #245f57;
  --accent-l:  #e6f1ee;

  --warm:      #c9803a;

  /* band tones */
  --low2:  #5b8fb0;
  --low1:  #88b4c9;
  --mid:   #6fae9f;
  --high1: #d99a4e;
  --high2: #c66a52;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(32,38,43,.05), 0 8px 24px rgba(32,38,43,.06);
  --maxw: 760px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -200px, #fbf9f4 0%, var(--bg) 70%);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app { max-width: var(--maxw); margin: 0 auto; padding: 28px 18px 60px; }

.is-hidden { display: none !important; }

/* ---------------- typography ---------------- */
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 .35em; font-weight: 700; }
h2 { font-size: 1.18rem; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 1.02rem; margin: 0; letter-spacing: -.01em; }
p  { margin: 0 0 1em; }
.note { font-size: .86rem; color: var(--ink-soft); margin: .6em 0 0; }

/* ---------------- start screen ---------------- */
.hero { text-align: center; padding: 22px 6px 30px; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .18em; font-size: .72rem;
  font-weight: 600; color: var(--accent-d); margin: 0 0 .8em;
}
.hero__sub { max-width: 52ch; margin: 0 auto; color: var(--ink-soft); font-size: 1.02rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px;
  margin: 0 0 18px;
}
.card__title { margin-bottom: .5em; }

/* legend */
.legend__intro { font-size: .92rem; color: var(--ink-soft); }
.legend__list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.legend__item { display: flex; gap: 12px; align-items: flex-start; }
.legend__pill {
  flex: 0 0 auto;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-l); color: var(--accent-d);
  font-weight: 700; font-size: .85rem; margin-top: 1px;
}
.legend__item strong { display: block; font-size: .95rem; }
.legend__desc { display: block; font-size: .84rem; color: var(--ink-soft); }

.legend__list--compact { gap: 8px; }
.legend__item--compact { font-size: .82rem; flex-wrap: wrap; }
.legend__item--compact strong { display: inline; }
.legend__item--compact .legend__desc { flex-basis: 100%; padding-left: 38px; }

/* details */
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field { flex: 1 1 200px; display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.field em { font-weight: 400; font-style: normal; opacity: .7; }
.field input {
  font: inherit; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fcfbf8; color: var(--ink);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* ---------------- buttons ---------------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-radius: 999px;
  padding: 11px 20px; transition: transform .06s ease, background .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn--lg { padding: 14px 28px; font-size: 1.02rem; }
.btn--sm { padding: 7px 13px; font-size: .82rem; }
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(47,125,114,.28); }
.btn--primary:hover { background: var(--accent-d); }
.btn--secondary { background: var(--accent-l); color: var(--accent-d); }
.btn--secondary:hover { background: #d8eae5; }
.btn--ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn--ghost:hover { background: #fff; color: var(--ink); }

.actions { display: flex; gap: 12px; margin-top: 22px; }
.actions--center { justify-content: center; }
.actions--split { justify-content: space-between; align-items: center; flex-wrap: wrap; }
.actions__right { display: flex; gap: 10px; }

/* ---------------- quiz ---------------- */
.progressbar {
  position: sticky; top: 0; z-index: 10;
  height: 6px; background: var(--line-soft); border-radius: 999px;
  overflow: hidden; margin: 0 0 10px;
}
.progressbar__fill { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }

.quiz-topbar {
  position: sticky; top: 10px; z-index: 9;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(245,242,236,.86); backdrop-filter: blur(6px);
  padding: 8px 4px; margin-bottom: 8px; border-radius: 8px;
}
.quiz-topbar__count { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }

.scale-help { margin-bottom: 14px; }

/* section */
.section { border: none; padding: 0; margin: 0 0 24px; }
.section__head {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 0 12px; width: 100%;
}
.section__tag {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 700;
  background: var(--accent); color: #fff; font-size: .95rem;
}
.section__title { font-size: 1.16rem; font-weight: 700; letter-spacing: -.01em; }

/* item */
.item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 16px 14px; margin-bottom: 12px;
  scroll-margin-top: 70px;
}
.item.is-answered { border-color: #d4e6e0; background: #fdfffe; }
.item.is-missing { border-color: var(--high2); box-shadow: 0 0 0 3px rgba(198,106,82,.12); }
.item__q { display: flex; gap: 11px; margin-bottom: 12px; }
.item__n {
  flex: 0 0 auto; min-width: 26px; height: 26px; padding: 0 6px;
  border-radius: 7px; background: var(--accent-l); color: var(--accent-d);
  font-weight: 700; font-size: .82rem; display: grid; place-items: center;
}
.item__t { font-size: .98rem; }

/* options — segmented control */
.opts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.opt { position: relative; cursor: pointer; }
.opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.opt__box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; height: 100%; min-height: 52px; padding: 6px 3px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fbfaf7; text-align: center; transition: all .12s ease;
}
.opt__num { font-weight: 700; font-size: .95rem; color: var(--ink-soft); }
.opt__txt { font-size: .64rem; line-height: 1.12; color: var(--ink-soft); letter-spacing: .01em; }
.opt:hover .opt__box { border-color: var(--accent); background: #fff; }
.opt input:focus-visible + .opt__box { outline: 2px solid var(--accent); outline-offset: 1px; }
.opt input:checked + .opt__box {
  background: var(--accent); border-color: var(--accent);
}
.opt input:checked + .opt__box .opt__num,
.opt input:checked + .opt__box .opt__txt { color: #fff; }

/* ---------------- results ---------------- */
.results-head { text-align: center; margin-bottom: 8px; }
.results-meta { color: var(--ink-soft); font-weight: 600; margin: 0; }

.quadrant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.quad {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 15px 13px; background: #fcfbf8;
  border-left: 5px solid var(--mid);
}
.quad--low2  { border-left-color: var(--low2); }
.quad--low1  { border-left-color: var(--low1); }
.quad--mid   { border-left-color: var(--mid); }
.quad--high1 { border-left-color: var(--high1); }
.quad--high2 { border-left-color: var(--high2); }
.quad__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.quad__score { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; }
.quad__blurb { font-size: .82rem; color: var(--ink-soft); margin: 4px 0 10px; }
.quad__band {
  display: inline-block; font-size: .8rem; font-weight: 700; color: #fff;
  padding: 4px 11px; border-radius: 999px; background: var(--mid);
}
.band--low2 { background: var(--low2); } .band--low1 { background: var(--low1); }
.band--mid  { background: var(--mid); }
.band--high1{ background: var(--high1);} .band--high2{ background: var(--high2); }
.quad__range { display: block; font-size: .72rem; color: var(--ink-soft); margin-top: 7px; }

.section-grid { display: grid; gap: 2px; margin-top: 12px; }
.sect-row {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px;
  padding: 10px 6px; border-bottom: 1px solid var(--line-soft);
}
.sect-row:last-child { border-bottom: none; }
.sect-row__id {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  background: var(--accent-l); color: var(--accent-d); font-weight: 700; font-size: .8rem;
}
.sect-row__title { font-size: .95rem; }
.sect-row__score { font-weight: 700; font-variant-numeric: tabular-nums; }
.sect-row__score em { font-weight: 400; font-style: normal; color: var(--ink-soft); font-size: .85em; }

.disclaimer {
  font-size: .82rem; color: var(--ink-soft); background: #fbf4ea;
  border: 1px solid #f0e2cd; border-radius: var(--radius-sm);
  padding: 12px 14px; margin: 18px 0 0;
}

/* ---------------- footer ---------------- */
.app-footer {
  max-width: var(--maxw); margin: 0 auto; padding: 0 18px 40px;
  font-size: .76rem; color: var(--ink-soft); text-align: center;
}

/* ---------------- responsive ---------------- */
@media (max-width: 560px) {
  .opt__txt { font-size: .58rem; }
  .opt__box { min-height: 56px; }
  .quadrant-grid { grid-template-columns: 1fr; }
  .actions--split { gap: 10px; }
  .actions__right { width: 100%; }
  .actions__right .btn { flex: 1; }
}

/* ---------------- print ---------------- */
@media print {
  body { background: #fff; }
  .no-print, .app-footer { display: none !important; }
  .app { max-width: none; padding: 0; }
  .card, .quad { box-shadow: none; break-inside: avoid; }
  .quadrant-grid { grid-template-columns: 1fr 1fr; }
  .disclaimer { background: #fff; }
  h1 { font-size: 1.6rem; }
}
