/* ============================================================
   Quiet Circle — shared CSS
   Design system for miscarriage / pregnancy loss / infant loss orgs.
   Tokens + base typography + flex-point switches.
   CSS+HTML only, no JS.
   ============================================================ */

/* ---------- 1. Tokens (default = oatmeal-warm) ---------- */

:root {
  /* Palette tokens (oatmeal-warm default) */
  --qc-bg:           #F4EFE7;
  --qc-surface:      #E5DDD0;
  --qc-surface-2:    #EBE5D9;
  --qc-ink:          #3B3F44;
  --qc-ink-quiet:    #6D7785;
  --qc-accent:       #C28F7C;
  --qc-accent-deep:  #8C7B6B;
  --qc-on-accent:    #FFFFFF;
  --qc-hairline:     #D8CFC1;
  --qc-footer-bg:    #2E3236;
  --qc-footer-fg:    #E5DDD0;
  --qc-exit-bg:      #3B3F44;
  --qc-exit-fg:      #F4EFE7;

  /* Quick-exit target (overridable per client) */
  --qc-exit-url: "https://www.weather.com";

  /* Typography */
  --qc-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --qc-sans:  "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Rhythm */
  --qc-measure: 62ch;
  --qc-gutter:  clamp(1.25rem, 4vw, 2.5rem);
  --qc-section: clamp(3.5rem, 8vw, 6rem);
  --qc-radius:  6px;

  /* Motion (intentionally minimal) */
  --qc-ease: cubic-bezier(.4, 0, .2, 1);
}

:root[data-palette="sage"] {
  --qc-surface:     #EBEEE7;
  --qc-surface-2:   #E2E7DD;
  --qc-accent:      #9FAE9C;
  --qc-accent-deep: #6F7E6C;
  --qc-hairline:    #D6DCD2;
}

:root[data-palette="dusty-blue"] {
  --qc-surface:     #E8ECEF;
  --qc-surface-2:   #DDE3E7;
  --qc-accent:      #8AA0AE;
  --qc-accent-deep: #586876;
  --qc-hairline:    #D2D9DE;
}

/* ---------- 2. Base reset (minimal) ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: var(--qc-serif);
  font-size: 17px;
  line-height: 1.75;
  color: var(--qc-ink);
  background: var(--qc-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  font-feature-settings: "kern", "liga", "calt";
}

img, svg { max-width: 100%; height: auto; display: block; }

a {
  color: var(--qc-accent-deep);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 200ms var(--qc-ease);
}
a:hover, a:focus-visible { color: var(--qc-ink); }
a:focus-visible {
  outline: 2px solid var(--qc-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- 3. Typography scale ---------- */

h1, h2, h3, h4 {
  font-family: var(--qc-serif);
  font-weight: 500;
  margin: 0 0 0.5em;
  letter-spacing: -0.005em;
}

h1 { font-size: clamp(2.25rem, 4vw, 3.5rem); line-height: 1.18; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem);  line-height: 1.25; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem);  line-height: 1.3; }

p, li {
  max-width: var(--qc-measure);
  margin: 0 0 1.1em;
}

.qc-lead {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--qc-ink-quiet);
}

.qc-small {
  font-size: 0.9375rem;
  color: var(--qc-ink-quiet);
}

.qc-ui {
  font-family: var(--qc-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

::selection {
  background: var(--qc-accent);
  color: var(--qc-on-accent);
}

/* ---------- 4. Layout helpers ---------- */

.qc-shell {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--qc-gutter);
}

.qc-shell--narrow { max-width: 44rem; }

.qc-section {
  padding-block: var(--qc-section);
}

.qc-hairline {
  border: 0;
  height: 1px;
  background: var(--qc-hairline);
  margin: 0;
}

/* ---------- 5. Quick exit (always visible, top-right) ---------- */

.qc-exit {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  font-family: var(--qc-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.5rem 0.875rem;
  background: var(--qc-exit-bg);
  color: var(--qc-exit-fg);
  text-decoration: none;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: background 200ms var(--qc-ease);
}
.qc-exit:hover, .qc-exit:focus-visible {
  background: var(--qc-accent-deep);
  color: var(--qc-on-accent);
}

/* ---------- 6. Header / nav ---------- */

.qc-header {
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--qc-hairline);
}

.qc-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  /* Reserve space on the right for the fixed quick-exit button */
  padding-right: 9rem;
}
@media (max-width: 640px) {
  .qc-header__inner { padding-right: 0; }
}

.qc-brand {
  font-family: var(--qc-serif);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--qc-ink);
  text-decoration: none;
  letter-spacing: -0.005em;
}

.qc-nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-family: var(--qc-sans);
  font-size: 0.9375rem;
}
.qc-nav a {
  color: var(--qc-ink-quiet);
  text-decoration: none;
}
.qc-nav a:hover, .qc-nav a:focus-visible { color: var(--qc-ink); }

/* ---------- 7. Hero ---------- */

