/* CAM 2026 scam feed — public/shared/feed.css (docs/design.md "Scam feed", revision 1)
 *
 * Loaded after theme.css on scamfeed/index.html only. Everything here is scoped to the feed
 * (.feed, .msg, .check, .done) and uses only the shared tokens and classes from docs/design.md:
 * no raw hex, channel looks through .msg--<channel> modifiers, 320 px reflow, expand/collapse
 * through the hidden attribute (a 150 ms fade is the only motion and it stops under
 * prefers-reduced-motion). Neutral greys for phone bubbles and browser chrome are mixed from
 * --ink and --card-bg so they stay neutral whatever the tenant accent is.
 */

.feed {
  --bubble: color-mix(in srgb, var(--ink) 7%, var(--card-bg));
  --chrome: color-mix(in srgb, var(--ink) 5%, var(--card-bg));
  --ok-tint: color-mix(in srgb, var(--ok) 11%, var(--card-bg));
  --danger-tint: color-mix(in srgb, var(--danger) 8%, var(--card-bg));
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}
.feed [hidden] { display: none !important; }   /* grid/flex rules below must never beat the attribute */
.feed .card { margin: 0; }

/* --- Progress: the shared .progress component (label, track, fill, data-step widths) from theme.css */
.feed-progress { padding: 0 var(--space-1); }
.feed-progress .progress-label { color: var(--accent-ink); }

/* --- Sticky action bar: the flow's one primary action, floating above the posts ---------------- */
.feedbar {
  position: sticky;
  bottom: var(--space-3);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-1), 0 12px 32px rgb(16 24 40 / 10%);
}
.feedbar__count { font-size: var(--text-s); font-weight: 600; color: var(--muted); white-space: nowrap; }
.feedbar .btn { flex: 1 1 auto; max-width: 20rem; }

/* --- Post list ---------------------------------------------------------------------------------- */
.feed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.feed-list__item { margin: 0; min-width: 0; }
.feed-list__item + .feed-list__item { margin-top: 0; }

/* --- Post card: collapsed summary (chips, title button, received header, 2-line snippet) --------- */
.msg {
  position: relative;
  padding: var(--space-4) var(--space-5) var(--space-5);
  scroll-margin-top: var(--space-6);
  transition: box-shadow 150ms ease-out;
}
.msg.is-open { box-shadow: 0 0 0 2px var(--tint-2), var(--shadow-1); }
.msg-summary { display: grid; gap: var(--space-3); cursor: pointer; }
.msg-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.chip--done { background: var(--ok-tint); color: var(--ok); }
.chip--done::before { content: "\2713" / ""; font-weight: 700; }   /* decorative; the word "Spotted" carries the meaning */

.msg-title { margin: 0; font-size: var(--text-l); line-height: 1.3; }
.msg-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--target);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--space-1);
  -webkit-tap-highlight-color: transparent;
}
.msg-toggle__text { min-width: 0; overflow-wrap: anywhere; }
.msg-toggle__icon {
  flex: none;
  width: 10px;
  height: 10px;
  margin: 0 var(--space-2) 0 0;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: translateY(-3px) rotate(45deg);
  transition: transform 150ms ease-out;
}
.msg-toggle[aria-expanded="true"] .msg-toggle__icon { transform: translateY(3px) rotate(-135deg); }

.msg-snippet {
  margin: 0;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* --- Open state: the full message, then the quiet "What gives it away?" button ------------------ */
.msg-panel { display: grid; gap: var(--space-4); margin-top: var(--space-4); animation: feed-fade 150ms ease-out; }
@keyframes feed-fade { from { opacity: 0; } to { opacity: 1; } }
.msg-panel p { overflow-wrap: anywhere; }
.msg-tells-toggle { justify-self: start; }
.msg-aside { margin: 0; font-size: var(--text-s); font-style: italic; color: var(--muted); text-align: center; }

/* Links inside a scam message look like links but go nowhere; a markdown link also shows its real target. */
.msg-link { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 0.15em; }
.msg-link__url { font-family: var(--mono); font-size: 0.85em; color: var(--muted); overflow-wrap: anywhere; }

/* --- Email: inbox preview (name, address, subject, snippet) then the body under a hairline ------ */
.mail-head { display: grid; gap: var(--space-1); }
.mail-head__from { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); }
.mail-head__name { font-weight: 600; }
.mail-head__addr { font-family: var(--mono); font-size: var(--text-s); color: var(--muted); overflow-wrap: anywhere; }
.mail-head__subject { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.mail-body { border-top: 1px solid var(--line); padding-top: var(--space-4); }
.mail-body p { margin: 0 0 var(--space-3); }
.mail-body p:last-child { margin-bottom: 0; }

/* --- Text message: grey thread header with the number, then grey bubbles ------------------------ */
.thread-head {
  display: flex;
  justify-content: center;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-s);
  background: var(--chrome);
}
.thread-head__number { font-weight: 600; font-size: var(--text-s); }
/* Collapsed, the 2-line snippet is itself a bubble; open, the body is one or two bubbles. */
.msg--sms .msg-snippet {
  max-width: min(100%, 32rem);
  padding: var(--space-2) var(--space-4);
  border-radius: 18px 18px 18px 6px;
  background: var(--bubble);
  color: var(--ink);
}
.thread { display: grid; gap: var(--space-2); justify-items: start; }
.thread__time, .thread__from { margin: 0; justify-self: center; font-size: var(--text-s); color: var(--muted); }
.thread__from { justify-self: start; font-weight: 600; margin-top: var(--space-2); }
.bubble {
  max-width: min(100%, 32rem);
  padding: var(--space-2) var(--space-4);
  border-radius: 18px 18px 18px 6px;
  background: var(--bubble);
  color: var(--ink);
}
.bubble p { margin: 0 0 var(--space-2); }
.bubble p:last-child { margin-bottom: 0; }
.thread .msg-aside { justify-self: center; padding: var(--space-1) var(--space-2); }

