/* ============================================================
   LEARNING SPACES by Compassion Collectif
   Palette: identical tokens to compassioncollectif.com
   (Desert Boho Calm + Deep Forest). Mobile-first, warm.
   ============================================================ */

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

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

  --border:  #DFCDB9;
  --border2: #CDB59C;

  --primary:      #8F9A7A;
  --primary-mid:  #6F7A5C;
  --primary-deep: #4C5540;
  --primary-soft: #E7EADD;
  --accent:       #9C5A2E;
  --accent-rose:  #C07A6C;
  --alert:        #A6543F;
  --forest:       #2E4A34;

  --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; }
main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }

/* ---------- 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; flex-wrap: wrap; }
.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.05rem; }
.brand-name small { display: block; font-family: var(--font-body); font-size: .68rem; opacity: .8; letter-spacing: .04em; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: .9rem; opacity: .85; }
.main-nav a:hover { background: rgba(255,255,255,.12); opacity: 1; }
.main-nav a.active { background: rgba(255,255,255,.18); opacity: 1; }
.auth-chip { background: var(--primary-soft); color: var(--forest); border: none; padding: 7px 14px; border-radius: 999px; font-family: var(--font-body); font-size: .85rem; font-weight: 700; cursor: pointer; }

/* ---------- Hero ---------- */
.hero { background: var(--forest); color: #fff; text-align: center; padding: 48px 16px 56px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); margin-bottom: 10px; }
.hero p { max-width: 620px; margin: 0 auto; opacity: .9; }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 20px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-soft); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.course-cover { font-size: 2rem; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; background: var(--primary-soft); }
.card h3 { font-size: 1.15rem; }
.card .tagline { color: var(--text-mid); font-size: .92rem; flex: 1; }
.badge-chip { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-deep); width: fit-content; }
.badge-chip.soon { background: var(--surface-deep); color: var(--accent); }
.badge-chip.free { background: var(--primary-soft); color: var(--forest); }
.meta-row { display: flex; gap: 10px; align-items: center; font-size: .82rem; color: var(--text-soft); flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-block; border: none; cursor: pointer; text-decoration: none; text-align: center; font-family: var(--font-body); font-weight: 700; font-size: .95rem; padding: 10px 18px; border-radius: var(--radius-control); transition: transform .12s ease; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary-mid); color: #fff; }
.btn-primary:hover { background: var(--primary-deep); }
.btn-outline { background: transparent; color: var(--primary-deep); border: 1.5px solid var(--primary-mid); }
.btn-soft { background: var(--primary-soft); color: var(--primary-deep); }
.btn-clay { background: var(--accent); color: #fff; }
.btn-sm { font-size: .82rem; padding: 6px 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Course / lesson ---------- */
.module-acc { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); margin-bottom: 14px; overflow: hidden; }
.module-acc summary { cursor: pointer; padding: 16px 18px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 10px; list-style: none; }
.module-acc summary::-webkit-details-marker { display: none; }
.module-progress { font-size: .8rem; color: var(--text-soft); font-weight: 400; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); text-decoration: none; color: var(--text); }
.lesson-row:hover { background: var(--primary-soft); }
.lesson-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border2); display: grid; place-items: center; font-size: .75rem; flex-shrink: 0; }
.lesson-check.done { background: var(--primary-mid); border-color: var(--primary-mid); color: #fff; }
.lesson-title { flex: 1; font-size: .95rem; }
.lesson-mins { font-size: .78rem; color: var(--text-soft); }
.lesson-body { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 26px; box-shadow: var(--shadow-soft); }
.lesson-body h2 { margin: 18px 0 8px; font-size: 1.25rem; }
.lesson-body p, .lesson-body li { margin-bottom: 10px; color: var(--text); }
.lesson-body ul, .lesson-body ol { padding-left: 22px; }
.lesson-body blockquote { border-left: 3px solid var(--primary); padding: 6px 14px; background: var(--primary-soft); border-radius: 0 10px 10px 0; margin: 12px 0; }
.video-wrap { position: relative; padding-top: 56.25%; border-radius: var(--radius-card); overflow: hidden; margin: 14px 0; background: var(--surface-deep); }
.video-wrap iframe, .video-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.resource-card { display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); text-decoration: none; color: var(--text); margin-bottom: 8px; font-size: .92rem; }
.resource-card:hover { border-color: var(--primary-mid); }
.resource-card small { display: block; color: var(--text-soft); }
.reflect-box { width: 100%; min-height: 110px; border: 1.5px solid var(--border2); border-radius: var(--radius-control); padding: 12px; font-family: var(--font-body); font-size: .95rem; background: var(--card); color: var(--text); resize: vertical; }

