/*
 * AskDimitri Research Phenotype (/tools/phenotype/).
 * Colours and fonts come from /css/tokens.css and the shared rules from /css/site.css; the
 * card's look and its figures from ./phenotype.charts.css (shared with the members' card). Only
 * what this page adds lives here: the one-question-at-a-time flow, the provisional card's axis
 * lines and the closing invitation. Mobile first. The content comes from
 * shared/phenotype/questions.mjs.
 */

.page.tool { max-width: 720px; }
.tool [hidden] { display: none !important; }

h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(30px, 6vw, 40px); line-height: 1.2;
  color: var(--ink); margin: 0 0 20px;
}
h1.stroke::after { animation-delay: 0.6s; }
.lede { font-family: var(--serif); font-size: 18px; line-height: 1.75; }
.lede p { margin: 0 0 18px; }

/* ------------------------------------------------------------------ the questionnaire */

.ph-form { margin-top: 28px; }
.ph-progress-row { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.ph-progress { flex: 1 1 auto; height: 2px; appearance: none; -webkit-appearance: none; border: 0; background: var(--hairline); border-radius: 1px; overflow: hidden; }
.ph-progress::-webkit-progress-bar { background: var(--hairline); border-radius: 1px; }
.ph-progress::-webkit-progress-value { background: var(--gold); border-radius: 1px; transition: width 0.35s ease; }
.ph-progress::-moz-progress-bar { background: var(--gold); border-radius: 1px; }
.ph-progress-text { flex: 0 0 auto; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* The ten marks: answered ones filled, the current one ringed; each jumps back to its question. */
.ph-dots { list-style: none; display: flex; gap: 4px; padding: 0; margin: 10px 0 0; }
.ph-dots li { flex: 1 1 0; min-width: 0; }
.ph-dot {
  width: 100%; min-height: 44px; padding: 0; margin: 0; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font: 500 11px/1 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums;
}
.ph-dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--field-border); background: var(--card); }
.ph-dot.is-done::before { background: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.ph-dot[aria-current="step"] { color: var(--ink); font-weight: 600; }
.ph-dot[aria-current="step"]::before { box-shadow: 0 0 0 3px var(--gold-tint), inset 0 0 0 2px var(--gold-ink); }
.ph-dot.is-done[aria-current="step"]::before { box-shadow: 0 0 0 3px var(--gold-tint), inset 0 0 0 2px var(--ink); }
.ph-dot:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 6px; }

.ph-q { border: 0; border-top: 1px solid var(--hairline); padding: 22px 0 6px; margin: 0; min-width: 0; }
.ph-q legend {
  float: left; width: 100%; padding: 0; margin: 0 0 12px;
  font-family: var(--serif); font-weight: 500; font-size: 20px; line-height: 1.35; color: var(--ink);
}
.ph-q legend + * { clear: both; }
.ph-n {
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--paper); background: var(--ink);
  border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  vertical-align: 3px; margin-right: 6px;
}
.ph-options { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-opt { position: relative; }
.ph-opt input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.ph-opt label {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  font-size: 15px; line-height: 1.35; color: var(--text); cursor: pointer;
  background: var(--card); border: 1px solid var(--field-border); border-radius: 22px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.ph-opt label:hover { border-color: var(--ink); }
.ph-opt input:checked + label { background: var(--tint); border-color: var(--ink); color: var(--ink); font-weight: 500; }
.ph-opt input:focus-visible + label { outline: 2px solid var(--ink); outline-offset: 2px; }

/* One at a time (the script adds .ph-stepping; without it every question shows). */
.ph-stepping .ph-q { display: none; border-top: 0; padding: 30px 0 4px; }
.ph-stepping .ph-q.is-current { display: block; }
.ph-stepping .ph-q legend { font-size: clamp(25px, 6.6vw, 32px); line-height: 1.2; margin-bottom: 22px; letter-spacing: -.01em; }
.ph-stepping .ph-n {
  display: block; width: auto; height: auto; margin: 0 0 10px; background: none; border-radius: 0;
  font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); vertical-align: baseline;
}
.ph-stepping .ph-n::before { content: "Question "; }
.ph-stepping .ph-n::after { content: " of 10"; }
.ph-stepping .ph-options { flex-direction: column; flex-wrap: nowrap; gap: 8px; }
.ph-stepping .ph-opt label {
  display: flex; width: 100%; min-height: 54px; padding: 12px 16px 12px 48px; border-radius: 12px; font-size: 16px; position: relative;
}
.ph-stepping .ph-opt label::before {
  content: ""; position: absolute; left: 16px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--field-border); background: var(--card);
}
.ph-stepping .ph-opt input:checked + label::before { box-shadow: inset 0 0 0 5px var(--ink); }
.ph-stepping .ph-opt input:checked + label { background: var(--tint); }

.ph-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 22px 0 0; }
.ph-nav .btn { margin: 0; min-width: 104px; }
.ph-nav .btn.secondary:disabled { opacity: .45; }
.ph-nav #ph-next:disabled { opacity: .4; cursor: not-allowed; }
.ph-nav-hint { flex: 1 1 100%; font-size: 12.5px; color: var(--muted); }
.ph-stepping .ph-show-row { display: none; }
.ph-stepping.on-last .ph-show-row, .ph-stepping.all-answered .ph-show-row { display: flex; }
.ph-stepping .ph-show-row { margin-top: 14px; }

