/* The case page: one column on phones; from 960px the join, follow and share panel holds a sticky right column.
   Loads after receipt.css (tokens, cards, paper, share buttons) and box.css (the one text box). */

:root { --fixed: #8fd19e; }

body.rp.case { overflow-x: hidden; }
.case-app { max-width: 560px; }
.case-layout { display: flex; flex-direction: column; gap: 16px; }
.case-layout > *, .case-side > * { min-width: 0; }
.case-side { display: flex; flex-direction: column; gap: 16px; }

.case .card h3 { font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; margin: 0; }
.case .card > .sub { margin-bottom: 10px; }
.case .empty { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.case a { overflow-wrap: anywhere; }

/* 1. Headline */
.case-head { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.case-head h1 { margin: 0; }
.case-head .lede { margin: 0; }
.eyebrow { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .02em; overflow-wrap: anywhere; }
.eyebrow b { color: var(--amber); font-weight: 500; }
.counts { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.count { display: inline-flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--muted); }
.count b { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.count[data-count="recent"] b { color: var(--amber); }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink);
    border: 1px solid var(--line-2);
    border-radius: 999px;
    padding: 3px 10px;
    margin: 0;
    white-space: nowrap;
    vertical-align: middle;
    letter-spacing: 0;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.chip[data-status="sent"] .dot { background: var(--warn); }
.chip[data-status="answered"] .dot { background: var(--amber); }
.chip[data-status="fixed"] .dot { background: var(--fixed); }
.chip[data-status="fixed"] { border-color: var(--fixed); }
h2 .chip { margin-left: 6px; font-weight: 400; }

/* 2. The way out */
.ways { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: way; }
.way { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.way:first-child { border-top: 0; padding-top: 2px; }
.way details { display: flex; flex-direction: column; gap: 6px; }
.way details > * + * { margin-top: 6px; }
.way summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px; padding-right: 26px; position: relative; min-height: 44px; }
.way summary::-webkit-details-marker { display: none; }
.way summary::after { content: "+"; position: absolute; right: 2px; top: 0; font-family: var(--mono); font-size: 18px; color: var(--muted); }
.way details[open] summary::after { content: "–"; }
.way summary:hover h3 { color: var(--amber); }
.way summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }
.way-top { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.head-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.jump { font-size: 13px; color: var(--amber); text-decoration: none; display: inline-flex; align-items: center; min-height: 32px; }
.jump:hover { text-decoration: underline; text-underline-offset: 3px; }
.kind {
    font-family: var(--mono);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    border: 1px solid var(--line-2);
    border-radius: 4px;
    padding: 1px 6px;
}
.kind[data-kind="official"] { color: var(--amber); border-color: rgba(244, 163, 64, .5); }
.kind[data-kind="prevention"] { color: var(--fixed); border-color: rgba(143, 209, 158, .45); }
.worked { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.worked::before { content: "✓ "; color: var(--fixed); }
.way h3 { font-size: 16.5px; line-height: 1.3; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink); }
.steps li::marker { color: var(--faint); font-family: var(--mono); font-size: 12px; }
.srcs { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.srcs .src-k { color: var(--faint); }
.srcs a { color: var(--muted); text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.srcs a:hover { color: var(--amber); }

.rights, .routes { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-2); display: flex; flex-direction: column; gap: 8px; }
.rights ul, .routes ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rights li { font-size: 13.5px; line-height: 1.5; }
.cc {
    display: inline-block;
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--ground);
    background: var(--muted);
    border-radius: 4px;
    padding: 0 5px;
    margin-right: 8px;
    vertical-align: 1px;
    white-space: nowrap;
}
.src { font-size: 12px; color: var(--muted); text-underline-offset: 3px; }
.src:hover { color: var(--amber); }
.route { display: flex; flex-direction: column; gap: 2px; }
.route .cc { align-self: flex-start; margin-bottom: 2px; }
.route .body { font-size: 14px; font-weight: 600; color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.route a.body:hover { color: var(--amber); }
.route .what { margin: 0; font-size: 13px; color: var(--muted); }
.route .facts { margin: 0; font-size: 12px; color: var(--faint); }

/* 3. Your next step: the one box */
.next-step { display: flex; flex-direction: column; gap: 10px; }
.next-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.next-top h2 { margin: 0; }
.status-pill .dot { background: var(--faint); transition: background .3s; }
.promise { margin: 0; font-family: var(--display); font-weight: 700; font-size: 21px; line-height: 1.15; letter-spacing: -.015em; text-wrap: balance; }
.next-step .composer { background: var(--ground); }
.next-step .go { width: 100%; }
.next-step .go[aria-disabled="true"]:not(.is-released) {
    cursor: not-allowed;
    color: var(--faint);
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line);
}
.go.unlocked { animation: unlock .6s cubic-bezier(.2, .8, .3, 1.2); }
.go.small { min-height: 44px; font-size: 15px; padding: 10px 16px; border-radius: 12px; }
.k { display: none; font-family: var(--mono); font-size: 12px; font-weight: 500; margin-left: 10px; padding: 2px 6px; border-radius: 6px; background: rgba(0, 0, 0, .14); }
.box-note { text-align: left; }

.next-result { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.you-line { margin: 0; font-family: var(--display); font-weight: 750; font-size: 22px; letter-spacing: -.02em; color: var(--amber); }
.you-line:empty { display: none; }
.own-link { margin: 0; font-size: 12.5px; color: var(--muted); }
.own-link a { color: var(--ink); text-underline-offset: 3px; }
.dev-note {
    margin: 0;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--warn);
    border: 1px dashed var(--warn);
    border-radius: 10px;
    padding: 10px 12px;
}

.letter { display: flex; flex-direction: column; gap: 10px; }
.letter-route { margin: 0; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.letter-route b { color: var(--ink); font-weight: 600; font-size: 14px; }
.letter-route .addr { font-family: var(--mono); font-size: 12.5px; color: var(--amber); overflow-wrap: anywhere; }
.letter-paper {
    background: var(--paper);
    color: var(--paper-ink);
    border-radius: 6px;
    padding: 16px;
    font-size: 14.5px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.letter-paper .subject { margin: 0 0 10px; font-weight: 700; }
.letter-paper .body { margin: 0; white-space: pre-wrap; }
.letter-paper mark.ph { background: #ffe19a; color: var(--paper-ink); border-radius: 3px; padding: 0 2px; box-shadow: inset 0 -2px 0 #e0a126; }
.letter-hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.letter-refused { margin: 0; font-size: 14px; color: var(--warn); }

/* Hand-offs after the letter: to someone who can help, or to the person's own AI agent */
.handoff { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--line-2); padding-top: 12px; }
.handoff[hidden], .handoff-mini[hidden] { display: none; }
.handoff .sub, .handoff-mini .sub { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.handoff .note, .handoff-mini .note { margin: 0; font-size: 12.5px; color: var(--muted); text-align: left; }
.handoff .note:empty, .handoff-mini .note:empty { display: none; }
.brief-box summary, .handoff-mini summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
    min-height: 32px;
    display: flex;
    align-items: center;
    text-underline-offset: 3px;
}
.brief-box summary { list-style: none; text-decoration: underline dotted var(--line-2); }
.brief-box summary::-webkit-details-marker { display: none; }
.brief-box summary:hover, .handoff-mini summary:hover { color: var(--amber); }
.brief {
    margin: 8px 0 0;
    max-height: 280px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--ground);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
}
.brief:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.handoff-mini { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.handoff-mini[open] { gap: 10px; }
.handoff-mini summary { color: var(--ink); font-weight: 600; }
.handoff-mini summary::after { content: "+"; margin-left: auto; font-family: var(--mono); color: var(--muted); }
.handoff-mini[open] summary::after { content: "–"; }
.handoff-mini summary::-webkit-details-marker { display: none; }
.handoff-mini summary { list-style: none; }
.handoff-mini .brief { max-height: 160px; margin: 0; }

/* 4. Join: the case as a paper ticket */
.join { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.join .receipt.ticket { max-width: none; animation: none; }
.ticket .head { margin: 0; text-transform: uppercase; font-weight: 700; overflow-wrap: anywhere; }
.ticket .you { font-weight: 700; font-size: 13.5px; }
.join h2 { margin: 6px 0 0; }
.join-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--amber); border: 1px solid var(--amber); cursor: default; filter: none; }
.join-btn[aria-pressed="true"]::before { content: "✓ "; }
.join .note { text-align: left; }
.join .note:empty { display: none; }
.join h2 + .sub { margin-top: -6px; }
.ticket.receipt { padding: 14px 16px 16px; }
.ticket .bars { height: 22px; margin: 8px 6px 2px; }
.ticket hr { margin: 7px 0; }
.milestone { font-size: 12.5px; }
.stamped { animation: stamp .32s cubic-bezier(.2, .9, .3, 1.4); }

/* 5–8. Follow, share, I got out, handle this for me */
.done { font-size: 14px; line-height: 1.45; }
.form-note { display: block; font-size: 12px; color: var(--muted); }
.form-note.warn { color: var(--warn); }
.got-out-btn { align-self: flex-start; }
.got-out { display: flex; flex-direction: column; gap: 8px; }
.got-out .done { color: var(--ink); border-left: 3px solid var(--fixed); padding-left: 10px; }
.got-out-form, .remove-form { display: flex; flex-direction: column; gap: 8px; }
.got-out-form label, .remove-form label { font-size: 13px; color: var(--ink); }
.got-out-form input, .got-out-form select, .remove-form input {
    min-height: 44px;
    font: inherit;
    font-size: 16px;
    color: var(--ink);
    background: var(--ground);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    padding: 8px 12px;
    width: 100%;
    min-width: 0;
}
.got-out-form input:focus, .got-out-form select:focus, .remove-form input:focus { border-color: var(--amber); outline: none; }
.got-out-form .go { align-self: flex-start; }
.badge {
    display: inline-block;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--warn);
    border: 1px solid var(--warn);
    border-radius: 4px;
    padding: 1px 6px;
    vertical-align: 3px;
}
.x-post { font-weight: 600; }

/* 9. Their side */
.status-line { margin: 0 0 6px; font-size: 14.5px; }
.side-status h3 { margin-top: 12px; }
.answer {
    margin: 8px 0 4px;
    padding: 2px 0 2px 14px;
    border-left: 3px solid var(--amber);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 14.5px;
}
.side-status .facts { margin: 0; font-size: 12px; color: var(--muted); }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.timeline time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding-top: 2px; }
.timeline li[data-kind="answered"] span, .timeline li[data-kind="fixed"] span { color: var(--amber); }

/* 10. The posts */
.post-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.post { border-top: 1px solid var(--line); padding: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.post:first-child { border-top: 0; padding-top: 4px; }
.post blockquote { margin: 0; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.post .meta { margin: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: center; font-size: 12px; color: var(--muted); }
.post .who { color: var(--ink); overflow-wrap: anywhere; }
.post .orig { color: var(--muted); text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 32px; }
.post .orig:hover { color: var(--amber); }
.linkish {
    font: inherit;
    font-size: 12px;
    color: var(--faint);
    background: none;
    border: 0;
    border-bottom: 1px dotted var(--line-2);
    padding: 2px 0;
    min-height: 32px;
    cursor: pointer;
}
.linkish:hover { color: var(--ink); }
.remove-form { background: var(--ground); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.remove-form .btn { align-self: flex-start; }
.post.is-removed { animation: fold-post .35s ease-in forwards; overflow: hidden; }

@media (max-width: 959px), (pointer: coarse) {
    .linkish, .post .orig, .brief-box summary, .handoff-mini summary { min-height: 44px; }
}

/* Keep the public story and private help choices in one reading path. */
.case-app { max-width: 820px; }
.case-layout { display: flex; flex-direction: column; gap: 28px; }
.case-head { gap: 12px; }
.case-head h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.12; }
.case-head .lede { font-size: 19px; max-width: 58ch; }
.case-head .fine { margin: 0; }
.case .next-step { border-color: var(--line-2); }
.case .next-step h2 { font-size: 24px; }
.case .composer { display: flex; flex-direction: column; gap: 10px; }
.case .composer label { color: var(--ink); font-size: 14px; font-weight: 600; }
.case .composer textarea, .case .composer select {
  width: 100%; min-width: 0; box-sizing: border-box; background: var(--ground);
  color: var(--ink); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 12px; font: 16px/1.55 var(--body); resize: vertical;
}
.case .composer select { min-height: 48px; }
.case .composer textarea:focus, .case .composer select:focus { outline: 2px solid var(--amber); outline-offset: 2px; }
.case .box-note { margin: 0 0 6px; line-height: 1.5; }
.case .go { min-height: 48px; }
.case-more { border-top: 1px solid var(--line-2); padding-top: 14px; }
.case-more > summary, .route-directory > summary { cursor: pointer; padding: 10px 0; min-height: 44px; font-weight: 600; color: var(--ink); }
.case-more[open] > summary { margin-bottom: 14px; }
.case-more > .card + .card { margin-top: 16px; }
.route-directory { margin-top: 14px; }
.letter-paper { display: flex; flex-direction: column; gap: 8px; }
.letter-paper label { font-size: 13px; font-weight: 600; }
.letter-paper input, .letter-paper textarea { width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid var(--paper-muted); border-radius: 4px; background: transparent; color: var(--paper-ink); padding: 10px; font: 16px/1.55 var(--body); }
.letter-paper textarea { resize: vertical; }
.letter-paper input:focus, .letter-paper textarea:focus { outline: 2px solid var(--paper-ink); outline-offset: 2px; }
.worked::before { content: none; }
.case .evidence-note { font-size: 13px; color: var(--muted); }
@media (min-width: 700px) { .next-step .go { align-self: flex-start; padding-inline: 28px; } }

@keyframes unlock { 0% { transform: scale(.96); box-shadow: 0 0 0 0 rgba(244, 163, 64, .6); } 60% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(244, 163, 64, 0); } 100% { transform: none; } }
@keyframes fold-post { 0% { max-height: 600px; opacity: 1; } 100% { max-height: 0; opacity: 0; padding-block: 0; border-top-width: 0; } }

/* The live reading keeps its mirror and highlighted text in the same geometry. */
.case .composer .field textarea { border: 0; padding: 2px; font: var(--field-size)/var(--field-line) var(--body); background: transparent; color: var(--ink); caret-color: var(--amber); resize: none; }
.case .composer .field textarea:focus { outline: none; }
.private-draft { margin: 14px 0; }
.private-draft > summary { cursor: pointer; min-height: 44px; padding: 10px 0; color: var(--ink); }
.private-draft select { display: block; font: inherit; padding: 10px; margin: 8px 0 14px; max-width: 100%; color: var(--ink); background: var(--ground); border: 1px solid var(--line-2); border-radius: 6px; }
.join:not([data-number]) .receipt.ticket { display: none; }

#publish-result:empty { display: none; }

.invite-link { width: 100%; min-width: 0; box-sizing: border-box; padding: 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--ground); color: var(--ink); font: 13px/1.5 var(--mono); }
.invite-link:focus { outline: 2px solid var(--amber); outline-offset: 2px; }

/* Collective progress stays next to the action it describes. */
.collective-progress { border-left: 2px solid var(--amber); padding: 2px 0 2px 16px; margin: 12px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.collective-progress p { margin: 0; }
.collective-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.collective-count { font-size: 13px; color: var(--muted); }
.collective-count span { font-family: var(--mono); color: var(--amber); }
.collective-progress progress { width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--surface-2); accent-color: var(--amber); }
.collective-progress progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 3px; }
.collective-progress progress::-webkit-progress-value { background: var(--amber); border-radius: 3px; }
.collective-progress .note { font-size: 12.5px; line-height: 1.55; }

.collective-scope summary { font-size: 12.5px; color: var(--muted); cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.collective-scope summary::before { content: "+"; }
.collective-scope[open] summary::before { content: "−"; }
.collective-scope summary::-webkit-details-marker { display: none; }
.collective-scope summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
