/* ============================================================
   COMPASSION COLLECTIF — compassioncollectif.com
   Desert Boho Calm (shared tokens with MLM/PAYG) + Deep Forest
   Mobile-first. Warm, personal, not clinical.
   ============================================================ */

:root {
  /* Canvas + surfaces */
  --bg:           #F6EFE6;
  --card:         #FCF8F1;
  --surface:      #EFE2D2;
  --surface-deep: #EBD9C8;
  --glass:        rgba(235, 217, 200, 0.65);

  /* Text */
  --text:      #4A3B32;
  --text-mid:  #6B5A50;
  --text-soft: #857060;

  /* Borders */
  --border:  #DFCDB9;
  --border2: #CDB59C;

  /* Brand */
  --primary:      #8F9A7A;   /* sage */
  --primary-mid:  #6F7A5C;
  --primary-deep: #4C5540;
  --primary-soft: #E7EADD;
  --accent:       #9C5A2E;   /* clay */
  --accent-rose:  #C07A6C;
  --alert:        #A6543F;
  --forest:       #2E4A34;   /* header / hero band */

  /* Shape + depth */
  --radius-card:    16px;
  --radius-control: 12px;
  --shadow-soft: 0 4px 24px rgba(74, 59, 50, .10);

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--primary-deep); }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 600; line-height: 1.25; }

/* ---------- Accessibility ---------- */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:focus-visible { outline-offset: 3px; }
/* Lighter ring on the dark forest bands so it stays visible */
.site-header :focus-visible,
.hero :focus-visible,
.site-footer :focus-visible,
.portal-topbar :focus-visible { outline-color: var(--primary-soft); }

.skip-link {
  position: absolute; left: 8px; top: -56px; z-index: 200;
  background: var(--card); color: var(--primary-deep);
  padding: 10px 16px; border-radius: var(--radius-control);
  font-family: var(--font-body); font-weight: 700; font-size: .9rem;
  text-decoration: none; box-shadow: var(--shadow-soft);
  transition: top .15s ease;
}
.skip-link:focus { top: 8px; }
body.in-portal .skip-link { display: none; }

/* ---------- Header ---------- */
.site-header {
  background: var(--forest);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-soft);
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary-soft); color: var(--forest);
  display: grid; place-items: center;
  font-family: var(--font-heading); font-size: 1.05rem; font-weight: 700;
}
.brand-name { font-family: var(--font-heading); font-size: 1.1rem; letter-spacing: .3px; }
.brand-sub { display: block; font-family: var(--font-body); font-size: .68rem; opacity: .8; letter-spacing: 1.4px; text-transform: uppercase; }

.nav-desktop { display: none; gap: 4px; }
.nav-desktop a {
  color: #fff; text-decoration: none; font-size: .92rem;
  padding: 8px 12px; border-radius: 999px; opacity: .85;
  transition: background .18s ease, opacity .18s ease;
}
.nav-desktop a:hover { background: rgba(255,255,255,.12); opacity: 1; }
.nav-desktop a.active { background: rgba(255,255,255,.18); opacity: 1; }

.btn {
  display: inline-block; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: .95rem; font-weight: 700;
  padding: 10px 20px; border-radius: 999px; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-sage { background: var(--primary-mid); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary-deep); border: 1.5px solid var(--border2); }
.btn-ghost-light { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.5); }
.btn-sm { padding: 7px 14px; font-size: .85rem; }

.menu-toggle {
  display: grid; place-items: center;
  background: none; border: none; color: #fff; cursor: pointer;
  width: 40px; height: 40px;
}
@media (min-width: 880px) {
  .nav-desktop { display: flex; }
  .menu-toggle { display: none; }
  .nav-mobile { display: none !important; }
}
.menu-toggle svg { width: 24px; height: 24px; }