.ph-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 24px 0 0; }
.ph-actions .btn { margin: 0; }
.btn.inline { display: inline-flex; align-items: center; justify-content: center; width: auto; height: 44px; padding: 0 18px; margin: 0; font-size: 15px; }
.ph-form .btn:disabled { cursor: not-allowed; }

/* ------------------------------------------------------------------ the provisional card */

.ph-card {
  margin-top: 40px; background: var(--card); border: 1px solid var(--hairline); border-radius: 16px; padding: 28px 20px 26px;
  box-shadow: 0 18px 40px -28px color-mix(in srgb, var(--ink) 30%, transparent);
}
@media (min-width: 720px) { .ph-card { padding: 44px 48px 36px; } }
.ph-card:focus { outline: none; }
.ph-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.ph-card .ph-meta { padding-top: 14px; border-top: 1px solid var(--hairline); }
.ph-radar-slot { margin: 0 0 22px; }

.ph-axes { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--hairline); }
.ph-axis {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--hairline); font-size: 15px; line-height: 1.5; scroll-margin-top: 80px;
  transition: background-color .6s ease, box-shadow .6s ease;
}
.ph-axis:focus { outline: none; }
.ph-axis:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.ph-axis.is-picked { background: var(--gold-tint); box-shadow: 0 0 0 10px var(--gold-tint); }
.ph-axis-name { font-size: 12px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--ink); }
.ph-axis-score { font-family: var(--serif); font-size: 22px; font-weight: 500; color: var(--ink); grid-row: 1 / span 2; grid-column: 2; align-self: center; font-variant-numeric: tabular-nums; }
.ph-axis-line { grid-column: 1; font-family: var(--serif); font-size: 16.5px; line-height: 1.5; color: var(--text); }
.ph-axis-bar { grid-column: 1 / -1; height: 4px; background: var(--hairline); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.ph-axis-bar > span { display: block; height: 100%; background: var(--ink); border-radius: 2px; }

.ph-gap { margin: 0; }
.ph-note { font-size: 13.5px; color: var(--muted); margin: 26px 0 0; font-style: italic; font-family: var(--serif); }
.ph-card-actions { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--hairline); }
.ph-copy-status { flex: 1 1 100%; font-size: 13.5px; color: var(--delta); font-weight: 500; }
.ph-copy-status:empty { display: none; }
.ph-copy-box {
  display: block; width: 100%; margin: 12px 0 0; padding: 10px 14px; resize: vertical;
  font-family: var(--sans); font-size: 14px; line-height: 1.55; color: var(--text);
  background: var(--paper); border: 1px solid var(--field-border); border-radius: 8px;
}

/* --------------------------------------------------------------- the closing invitation */

.ph-join {
  position: relative; margin-top: 40px; padding: 30px 22px 28px; border-radius: 16px; overflow: hidden;
  background: var(--ink); color: color-mix(in srgb, var(--paper) 88%, var(--ink));
}
@media (min-width: 720px) { .ph-join { padding: 44px 48px 40px; } }
.ph-join-delta { width: 30px; margin: 0 0 18px; }
.ph-join-kicker { margin: 0 0 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: color-mix(in srgb, var(--gold) 75%, var(--paper)); }
.ph-join h2 { font-family: var(--serif); font-weight: 450; font-size: clamp(30px, 8vw, 40px); line-height: 1.1; letter-spacing: -.012em; color: var(--paper); margin: 0 0 16px; }
.ph-join p { margin: 0 0 16px; font-size: 15px; line-height: 1.65; }
.ph-join p:last-child { margin-bottom: 0; }
.ph-join-list { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 0; border-top: 1px solid color-mix(in srgb, var(--paper) 18%, var(--ink)); }
.ph-join-list li { padding: 12px 0 12px 26px; position: relative; font-size: 14.5px; line-height: 1.55; border-bottom: 1px solid color-mix(in srgb, var(--paper) 18%, var(--ink)); }
.ph-join-list li::before { content: ""; position: absolute; left: 2px; top: 20px; width: 10px; height: 2px; background: var(--gold); }
.ph-join-list b { color: var(--paper); font-weight: 600; }
.ph-join a { color: var(--paper); }
.ph-join a.cta {
  display: flex; width: fit-content; align-items: center; min-height: 48px; margin-top: 18px; padding: 0 24px; border-radius: 8px;
  background: var(--paper); color: var(--ink); font-weight: 600; text-decoration: none; transition: background 0.2s ease;
}
.ph-join a.cta:hover { background: var(--gold-tint); }
.ph-join a.cta:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.ph-about { margin-top: 28px; font-size: 15px; }
.ph-about > summary { cursor: pointer; color: var(--ink); font-weight: 500; min-height: 44px; display: flex; align-items: center; }
.ph-about p { margin: 10px 0 0; }
.ph-about b { font-weight: 600; color: var(--ink); }

footer.site { margin-top: 64px; }

@media (max-width: 420px) {
  .ph-q legend { font-size: 18px; }
  .ph-stepping .ph-q legend { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  .ph-opt label, .ph-progress::-webkit-progress-value, .btn.inline, .ph-axis, .ph-join a.cta { transition: none; }
}

@media print {
  .watermark, .skip, nav.site, .ph-form, .ph-join, .ph-about, .ph-card-actions, .ph-copy-box, .lede, .eyebrow { display: none !important; }
  .ph-card { border-color: #999; background: #fff; box-shadow: none; }
  .ph-axis-bar > span, .ph-axis-bar { background: #999; }
}
