/* conversation.css: the typed Conversation.
   Builds on theme.css for colour, type, buttons and the navy bar. Mobile first, 16px side gutter.
   One thing is meant to be remembered: the question set large in the serif, and under it answers
   that are tall, full-width slabs a thumb can hit. Everything else stays quiet and flat. */

body.sheet-open { overflow: hidden; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible { outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
[tabindex="-1"]:focus-visible { outline: 3px solid var(--focus); }


.page { width: 100%; max-width: var(--w-page); margin: 0 auto; padding: 0 var(--gutter) 0; }

/* ---------- top bar and tools ---------- */

.page {
    display: grid; grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "progress" "layout" "tools" "foot";
    grid-template-rows: auto auto 1fr auto auto;
}
.top { grid-area: top; padding: 12px 0; }
.home { font-size: 0.95rem; line-height: 1.3; }
.home:hover { text-decoration: underline; }
.progress { grid-area: progress; }
.layout { grid-area: layout; }
.foot { grid-area: foot; }

.tools {
    grid-area: tools; display: flex; flex-wrap: wrap; gap: 0 18px;
    margin-top: 28px; padding-top: 6px; border-top: 1px solid var(--line);
}
.tool {
    appearance: none; border: 0; background: none; color: var(--link); cursor: pointer;
    font: 400 0.9375rem/1.2 var(--sans); padding: 10px 0; min-height: 44px; text-decoration: underline;
    text-underline-offset: 3px;
}
.tool:hover { text-decoration-thickness: 2px; }
.count {
    display: inline-block; margin-left: 6px; min-width: 1.4em; padding: 0 5px; border-radius: 10px;
    background: var(--navy); color: var(--bg); font: 600 0.75rem/1.5 var(--sans); text-align: center;
    text-decoration: none;
}

@media (min-width: 60rem) {
    .page {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "top tools" "progress progress" "layout layout" "foot foot";
        grid-template-rows: auto auto 1fr auto;
        column-gap: 24px;
    }
    /* the tools join the navy bar when they sit beside the name; the bar colour runs through their row */
    .top { grid-column: 1 / -1; grid-row: 1; padding: 10px 0; }
    .tools {
        grid-column: 2; grid-row: 1; align-self: stretch;
        margin-top: 0; padding: 0; border-top: 0; gap: 0 22px; align-items: center;
    }
    .tool { font-size: 0.9rem; color: var(--on-navy-soft); }
    .tool:hover { color: #ffffff; }
    .tool:focus-visible { outline-color: var(--focus-on-dark); }
    .count { background: var(--amber); color: var(--navy-dark); }
}

/* ---------- where you are ---------- */

.progress { padding: 22px 0 4px; }

/* .acts, the four-act bar, lives in theme.css: the Fit Check draws the same one. */

.left { margin: 12px 0 0; color: var(--muted); font-size: 0.9375rem; }
.left-note { margin: 2px 0 0; color: var(--muted); font-size: 0.8125rem; }

/* ---------- layout ---------- */

.layout { display: flex; flex-direction: column; gap: 8px; }
.know-panel { order: -1; margin-top: 8px; }
/* the question sits on one white card with a navy top edge */
.stage {
    min-width: 0; margin-top: 12px; padding: 22px 16px 24px;
    background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--navy);
    border-radius: var(--radius); box-shadow: var(--shadow-soft);
}
.stage:focus { outline: none; }

@media (min-width: 60rem) {
    .layout {
        display: grid; grid-template-columns: minmax(0, 40rem) 19rem; gap: 56px;
        justify-content: space-between; align-items: start;
    }
    .know-panel { order: 0; position: sticky; top: 20px; margin-top: 28px; }
    .stage { margin-top: 20px; padding: 32px 36px 36px; }
}

/* ---------- the question ---------- */

.act-heading {
    margin: 0 0 20px;
    font: 400 1rem/1.3 var(--sans); color: var(--muted);
    padding-bottom: 8px; border-bottom: 1px solid var(--line);
}

.q-title {
    display: block;
    margin: 0 0 10px;
    font: 700 clamp(1.5rem, 5.4vw, 2.15rem)/1.18 var(--serif);
    letter-spacing: -0.012em; color: var(--navy);
    text-wrap: balance;
}
.q-title.small { font: 700 1.2rem/1.3 var(--serif); letter-spacing: 0; margin-bottom: 4px; }

.about { margin: 0 0 6px; color: var(--muted); font-size: 0.9375rem; }
.help { margin: 0 0 16px; max-width: 34rem; color: var(--muted); font-size: 1.0625rem; line-height: 1.55; }
.hint { margin: 0 0 8px; color: var(--muted); font-size: 0.9375rem; }
.basis { margin: 0 0 14px; color: var(--muted); font-size: 0.9375rem; }

.sensitive-note {
    margin: 0 0 16px; padding: 10px 14px; max-width: 34rem;
    border-left: 4px solid var(--note-line); background: var(--note-bg);
    font-size: 0.9375rem; line-height: 1.5;
}

/* ---------- answers ---------- */

.choices, .scale, .ucs, .chips, .areas, .sounds, .waiting, .verdicts {
    margin: 0; padding: 0; list-style: none;
}
.choices, .scale, .ucs { display: grid; gap: 8px; }
.opt { margin: 0; }
.opt .more { margin: 4px 0 0 2px; }
.detail { margin: 6px 0 4px 4px; padding: 8px 12px; border-left: 3px solid var(--line-strong); color: var(--muted); font-size: 0.9375rem; line-height: 1.5; }

.choice {
    appearance: none; width: 100%; display: flex; align-items: center; gap: 14px;
    min-height: 58px; padding: 12px 16px; text-align: left; cursor: pointer;
    background: var(--card); color: var(--ink);
    border: 1.5px solid var(--line-strong); border-radius: 6px;
    font: 400 1.0625rem/1.35 var(--sans);
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.choice:hover { border-color: var(--navy); }
.choice[aria-checked="true"] { border-color: var(--navy); background: var(--tint); font-weight: 600; box-shadow: inset 4px 0 0 var(--green); }

.mark {
    flex: none; width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid var(--line-strong); background: var(--card); position: relative;
}
.choice[role="checkbox"] .mark { border-radius: 4px; }
.choice[aria-checked="true"] .mark { border-color: var(--navy); background: var(--navy); }
.choice[aria-checked="true"] .mark::after {
    content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px;
    border: solid var(--bg); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.choice[role="radio"]:not(.small):not(.scale-choice) .label { flex: 1; }

.scale-choice { min-height: 64px; }
.n {
    flex: none; width: 44px; height: 44px; display: grid; place-items: center;
    font: 700 1.5rem/1 var(--serif); color: var(--navy);
    border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--card);
}
.scale-choice[aria-checked="true"] .n { background: var(--navy); color: var(--bg); border-color: var(--navy); }

.pair { margin: 0 0 18px; padding: 0; border: 0; }
.pair legend { padding: 0; margin: 0 0 8px; font: 700 1.125rem/1.3 var(--serif); }
.compact { grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); }
.compact .choice { min-height: 50px; font-size: 1rem; }

.find { margin: 0 0 12px; }
.find-label { display: block; margin: 0 0 4px; font-size: 0.9375rem; color: var(--muted); }

/* ---------- country type-ahead ---------- */

.ta { margin: 0 0 12px; max-width: 34rem; }
.ta-list { list-style: none; margin: 4px 0 0; padding: 0; background: var(--card); border: 1.5px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.ta-list[hidden] { display: none; }
.ta-opt {
    appearance: none; display: block; width: 100%; min-height: 48px; padding: 10px 14px; text-align: left; cursor: pointer;
    background: none; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); font: 400 1.0625rem/1.3 var(--sans);
}
.ta-list li:last-child .ta-opt { border-bottom: 0; }
.ta-opt:hover, .ta-opt:focus-visible { background: var(--tint); }
.ta-none { padding: 12px 14px; color: var(--muted); font-size: 0.9375rem; }
.ta-chosen { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ta-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 14px; min-height: 44px; background: var(--tint); border: 1.5px solid var(--navy); border-radius: 22px; font-weight: 600; }
.ta-x { appearance: none; cursor: pointer; min-height: 36px; padding: 4px 10px; background: none; border: 0; color: var(--link); font: 400 0.875rem/1 var(--sans); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- text fields ---------- */

.text {
    display: block; width: 100%; max-width: 34rem; padding: 12px 14px;
    background: var(--card); color: var(--ink); border: 1.5px solid var(--line-strong); border-radius: 6px;
    font: 400 1.125rem/1.45 var(--sans);
}
.text:focus { border-color: var(--navy); }
.area { max-width: 100%; min-height: 8.5rem; resize: vertical; }

/* ---------- chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.areas { display: grid; gap: 8px; margin-top: 16px; }
.areas .area { margin: 0; }
.area .chips.narrow { margin: 8px 0 6px 14px; padding-left: 14px; border-left: 3px solid var(--line); }

.chip {
    appearance: none; cursor: pointer; text-align: left;
    padding: 9px 14px; min-height: 44px;
    background: var(--card); color: var(--ink); border: 1.5px solid var(--line-strong); border-radius: 22px;
    font: 400 1rem/1.35 var(--sans);
}
.chip:hover { border-color: var(--navy); }
.chip[aria-pressed="true"] { background: var(--tint); border-color: var(--navy); font-weight: 600; }
.chip.wide { border-radius: 6px; width: 100%; padding: 12px 14px; }

/* ---------- what it sounds like ---------- */

.yours {
    margin: 0 0 18px; padding: 10px 16px; border-left: 4px solid var(--line-strong);
    color: var(--muted); font: 400 1.0625rem/1.5 var(--sans); white-space: pre-line;
}
.sounds { display: grid; gap: 12px; margin-bottom: 16px; }
.sound { padding: 14px 16px; background: var(--card); border: 1.5px solid var(--line); border-radius: 6px; }
.sound-line { margin: 0 0 4px; font: 700 1.125rem/1.35 var(--serif); }
.because { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.875rem; }
.pair-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.choice.small { width: auto; flex: 1 1 8rem; min-height: 48px; justify-content: center; padding: 8px 14px; font-size: 1rem; }
.choice.small[aria-checked="true"] { box-shadow: none; }

/* ---------- use cases ---------- */

.ucs { counter-reset: none; }
.uc { margin: 0; }
.uc-choice { align-items: flex-start; min-height: 0; padding: 14px 16px; }
.uc-choice .mark { margin-top: 3px; }
.uc-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.uc-name { font: 700 1.0625rem/1.3 var(--sans); }
.uc-desc { color: var(--muted); font: 400 0.9375rem/1.45 var(--sans); }
.uc-choice[aria-checked="true"] .uc-desc { color: var(--ink); }
.uc-badge {
    align-self: flex-start; margin-top: 2px; padding: 1px 9px; border: 1.5px solid var(--line-strong); border-radius: 12px;
    color: var(--ink); font: 600 0.8125rem/1.5 var(--sans);
}
.strength-strong .uc-badge { border-color: var(--navy); color: var(--navy); }
.strength-none .uc-badge, .strength-weak .uc-badge { color: var(--muted); border-style: dashed; }
.uc.muted .uc-choice { background: transparent; }
.rest { margin-top: 14px; }
.rest summary { cursor: pointer; padding: 10px 0; color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.rest .ucs { margin-top: 8px; }

.notice {
    margin: 18px 0 0; padding: 14px 16px; background: var(--note-bg);
    border-left: 4px solid var(--note-line); border-radius: 0 6px 6px 0;
}
.notice p { margin: 0 0 10px; }
.notice p:last-child { margin-bottom: 0; }

/* ---------- buttons ---------- */

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.btn {
    appearance: none; display: inline-flex; align-items: center; justify-content: center; text-align: center;
    min-height: 50px; padding: 10px 24px; cursor: pointer; text-decoration: none;
    background: var(--btn-bg); color: var(--btn-ink); border: 1.5px solid var(--btn-bg); border-radius: var(--radius-sm);
    font: 600 1.0625rem/1.2 var(--sans);
}
.btn:hover { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); color: var(--btn-ink); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.alt { background: var(--card); color: var(--navy); border-color: var(--navy); }
.btn.alt:hover { background: var(--tint); color: var(--navy); border-color: var(--navy); }
.btn.quiet { background: none; border-color: transparent; color: var(--link); padding-left: 4px; padding-right: 4px; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
.btn.quiet:hover { background: none; color: var(--link); border-color: transparent; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }

.link, .more {
    appearance: none; border: 0; background: none; padding: 6px 0; cursor: pointer;
    color: var(--link); font: 400 0.9375rem/1.3 var(--sans); text-decoration: underline; text-underline-offset: 3px;
}
.aside { margin: 14px 0 0; color: var(--muted); font-size: 0.9375rem; }

/* ---------- the person's own words: a quiet link under the choices that opens a small box ---------- */

.words { margin: 4px 0 0; }
.words .aside { margin: 0; }
.words-panel { margin: 4px 0 0; padding: 12px 0 0 14px; max-width: 34rem; border-left: 3px solid var(--line); }
.words-panel[hidden] { display: none; }
.words-text { min-height: 5.5rem; }
.words-panel .row { margin-top: 12px; }
.words-q { margin: 0 0 10px; font: 600 1.125rem/1.4 var(--sans); }
.words-ask .pair-btns { display: flex; flex-wrap: wrap; gap: 10px; }
/* While the box is open its own Next is the way on; the question's Next would be a second one. */
.q.words-on > .row [data-act="next-multi"], .q.words-on > .row [data-act="next-pair"] { display: none; }

/* ---------- waiting and done ---------- */

.waiting { display: grid; gap: 10px; margin-bottom: 8px; }
.waiting li { padding: 10px 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: 6px; }

.verdicts { display: grid; gap: 10px; margin: 0 0 16px; }
.verdict { padding: 12px 16px; background: var(--card); border: 1.5px solid var(--line); border-left-width: 6px; border-radius: 6px; display: grid; gap: 2px; }
.verdict-name { font-weight: 700; }
.verdict-line { color: var(--muted); font-size: 0.9375rem; }
.v-yes { border-left-color: var(--v-yes); }
.v-cond { border-left-color: var(--v-cond); }
.v-wait { border-left-color: var(--v-wait); }
.v-no { border-left-color: var(--v-no); }
.v-none { border-left-color: var(--v-none); }

/* ---------- what we know so far ---------- */

.know-details { border: 1px solid var(--line); border-top: 4px solid var(--navy); border-radius: var(--radius); box-shadow: var(--shadow-soft); background: var(--card); }
.know-details summary {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px;
    padding: 10px 14px; min-height: 44px; cursor: pointer; list-style: none;
}
.know-details summary::-webkit-details-marker { display: none; }
.know-details summary::after {
    content: ""; flex: none; width: 8px; height: 8px; margin-left: auto; align-self: center;
    border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 0.15s ease;
}
.know-details[open] summary::after { transform: rotate(-135deg); }
.know-title { font: 700 1rem/1.3 var(--serif); }
.know-line { color: var(--muted); font-size: 0.875rem; flex: 1 1 100%; order: 3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.know-line:empty { display: none; }
.know-body { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.panel-empty { margin: 10px 0 0; color: var(--muted); font-size: 0.9375rem; }

.know { margin: 8px 0 0; }
.kv { margin: 0 0 12px; }
.kv dt { color: var(--muted); font-size: 0.8125rem; margin: 0 0 2px; }
.kv dd { margin: 0; font-size: 0.9375rem; line-height: 1.45; }
.kv ul { margin: 0; padding-left: 1.1em; }
.kv li { margin: 0 0 2px; }
.kv .verdict-list { list-style: none; padding-left: 0; }
.verdict-list li { padding-left: 10px; border-left: 4px solid var(--line); }

@media (min-width: 60rem) {
    .know-details summary { cursor: default; pointer-events: none; }
    .know-details summary::after { display: none; }
    .know-line { display: none; }
}

/* ---------- sheets ---------- */

.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; background: var(--shade); }
.sheet-body {
    position: relative; width: 100%; max-height: 92vh; overflow-y: auto;
    padding: 22px 16px 24px; background: var(--bg); color: var(--ink);
    border-radius: 12px 12px 0 0; border-top: 1px solid var(--line);
}
.sheet-title { margin: 0 0 8px; font: 700 1.6rem/1.2 var(--serif); }
.sheet-title:focus { outline: none; }
.sheet-body .email, .sheet-body .paste { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.status { min-height: 1.5em; margin: 12px 0 0; color: var(--ink); font-size: 0.9375rem; }

@media (min-width: 40rem) {
    .sheet { align-items: center; }
    .sheet-body { width: 34rem; max-height: 86vh; border-radius: 8px; border: 1px solid var(--line); padding: 28px 28px 26px; }
}

/* ---------- foot ---------- */

.foot { margin-top: 48px; }
.foot .link { color: var(--on-navy-soft); }
.foot .link:hover { color: #ffffff; }
.foot p { margin: 0 0 4px; max-width: 36rem; }

.loading { color: var(--muted); }

#irf-save-indicator { display: none !important; }

@media print {
    .tools, .sheet, .row, .know-panel { display: none; }
}

/* Voice input. Drawn only when this browser can run the speech model on the device. */
.voice { margin: 14px 0 18px; }
.mic {
    display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 16px;
    border: 2px solid var(--navy); border-radius: 999px; background: var(--card); color: var(--navy);
    font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.mic:hover { background: var(--tint); }
.mic[disabled] { opacity: 0.6; cursor: progress; }
.mic-dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--navy); flex: none; }
.mic[aria-pressed="true"] { background: var(--tint); }
.mic[aria-pressed="true"] .mic-dot { background: var(--v-wait); border-color: var(--v-wait); animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 50% { transform: scale(1.35); } }
.voice-hint { margin: 8px 0 0; color: var(--muted); font-size: 0.9375rem; max-width: 34rem; }
.voice-box:empty { display: none; }
.voice-box { margin-top: 10px; padding: 10px 14px; border-left: 4px solid var(--navy); background: var(--tint); max-width: 34rem; }
.voice-say { margin: 0 0 8px; }
.voice-say:last-child { margin-bottom: 0; }
.voice-notice { font-weight: 600; }
.voice-btns { margin-top: 8px; }
.voice-off { color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
    .mic[aria-pressed="true"] .mic-dot { animation: none; }
}
