/* app.css — small additions on top of the V1 design system (demos-app.css) for
   the authenticated app. Keep this thin; prefer the .da-* system. */

/* Normalize the [hidden] attribute. Several .da-* components set `display`
   (e.g. .da-saved, .da-mailwarn, .da-alert), which beats the UA `[hidden]`
   rule — so toggling `el.hidden` alone wouldn't hide them. This guarantees it. */
[hidden] { display: none !important; }

/* Special-interest MATCH chip: shown when an item's tagged issues intersect the
   user's followed topics. Deliberately distinct from the neutral spectrum tags
   (.da-spec) and never maple — maple is reserved for civic actions. A quiet
   forest-on-sage chip that reads as "this is personal to you". */
.da-matchtag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-pill, 999px);
  background: var(--color-sage-pale); color: var(--color-forest);
  border: 1px solid var(--color-sage-light, #B7CBBE);
  font-size: var(--text-caption); font-weight: 600; line-height: 1.4;
}
.da-matchtag svg { width: 13px; height: 13px; flex: 0 0 13px; }

.da-matchrow {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 12px;
}

/* Petition card headline: petitions have no short title — the full "what it
   does" summary IS the headline. At the bill-title size (h4) a 2-3 line
   summary reads as a giant truncated headline; step it down so the whole
   summary fits and reads as a summary, not a cut-off title. */
.da-itemcard--petition .da-itemcard__title {
  font-size: var(--text-body); font-weight: var(--weight-semibold);
  line-height: 1.4; letter-spacing: 0;
}

/* Value/match tag group, relocated to sit just above the debate (bills) or the
   petition text (petitions). Own the spacing here so it reads as a labelled
   lead-in to that section rather than floating under the summary. */
.da-itemcard__valtags { display: flex; flex-direction: column; gap: 9px; margin-top: var(--space-base); }
.da-itemcard__valtags .da-itemcard__tags { margin-bottom: 0; }
.da-itemcard__valtags .da-matchrow { margin-top: 0; }

/* Language toggle is now <a> links (real navigation to /setlang) rather than
   inert buttons — mirror the .da-lang button styling so it looks identical. */
.da-lang a {
  font-family: var(--font-sans); font-weight: 700; font-size: 13px;
  color: var(--color-sage); padding: 4px 5px; border-radius: 6px; letter-spacing: 0.02em;
  text-decoration: none; transition: color var(--dur-base) var(--ease-out);
}
.da-lang a.active { color: var(--color-forest); text-decoration: underline; text-underline-offset: 3px; }
.da-lang a:hover { color: var(--color-forest-light); }
.da-lang a:focus-visible { box-shadow: var(--focus-ring); }

/* Busy/disabled state while a support or follow/mute action is in flight. */
.is-busy { opacity: 0.55; pointer-events: none; }

/* Constrain the leading icon in the petition-text summary (base CSS only sizes
   the chevron, so an unsized leading <svg> would balloon). */
.da-pettext > summary > svg:first-of-type { width: 16px; height: 16px; flex: 0 0 16px; }

/* === Deep analysis (Claude Design: "Bill Detail Deep Analysis Update") =====
   The design handoff (design-references/Bill Detail Deep Analysis Update.html)
   shipped markup structure only — these styles implement its components on the
   brand tokens. Governing rule (docs/DEEP_ANALYSIS.md §4.5): visual weight
   DESCENDS with certainty — change-areas solid, reactions lighter, scenarios
   visibly provisional (dashed, muted, always labelled). */

