/*
 * Sam — button-only guided help panel styling (docs/SUPPORT_SYSTEM_SPEC.md §3).
 * Self-contained: reuses the sitewide design-token custom properties
 * (--ink, --eucalypt, etc.) that every website/*.html page already
 * declares at :root with identical values, with literal fallbacks so this
 * file still renders correctly if loaded somewhere those tokens aren't set.
 *
 * 18px body-copy floor, EVERY declared font-size in this file — Sam's own
 * UI has no separate, smaller baseline (§3, explicit). No rem units
 * anywhere: rem resolves against <html>'s font-size (the browser's 16px
 * default, since no website/*.html page sets html{font-size}), NOT against
 * .sam-panel's own 18px — setting font-size:18px on .sam-panel does not
 * change what any descendant's rem value resolves against. A live CDP
 * breakpoint sweep during this branch's build (Step 9) caught exactly this
 * mistake shipped in an earlier draft of this file: 14 rules used rem,
 * measuring as low as 12.48px in a real browser despite this file's own
 * header comment already warning about the trap. Every font-size below
 * is a bare px value for that reason — never rem, and never < 18px.
 */

.sam-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 38, 61, .5);
  display: none;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 24px;
  z-index: 2147483000;
}
.sam-overlay.sam-open { display: flex; }

.sam-panel {
  background: #fff;
  width: 100%;
  max-width: 420px;
  max-height: min(720px, 86vh);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(21, 38, 61, .35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body, 'Hanken Grotesk', system-ui, sans-serif);
  color: var(--ink, #15263D);
  font-size: 18px;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .sam-overlay { padding: 0; align-items: flex-end; justify-content: center; }
  .sam-panel { max-width: 100%; width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; }
}

.sam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line, #E6E0D6);
  background: var(--eucalypt, #2E7A68);
  color: #fff;
  flex: none;
}
.sam-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sam-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255, 255, 255, .18);
  display: grid; place-items: center; flex: none;
}
.sam-avatar svg { width: 20px; height: 20px; }
.sam-title {
  font-family: var(--font-display, 'Bricolage Grotesque', system-ui, sans-serif);
  font-weight: 700; font-size: 20px; line-height: 1.3; display: block;
}
.sam-title-sub {
  display: block;
  font-family: var(--font-body, inherit);
  font-weight: 500;
  font-size: 18px;
  color: rgba(255, 255, 255, .82);
}
.sam-close {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: transparent; border: none; border-radius: 10px; cursor: pointer;
  color: #fff; flex: none;
}
.sam-close:hover { background: rgba(255, 255, 255, .15); }
.sam-close svg { width: 20px; height: 20px; }

.sam-body { flex: 1; overflow-y: auto; padding: 20px 20px 6px; }
.sam-content { display: block; }

