/* =============================================================================
   Seasons Family Guide
   Sits on the RIGHT edge. Comfort & Accessibility owns the LEFT edge, so the two
   panels open toward the centre and neither launcher covers the other. Lifts above
   the mobile action bar via a safe-area-aware offset.
   ============================================================================= */

.scc-fg {
  position: fixed;
  /* RIGHT edge. Comfort & Accessibility owns the LEFT edge, so the two panels open toward the
     centre and neither launcher can cover the other. */
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 130;                 /* below cookie consent (140) and dialogs (200) */
  display: grid;
  justify-items: end;
  gap: .6rem;
}
.scc-fg[hidden] { display: none; }
/* The container is only a positioning wrapper. As a fixed grid it can resolve to the full viewport
   width, so its EMPTY area would otherwise sit invisibly over the Comfort & Accessibility launcher on
   the opposite (left) edge and swallow its taps — the exact reason the accessibility button did not
   respond on mobile. Make the wrapper click-through and hand pointer events only to the real controls,
   so an empty region never intercepts a tap meant for the launcher beneath it. */
.scc-fg { pointer-events: none; }
.scc-fg > * { pointer-events: auto; }

/* BREAKPOINT MUST MATCH `.mobile-actions`, WHICH IS 68rem — NOT 48rem.
   These two rules previously switched at 48rem while the mobile action bar appears at 68rem, so
   across the whole 768px-1088px band the launcher sat on top of the action bar. Measured at
   1024px: a real overlap. Both rules now switch on the same 68rem boundary the bar itself uses,
   so the launcher lifts exactly when, and only when, there is a bar to clear. */