/* overview + method note */
.da-deep__overview { font-size: var(--text-body); line-height: 1.65; color: var(--color-charcoal); margin: 10px 0 0; text-wrap: pretty; }
.da-methodchip {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  font-size: var(--text-caption); font-weight: var(--weight-semibold); color: var(--color-sage);
  background: var(--color-white); border: 1px solid var(--color-forest-pale); border-radius: var(--radius-full);
  padding: 5px 12px; cursor: pointer; transition: color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.da-methodchip:hover { color: var(--color-forest); border-color: var(--color-sage-light); }
.da-methodchip:focus-visible { box-shadow: var(--focus-ring); }
.da-methodchip svg { width: 14px; height: 14px; }
.da-methodnote { margin-top: var(--space-base); background: var(--color-sage-pale); border: 1px solid var(--color-forest-pale); border-radius: var(--radius-md); padding: var(--space-base); }
.da-methodnote__head { display: flex; align-items: center; justify-content: space-between; font-size: var(--text-label); font-weight: var(--weight-semibold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-sage); margin-bottom: 6px; }
.da-methodnote__close { border: 0; background: none; font-size: 18px; line-height: 1; color: var(--color-sage); cursor: pointer; padding: 2px 6px; }
.da-methodnote p { font-size: var(--text-body-s); line-height: 1.6; color: var(--color-charcoal); margin: 0 0 6px; }
.da-methodnote__meta { font-size: var(--text-caption); color: var(--color-sage); margin: 0; }


/* change-areas: the FACT tier — full weight, solid borders */
.da-changearea-list { display: flex; flex-direction: column; gap: 10px; margin-top: var(--space-base); }
.da-changearea { border: 1px solid var(--color-forest-pale); border-radius: var(--radius-md); background: var(--color-white); overflow: hidden; }
.da-changearea[open] { border-color: var(--color-sage-light); }
.da-changearea__summary { list-style: none; display: flex; align-items: center; gap: var(--space-sm); padding: 12px var(--space-base); cursor: pointer; -webkit-user-select: none; user-select: none; }
.da-changearea__summary::-webkit-details-marker { display: none; }
.da-changearea__num { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--radius-full); background: var(--color-forest); color: var(--color-white); font-size: var(--text-caption); font-weight: var(--weight-bold); }
.da-changearea__label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.da-changearea__heading { font-size: var(--text-body-s); font-weight: var(--weight-semibold); color: var(--color-forest); }
/* The "is this about me?" line on the collapsed row. Quieter than the heading
   so the row still scans as one item, not two. */
.da-changearea__affects { font-size: var(--text-caption); font-weight: var(--weight-regular, 400); color: var(--color-warm-gray); line-height: 1.4; }
.da-changearea__chev { width: 16px; height: 16px; color: var(--color-sage); transition: transform var(--dur-base) var(--ease-out); }
.da-changearea[open] .da-changearea__chev { transform: rotate(180deg); }
.da-changearea__body { padding: 0 var(--space-base) var(--space-base); }
.da-changearea__list { margin: 0; padding-left: 20px; }
.da-changearea__list li { font-size: var(--text-body-s); line-height: 1.6; color: var(--color-charcoal); margin-bottom: 8px; }
.da-changearea__who { font-size: var(--text-body-s); line-height: 1.55; color: var(--color-charcoal); margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--color-forest-pale); }
/* Leading variant: it now opens the section, so it needs no top rule and sits
   above the bullets rather than trailing them. */
.da-changearea__who--lead { margin: 0 0 10px; padding-top: 0; border-top: none; padding-bottom: 10px; border-bottom: 1px solid var(--color-forest-pale); }
.da-cite { display: inline-block; margin-left: 7px; font-family: var(--font-mono); font-size: 11px; color: var(--color-sage); background: var(--color-sage-pale); border: 1px solid var(--color-forest-pale); border-radius: var(--radius-sm); padding: 1px 6px; white-space: nowrap; vertical-align: 1px; }

/* reactions: MEDIUM certainty — lighter treatment, certainty chip mandatory */
.da-reaction-list { display: flex; flex-direction: column; gap: var(--space-base); margin-top: var(--space-base); }
.da-reaction { border-left: 3px solid var(--color-sage-light); padding: 2px 0 2px var(--space-base); }
.da-reaction__top { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; margin-bottom: 8px; }
.da-reaction__field { font-size: var(--text-body-s); line-height: 1.6; color: var(--color-charcoal); margin: 4px 0 0; }
.da-reaction__lbl { font-weight: var(--weight-bold); color: var(--color-forest); }
.da-certainty { display: inline-flex; align-items: center; font-size: var(--text-caption); font-weight: var(--weight-semibold); color: var(--color-sage); background: var(--color-base); border: 1px solid var(--color-forest-pale); border-radius: var(--radius-full); padding: 2px 10px; }
.da-perspectives { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 640px){ .da-perspectives { grid-template-columns: 1fr; } }
.da-perspectives--single { grid-template-columns: 1fr; }
.da-perspectives__side { background: var(--color-base); border: 1px solid var(--color-forest-pale); border-radius: var(--radius-md); padding: 10px 12px; }
.da-perspectives__label { font-size: var(--text-label); font-weight: var(--weight-semibold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-sage); margin: 0 0 4px; }
.da-perspectives__side p:not(.da-perspectives__label) { font-size: var(--text-body-s); line-height: 1.55; color: var(--color-charcoal); margin: 0; }