/* --- Phone call: a call-log row, then the voicemail transcript in a quiet card ------------------- */
.call-row { display: flex; align-items: center; gap: var(--space-3); }
.call-row__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--danger-tint);
  color: var(--danger);
}
.call-row__icon::before { content: "\2199"; font-size: 1.1rem; font-weight: 700; }
.call-row__text { display: grid; gap: 2px; min-width: 0; }
.call-row__number { font-weight: 600; overflow-wrap: anywhere; }
.call-row__sub { font-size: var(--text-s); color: var(--danger); }
.transcript { display: grid; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-s); background: var(--chrome); }
.transcript__label { margin: 0; font-size: var(--text-s); font-weight: 600; color: var(--muted); }
.transcript__line { margin: 0; }
.transcript .msg-aside { text-align: left; }

/* --- Marketplace listing: plain placeholder tile, price and place lines, then the DM thread -------- */
.listing { display: grid; grid-template-columns: 5.5rem 1fr; gap: var(--space-3); align-items: start; }
.listing__tile {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: var(--radius-s);
  background: var(--chrome);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: var(--text-s);
  text-align: center;
}
.listing__text { display: grid; gap: var(--space-1); min-width: 0; }
.listing__price { margin: 0; font-size: var(--text-l); font-weight: 700; }
.listing__meta { margin: 0; font-size: var(--text-s); color: var(--muted); overflow-wrap: anywhere; }
.social-body { display: grid; gap: var(--space-3); }
.listing__desc { margin: 0; padding-top: var(--space-3); border-top: 1px solid var(--line); }
.social-body .thread { border-radius: var(--radius-s); }

/* --- Website: browser chrome with a fake address bar showing the .example domain --------------- */
.chrome {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-s);
  background: var(--chrome);
}
.chrome__dots { display: inline-flex; gap: 5px; }
.chrome__dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.chrome__url {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  background: var(--card-bg);
  font-family: var(--mono);
  font-size: var(--text-s);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.web-body { display: grid; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-s); }
.web-body__title { margin: 0; font-size: var(--text-l); font-weight: 700; }
.web-body p { margin: 0; }

/* --- Tells: highlighted phrases in the message + the numbered list with one "why" each ----------- */
/* The mark gets a tint and an underline, so colour is never the only cue; the list repeats the quote. */
mark.tell {
  background: var(--tint-2);
  color: inherit;
  border-bottom: 2px solid var(--accent-fill);
  border-radius: 3px;
  padding: 0 0.15em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.tells-panel { display: grid; gap: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); animation: feed-fade 150ms ease-out; }
.tells-panel > h3 { margin: 0; }
.tells { margin: 0; padding-left: 1.4rem; display: grid; gap: var(--space-3); }
.tells li { margin: 0; padding-left: var(--space-1); }
.tells li::marker { font-weight: 700; color: var(--accent-ink); }
.tells q { font-weight: 600; color: var(--accent-ink); quotes: "\201C" "\201D"; }
.tells__why { display: block; margin-top: 2px; color: var(--ink); }
.msg-sources { margin: 0; font-size: var(--text-s); color: var(--muted); overflow-wrap: anywhere; }

/* --- What to do right now: soft card with the action hint and the tenant help desk --------------- */
.action { padding: var(--space-4) var(--space-5); display: grid; gap: var(--space-2); }
.action > h3 { margin: 0; color: var(--accent-ink); }
.action__hint { margin: 0; font-weight: 600; max-width: 36rem; }
.action__help { padding-top: var(--space-2); border-top: 1px solid var(--line); }
.action__help p { margin: 0 0 var(--space-2); }
.action__help p:last-child { margin-bottom: 0; }

