/* ============================================================================
   MCCS Coder Training — design system
   Look & feel inspired by Lovely (lovely-ai.com): warm, calm, gentle,
   research-informed. Cream canvas, soft coral + sage accents, rounded cards,
   gentle shadows, humanist type. All theming via CSS variables so a later
   brand pass (logo / exact colors) is a variable swap, not a rewrite.
   ========================================================================== */

:root {
  /* --- brand palette — matched to lovely-ai.com: deep-navy canvas, a single
         periwinkle accent, near-white headings, muted lavender-grey body.
         Variable names are kept (coral/sage/gold) so the rest of the sheet is
         untouched; their VALUES now carry the dark theme. --- */
  --cream:        #111827;   /* page canvas — Lovely --bg */
  --cream-2:      #1F2937;   /* raised surfaces (cards) — Lovely --card */
  --surface-3:    #18212F;   /* insets — quotes, neutral chips (recessed) */
  --ink:          #F3F4F6;   /* primary text / headings — near-white */
  --ink-soft:     #D1D5DB;   /* secondary text */
  --ink-faint:    #9CA3AF;   /* captions, meta — Lovely --muted */
  --ink-on-accent:#0B1220;   /* dark text on accent — Lovely --primary-contrast */

  --coral:        #A6B4FD;   /* primary accent — periwinkle (Lovely --primary) */
  --coral-deep:   #BCC6FE;   /* brighter periwinkle — links, hover, accent text */
  --coral-wash:   #2A3352;   /* periwinkle-tinted dark panel */

  --sage:         #A7F3D0;   /* secondary accent — mint (Lovely --accent-2) */
  --sage-deep:    #8FE9C2;   /* mint accent text on dark */
  --sage-wash:    #16302A;   /* dark mint panel */

  --gold:         #A6B4FD;   /* (no gold in Lovely) — alias to periwinkle */
  --gold-wash:    #1E2740;   /* callout — soft periwinkle highlight panel */
  --gold-line:    #3A4673;   /* callout border */

  --good:         #4FB477;   /* correct — deeper grass-green (distinct from mint) */
  --good-wash:    #14271D;
  --good-line:    #2D5740;
  --bad:          #ED7E70;   /* incorrect — coral-red for dark */
  --bad-wash:     #2C1A1B;
  --bad-line:     #5C302C;

  --line:         #334155;   /* hairlines / borders — Lovely --border */
  --shadow:       0 10px 30px rgba(0, 0, 0, 0.40);
  --shadow-sm:    0 2px 10px rgba(0, 0, 0, 0.30);
  --radius:       18px;
  --radius-sm:    12px;
  --radius-pill:  999px;

  --maxw:         860px;
  --font: "Nunito", "Quicksand", -apple-system, BlinkMacSystemFont, "Segoe UI",
          system-ui, sans-serif;
}

/* Optional web font; silently falls back to the system stack offline. */
@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap");

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* gentle background wash, echoing Lovely's soft gradients */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(62rem 42rem at 88% -12%, var(--coral-wash) 0%, transparent 56%),
    radial-gradient(48rem 34rem at -12% 108%, var(--sage-wash) 0%, transparent 58%);
  opacity: 0.75;
}

h1, h2, h3 { line-height: 1.25; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; margin: 0 0 0.4em; }
h2 { font-size: 1.4rem; margin: 1.6em 0 0.5em; }
h3 { font-size: 1.12rem; margin: 1.3em 0 0.4em; font-weight: 700; }
p  { margin: 0 0 1em; }
em { font-style: italic; }           /* italics — never underline (REH) */
a  { color: var(--coral-deep); }

/* ----------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(17, 24, 39, 0.82);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem 1.2rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 12px;
  background: linear-gradient(135deg, var(--coral), var(--sage));
  display: grid; place-items: center;
  color: var(--ink-on-accent); font-weight: 800; font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}
.brand__name { font-weight: 800; font-size: 1.02rem; }
.brand__sub  { color: var(--ink-faint); font-size: 0.72rem; font-weight: 600;
               letter-spacing: 0.04em; text-transform: uppercase; }
.site-header__spacer { flex: 1; }
.header-progress { display: flex; align-items: center; gap: 0.5rem;
                   font-size: 0.8rem; color: var(--ink-soft); }
.header-progress__bar {
  width: 120px; height: 8px; border-radius: var(--radius-pill);
  background: var(--line); overflow: hidden;
}
.header-progress__fill { height: 100%; width: 0;
  background: linear-gradient(90deg, var(--coral), var(--sage));
  transition: width .4s ease; }

/* ------------------------------------------------------------------ layout */
.layout { max-width: var(--maxw); margin: 0 auto; padding: 1.4rem 1.2rem 6rem; }

