/*
 * MHA design-system components. Consumes academy/design-system/tokens.css.
 *
 * ============================================================================
 * CANONICAL MARKUP CONTRACT (verbatim from task-2-brief.md, Step 1).
 * Every later HTML file copies these class names and this nesting exactly.
 * ============================================================================
 *
 * <div class="mha-driving-question"><span class="mha-label">DRIVING QUESTION</span>
 *   <strong>What problem am I actually trying to solve?</strong></div>
 *
 * <div class="mha-3w">
 *   <div class="w-why"><span>WHY</span>...</div>
 *   <div class="w-when"><span>WHEN</span>...</div>
 *   <div class="w-where"><span>WHERE</span>...</div>
 *   <div class="w-notwhen"><span>NOT WHEN</span>...</div>
 *   <div class="w-fail"><span>FAILURE IF IGNORED</span>...</div>
 * </div>
 *
 * <div class="mha-field-insight"><span class="mha-label">FIELD INSIGHT | MICHAEL COLLINS</span>
 *   <p>...</p><img class="mc-mark" src="../assets/mc-monogram.svg" alt=""></div>
 *
 * Photo variant (preferred where a real headshot is available; mc-mark
 * monogram remains a valid fallback/secondary mark):
 * <div class="mha-field-insight"><span class="mha-label">FIELD INSIGHT | MICHAEL COLLINS</span>
 *   <p>...</p><img class="mc-photo" src="../assets/michael-collins.jpg" alt="Michael Collins"></div>
 *
 * <div class="mha-pro-tip"><span class="mha-label">PRO TIP | MC</span>
 *   <p><b>If</b> ... <b>then</b> ... <b>Tradeoff:</b> ... <b>Verify:</b> ...</p></div>
 *
 * <div class="mha-common-mistake"><span class="mha-label">COMMON MISTAKE</span><p>...</p></div>
 * <div class="mha-design-principle"><span class="mha-label">DESIGN PRINCIPLE</span><strong>...</strong></div>
 * <div class="mha-tlp"><span class="mha-label">THINK LIKE THE PACKAGE</span><p>...</p></div>
 * <div class="mha-tlo"><span class="mha-label">THINK LIKE THE OPERATOR</span><p>...</p></div>
 * <div class="mha-controls-corner"><span class="mha-label">CONTROLS CORNER</span><p>...</p></div>
 * <div class="mha-stop-think"><span class="mha-label">STOP AND THINK</span><p>...</p></div>
 * <div class="mha-riverside"><span class="mha-label">RIVERSIDE PROJECT</span>
 *   <div class="rv-body">...</div></div>
 * <div class="mha-forest"><span class="mha-label">FOREST THROUGH THE TREES</span><p>...</p></div>
 * <div class="mha-checkpoint"><span class="mha-label">CHECKPOINT</span><ol><li>...</li></ol></div>
 *
 * ============================================================================
 * PAGE SHELL CONTRACT (mha-page / mha-header / mha-journey / mha-footer).
 * Not given as literal markup in the brief's fenced block; the brief only
 * describes these in prose (Step 1 "Styling requirements") and lists the
 * class names in "Interfaces". Markup below is this task's concrete design
 * for that prose so later writers have one contract to copy, same as above.
 * ============================================================================
 *
 * <body class="mha-page">
 *   <header class="mha-header">
 *     <span class="mha-header-part">PART IV | LESSON 15: TRANSFERS AND MERGES</span>
 *     <span class="mha-header-word">MATERIAL HANDLING ACADEMY</span>
 *   </header>
 *
 *   <nav class="mha-journey">
 *     <ol class="mha-journey-parts">
 *       <li class="jp">I</li>
 *       ...
 *       <li class="jp is-current">IV</li>
 *       ...
 *       <li class="jp">VIII</li>
 *     </ol>
 *     <p class="mha-journey-carry">You carry in: ...</p>
 *   </nav>
 *
 *   ...lesson body: driving question, 3W, devices, riverside, forest, checkpoint...
 *
 *   <footer class="mha-footer">
 *     <span class="mha-footer-tagline">EDUCATE. ELEVATE. ENGINEER EXCELLENCE.</span>
 *     <span class="mha-footer-context">...</span>
 *   </footer>
 * </body>
 *
 * Notes:
 * - .jp.is-current is the gold "you are here" chip; plain .jp is navy at 35%
 *   opacity per the brief's styling requirements.
 * - w-notwhen / w-fail use a dedicated dark-red pair (#3d1216 fill,
 *   #ff8a80 label) called out literally in the brief; not tokens.css colors.
 */