/* --- The 3-question check ----------------------------------------------------------------------- */
.check__title { margin-top: 0; }
.check__hint { margin: 0 0 var(--space-4); color: var(--muted); max-width: 36rem; }
.check__body { display: grid; gap: var(--space-3); justify-items: start; }
.check-form { display: grid; gap: var(--space-5); justify-items: stretch; width: 100%; }
.check__intro { margin: 0; color: var(--muted); max-width: 36rem; }
.check__q { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: var(--space-3); }
.check__q legend { padding: 0; margin-bottom: var(--space-1); overflow-wrap: anywhere; }
.check__num { display: block; margin-bottom: var(--space-1); font-size: var(--text-s); font-weight: 600; color: var(--muted); }
.check__text { display: block; font-size: var(--text-l); font-weight: 700; line-height: 1.3; }
.check__about { margin: 0; font-size: var(--text-s); color: var(--muted); }
.choices { display: grid; gap: var(--space-2); }
.choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: var(--control);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--card-bg);
  cursor: pointer;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
.choice input[type="radio"] { flex: none; width: 1.3rem; height: 1.3rem; margin: 0.15rem 0 0; accent-color: var(--accent-fill); }
.choice__text { min-width: 0; overflow-wrap: anywhere; }
.choice:hover { background: var(--tint-1); }
.choice.is-selected, .choice:has(input:checked) { border-color: var(--accent-fill); background: var(--tint-1); }
.choice.is-selected .choice__text, .choice:has(input:checked) .choice__text { font-weight: 600; }
/* Where :has() is supported, the ring sits on the whole card; elsewhere the radio keeps its own ring. */
.choice:has(input:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.choice:has(input:focus-visible) input { outline: none; }
.check__q.is-missing .choices { outline: 2px solid var(--danger); outline-offset: 4px; border-radius: var(--radius-s); }
.check__error { margin: 0; font-size: var(--text-s); font-weight: 600; color: var(--danger); }
.check__result { margin: 0; padding: var(--space-4) var(--space-5); }
.check__result p { margin: 0 0 var(--space-2); }
.check__result p:last-child { margin-bottom: 0; }
.check__wrong { margin: 0; padding-left: 1.25rem; }
.check-form > .btn { justify-self: start; }

/* --- Completed: calm success card, raw score, what you learned, help desk, next step ------------ */
.done { display: grid; gap: var(--space-3); justify-items: start; }
.done__glyph { position: relative; width: 56px; height: 56px; border-radius: 50%; background: var(--ok-tint); }
.done__glyph::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 13px;
  width: 11px;
  height: 22px;
  border: solid var(--ok);
  border-width: 0 4px 4px 0;
  transform: rotate(45deg);
}
.done__title { margin: 0; font-size: var(--text-xl); color: var(--accent-ink); }
.done .notice { margin: 0; }
.done__score { margin: 0; font-size: var(--text-xl); font-weight: 700; }
.done > h3 { margin: var(--space-3) 0 0; }
.learned { list-style: none; margin: 0; padding: 0; display: grid; width: 100%; }
.learned li { margin: 0; padding: var(--space-3) 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.learned li:last-child { border-bottom: 1px solid var(--line); }
.learned__type { font-weight: 700; color: var(--accent-ink); }
.learned__tip { color: var(--ink); }
.done .helpdesk { width: 100%; padding: var(--space-4) var(--space-5); }
.done__next { margin: var(--space-2) 0 0; width: 100%; }

/* --- Notes: opens soon, session ended, load error ---------------------------------------------- */
.note { display: grid; gap: var(--space-3); justify-items: start; }
.note__title { margin: 0; }

/* --- 320 px reflow: stacked meta, full-width buttons, tighter cards ------------------------------ */
@media (max-width: 480px) {
  .msg { padding: var(--space-4); }
  .feedbar { padding: var(--space-2); }
  .feedbar .btn { max-width: none; }
  .msg-tells-toggle, .check-form > .btn, .check__body > .btn, .done__next .btn, .note .btn, .check__result .btn { display: flex; width: 100%; justify-self: stretch; }
  .listing { grid-template-columns: 4.5rem 1fr; }
  .call-row__icon { width: 36px; height: 36px; }
  .feed-progress .progress-label { font-size: 0.875rem; }
}
@media (max-width: 360px) {
  .feedbar__count { display: none; }
  .listing { grid-template-columns: 1fr; }
  .listing__tile { aspect-ratio: auto; height: 3rem; }
}

/* --- Motion: expand/collapse is the hidden attribute; the fades and the chevron turn stop here --- */
@media (prefers-reduced-motion: reduce) {
  .msg, .msg-panel, .tells-panel, .msg-toggle__icon, .choice, .feed-progress .progress-fill { animation: none !important; transition: none !important; }
}