.card {
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.2rem;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.45rem;
  color: var(--coral-deep); font-weight: 700; font-size: 0.74rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 0.5rem;
}

/* hero */
.hero { text-align: center; padding: 2.4rem 1.4rem 1.8rem; }
.hero h1 { font-size: 2.3rem; }
.hero p.lede { font-size: 1.12rem; color: var(--ink-soft); max-width: 40rem;
               margin: 0 auto 1.4rem; }
.pill-row { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: var(--radius-pill); padding: 0.35rem 0.85rem;
  font-size: 0.82rem; color: var(--ink-soft); font-weight: 600;
}

/* ------------------------------------------------------------------ buttons */
.btn {
  font-family: inherit; font-weight: 700; font-size: 0.95rem;
  border: none; border-radius: var(--radius-pill); cursor: pointer;
  padding: 0.7rem 1.4rem; transition: transform .08s ease, box-shadow .2s ease,
            background .2s ease; display: inline-flex; align-items: center;
  gap: 0.5rem;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--coral); color: var(--ink-on-accent); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--coral-deep); }
.btn--ghost { background: transparent; color: var(--ink-soft);
              border: 1px solid var(--line); }
.btn--ghost:hover { background: var(--coral-wash); color: var(--ink); }
.btn--sage { background: var(--sage); color: var(--ink-on-accent); }
.btn--sage:hover { background: var(--sage-deep); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: center;
           margin-top: 1.2rem; }

/* ----------------------------------------------------------- curriculum map */
.part { margin-bottom: 1.5rem; }
.part__head { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.6rem; }
.part__num {
  font-weight: 800; color: var(--coral-deep); font-size: 0.85rem;
  background: var(--coral-wash); border-radius: var(--radius-pill);
  padding: 0.2rem 0.7rem;
}
.part__title { font-weight: 800; font-size: 1.05rem; }
.module-list { display: grid; gap: 0.6rem; }
.module {
  display: flex; align-items: center; gap: 0.9rem;
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0.85rem 1rem; cursor: pointer;
  transition: border-color .15s ease, transform .08s ease, box-shadow .2s ease;
}
.module:hover { border-color: var(--coral); box-shadow: var(--shadow-sm);
                transform: translateY(-1px); }
.module--locked { opacity: 0.55; cursor: not-allowed; }
.module--locked:hover { transform: none; border-color: var(--line); box-shadow: none; }
.module__status {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 0.9rem; font-weight: 800;
  background: var(--line); color: var(--ink-faint);
}
.module__status--done { background: var(--good-wash); color: var(--good); }
.module__status--active { background: var(--coral-wash); color: var(--coral-deep); }
.module__body { flex: 1; }
.module__id { font-weight: 800; font-size: 0.92rem; }
.module__obj { color: var(--ink-soft); font-size: 0.85rem; }
.module__chev { color: var(--ink-faint); }

/* --------------------------------------------------------------- code chips */
.code-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-weight: 800; font-size: 0.85rem; border-radius: var(--radius-sm);
  padding: 0.18rem 0.55rem; white-space: nowrap; border: 1px solid transparent;
}
.code-chip--pos { background: var(--good-wash); color: var(--good);
                  border-color: var(--good-line); }
.code-chip--neg { background: var(--bad-wash); color: var(--bad);
                  border-color: var(--bad-line); }
.code-chip--neutral { background: var(--surface-3); color: var(--ink-soft);
                      border-color: var(--line); }
.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
             gap: 0.6rem; margin: 1rem 0; }
.code-card { border: 1px solid var(--line); border-radius: var(--radius-sm);
             padding: 0.7rem 0.8rem; background: var(--cream-2); }
.code-card__def { font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.3rem; }

/* -------------------------------------------------------------------- items */
.item { }
.unit-quote {
  background: var(--surface-3); border-left: 4px solid var(--coral);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.9rem 1.1rem; margin: 0.8rem 0; font-size: 1.05rem;
}
.unit-quote .speaker { font-weight: 800; color: var(--ink-soft);
                       margin-right: 0.35rem; }
.antecedent {
  background: var(--sage-wash); border-left: 4px solid var(--sage);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.6rem 1rem; margin: 0.6rem 0; font-size: 0.92rem; color: var(--ink-soft);
}
.antecedent .label { font-size: 0.7rem; text-transform: uppercase;
                     letter-spacing: 0.06em; font-weight: 700; color: var(--sage-deep);
                     display: block; margin-bottom: 0.2rem; }