* , *::before, *::after { box-sizing: border-box; }

:root {
  --mha-red-dark: #3d1216;
  --mha-red-dark-label: #ff8a80;
}

.mha-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 0 3rem;
}

/* ---- header ---- */
.mha-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--mha-navy);
  color: var(--mha-text-on-navy);
  padding: .85rem 1.25rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.mha-header-part {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.mha-header-word {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mha-gold);
}

/* ---- journey strip ---- */
.mha-journey { margin: 0 1.25rem 1.75rem; }
.mha-journey-parts {
  display: flex;
  gap: .4rem;
  list-style: none;
  margin: 0 0 .6rem;
  padding: 0;
  flex-wrap: wrap;
}
.mha-journey-parts .jp {
  flex: 1 1 auto;
  min-width: 32px;
  text-align: center;
  padding: .4rem 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  background: var(--mha-navy);
  color: var(--mha-text-on-navy);
  opacity: .35;
  border-radius: var(--r);
}
.mha-journey-parts .jp.is-current {
  background: var(--mha-gold);
  color: var(--mha-navy);
  opacity: 1;
}
.mha-journey-carry {
  font-size: 13px;
  font-style: italic;
  color: var(--mha-ink);
  margin: 0;
}

/* ---- driving question ---- */
.mha-driving-question {
  background: var(--mha-gold);
  color: var(--mha-navy);
  padding: 1rem 1.25rem;
  border-radius: var(--r);
  margin: 0 1.25rem 1.75rem;
}
.mha-driving-question .mha-label { color: var(--mha-navy); }
.mha-driving-question strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  margin-top: .3rem;
  text-transform: none;
  letter-spacing: 0;
}

/* ---- three w's decision card ----
   Six-column grid: the three navy chips span 2 columns each (row of 3),
   the two dark-red chips span 3 each (balanced row of 2 beneath). */
.mha-3w {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 0 1.25rem 1.75rem;
}
.mha-3w > div {
  grid-column: span 2;
  padding: .8rem .9rem;
  border-radius: var(--r);
  background: var(--mha-navy);
  color: var(--mha-text-on-navy);
  font-size: 13px;
  line-height: 1.55;
}
.mha-3w > div > span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mha-gold);
  margin-bottom: .4rem;
}
.mha-3w > .w-notwhen,
.mha-3w > .w-fail {
  grid-column: span 3;
  background: var(--mha-red-dark);
}
.mha-3w .w-notwhen > span,
.mha-3w .w-fail > span {
  color: var(--mha-red-dark-label);
}

/* ---- field insight ---- */
.mha-field-insight {
  background: var(--mha-navy);
  color: var(--mha-text-on-navy);
  padding: 1.25rem 1.4rem;
  border-radius: var(--r);
  margin: 0 1.25rem 1.75rem;
  /* contains the floated .mc-photo so the box grows to fit it instead of
     letting the circular photo hang past the bottom edge */
  display: flow-root;
}
.mha-field-insight .mha-label {
  display: block;
  color: var(--mha-gold);
  margin-bottom: .6rem;
}
.mha-field-insight p { color: var(--mha-text-on-navy); max-width: 60ch; margin: 0; }
.mha-field-insight .mc-mark { height: 40px; margin-top: .75rem; display: block; }
/* Profile photo variant: always circular, object-position center top (brand rule). */
.mha-field-insight .mc-photo {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; object-position: center top;
  border: 3px solid var(--mha-gold);
  float: right; margin: 0 0 6px 10px;
}

/* ---- pro tip ---- */
.mha-pro-tip {
  background: rgba(240, 196, 25, .14);
  border: 2px solid var(--mha-gold);
  padding: 1rem 1.25rem;
  border-radius: var(--r);
  margin: 0 1.25rem 1.75rem;
}
.mha-pro-tip .mha-label { color: var(--mha-ink); }
.mha-pro-tip p { margin: .5rem 0 0; }

