/* ============================================================================
   /guides/make-it-make-sense/ — showpiece styles
   Loaded by src/pages/guides/make-it-make-sense.astro. BaseLayout supplies the
   site header/footer/fonts. Two visual registers:
     .v-edited  → full brand (mono, hard shadows, ink-on-paper, confident)
     .v-raw     → generic "AI-doc" skin (system sans, muted, over-boxed)
   The floating toggle flips #mms[data-view] to swap which register is visible.
   Colours declared as rgb() so lint:hex (#xxx only) stays clean; inline <svg>
   fills may carry hex (the lint strips <svg> blocks before scanning).
   ============================================================================ */

:root {
  --ink:              rgb(3 5 16);
  --ink-soft:         rgb(90 94 110);
  --paper:            rgb(244 241 234);
  --paper-soft:       rgb(233 230 223);
  --accent-primary:   rgb(255 189 105);   /* yellow — primary CTA */
  --accent-secondary: rgb(134 165 217);   /* sky    — accent */
  --brand-coral:      rgb(242 87 87);

  --font-display: "IBM Plex Mono", ui-monospace, monospace;
  --font-body:    "Space Mono", ui-monospace, monospace;
  --font-slop:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --shadow-cta: 6px 6px 0 0 rgb(3 5 16);
  --shadow-md:  4px 4px 0 0 rgb(3 5 16);

  --pad-x: clamp(20px, 5vw, 64px);
}

/* overflow-x: clip (not hidden) — `hidden` forces overflow-y to compute to
   `auto`, turning <main> into a nested vertical scroll container and causing a
   "sticky" first-scroll hand-off on mobile/desktop. `clip` hides horizontal
   overflow without creating a scroll container or touching the y-axis. */
.mms { position: relative; overflow-x: clip; }
.mms *, .mms *::before, .mms *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ----------------------------------------------------------------------------
   View switching — both states in the DOM; root attr decides which shows
   ---------------------------------------------------------------------------- */
.mms .v-raw { display: none; }
.mms[data-view="original"] .v-edited { display: none; }
.mms[data-view="original"] .v-raw { display: block; }

/* Whole-page tint + banner offset when in original mode */
.mms[data-view="original"] { background: var(--paper-soft); }
.mms-banner {
  display: none;
  position: sticky; top: 0; z-index: 40;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-body); font-size: 12px; letter-spacing: 0.02em;
  text-align: center; padding: 8px 16px;
}
.mms-banner strong { color: var(--accent-primary); }
.mms[data-view="original"] .mms-banner { display: block; }

/* ----------------------------------------------------------------------------
   Layout scaffolding
   ---------------------------------------------------------------------------- */
.mms-section, .mms-hero {
  width: 100%;
  padding: clamp(64px, 10vw, 140px) var(--pad-x);
}
.mms-hero { padding-top: clamp(72px, 12vw, 180px); }
.mms-inner { max-width: 1080px; margin: 0 auto; }
/* --prose no longer narrows the container (that caused the shifting left edge);
   prose sections share the same container and bound text per-element instead. */
.mms-inner--prose { max-width: 1080px; }

.mms-slab { height: 6px; background: var(--accent-secondary); width: 100%; }

/* Section-break reveal */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
[data-reveal].in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ----------------------------------------------------------------------------
   BRAND (edited) type
   ---------------------------------------------------------------------------- */
.mms-h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(34px, 5.2vw, 66px); line-height: 1.03; letter-spacing: -0.04em;
  text-transform: uppercase; margin: 0; color: var(--ink);
}
.mms-h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(26px, 3.4vw, 44px); line-height: 1.05; letter-spacing: -0.04em;
  text-transform: uppercase; margin: 0 0 8px; color: var(--ink);
}
.mms-h2--big { font-size: clamp(30px, 4.6vw, 60px); }
.mms-mark {
  background-image: linear-gradient(var(--accent-secondary), var(--accent-secondary));
  background-repeat: no-repeat; background-position: 0 88%; background-size: 100% 0.28em;
}
.mms-lede {
  font-family: var(--font-body); font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.5; color: var(--ink-soft); margin: 20px 0 0; max-width: 44ch;
}
.mms-intro {
  font-family: var(--font-body); font-size: 16px; line-height: 1.7;
  color: var(--ink); margin: 22px 0 0;
}
.mms-intro em, .mms-lede em { font-style: italic; }