/* scenarios: SPECULATIVE — dashed, muted, standing marker. Never render these
   with the same visual authority as the fact tier. */
.da-scenario-list { display: flex; flex-direction: column; gap: 10px; margin-top: var(--space-base); }
.da-scenario { border: 1px dashed var(--color-sage-light); border-radius: var(--radius-md); background: var(--color-base); overflow: hidden; }
.da-scenario__summary { list-style: none; display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; padding: 11px var(--space-base); cursor: pointer; -webkit-user-select: none; user-select: none; }
.da-scenario__summary::-webkit-details-marker { display: none; }
.da-scenario__marker { flex: 0 0 auto; font-size: 10px; font-weight: var(--weight-bold); letter-spacing: 0.07em; text-transform: uppercase; color: var(--color-sage); border: 1px solid var(--color-sage-light); border-radius: var(--radius-sm); padding: 2px 7px; background: var(--color-white); }
.da-scenario__heading { font-size: var(--text-body-s); font-weight: var(--weight-semibold); color: var(--color-charcoal); flex: 1 1 220px; }
.da-scenario__plausibility { display: inline-flex; align-items: center; font-size: var(--text-caption); font-weight: var(--weight-semibold); color: var(--color-sage); background: var(--color-base); border: 1px solid var(--color-forest-pale); border-radius: var(--radius-full); padding: 2px 10px; white-space: nowrap; }

/* Shared likelihood colour tiers — a SINGLE-HUE ramp (deep forest = most
   confident → grey = least). Applied to both the reaction certainty chip and the
   scenario plausibility chip. Deliberately NOT red/green: likelihood is not
   good/bad, and a valenced palette would imply a judgment Demos must not make.
   Placed after both chip base rules so the tier colour wins (equal specificity). */
.da-certainty--high, .da-scenario__plausibility--high { color: var(--color-white); background: var(--color-forest); border-color: var(--color-forest); }
.da-certainty--likely, .da-scenario__plausibility--likely { color: var(--color-forest); background: var(--color-sage-light); border-color: var(--color-sage-light); }
.da-certainty--mod, .da-scenario__plausibility--mod { color: var(--color-forest-light); background: var(--color-sage-pale); border-color: var(--color-sage-light); }
.da-certainty--low, .da-scenario__plausibility--low { color: var(--color-warm-gray); background: var(--color-base); border-color: var(--color-forest-pale); }
.da-scenario__chev { width: 16px; height: 16px; color: var(--color-sage); transition: transform var(--dur-base) var(--ease-out); }
.da-scenario[open] .da-scenario__chev { transform: rotate(180deg); }
.da-scenario__body { padding: 0 var(--space-base) var(--space-base); }
.da-scenario__body p { font-size: var(--text-body-s); line-height: 1.6; color: var(--color-charcoal); margin: 0 0 8px; }
.da-scenario__prevent { border-top: 1px solid var(--color-forest-pale); padding-top: 8px; }

/* Discovery link from feed cards to a bill's published deep analysis.
   Informational forest/sage — deliberately NOT maple (maple = civic action). */