/* ---- common mistake ---- */
.mha-common-mistake {
  background: #fff;
  border-left: 4px solid var(--mha-red);
  padding: .8rem 1.1rem;
  margin: 0 1.25rem 1.75rem;
}
.mha-common-mistake .mha-label { color: var(--mha-red); }
.mha-common-mistake p { margin: .4rem 0 0; }

/* ---- design principle ---- */
.mha-design-principle {
  background: rgba(240, 196, 25, .2);
  padding: 1rem 1.25rem;
  border-radius: var(--r);
  margin: 0 1.25rem 1.75rem;
}
.mha-design-principle .mha-label { color: var(--mha-ink); }
.mha-design-principle strong {
  display: block;
  font-size: 18px;
  margin-top: .35rem;
  text-transform: uppercase;
}

/* ---- think like the package / operator ---- */
.mha-tlp, .mha-tlo {
  background: #fff;
  border: 1px solid var(--mha-rule);
  border-left: 4px solid var(--mha-navy);
  padding: .8rem 1.1rem;
  margin: 0 1.25rem 1.75rem;
}
.mha-tlp .mha-label, .mha-tlo .mha-label { color: var(--mha-navy); }
.mha-tlp p, .mha-tlo p { margin: .4rem 0 0; }

/* ---- controls corner ---- */
.mha-controls-corner {
  background: #fff;
  border-left: 4px solid var(--mha-blue);
  padding: .8rem 1.1rem;
  margin: 0 1.25rem 1.75rem;
}
.mha-controls-corner .mha-label { color: var(--mha-blue-ink); }
.mha-controls-corner p { margin: .4rem 0 0; }

/* ---- stop and think ---- */
.mha-stop-think {
  border: 1px dashed var(--mha-ink);
  border-radius: var(--r);
  padding: .8rem 1.1rem;
  margin: 0 1.25rem 1.75rem;
}
.mha-stop-think .mha-label { color: var(--mha-ink); }
.mha-stop-think p { margin: .4rem 0 0; }

/* ---- riverside project (spiral-notebook page) ---- */
.mha-riverside {
  background-color: var(--mha-cream);
  background-image: repeating-linear-gradient(
    var(--mha-cream) 0 27px,
    var(--mha-rule) 27px 28px
  );
  border-left: 3px solid var(--mha-red);
  padding: 1.1rem 1.4rem 1.1rem 2rem;
  margin: 0 1.25rem 1.75rem;
  transform: rotate(-.4deg);
  box-shadow: 0 1px 5px rgba(26, 26, 46, .15);
}
.mha-riverside .mha-label { color: var(--mha-red); display: block; margin-bottom: .3rem; }
.mha-riverside .rv-body { font-size: 14px; line-height: 28px; }
.mha-riverside .rv-body p { margin: 0 0 0; max-width: 65ch; }
.mha-riverside .rv-prompt {
  font-family: 'Segoe Print', cursive;
  font-size: 16px;
  line-height: 28px;
  color: var(--mha-navy);
}

/* ---- forest through the trees ---- */
.mha-forest {
  background: var(--mha-navy);
  color: var(--mha-text-on-navy);
  padding: 1.5rem 1.75rem;
  margin: 0 0 1.75rem;
}
.mha-forest .mha-label { color: var(--mha-gold); display: block; margin-bottom: .4rem; }
.mha-forest p { color: var(--mha-text-on-navy); margin: 0; max-width: 70ch; }

/* ---- checkpoint ---- */
.mha-checkpoint {
  background: #fff;
  border: 1px solid var(--mha-rule);
  border-radius: var(--r);
  padding: 1rem 1.25rem;
  margin: 0 1.25rem 1.75rem;
}
.mha-checkpoint .mha-label { color: var(--mha-ink); }
.mha-checkpoint ol { margin: .5rem 0 0; padding-left: 1.25rem; }
.mha-checkpoint li { margin-bottom: .5rem; }

/* ---- footer ---- */
.mha-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--mha-navy);
  padding: .85rem 1.25rem;
  margin-top: 1.5rem;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  flex-wrap: wrap;
}
.mha-footer-tagline { color: var(--mha-gold); font-weight: 700; }
.mha-footer-context { color: var(--mha-text-on-navy); }