.qc-hero {
  padding-block: clamp(4rem, 10vw, 7rem);
  background: var(--qc-bg);
}
.qc-hero__eyebrow {
  font-family: var(--qc-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--qc-accent-deep);
  margin-bottom: 1rem;
}
.qc-hero__h1 {
  max-width: 22ch;
  margin-bottom: 1.25rem;
}
.qc-hero__lead {
  max-width: 50ch;
  font-size: 1.25rem;
  line-height: 1.65;
  color: var(--qc-ink-quiet);
}

/* ---------- 8. Buttons ---------- */

.qc-btn {
  display: inline-block;
  font-family: var(--qc-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 0.75rem 1.25rem;
  border-radius: 4px;
  text-decoration: none;
  transition: background 200ms var(--qc-ease), color 200ms var(--qc-ease);
  border: 1px solid transparent;
}
.qc-btn--primary {
  background: var(--qc-accent-deep);
  color: var(--qc-on-accent);
}
.qc-btn--primary:hover, .qc-btn--primary:focus-visible {
  background: var(--qc-ink);
  color: var(--qc-on-accent);
}
.qc-btn--quiet {
  background: transparent;
  color: var(--qc-ink);
  border-color: var(--qc-hairline);
}
.qc-btn--quiet:hover, .qc-btn--quiet:focus-visible {
  border-color: var(--qc-accent);
  color: var(--qc-accent-deep);
}

/* ---------- 9. Cards (offerings / programs) ---------- */

.qc-card {
  background: var(--qc-surface);
  border-radius: var(--qc-radius);
  padding: 1.75rem 1.75rem 2rem;
  border: 1px solid var(--qc-hairline);
}
.qc-card__title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}
.qc-card__body {
  color: var(--qc-ink-quiet);
  font-size: 1rem;
  line-height: 1.7;
}

.qc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.25rem;
}

/* ---------- 10. Pull-quotes and verse slots ---------- */

.qc-pull {
  font-family: var(--qc-serif);
  font-size: 1.5rem;
  line-height: 1.5;
  color: var(--qc-ink);
  padding: 2.5rem var(--qc-gutter);
  border-left: 2px solid var(--qc-accent);
  max-width: 40rem;
  margin: 2.5rem 0;
  font-style: italic;
}
.qc-pull__attr {
  display: block;
  font-style: normal;
  font-family: var(--qc-sans);
  font-size: 0.875rem;
  color: var(--qc-ink-quiet);
  margin-top: 1rem;
  letter-spacing: 0.04em;
}

/* ---------- 11. Reassurance line (single use, newly-grieving page) ---------- */

.qc-reassure {
  font-family: var(--qc-serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.45;
  color: var(--qc-ink);
  max-width: 30ch;
  padding-block: var(--qc-section);
}

/* ---------- 12. Footer ---------- */

.qc-footer {
  background: var(--qc-footer-bg);
  color: var(--qc-footer-fg);
  padding-block: clamp(3rem, 6vw, 4rem);
  margin-top: var(--qc-section);
}
/* ---------- Page-gallery previews (pages.html) ----------
   Same technique as the peer kits: render the page at desktop width inside a
   clipping frame and scale it down, so the card shows real layout rather than
   a 22rem sliver of the header. */
.qc-pagecard-frame {
  height: 21rem;
  overflow: hidden;
  border: 1px solid var(--qc-hairline);
  border-radius: var(--qc-radius);
  background: var(--qc-bg);
  margin-bottom: 1.25rem;
}
.qc-pagecard-frame iframe {
  width: 1400px;
  height: 1600px;
  border: 0;
  display: block;
  transform: scale(.45);
  transform-origin: 0 0;
}

/* .qc-small carries --qc-ink-quiet, which is a light-ground token. Inside the
   dark footer that lands at 2.85:1, and the crisis-line number is set in it.
   Reassert the footer's own foreground here rather than weakening .qc-small:
   with the 0.7 opacity the markup applies, this composites to about 5.6:1.
   Any future light-ground component placed in the footer needs the same. */
.qc-footer .qc-small {
  color: var(--qc-footer-fg);
}

.qc-footer a {
  color: var(--qc-footer-fg);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}
.qc-footer a:hover, .qc-footer a:focus-visible {
  border-bottom-color: var(--qc-footer-fg);
}
.qc-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 2.5rem;
}
.qc-footer__heading {
  font-family: var(--qc-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: var(--qc-footer-fg);
  opacity: 0.7;
}

/* ============================================================
   13. FLEX-POINT SWITCHES
   These are how a build configures the system without forking.
   Set the attributes on <html> at build time.
   ============================================================ */

/* Faith disclosure — show only when data-faith="on" */
.qc-faith-disclosure,
.qc-faith-only { display: none; }
:root[data-faith="on"] .qc-faith-disclosure,
:root[data-faith="on"] .qc-faith-only { display: block; }

/* Secular-only blocks — hide when data-faith="on" */
:root[data-faith="on"] .qc-secular-only { display: none; }

/* Stories block — show only when data-stories="include" */
.qc-stories { display: none; }
:root[data-stories="include"] .qc-stories { display: block; }

/* Primary path — drives hero CTA copy without rewriting HTML.
   The CTA element renders the text via ::before content. */
:root                                          { --qc-cta-label: "Read: If you've just experienced a loss"; }
:root[data-primary-path="find-group"]          { --qc-cta-label: "Find a support group near you"; }
:root[data-primary-path="comfort-box"]         { --qc-cta-label: "Get a comfort box sent to a family in loss"; }
:root[data-primary-path="speak-peer"]          { --qc-cta-label: "Speak with a peer who's been here"; }
:root[data-primary-path="read-newly-grieving"] { --qc-cta-label: "Read: If you've just experienced a loss"; }

.qc-primary-cta::before { content: var(--qc-cta-label); }

/* ---------- 13b. Swatches (for design-system.html) ---------- */

.qc-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin-block: 1.5rem 2.5rem;
}
.qc-swatch {
  border-radius: var(--qc-radius);
  border: 1px solid var(--qc-hairline);
  background: var(--qc-surface);
  overflow: hidden;
  font-family: var(--qc-sans);
  font-size: 0.8125rem;
}
.qc-swatch__chip {
  height: 5.5rem;
}
.qc-swatch__body {
  padding: 0.75rem 0.875rem 0.875rem;
  background: var(--qc-bg);
  border-top: 1px solid var(--qc-hairline);
}
.qc-swatch__name {
  display: block;
  font-weight: 500;
  color: var(--qc-ink);
}
.qc-swatch__hex {
  display: block;
  color: var(--qc-ink-quiet);
  font-variant-numeric: tabular-nums;
  margin-top: 0.125rem;
}