.da-deeplink {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 10px;
  font-size: var(--text-body-s); font-weight: var(--weight-semibold); color: var(--color-forest);
  background: var(--color-sage-pale); border: 1px solid var(--color-forest-pale);
  border-radius: var(--radius-full); padding: 6px 13px; text-decoration: none;
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.da-deeplink:hover { background: var(--color-forest-pale); border-color: var(--color-sage-light); }
.da-deeplink:focus-visible { box-shadow: var(--focus-ring); }
.da-deeplink svg { width: 15px; height: 15px; color: var(--color-sage); }
.da-deeplink svg:last-child { width: 13px; height: 13px; }

/* Analysis-staleness banner (lifecycle): the bill text moved after the
   analysis was published — keep it visible but transparently flagged. Amber,
   informational, never alarming. */
.da-stalebanner {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 12px;
  padding: 11px 14px; border-radius: var(--radius-md);
  background: #fdf6ec; border: 1px solid #e8d3a8; color: #7a5a1e;
  font-size: var(--text-body-s); line-height: 1.5;
}
.da-stalebanner svg { width: 17px; height: 17px; flex: 0 0 17px; margin-top: 1px; }

/* --- Search (search.html) ---------------------------------------------------
   Header search affordance + the search page's bar / filters / topic picker.
   Reuses da-seg, da-chip-opt, da-chips, da-empty, da-itemlist for the rest. */
.da-head__search {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-md);
  color: var(--color-sage); text-decoration: none;
  transition: color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.da-head__search:hover { color: var(--color-forest); background: var(--color-sage-pale); }
.da-head__search:focus-visible { box-shadow: var(--focus-ring); }
.da-head__search[aria-current="page"] { color: var(--color-forest); background: var(--color-sage-pale); }
.da-head__search svg { width: 20px; height: 20px; }

.da-search { margin-bottom: var(--space-lg); }
.da-search__bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--color-white); border: 1.5px solid var(--color-forest-pale);
  border-radius: var(--radius-lg); padding: 6px 6px 6px 14px;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.da-search__bar:focus-within { border-color: var(--color-sage-light); box-shadow: var(--focus-ring); }
.da-search__ico { width: 20px; height: 20px; flex: 0 0 20px; color: var(--color-sage); }
.da-search__input {
  flex: 1 1 auto; min-width: 0; appearance: none; border: none; background: transparent;
  font-family: var(--font-sans); font-size: var(--text-body); color: var(--color-charcoal);
  padding: 9px 0;
}
.da-search__input:focus { outline: none; }
.da-search__input::placeholder { color: var(--color-warm-gray); }
.da-search__go { flex: 0 0 auto; }

.da-search__filters { margin-top: var(--space-base); }

.da-search__topics { margin-top: var(--space-md); }
.da-search__toplbl {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-size: var(--text-body-s); font-weight: var(--weight-semibold); color: var(--color-forest);
  padding: 7px 4px;
}
.da-search__toplbl::-webkit-details-marker { display: none; }
.da-search__toplbl svg { width: 16px; height: 16px; color: var(--color-sage); }
.da-search__chev { transition: transform var(--dur-base) var(--ease-out); }
.da-search__topics[open] .da-search__chev { transform: rotate(180deg); }
.da-search__topbody { padding-top: 4px; }
.da-search__clear { display: inline-block; margin-top: var(--space-md); }

/* ---- Open layer (public, no account) ------------------------------------ */
/* The signed-out invitation that stands where the position buttons go. It is
   deliberately quiet: a soft panel, not a banner. The open layer is a complete
   product for the person who stays there (docs/POSITIONING.md §2), so this must
   read as an offer, never as a wall in front of withheld content. Anything
   louder — accent fills, urgency, a dismissable overlay — turns a civic utility
   into a lead magnet, which is the exact failure guardrail 1 names. */
.da-support--invite {
  background: var(--color-sage-pale);
  border: 1px solid var(--color-sage-light);
  border-radius: var(--radius-md);
  padding: var(--space-base);
  /* The feed stack is margin-bottom-only, so a block without one sits flush
     against whatever follows. This panel had none: on the feeds it touched the
     scope toggle and on /search it touched the search box. 24px matches the
     gap above it (.da-tabs), so the card reads as one object with room on both
     sides. Collapses against .da-itemcard__actions on the detail pages, which
     already reserves 24 — so this is a no-op there. */
  margin-bottom: var(--space-lg);
}
.da-support--invite .da-support__note { margin-top: 6px; }
/* The shared benefits line (templates/_invite.html) sits under the per-surface
   body, so it needs a little more air and the buttons need more again — three
   stacked lines of the same weight read as one paragraph otherwise. */