@media (max-width: 68rem) {
  /* clear the mobile action bar and the device safe area */
  .scc-fg { bottom: calc(4.75rem + env(safe-area-inset-bottom)); }
}
/* Above the bar's breakpoint the right quick-action rail sits mid-edge; keep a clear gap below it. */
@media (min-width: 68.01rem) {
  .scc-fg { bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
}

/* ---------- launcher ----------
   Previously this read as a flat pill and people simply did not notice it. It now sits on a raised
   surface: a real bottom edge, a layered shadow, and a lift on hover — so it reads as a physical
   button rather than a label, without resorting to animation that would nag. */
/* RESTING STATE IS AN ICON. The pill previously carried a permanent "Family Support" label, which
   made it 199px wide and parked it over hero imagery and card grids at the bottom-right. The label
   is now an inward-opening tooltip; the clay "ask me" dot below still marks it as interactive. */
.scc-fg__launcher {
  position: relative;
  display: grid; place-items: center;
  width: 54px; height: 54px; padding: 0;
  border: 1px solid var(--forest-700);
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, #fff 0%, var(--cream) 100%);
  color: var(--forest-800);
  font-family: var(--font-sans);
  cursor: pointer;
  /* solid bottom edge + ambient shadow = dimensional without a drop-shadow blur haze */
  box-shadow:
    0 4px 0 0 var(--forest-700),
    0 10px 22px rgba(27,55,45,.22),
    inset 0 1px 0 rgba(255,255,255,.9);
  transform: translateY(0);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.scc-fg__launcher:hover {
  background: linear-gradient(180deg, #fff 0%, var(--forest-050) 100%);
  transform: translateY(-2px);
  box-shadow:
    0 6px 0 0 var(--forest-700),
    0 16px 30px rgba(27,55,45,.26),
    inset 0 1px 0 rgba(255,255,255,.9);
}
/* Pressed state travels down onto its own edge — the affordance completes the metaphor. */
.scc-fg__launcher:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 0 var(--forest-700),
    0 4px 10px rgba(27,55,45,.2),
    inset 0 1px 0 rgba(255,255,255,.9);
}
.scc-fg__launcher .scc-icon { color: var(--clay); }
.scc-fg__launcher:focus-visible { outline: 3px solid var(--clay); outline-offset: 3px; }

/* Tooltip label — opens INWARD (leftward) so it never travels toward or past the viewport edge. */
.scc-fg__launchlabel {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  white-space: nowrap;
  padding: .5rem .8rem;
  border-radius: 10px;
  background: var(--forest-700);
  color: #fff;
  font-size: .82rem; font-weight: 650; line-height: 1.2;
  box-shadow: 0 6px 16px rgba(27,55,45,.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.scc-fg__launchlabel::after {
  content: "";
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  border: 6px solid transparent; border-left-color: var(--forest-700);
}
.scc-fg__launcher:hover .scc-fg__launchlabel,
.scc-fg__launcher:focus-visible .scc-fg__launchlabel {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
/* Below the desktop rail breakpoint the tooltip has nowhere safe to go; aria-label still describes
   the control, so suppressing the visual tooltip costs nothing to AT. */
@media (max-width: 64rem) {
  .scc-fg__launchlabel { display: none; }
}

/* A small "ask me" cue so first-time visitors understand it is interactive, not a badge. */
.scc-fg__launcher::after {
  content: "";
  position: absolute; top: -3px; right: -3px;
  width: .7rem; height: .7rem; border-radius: 50%;
  background: var(--clay); border: 2px solid var(--paper);
}
.scc-fg.has-been-opened .scc-fg__launcher::after { display: none; }

.scc-fg.is-open .scc-fg__launcher { display: none; }

@media (prefers-reduced-motion: reduce) {
  .scc-fg__launcher { transition: none; }
  .scc-fg__launcher:hover, .scc-fg__launcher:active { transform: none; }
  /* The tooltip still appears — it is information, not decoration — it just does not slide. */
  .scc-fg__launchlabel { transition: none; transform: translateY(-50%); }
  .scc-fg__launcher:hover .scc-fg__launchlabel,
  .scc-fg__launcher:focus-visible .scc-fg__launchlabel { transform: translateY(-50%); }
}

/* ---------- proactive invitation ---------- */
.scc-fg__invite {
  max-width: min(22rem, calc(100vw - 2rem));
  background: var(--paper); border: 1px solid var(--cream-3); border-left: 4px solid var(--clay);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 1rem; display: grid; gap: .7rem;
}
.scc-fg__invite p { margin: 0; color: var(--ink); font-size: var(--step--1); line-height: 1.45; }
.scc-fg__inviteactions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- panel ---------- */
.scc-fg__panel {
  margin-left: auto;
  width: min(25rem, calc(100vw - 2rem));
  max-height: min(34rem, calc(100vh - 6rem));
  background: var(--paper);
  border: 1px solid var(--cream-3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: grid; grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
}
.scc-fg__panel[hidden] { display: none; }
@media (max-width: 30rem) {
  /* Bottom sheet on small screens.
     The container keeps its safe-area offset — resetting it to bottom:0 here is what pushed the
     launcher down onto the mobile action bar. Only the PANEL goes full-bleed. */
  .scc-fg { left: 0; right: 0; }
  .scc-fg.is-open { bottom: 0; }
  .scc-fg__panel {
    width: 100vw; max-height: 82vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
  }
  .scc-fg__launcher { margin-right: 1rem; margin-bottom: 1rem; }
  .scc-fg__invite { margin: 0 1rem 1rem; }
}

.scc-fg__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem;
  padding: 1rem 1rem .85rem; background: var(--forest-800); color: #fff;
}
.scc-fg__head h2 { margin: 0; font-size: var(--step-1); color: #fff; line-height: 1.2; }
.scc-fg__disclosure { margin: .3rem 0 0; font-size: .78rem; line-height: 1.4; color: #C6D6CE; }
.scc-fg__close {
  /* 44px: this audience skews older, and a close control is the one thing that must never be
     fiddly to hit. WCAG 2.2 AA only requires 24px, but that is a floor, not a target. */
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.14); border: 0; color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.scc-fg__close:hover { background: rgba(255,255,255,.26); }

/* ---------- conversation ---------- */
.scc-fg__log {
  padding: 1rem; overflow-y: auto; display: grid; gap: .8rem; align-content: start;
  background: var(--cream);
}
.scc-fg__turn { display: grid; gap: .45rem; justify-items: start; }
.scc-fg__turn--user { justify-items: end; }
.scc-fg__bubble {
  max-width: 92%; padding: .7rem .85rem; border-radius: 14px;
  font-size: var(--step--1); line-height: 1.5;
  background: var(--paper); color: var(--ink); border: 1px solid var(--cream-3);
}
.scc-fg__turn--user .scc-fg__bubble { background: var(--forest-050); border-color: var(--forest-100); }
.scc-fg__turn--emergency .scc-fg__bubble {
  background: #FDECEA; border-color: #E9B4AE; border-left: 4px solid var(--err); color: #7A241A; font-weight: 600;
}
.scc-fg__actions { display: flex; flex-wrap: wrap; gap: .4rem; }

.scc-fg__action {
  display: inline-flex; align-items: center; min-height: 40px;
  padding: .45rem .8rem; border-radius: var(--radius-pill);
  border: 1px solid var(--forest-700); background: var(--paper); color: var(--forest-700);
  font-family: var(--font-sans); font-size: .82rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.scc-fg__action:hover { background: var(--forest-050); color: var(--forest-700); }
.scc-fg__action--primary { background: var(--clay); border-color: var(--clay); color: #fff; }
.scc-fg__action--primary:hover { background: var(--clay-600); border-color: var(--clay-600); color: #fff; }

/* ---------- topic chips ---------- */
.scc-fg__topics {
  display: flex; gap: .4rem; overflow-x: auto; padding: .7rem 1rem;
  border-top: 1px solid var(--cream-3); background: var(--paper);
  scrollbar-width: thin;
}
.scc-fg__chip {
  flex: none; min-height: 44px; padding: .5rem .8rem;
  border: 1px solid var(--cream-3); border-radius: var(--radius-pill);
  background: var(--cream-2); color: var(--ink); cursor: pointer;
  font-family: var(--font-sans); font-size: .8rem; white-space: nowrap;
}
.scc-fg__chip:hover { background: var(--forest-050); border-color: var(--forest-700); color: var(--forest-700); }

/* ---------- composer ---------- */
.scc-fg__form {
  display: flex; gap: .5rem; padding: .75rem 1rem 1rem;
  border-top: 1px solid var(--cream-3); background: var(--paper);
}
.scc-fg__form input[type="text"] {
  flex: 1; min-height: 46px; padding: .55rem .8rem;
  border: 1px solid var(--cream-3); border-radius: var(--radius);
  font-family: var(--font-sans); font-size: var(--step--1); color: var(--ink); background: var(--cream);
}
.scc-fg__form.is-busy { opacity: .65; }
.scc-fg__send {
  flex: none; width: 46px; height: 46px; border-radius: var(--radius);
  border: 0; background: var(--clay); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.scc-fg__send:hover { background: var(--clay-600); }

/* ---------- capture form ---------- */
.scc-fg__capture {
  width: 100%; display: grid; gap: .6rem;
  background: var(--paper); border: 1px solid var(--cream-3); border-radius: 14px; padding: .9rem;
}
.scc-fg__caphint { margin: 0; font-size: .82rem; color: var(--ink-soft); }
.scc-fg__field { display: grid; gap: .2rem; }
.scc-fg__field label { font-size: .78rem; font-weight: 600; color: var(--ink); }
.scc-fg__field label span { font-weight: 400; color: var(--ink-soft); }
.scc-fg__field input, .scc-fg__field textarea {
  min-height: 44px; padding: .45rem .6rem;
  border: 1px solid var(--cream-3); border-radius: 10px;
  font-family: var(--font-sans); font-size: .88rem; color: var(--ink); background: var(--cream);
}
.scc-fg__field textarea { min-height: 60px; resize: vertical; }
.scc-fg__consent { display: flex; gap: .5ch; align-items: flex-start; font-size: .78rem; color: var(--ink-soft); line-height: 1.4; }
.scc-fg__consent input { margin-top: .18rem; }
.scc-fg__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.scc-fg__error { margin: 0; color: var(--err); font-size: .8rem; font-weight: 600; }
.scc-fg__capactions { display: flex; gap: .5rem; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  .scc-fg__log { scroll-behavior: auto; }
}

/* ---------- collision handling ----------
   The panel is a full-width bottom sheet on small screens, so it necessarily covers the mobile
   action bar. Rather than let them overlap, the action bar stands down while the guide is open —
   the panel already offers Call and Schedule a visit, so nothing becomes unreachable.
   The coordinator sets data-scc-float on <html>, which is what these rules key off. */
html[data-scc-float~="family-guide"] .mobile-actions { display: none; }

/* The right-hand CTA shell and the guide launcher sit on opposite sides, but on very narrow
   screens the shell is lifted clear of the sheet as well. */
@media (max-width: 30rem) {
  html[data-scc-float~="family-guide"] .action-rail { display: none; }
}