/* One shared left edge everywhere: bound long text by a readable measure,
   anchored left (not centered). rem/px only — never ch on the display font. */
.mms-h1 { max-width: 46rem; }
.mms-h2 { max-width: 42rem; }
.mms-intro { max-width: 40rem; }
/* Deliberate centered "statement" sections — everything centers together */
.mms-section--cta { text-align: center; }
.mms-section--cta .mms-h2,
.mms-section--cta .mms-intro { margin-left: auto; margin-right: auto; }

.mms-hero .mms-inner { position: relative; }

/* ----------------------------------------------------------------------------
   § 2 · Mismatch poles
   ---------------------------------------------------------------------------- */
.mms-poles {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: clamp(12px, 3vw, 36px);
  align-items: stretch; margin-top: 40px;
}
.mms-pole {
  border: 2px solid var(--ink); background: var(--paper); padding: 24px;
}
.mms-pole--reader { background: var(--paper); box-shadow: var(--shadow-md); }
.mms-pole--ai { opacity: 0.92; }
.mms-pole__label {
  font-family: var(--font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 14px;
}
.mms-pole--reader .mms-pole__label { color: var(--ink); }
.mms-pole__list { list-style: none; margin: 0; padding: 0; }
.mms-pole__list li {
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
  padding: 8px 0; border-bottom: 1px solid rgb(3 5 16 / 0.12);
}
.mms-pole__list li:last-child { border-bottom: 0; }
.mms-pole__note { font-family: var(--font-body); font-size: 13px; color: var(--ink-soft); margin: 14px 0 0; font-style: italic; }
.mms-pole__conv { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.mms-pole__arrow { font-family: var(--font-display); font-size: 28px; color: var(--ink); }
.mms-bridge {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(16px, 1.8vw, 22px);
  line-height: 1.4; letter-spacing: -0.02em;
  margin: 40px 0 0; max-width: 40rem;
}

/* ----------------------------------------------------------------------------
   § 3 · Deep-dive stepper
   ---------------------------------------------------------------------------- */
.mms-section--deep { background: var(--paper-soft); }
.mms[data-view="original"] .mms-section--deep { background: var(--paper); }
.mms-deep {
  display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 36px;
}
.mms-specimen {
  border: 2px solid var(--ink); background: var(--paper); padding: 26px 28px;
}
.mms-specimen > p {
  font-family: var(--font-slop); font-size: 15.5px; line-height: 1.75; color: rgb(3 5 16 / 0.72); margin: 0;
}
.mms-specimen .x { transition: color .35s ease, background .35s ease, opacity .35s ease; }
/* struck = this pass (or an earlier one) removed it */
.mms-specimen .x.is-struck {
  text-decoration: line-through; text-decoration-color: var(--brand-coral);
  text-decoration-thickness: 2px; color: rgb(3 5 16 / 0.32);
}
/* spotlight = the pass currently being explained */
.mms-specimen .x.is-active {
  background: var(--accent-primary); color: var(--ink); text-decoration-color: var(--ink);
  border-radius: 2px; padding: 0 2px;
}
.mms-specimen__result {
  margin-top: 20px; border-top: 2px dashed var(--ink); padding-top: 18px;
}
.mms-specimen__result-label {
  font-family: var(--font-body); font-weight: 700; font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent-secondary); margin: 0 0 8px;
}
.mms-specimen__result p { font-family: var(--font-body); font-size: 15px; line-height: 1.6; margin: 0; }

.mms-steps { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.mms-step {
  font-family: var(--font-body); font-weight: 700; font-size: 12.5px;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  padding: 8px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: background .2s ease, color .2s ease;
}
.mms-step__n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: var(--paper);
  font-size: 10px;
}
.mms-step.is-active { background: var(--ink); color: var(--paper); }
.mms-step.is-active .mms-step__n { background: var(--accent-primary); color: var(--ink); }
.mms-step.is-done { border-color: rgb(3 5 16 / 0.4); color: var(--ink-soft); }

.mms-notes { position: relative; min-height: 96px; }
.mms-note {
  font-family: var(--font-body); font-size: 14.5px; line-height: 1.6; margin: 0;
  display: none;
}
.mms-note.is-active { display: block; }
.mms-note strong { font-family: var(--font-display); }

.mms-stepper__nav { display: flex; gap: 10px; margin-top: 20px; }
.mms-ghostbtn {
  font-family: var(--font-body); font-weight: 700; font-size: 12px; letter-spacing: 0.02em;
  border: 2px solid var(--ink); background: transparent; color: var(--ink);
  padding: 9px 14px; cursor: pointer;
}
.mms-ghostbtn:disabled { opacity: 0.35; cursor: not-allowed; }
.mms-ghostbtn--fwd { background: var(--accent-primary); }

/* ----------------------------------------------------------------------------
   § 4 · Pass machine
   ---------------------------------------------------------------------------- */
.mms-flow2 { margin-top: 40px; }
.mms-flow2__entry {
  font-family: var(--font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 16px;
}
.mms-flow2__passes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.mms-passnode {
  border: 2px solid var(--ink); border-top: 5px solid var(--accent-secondary);
  background: var(--paper); padding: 16px; min-height: 116px;
  display: flex; flex-direction: column; gap: 10px;
}
.mms-passnode__name {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  text-transform: uppercase; letter-spacing: -0.02em;
}
.mms-passnode__gate {
  font-family: var(--font-body); font-size: 12px; line-height: 1.45; color: var(--ink-soft); margin-top: auto;
}
.mms-coldread { margin-top: 16px; border: 2px dashed var(--ink); padding: 20px 22px; }
.mms-coldread__q { font-family: var(--font-body); font-size: 15px; margin: 0 0 14px; text-align: center; }
.mms-coldread__q strong { font-family: var(--font-display); }
.mms-coldread__forks { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.mms-fork {
  font-family: var(--font-body); font-weight: 700; font-size: 13px;
  border: 2px solid var(--ink); padding: 10px 16px;
}
.mms-fork--ship { background: var(--accent-primary); box-shadow: var(--shadow-md); }
.mms-fork--loop { border-style: dashed; color: var(--ink-soft); }

/* ----------------------------------------------------------------------------
   § 5 · Pass cards
   ---------------------------------------------------------------------------- */
.mms-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 40px; }
.mms-card { border: 2px solid var(--ink); background: var(--paper); padding: 22px; }
.mms-card:nth-child(4n+1) { box-shadow: var(--shadow-md); }
.mms-card__tag {
  font-family: var(--font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-secondary); margin: 0 0 6px;
}
.mms-card__q { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; margin: 0 0 14px; }
.mms-card__list { list-style: none; margin: 0; padding: 0; }
.mms-card__list li {
  font-family: var(--font-body); font-size: 14px; line-height: 1.5; padding: 7px 0 7px 18px; position: relative;
}
.mms-card__list li::before { content: "→"; position: absolute; left: 0; color: var(--ink-soft); }

/* ----------------------------------------------------------------------------
   § 6 · Rule / § 7 payoff / § 8 CTA
   ---------------------------------------------------------------------------- */
/* Dark "statement" section (the payoff) — restores the light/dark rhythm.
   Reverts to paper in original mode so the raw AI-doc skin stays light. */
.mms-section--dark { background: var(--ink); }
.mms[data-view="original"] .mms-section--dark { background: var(--paper); }
.mms-section--dark .mms-h2 { color: var(--paper); }
.mms-section--dark .mms-intro { color: rgb(244 241 234 / 0.86); }

.mms-code {
  font-family: var(--font-display); font-size: clamp(12px, 1.5vw, 15px); line-height: 1.8;
  background: var(--ink); color: var(--paper); text-align: left;
  padding: 22px 24px; margin: 28px auto 0; max-width: 620px; overflow-x: auto;
  border: 2px solid var(--ink);
}
.mms-code code { white-space: pre; }
.mms-ctas { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 30px; }
.mms-cta {
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.02em; text-decoration: none;
  border: 3px solid var(--ink); background: var(--paper); color: var(--ink);
  padding: 13px 22px; transition: transform .1s ease, box-shadow .1s ease;
}
.mms-cta--primary { background: var(--accent-primary); box-shadow: var(--shadow-cta); }
.mms-cta--primary:active { transform: translate(6px, 6px); box-shadow: none; }

/* ----------------------------------------------------------------------------
   FLOATING TOGGLE
   ---------------------------------------------------------------------------- */
.mms-toggle {
  position: fixed; right: clamp(14px, 3vw, 32px); bottom: clamp(14px, 3vw, 32px);
  z-index: 60; text-align: right; max-width: 220px;
}
.mms-toggle__btn { border: 0; background: transparent; padding: 0; cursor: pointer; display: inline-block; }
.mms-toggle__track {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; align-items: center;
  width: 190px; height: 42px; border: 3px solid var(--ink); background: var(--paper);
  box-shadow: var(--shadow-md); font-family: var(--font-body); font-weight: 700; font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.mms-toggle__opt { z-index: 2; text-align: center; transition: color .2s ease; color: var(--ink-soft); }
.mms-toggle__knob {
  position: absolute; z-index: 1; top: 0; left: 50%; width: 50%; height: 100%;
  background: var(--accent-primary); transition: left .22s ease, background .22s ease;
}
/* default = edited (knob right) */
.mms-toggle__opt--edit { color: var(--ink); }
.mms[data-view="original"] ~ .mms-toggle .mms-toggle__knob,
.mms-toggle.is-original .mms-toggle__knob { left: 0; background: var(--accent-secondary); }
.mms-toggle.is-original .mms-toggle__opt--edit { color: var(--ink-soft); }
.mms-toggle.is-original .mms-toggle__opt--orig { color: var(--ink); }
.mms-toggle__cap {
  font-family: var(--font-body); font-size: 11px; line-height: 1.4; color: var(--ink-soft);
  margin: 8px 0 0; background: rgb(244 241 234 / 0.85); padding: 4px 6px;
}
@media (prefers-reduced-motion: reduce) {
  .mms-toggle__knob, .mms-specimen .x, .mms-step, .mms-cta { transition: none; }
}

/* ----------------------------------------------------------------------------
   RAW ("AI-doc") skin — generic, muted, over-formatted
   ---------------------------------------------------------------------------- */
.v-raw { font-family: var(--font-slop); color: rgb(3 5 16 / 0.82); max-width: 780px; margin: 0 auto; }
.raw-h1 {
  font-family: var(--font-slop); font-weight: 700; font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.25; letter-spacing: -0.01em; color: rgb(3 5 16 / 0.9); margin: 0 0 14px;
}
.raw-h2 {
  font-family: var(--font-slop); font-weight: 700; font-size: clamp(19px, 2.4vw, 26px);
  line-height: 1.3; color: rgb(3 5 16 / 0.9); margin: 0 0 16px;
}
.raw-sub { font-family: var(--font-slop); font-size: 15px; color: var(--ink-soft); margin: 0 0 18px; }
.raw-p { font-family: var(--font-slop); font-size: 16px; line-height: 1.75; margin: 0 0 16px; }
.raw-p strong { font-weight: 700; }
.raw-cta-btn {
  font-family: var(--font-body); display: inline-block; margin-top: 18px;
  background: rgb(76 95 213); color: rgb(255 255 255);
  font-weight: 700; font-size: 15px; padding: 12px 26px; border-radius: 8px;
}

/* ----------------------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .mms-poles { grid-template-columns: 1fr; }
  .mms-pole__conv { flex-direction: row; padding: 4px 0; }
  .mms-pole__arrow { transform: rotate(90deg); }
  .mms-cards { grid-template-columns: 1fr; }
  .mms-flow2__passes { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .mms-flow2__passes { grid-template-columns: 1fr; }
  .mms-fork { width: 100%; text-align: center; }
  .mms-toggle { max-width: 170px; }
  .mms-toggle__track { width: 160px; }
}