/* Mobile nav drawer */
.nav-mobile {
  display: none;
  background: var(--forest);
  border-top: 1px solid rgba(255,255,255,.15);
  padding: 8px 16px 16px;
}
.nav-mobile.open { display: block; }
.nav-mobile a {
  display: block; color: #fff; text-decoration: none;
  padding: 12px 8px; font-size: 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav-mobile a.active { color: var(--primary-soft); font-weight: 700; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, var(--forest) 0%, #3A5A42 100%);
  color: #fff;
  text-align: center;
  padding: 56px 20px 72px;
}
.hero h1 { font-size: clamp(1.7rem, 5vw, 2.7rem); max-width: 720px; margin: 0 auto 14px; }
.hero p { max-width: 560px; margin: 0 auto 26px; opacity: .9; font-size: 1.05rem; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Sections ---------- */
.section { max-width: 1080px; margin: 0 auto; padding: 56px 20px; }
.section-alt { background: var(--card); }
.section-alt-wrap { background: var(--card); }
.section h2 { font-size: clamp(1.4rem, 3.5vw, 2rem); margin-bottom: 8px; color: var(--primary-deep); }
.section .lede { color: var(--text-mid); max-width: 640px; margin-bottom: 32px; }
.eyebrow {
  font-size: .72rem; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent); font-weight: 800; margin-bottom: 6px;
}

.grid { display: grid; gap: 20px; }
@media (min-width: 640px)  { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 920px)  { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-soft);
}
.section-alt-wrap .card { background: var(--bg); }
.card h3 { color: var(--primary-deep); margin-bottom: 8px; font-size: 1.15rem; }
.card p { color: var(--text-mid); font-size: .95rem; }
.card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary-deep);
  display: grid; place-items: center; margin-bottom: 14px;
  font-size: 1.3rem;
}

/* ---------- Product chips ---------- */
.product-chip {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px;
  background: var(--card);
  box-shadow: var(--shadow-soft);
  position: relative;
}
.chip-badge {
  position: absolute; top: 16px; right: 16px;
  font-size: .68rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.badge-live { background: var(--primary-soft); color: var(--primary-deep); }
.badge-soon { background: var(--surface-deep); color: var(--accent); }
.product-logo {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; color: #fff;
}
.logo-mlm  { background: var(--forest); }
.logo-payg { background: var(--accent); }
.logo-ls   { background: var(--primary-mid); }
.logo-soon { background: var(--border2); color: var(--text-mid); }

/* ---------- Join / community cards ---------- */
.join-card { border-top: 5px solid var(--primary); }
.join-card.friends { border-top-color: var(--accent); }
.join-list { list-style: none; margin: 12px 0 18px; }
.join-list li { padding: 6px 0 6px 26px; position: relative; color: var(--text-mid); font-size: .95rem; }
.join-list li::before {
  content: "✓"; position: absolute; left: 2px; color: var(--primary-mid); font-weight: 800;
}

/* ---------- Motion & polish ---------- */
/* Shadow-only hover lift (no transform → no reflow) */
.card, .product-chip { transition: box-shadow .18s ease; }
.card:hover, .product-chip:hover { box-shadow: 0 10px 30px rgba(74, 59, 50, .16); }
/* Push a product chip's CTA to the bottom so it rests on the chip's base */
.product-chip .btn { margin-top: auto; align-self: flex-start; }

/* Gentle reveal-on-scroll — only when the visitor hasn't asked to reduce motion.
   JS adds .reveal (hidden) then .is-visible (shown); the class is only ever put
   on public-site cards, and a safety timeout guarantees nothing stays hidden. */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0; transform: translateY(14px);
    transition: opacity .55s ease, transform .55s ease, box-shadow .18s ease;
  }
  .reveal.is-visible { opacity: 1; transform: none; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--forest); color: #fff;
  padding: 36px 20px; text-align: center; font-size: .88rem;
}
.site-footer a { color: var(--primary-soft); }
.footer-note { opacity: .7; margin-top: 8px; font-size: .8rem; }

/* ============================================================
   AUTH MODAL + MEMBER PORTAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(46, 74, 52, .55);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: var(--radius-card);
  max-width: 420px; width: 100%;
  padding: 30px 26px;
  box-shadow: 0 12px 48px rgba(46,74,52,.35);
  animation: rise .22s ease;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { color: var(--primary-deep); margin-bottom: 4px; font-size: 1.3rem; }
.modal .modal-sub { color: var(--text-soft); font-size: .88rem; margin-bottom: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; font-weight: 700; color: var(--text-mid); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border2);
  border-radius: var(--radius-control);
  font-family: var(--font-body); font-size: .95rem;
  background: #fff; color: var(--text);
}
.field input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.auth-note { font-size: .8rem; color: var(--text-soft); text-align: center; margin-top: 14px; }
.auth-error { color: var(--alert); font-size: .85rem; margin-bottom: 10px; display: none; }
.modal-close {
  float: right; background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: var(--text-soft);
}

/* ---------- Play As You Go (subdomain view) ---------- */
/* Hidden by default; app.js adds body.on-payg on the playasyougo host. */
.payg-site { display: none; }
body.on-payg .public-site { display: none; }
body.on-payg .payg-site { display: block; }