.options { display: grid; gap: 0.6rem; margin: 1rem 0; }
.option {
  text-align: left; width: 100%; font-family: inherit; font-size: 0.96rem;
  background: var(--cream-2); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: 0.8rem 1rem; cursor: pointer;
  transition: border-color .12s ease, background .12s ease; color: var(--ink);
  display: flex; align-items: center; gap: 0.7rem;
}
.option:hover { border-color: var(--coral); }
.option--selected { border-color: var(--coral); background: var(--coral-wash); }
.option--correct { border-color: var(--good); background: var(--good-wash); }
.option--wrong   { border-color: var(--bad); background: var(--bad-wash); }
.option--muted   { opacity: 0.6; }
.option__key { font-weight: 800; color: var(--ink-faint); flex: none; }

.palette { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 1rem 0; }
.palette .code-chip { cursor: pointer; border-width: 1.5px; }
.palette .code-chip--selected { outline: 3px solid var(--coral);
                                outline-offset: 1px; }

/* feedback */
.feedback {
  border-radius: var(--radius-sm); padding: 0.9rem 1.1rem; margin-top: 1rem;
  font-size: 0.94rem; animation: rise .25s ease;
}
.feedback--correct { background: var(--good-wash); border: 1px solid var(--good-line); }
.feedback--wrong   { background: var(--bad-wash); border: 1px solid var(--bad-line); }
.feedback__head { font-weight: 800; margin-bottom: 0.3rem; display: flex;
                  align-items: center; gap: 0.4rem; }
.feedback--correct .feedback__head { color: var(--good); }
.feedback--wrong .feedback__head { color: var(--bad); }
.feedback__basis { margin-top: 0.5rem; padding-top: 0.5rem;
                   border-top: 1px dashed var(--line); color: var(--ink-soft);
                   font-size: 0.88rem; }
.feedback__cite { color: var(--ink-faint); font-size: 0.78rem; margin-top: 0.4rem; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* progress within a lesson */
.lesson-progress { display: flex; gap: 0.3rem; margin-bottom: 1rem; }
.lesson-progress .dot { flex: 1; height: 6px; border-radius: var(--radius-pill);
                        background: var(--line); }
.lesson-progress .dot--done { background: var(--sage); }
.lesson-progress .dot--current { background: var(--coral); }

/* flag / tone-dependent control */
.flag-toggle { display: flex; gap: 0.6rem; margin: 0.8rem 0; }
.flag-toggle .btn { flex: 1; justify-content: center; }

/* gate result */
.score-ring { display: grid; place-items: center; margin: 1rem auto; }
.gate-codes { display: grid; gap: 0.4rem; margin: 1rem 0; }
.gate-code-row { display: flex; align-items: center; gap: 0.7rem;
                 font-size: 0.9rem; }
.gate-code-row .bar { flex: 1; height: 10px; border-radius: var(--radius-pill);
                      background: var(--line); overflow: hidden; }
.gate-code-row .bar__fill { height: 100%; border-radius: var(--radius-pill); }
.gate-code-row .g-val { font-weight: 800; width: 3.2rem; text-align: right; }

.callout {
  background: var(--gold-wash); border: 1px solid var(--gold-line);
  border-radius: var(--radius-sm); padding: 0.9rem 1.1rem; margin: 1rem 0;
  font-size: 0.92rem;
}
.callout strong { color: var(--coral-deep); }

.note { color: var(--ink-soft); font-size: 0.88rem; }
.kicker { color: var(--ink-faint); font-size: 0.8rem; font-weight: 700;
          text-transform: uppercase; letter-spacing: 0.06em; }

.crumb { color: var(--ink-faint); font-size: 0.85rem; margin-bottom: 0.6rem;
         cursor: pointer; display: inline-flex; gap: 0.3rem; }
.crumb:hover { color: var(--coral-deep); }

@media (max-width: 560px) {
  .hero h1 { font-size: 1.7rem; }
  .header-progress__bar { width: 70px; }
}

/* provenance / derivation page */
.prov-list { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.prov-list li { margin: 0 0 0.7rem; }
.prov-list li strong { color: var(--ink); }

/* header nav link to the provenance page */
.header-link {
  font-size: 0.82rem; font-weight: 600; color: var(--sage-deep);
  text-decoration: none; padding: 0.3rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--sage-wash); white-space: nowrap; margin-right: 0.9rem;
}
.header-link:hover { background: var(--sage-wash); color: var(--ink); }

/* ------------------------------------------------------------------ footer */
.site-footer {
  max-width: var(--maxw); margin: 2rem auto 0; padding: 1.4rem 1.2rem;
  border-top: 1px solid var(--line);
  text-align: center;
}
.site-footer p {
  font-size: 0.82rem; color: var(--ink-faint); margin: 0;
}