/* ---- in-context calculator widget (TRY IT) ----
   One reusable device wired by academy/calculators/calc-widget.js against the
   same tested math (calc-core.js) the standalone calculators use. On screen it
   is interactive; in print the controls hide and a one-line formula shows.
   Markup contract:
   <div class="mha-calc-widget" data-widget="TYPE" data-dec="1">
     <span class="mha-label">TRY IT | NAME</span>
     <p class="cw-caption">one-line course-voice caption</p>
     <div class="cw-controls">
       <label class="cw-field"><span>L (IN)</span><input data-field="L" value="13"></label>
       ...
     </div>
     <div class="cw-result" hidden></div>
     <p class="cw-print">Formula on one line for the printed page.</p>
   </div> */
.mha-calc-widget {
  background: #fff;
  border: 1px solid var(--mha-rule);
  border-left: 4px solid var(--mha-gold);
  border-radius: var(--r);
  padding: .85rem 1.1rem;
  margin: 0 1.25rem 1.75rem;
}
.mha-calc-widget .mha-label { color: var(--mha-navy); display: block; margin-bottom: .5rem; }
.mha-calc-widget .cw-caption {
  font-size: 12.5px;
  font-style: italic;
  color: var(--mha-ink);
  margin: 0 0 .7rem;
  max-width: 72ch;
}
.mha-calc-widget .cw-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .8rem;
  align-items: flex-end;
}
.mha-calc-widget .cw-field { display: flex; flex-direction: column; gap: .22rem; }
.mha-calc-widget .cw-field > span {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--mha-navy);
}
.mha-calc-widget .cw-field input,
.mha-calc-widget .cw-field select {
  font-family: var(--ff);
  font-size: 13px;
  padding: .34rem .5rem;
  border: 1px solid var(--mha-rule);
  border-radius: 4px;
  background: var(--mha-cream);
  color: var(--mha-ink);
  width: 6.5rem;
}
.mha-calc-widget .cw-field select { width: 11rem; }
/* Shared gold focus ring so the in-lesson calc inputs match the standalone
   calculators instead of falling back to the browser-default outline (audit M-6). */
.mha-calc-widget .cw-field input:focus-visible,
.mha-calc-widget .cw-field select:focus-visible {
  outline: 2px solid var(--mha-gold);
  outline-offset: 1px;
}
.mha-calc-widget .cw-result {
  margin-top: .75rem;
  padding-top: .7rem;
  border-top: 1px solid var(--mha-rule);
}
.mha-calc-widget .cw-val { font-size: 20px; font-weight: 800; color: var(--mha-navy); line-height: 1.2; }
.mha-calc-widget .cw-val .u {
  font-size: 12px;
  font-weight: 600;
  color: var(--mha-ink);
  letter-spacing: .01em;
  margin-left: .35rem;
  text-transform: none;
}
.mha-calc-widget .cw-verdict {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .16rem .5rem;
  border-radius: 4px;
  margin-left: .5rem;
  vertical-align: middle;
}
.mha-calc-widget .cw-verdict.pass { background: rgba(46, 125, 50, .14); color: var(--mha-green); }
.mha-calc-widget .cw-verdict.fail { background: rgba(192, 57, 43, .12); color: var(--mha-red); }
.mha-calc-widget .cw-sub {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .9rem;
  margin-top: .35rem;
  font-size: 12px;
  color: var(--mha-ink);
}
.mha-calc-widget .cw-sub b { color: var(--mha-navy); }
.mha-calc-widget .cw-interp {
  font-size: 12.5px;
  line-height: 1.5;
  margin: .45rem 0 0;
  max-width: 72ch;
}
.mha-calc-widget .cw-print {
  display: none;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  color: var(--mha-navy);
  margin: .5rem 0 0;
  max-width: none;
}
@media print {
  .mha-calc-widget { break-inside: avoid; border-left-color: var(--mha-navy); }
  .mha-calc-widget .cw-controls,
  .mha-calc-widget .cw-result { display: none !important; }
  .mha-calc-widget .cw-print { display: block; }
}