/* ---------- Portal ---------- */
.portal { display: none; min-height: 100vh; background: var(--bg); }
.portal.active { display: block; }
body.in-portal .public-site { display: none; }

.portal-topbar {
  background: var(--forest); color: #fff;
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 40;
}
.portal-topbar .who { font-size: .85rem; opacity: .85; }

.portal-shell {
  max-width: 1080px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr; gap: 0;
}
@media (min-width: 880px) {
  .portal-shell { grid-template-columns: 230px 1fr; gap: 24px; padding: 24px 20px; }
}

/* Sidebar (desktop) / bottom tabs (mobile) — Mighty Networks style */
.portal-nav { display: none; }
@media (min-width: 880px) {
  .portal-nav {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 76px; align-self: start;
  }
  .portal-nav button {
    text-align: left; background: none; border: none; cursor: pointer;
    font-family: var(--font-body); font-size: .95rem; font-weight: 600;
    color: var(--text-mid); padding: 11px 14px; border-radius: var(--radius-control);
    display: flex; gap: 10px; align-items: center;
  }
  .portal-nav button.active { background: var(--primary-soft); color: var(--primary-deep); }
  .portal-nav button:hover { background: var(--surface); }
}
.portal-tabs-mobile {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(74,59,50,.08);
}
@media (min-width: 880px) { .portal-tabs-mobile { display: none; } }
.portal-tabs-mobile button {
  flex: 1; background: none; border: none; cursor: pointer;
  padding: 9px 4px 12px; font-family: var(--font-body); font-size: .68rem; font-weight: 700;
  color: var(--text-soft); display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.portal-tabs-mobile button.active { color: var(--primary-deep); }
.portal-tabs-mobile .ico { font-size: 1.25rem; line-height: 1; }

.portal-main { padding: 20px 16px 90px; }
@media (min-width: 880px) { .portal-main { padding: 0 0 40px; } }

.portal-banner {
  border-radius: var(--radius-card);
  padding: 26px 24px;
  color: #fff; margin-bottom: 20px;
}
.banner-payg    { background: linear-gradient(120deg, var(--primary-mid), var(--forest)); }
.banner-friends { background: linear-gradient(120deg, var(--accent), #7A431F); }
.portal-banner h2 { font-size: 1.4rem; margin-bottom: 4px; }
.portal-banner p { opacity: .9; font-size: .92rem; }

.pane { display: none; }
.pane.active { display: block; }

.feed-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
}
.feed-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary-mid); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: .9rem;
}
.feed-meta .name { font-weight: 700; font-size: .92rem; }
.feed-meta .when { font-size: .78rem; color: var(--text-soft); }
.feed-card h4 { font-family: var(--font-heading); color: var(--primary-deep); margin-bottom: 6px; }
.feed-card p { font-size: .93rem; color: var(--text-mid); }
.pin-tag {
  font-size: .68rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  background: var(--surface-deep); color: var(--accent);
  padding: 3px 9px; border-radius: 999px; margin-left: auto;
}

.resource-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-control); padding: 14px 16px; margin-bottom: 10px;
}
.resource-row .r-icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary-deep);
  display: grid; place-items: center; font-size: 1.1rem;
}
.resource-row .r-body { flex: 1; min-width: 0; }
.resource-row .r-title { font-weight: 700; font-size: .92rem; }
.resource-row .r-sub { font-size: .78rem; color: var(--text-soft); }

.poll-option {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--border2); border-radius: var(--radius-control);
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
  background: #fff; font-size: .92rem; position: relative; overflow: hidden;
}
.poll-option .bar {
  position: absolute; inset: 0; width: 0%;
  background: var(--primary-soft); z-index: 0; transition: width .5s ease;
}
.poll-option span { position: relative; z-index: 1; }
.poll-option .pct { margin-left: auto; font-weight: 800; color: var(--primary-deep); }
.poll-option.chosen { border-color: var(--primary-mid); }

.admin-box {
  border: 2px dashed var(--border2); border-radius: var(--radius-card);
  padding: 18px; margin-bottom: 20px; background: var(--surface);
}
.admin-box textarea {
  width: 100%; min-height: 80px; padding: 12px;
  border: 1.5px solid var(--border2); border-radius: var(--radius-control);
  font-family: var(--font-body); font-size: .93rem; margin-bottom: 10px; resize: vertical;
}
.admin-tag {
  font-size: .68rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px; display: block;
}

/* ============================================================
   REDUCED MOTION — honour the OS "reduce motion" preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