.sam-greeting { margin-bottom: 18px; color: var(--ink, #15263D); }

.sam-menu-list, .sam-article-list { list-style: none; display: grid; gap: 10px; margin-bottom: 8px; }

.sam-menu-btn, .sam-article-btn {
  width: 100%;
  text-align: left;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--line, #E6E0D6);
  background: #fff;
  color: var(--ink, #15263D);
  font-family: var(--font-body, inherit);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.sam-menu-btn:hover, .sam-article-btn:hover {
  border-color: var(--eucalypt, #2E7A68);
  background: var(--eucalypt-tint, #E7F1ED);
}

.sam-back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 4px; margin-bottom: 8px;
  background: none; border: none;
  color: var(--eucalypt-deep, #1F5A4C);
  font-family: var(--font-body, inherit);
  font-weight: 600; font-size: 18px; cursor: pointer;
}
.sam-back-btn svg { width: 16px; height: 16px; flex: none; }

.sam-view-heading {
  font-family: var(--font-display, inherit);
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}

.sam-scope-note { font-style: italic; color: var(--ink-soft, #475A73); margin-bottom: 12px; }

.sam-bluf {
  background: var(--eucalypt-tint, #E7F1ED);
  border: 1px solid #C3DCCE;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
  color: var(--ink, #15263D);
}

.sam-expand-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 4px; margin-bottom: 6px;
  background: none; border: none;
  color: var(--eucalypt-deep, #1F5A4C);
  font-family: var(--font-body, inherit);
  font-weight: 600; font-size: 18px; cursor: pointer;
  text-decoration: underline;
}

.sam-steps-body { margin: 8px 0 6px; }
.sam-steps-body h2 {
  font-family: var(--font-display, inherit);
  font-size: 19px; font-weight: 600; margin: 20px 0 10px; line-height: 1.3;
}
.sam-steps-body h2:first-child { margin-top: 6px; }
.sam-steps-body p { color: var(--ink-soft, #475A73); margin-bottom: 12px; line-height: 1.6; }
.sam-steps-body p:last-child { margin-bottom: 0; }
.sam-steps-body strong { color: var(--ink, #15263D); font-weight: 600; }
.sam-steps-body a { color: var(--eucalypt-deep, #1F5A4C); }

.sam-steps-body .help-steps { list-style: none; counter-reset: samstep; display: grid; gap: 14px; margin: 14px 0; }
.sam-steps-body .help-steps > li { position: relative; padding-left: 48px; min-height: 34px; color: var(--ink-soft, #475A73); line-height: 1.6; }
.sam-steps-body .help-steps > li::before {
  counter-increment: samstep; content: counter(samstep);
  position: absolute; left: 0; top: -3px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--eucalypt, #2E7A68); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display, inherit); font-weight: 700; font-size: 18px;
}
.sam-steps-body .help-steps > li > p { margin-bottom: 8px; color: var(--ink-soft, #475A73); }
.sam-steps-body .help-steps > li > p:last-child { margin-bottom: 0; }

.sam-steps-body .plain-bullets { list-style: disc; padding-left: 20px; display: grid; gap: 8px; margin: 12px 0; color: var(--ink-soft, #475A73); }
.sam-steps-body .sub-list { list-style: disc; padding-left: 20px; display: grid; gap: 6px; margin-top: 8px; color: var(--ink-soft, #475A73); }

.sam-steps-body .callout { border-radius: 12px; padding: 14px 16px; margin: 14px 0; }
.sam-steps-body .callout p { margin-bottom: 0; }
.sam-steps-body .callout.tip { background: var(--eucalypt-tint, #E7F1ED); border: 1px solid #C3DCCE; color: var(--eucalypt-deep, #1F5A4C); }
.sam-steps-body .callout.note { background: var(--honey-soft, #F5E7CC); border: 1px solid #E8D4A8; color: #7A5A1F; }

.sam-read-full { margin: 10px 0 4px; font-size: 18px; }
.sam-read-full a { display: inline-flex; align-items: center; min-height: 44px; color: var(--eucalypt-deep, #1F5A4C); font-weight: 600; }

.sam-guide-note { font-size: 18px; color: var(--ink-soft, #475A73); margin-top: 4px; }

.sam-leaf-actions { display: grid; gap: 10px; margin-top: 16px; }
.sam-action-btn {
  min-height: 44px; padding: 10px 16px; border-radius: 999px;
  border: 1.5px solid var(--line, #E6E0D6);
  background: #fff; color: var(--ink, #15263D);
  font-family: var(--font-body, inherit); font-weight: 600; font-size: 18px; cursor: pointer;
  width: 100%;
}
.sam-action-btn:hover { border-color: var(--eucalypt, #2E7A68); }
.sam-action-primary { background: var(--eucalypt, #2E7A68); border-color: var(--eucalypt, #2E7A68); color: #fff; }
.sam-action-primary:hover { background: var(--eucalypt-deep, #1F5A4C); border-color: var(--eucalypt-deep, #1F5A4C); }
.sam-action-btn[disabled] { opacity: .55; cursor: not-allowed; }
.sam-action-disabled-wrap { display: grid; gap: 4px; }
.sam-coming-soon-note { font-size: 18px; color: var(--ink-soft, #475A73); padding-left: 4px; }

.sam-fixed-msg, .sam-escalate-sent-msg { margin-bottom: 16px; color: var(--ink, #15263D); }

.sam-mailto-fallback {
  border: 1px solid var(--line, #E6E0D6);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
  background: var(--sand, #FBF8F3);
}
.sam-fallback-intro { color: var(--ink-soft, #475A73); margin-bottom: 12px; }
.sam-fallback-textarea { background: #fff; margin-bottom: 10px; min-height: 140px; }
.sam-copy-status { font-size: 18px; color: var(--ink-soft, #475A73); margin-top: 8px; min-height: 1.4em; }

.sam-escalate-intro { color: var(--ink-soft, #475A73); margin-bottom: 14px; }

.sam-field-label { display: block; font-weight: 600; margin-bottom: 8px; color: var(--ink, #15263D); }
.sam-textarea {
  width: 100%; min-height: 120px; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--line, #E6E0D6);
  font-family: var(--font-body, inherit); font-size: 18px; color: var(--ink, #15263D);
  resize: vertical;
}
.sam-textarea:focus { border-color: var(--eucalypt, #2E7A68); outline: none; }

.sam-safety-note { font-size: 18px; color: var(--ink-soft, #475A73); margin: 8px 0; }

.sam-distress-banner, .sam-credential-banner {
  border-radius: 12px; padding: 16px 18px; margin: 10px 0;
  background: var(--honey-soft, #F5E7CC); border: 1px solid #E8D4A8; color: #7A5A1F;
}
.sam-distress-banner p { margin-bottom: 10px; line-height: 1.6; }
.sam-distress-banner p:last-child { margin-bottom: 0; }
.sam-distress-banner a { color: #7A5A1F; font-weight: 700; text-decoration: underline; }
.sam-credential-banner p { line-height: 1.6; }

.sam-send-btn { margin-top: 14px; }

.sam-footer {
  border-top: 1px solid var(--line, #E6E0D6);
  padding: 12px 18px;
  flex: none;
  background: var(--sand, #FBF8F3);
}
.sam-talk-btn {
  width: 100%; min-height: 44px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; border: 1.5px solid var(--eucalypt, #2E7A68);
  background: #fff; color: var(--eucalypt-deep, #1F5A4C);
  font-family: var(--font-body, inherit); font-weight: 600; font-size: 18px; cursor: pointer;
}
.sam-talk-btn:hover { background: var(--eucalypt-tint, #E7F1ED); }
.sam-talk-btn svg { width: 18px; height: 18px; flex: none; }
.sam-panel.sam-on-escalate .sam-footer { display: none; }
.sam-panel.sam-on-menu .sam-footer { display: none; }

/* Two focus-ring colors, not the sitewide --honey token: a live CDP
   contrast check (Step 9) found var(--honey) #D9982F fails the required
   3:1 non-text contrast (§3) against every background this panel actually
   uses it on — 2.48:1 on white/sand, 2.07:1 on the header's green — even
   though it's the same color every website/*.html page already uses for
   :focus-visible. Rather than carry a known-failing ring into a new
   surface, or diverge inconsistently for only some controls, this panel
   uses ink (already the panel's own text color) on white/sand — 15.26:1
   and 14.40:1 — and white (already the header's own text color) on the
   header's green — 5.12:1. Both clear 3:1 with wide margin. No new colors
   introduced; the sitewide --honey gap itself is unrelated to this PR
   (see conversation history — flagged, not fixed here). */
.sam-panel :focus-visible {
  outline: 3px solid var(--ink, #15263D);
  outline-offset: 2px;
  border-radius: 6px;
}
.sam-header :focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  border-radius: 6px;
}

body.sam-noscroll { overflow: hidden; }