/* ---------- Dashboard ---------- */
.ring-wrap { display: flex; align-items: center; gap: 16px; }
.ring { --p: 0; width: 74px; height: 74px; border-radius: 50%; background: conic-gradient(var(--primary-mid) calc(var(--p)*1%), var(--surface-deep) 0); display: grid; place-items: center; flex-shrink: 0; }
.ring::after { content: attr(data-label); width: 56px; height: 56px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 800; font-size: .82rem; color: var(--primary-deep); }
.affirmation { background: var(--primary-soft); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 20px; font-family: var(--font-heading); font-size: 1.05rem; color: var(--primary-deep); margin-bottom: 20px; }
.month-track { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px; }
.month-cell { min-width: 96px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 10px; text-align: center; font-size: .78rem; color: var(--text-mid); }
.month-cell.now { border-color: var(--primary-mid); box-shadow: 0 0 0 2px var(--primary-soft); }
.month-cell .dot-row { display: flex; gap: 3px; justify-content: center; margin-top: 6px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-deep); }
.dot.done { background: var(--primary-mid); }
.badges-row { display: flex; gap: 12px; flex-wrap: wrap; }
.badge-tile { text-align: center; width: 92px; padding: 12px 6px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); font-size: .72rem; color: var(--text-mid); }
.badge-tile .b-icon { font-size: 1.6rem; }
.badge-tile.locked { opacity: .38; filter: grayscale(.7); }

/* ---------- Community ---------- */
.people-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.person { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px; text-align: center; }
.person .avatar { font-size: 2rem; }
.person .p-name { font-weight: 700; font-size: .92rem; }
.person .p-bio { font-size: .78rem; color: var(--text-soft); min-height: 2.2em; }
.post { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 18px; margin-bottom: 12px; }
.post-type { font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 9px; border-radius: 999px; }
.post-type.learning { background: var(--primary-soft); color: var(--primary-deep); }
.post-type.question { background: #F3E3D3; color: var(--accent); }
.post-type.resource { background: #F0E0DC; color: var(--accent-rose); }
.post h4 { margin: 6px 0 4px; }
.post .p-meta { font-size: .78rem; color: var(--text-soft); }
.post .p-body { font-size: .92rem; margin-top: 6px; }
.reply { border-top: 1px dashed var(--border); margin-top: 10px; padding-top: 8px; font-size: .88rem; }
.form-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.form-row input, .form-row select, .form-row textarea { border: 1.5px solid var(--border2); border-radius: var(--radius-control); padding: 10px 12px; font-family: var(--font-body); font-size: .95rem; background: var(--card); color: var(--text); }

/* ---------- Messages ---------- */
.msg-thread { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.msg { max-width: 78%; padding: 9px 14px; border-radius: 14px; font-size: .92rem; }
.msg.me { align-self: flex-end; background: var(--primary-mid); color: #fff; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 4px; }
.msg .m-time { display: block; font-size: .68rem; opacity: .7; margin-top: 2px; }

/* ---------- Modals / toasts ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(74,59,50,.45); display: none; place-items: center; z-index: 100; padding: 16px; }
.modal-back.open { display: grid; }
.modal { background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow-soft); max-width: 460px; width: 100%; padding: 26px; max-height: 90vh; overflow-y: auto; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--forest); color: #fff; padding: 10px 20px; border-radius: 999px; font-size: .9rem; z-index: 120; box-shadow: var(--shadow-soft); animation: toastIn .25s ease; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }
.brainbreak { position: fixed; bottom: 22px; right: 22px; max-width: 300px; background: var(--card); border: 1.5px solid var(--primary); border-radius: var(--radius-card); box-shadow: var(--shadow-soft); padding: 16px; z-index: 110; font-size: .9rem; }

/* ---------- Celebration / share ---------- */
.celebrate { text-align: center; padding: 10px 0 4px; }
.celebrate .c-emoji { font-size: 3rem; }
#shareCanvas { width: 100%; max-width: 420px; border-radius: var(--radius-card); border: 1px solid var(--border); margin: 12px auto; display: block; }
.share-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- Demo banner / footer ---------- */
.demo-banner { background: var(--surface-deep); color: var(--text-mid); text-align: center; font-size: .8rem; padding: 6px 12px; }
.site-footer { background: var(--forest); color: #fff; margin-top: 48px; padding: 34px 16px; }
.footer-inner { max-width: 1080px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; font-size: .88rem; }
.site-footer a { color: var(--primary-soft); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.social-row { display: flex; gap: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 30px 0 6px; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--text-soft); font-size: .88rem; }
.tabs { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.tab { padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--border2); background: transparent; cursor: pointer; font-family: var(--font-body); font-size: .85rem; color: var(--text-mid); }
.tab.active { background: var(--primary-mid); border-color: var(--primary-mid); color: #fff; }
@media (max-width: 560px) { .header-inner { justify-content: center; } main { padding-top: 16px; } }