.da-support--invite .da-support__note--benefits { margin-top: 10px; }
.da-support--invite .da-support__btns { flex-wrap: wrap; align-items: center; margin-top: 14px; }

/* Header sign-in, shown only when signed out (the account menu takes this slot
   for members). */
.da-head__signin { white-space: nowrap; }

@media (max-width: 560px) {
  .da-support--invite .da-support__btns > .da-btn { width: 100%; }
}

/* --- Category filter on the feeds (templates/_specfilter.html) -------------
   The chips reuse .da-spec, so a filter chip and the tag on a card are
   visibly the same object — that is the whole affordance: you see "Economic"
   on a card, you recognise it in the bar. Selected state is a ring plus a
   deeper fill rather than a different colour, because the colour already
   means "this category" and must not also mean "this is on". */
.da-specfilter {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  /* Tighter above than below on purpose: the filter belongs to the same
     control cluster as the scope toggle, and should separate from the notes
     that follow. 16px matches the page's rhythm. */
  margin-top: var(--space-sm);
  margin-bottom: var(--space-base);
}
.da-specfilter__lbl {
  font-size: var(--text-caption); font-weight: var(--weight-semibold);
  color: var(--color-warm-gray); margin-right: 2px;
}
a.da-spec { text-decoration: none; cursor: pointer; transition: box-shadow var(--dur-base) var(--ease-out), filter var(--dur-base) var(--ease-out); }
a.da-spec:hover { filter: brightness(0.97); }
a.da-spec:focus-visible { outline: 2px solid var(--color-forest); outline-offset: 2px; }
.da-spec.is-on { box-shadow: inset 0 0 0 1.5px currentColor; filter: brightness(0.96); }
/* A combination with no results is shown, not hidden: seeing that
   "Environmental + Identity" exists but is empty is information. */
.da-spec.is-off { opacity: 0.38; cursor: not-allowed; }
.da-specfilter__clear { margin-left: 2px; }
.da-specfilter__note {
  font-size: var(--text-caption); color: var(--color-warm-gray);
  margin: 8px 0 0;
}
@media (max-width: 560px) {
  .da-specfilter { gap: 6px; }
  .da-specfilter__lbl { width: 100%; margin-bottom: 2px; }
}

/* --- Section folding on the deep-analysis page ----------------------------
   A 27-area bill is ~6,000 words. Opening on a wall of rows is what made the
   page read as laborious, so the overview is the brief and the detail is a
   choice. Native <details>: works with no JS, stays in the DOM when closed
   (so indexing and Ctrl+F are unaffected), and matches the per-area pattern
   already used inside these sections. */
.da-sectfold { min-width: 0; }
.da-sectfold__summary { list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; -webkit-user-select: none; user-select: none; }
.da-sectfold__summary::-webkit-details-marker { display: none; }
.da-sectfold__summary:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.da-sectfold__count { font-size: var(--text-caption); font-weight: var(--weight-bold); color: var(--color-forest); background: var(--color-forest-pale); border-radius: var(--radius-full); padding: 2px 9px; }
.da-sectfold__cta { margin-left: auto; font-size: var(--text-body-s); font-weight: var(--weight-semibold); color: var(--color-sage); }
.da-sectfold__summary:hover .da-sectfold__cta { color: var(--color-forest); }
.da-sectfold__cta--hide { display: none; }
.da-sectfold[open] > .da-sectfold__summary .da-sectfold__cta--show { display: none; }
.da-sectfold[open] > .da-sectfold__summary .da-sectfold__cta--hide { display: inline; }
.da-sectfold__chev { width: 18px; height: 18px; flex: 0 0 18px; color: var(--color-sage); transition: transform var(--dur-base) var(--ease-out); }
.da-sectfold[open] > .da-sectfold__summary .da-sectfold__chev { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .da-sectfold__chev { transition: none; } }