/* Three palette demos in a row, each independent of the page palette */
.qc-palette-demo {
  background: var(--qc-bg);
  border: 1px solid var(--qc-hairline);
  border-radius: var(--qc-radius);
  padding: 1.5rem 1.5rem 1.75rem;
}
.qc-palette-demo[data-palette="oatmeal-warm"] {
  --qc-bg:           #F4EFE7;
  --qc-surface:      #E5DDD0;
  --qc-accent:       #C28F7C;
  --qc-accent-deep:  #8C7B6B;
  --qc-hairline:     #D8CFC1;
}
.qc-palette-demo[data-palette="sage"] {
  --qc-bg:           #F4EFE7;
  --qc-surface:      #EBEEE7;
  --qc-accent:       #9FAE9C;
  --qc-accent-deep:  #6F7E6C;
  --qc-hairline:     #D6DCD2;
}
.qc-palette-demo[data-palette="dusty-blue"] {
  --qc-bg:           #F4EFE7;
  --qc-surface:      #E8ECEF;
  --qc-accent:       #8AA0AE;
  --qc-accent-deep:  #586876;
  --qc-hairline:     #D2D9DE;
}

/* ---------- 13c. Section labels (for sections.html) ---------- */

.qc-section-label {
  font-family: var(--qc-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--qc-ink-quiet);
  border-top: 1px solid var(--qc-hairline);
  padding-top: 1rem;
  margin-top: 4rem;
  display: block;
}
.qc-section-label--first { margin-top: 0; }

.qc-section-note {
  font-family: var(--qc-sans);
  font-size: 0.875rem;
  color: var(--qc-ink-quiet);
  background: var(--qc-surface-2);
  border-left: 2px solid var(--qc-accent);
  padding: 0.875rem 1rem;
  margin: 0 0 2rem;
  max-width: 50rem;
}

/* ---------- 13d. Two-column block ---------- */

.qc-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 760px) {
  .qc-two-col { grid-template-columns: 1fr; }
}

/* ---------- 13e. Plain list (for what-we-offer) ---------- */

.qc-plain-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  border-top: 1px solid var(--qc-hairline);
}
.qc-plain-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--qc-hairline);
  max-width: none;
  margin: 0;
}
.qc-plain-list__name {
  font-weight: 500;
  display: block;
  margin-bottom: 0.25rem;
}
.qc-plain-list__desc {
  color: var(--qc-ink-quiet);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ---------- 13f. Code (inline) ---------- */

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.875em;
  background: var(--qc-surface);
  padding: 0.05em 0.35em;
  border-radius: 3px;
  color: var(--qc-ink);
}

/* ---------- 14. Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 14b. Demo headings ---------- */
/* Used on sections.html / design-system.html where a section
   demonstrates what an H1 looks like without claiming the
   document's single semantic H1. */

p.qc-hero__h1,
.qc-h1-demo {
  font-family: var(--qc-serif);
  font-weight: 500;
  font-size: clamp(2.25rem, 4vw, 3.5rem);
  line-height: 1.18;
  letter-spacing: -0.005em;
  color: var(--qc-ink);
  max-width: 22ch;
  margin: 0 0 1.25rem;
}

/* ---------- 15. Print ---------- */

@media print {
  .qc-exit, .qc-nav, .qc-footer { display: none; }
  body { background: #fff; color: #000; }
}
