/* ============================================================
   MLO EDUCATION — SHARED LAYOUT (draft, 2026-11-07)
   The layout rules from design-system/LAYOUT_AUDIT_AND_RULES.md
   and Cowork's R25, as shared classes.

   NOT LINKED BY ANY PAGE YET. Page types switch to it one at a
   time (re-measured after each). Until then this file changes
   nothing. It only ADDS tokens and mlo-* classes; it never
   redefines an existing token, so linking it is safe.

   Sizes are for a classroom screen read from the back of the
   room: nothing a student reads is smaller than 16px.
   ============================================================ */

:root {
  /* ── Page widths (Rule 1) ───────────────────────────────── */
  --w-hub:      1400px;  /* homepage, level/semester/unit hubs */
  --w-activity: 1200px;  /* every activity: the same width     */
  --w-story:    1400px;  /* picture beside the text            */
  --w-game:     1600px;  /* full-screen class games            */
  --w-prose:    760px;   /* any paragraph of running text      */
  --gutter:     24px;    /* side margin on every page          */

  /* ── Type roles (Rule 2): size at 1366 → size at 1920 ───── */
  --t-display: clamp(64px, 5vw, 96px);   /* title screens, the word taught */
  --t-h1:      clamp(40px, 2.9vw, 56px); /* page title                     */
  --t-h2:      clamp(28px, 1.9vw, 36px); /* section title                  */
  --t-h3:      clamp(22px, 1.4vw, 26px); /* card title, button label       */
  --t-body:    clamp(20px, 1.25vw, 24px);/* body and activity text         */
  --t-small:   16px;                     /* meta, breadcrumbs, captions    */

  /* ── Corners (Rule 4): three sizes only ──────────────────── */
  --corner-sm:   12px;   /* chips, inputs, tags   */
  --corner-card: 20px;   /* cards and panels      */
  --corner-pill: 999px;  /* buttons               */

  /* ── Buttons (Rule 5) ────────────────────────────────────── */
  --btn-h:    56px;  --btn-font:    22px;  --btn-pad:    0 32px;
  --btn-h-sm: 40px;  --btn-font-sm: 16px;  --btn-pad-sm: 0 20px;

  /* ── One card, one elevation (Rules 6 and 8) ─────────────── */
  --card-min:  280px;    /* a card is never narrower …          */
  --card-max:  420px;    /* … or wider than this, even if alone */
  --card-pad:  24px;
  --card-bg:   rgba(255, 255, 255, 0.06);
  --card-line: rgba(244, 200, 66, 0.22);
  --elev-rest:  0 8px 24px rgba(10, 6, 30, 0.35);
  --elev-hover: 0 14px 34px rgba(10, 6, 30, 0.45);

  /* ── Header bar (Rule 8) ─────────────────────────────────── */
  --bar-h: 64px;
}

/* ── Page shapes (Rule 1) ─────────────────────────────────── */
.mlo-page {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
  box-sizing: border-box;
  font-size: var(--t-body);
}
.mlo-page--hub      { max-width: calc(var(--w-hub) + 2 * var(--gutter)); }
.mlo-page--activity { max-width: calc(var(--w-activity) + 2 * var(--gutter)); min-height: calc(100dvh - var(--bar-h)); display: flex; flex-direction: column; }
.mlo-page--story    { max-width: calc(var(--w-story) + 2 * var(--gutter)); min-height: calc(100dvh - var(--bar-h)); display: flex; flex-direction: column; }
.mlo-page--game     { max-width: calc(var(--w-game) + 2 * var(--gutter)); height: calc(100dvh - var(--bar-h)); display: flex; flex-direction: column; }
.mlo-prose          { max-width: var(--w-prose); }

/* ── Type roles (Rule 2) ──────────────────────────────────── */
.mlo-display { font-size: var(--t-display); font-weight: 800; line-height: 1.05; }
.mlo-h1      { font-size: var(--t-h1);      font-weight: 800; line-height: 1.1; }
.mlo-h2      { font-size: var(--t-h2);      font-weight: 800; line-height: 1.2; }
.mlo-h3      { font-size: var(--t-h3);      font-weight: 700; line-height: 1.25; }
.mlo-body    { font-size: var(--t-body);    line-height: 1.5; }
.mlo-small   { font-size: var(--t-small);   line-height: 1.4; opacity: 0.8; }

/* ── Buttons (Rule 5): two sizes, one primary per screen ──── */
.mlo-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--btn-h); padding: var(--btn-pad);
  font: 800 var(--btn-font)/1 var(--font);
  border-radius: var(--corner-pill); border: 2px solid var(--gold);
  background: transparent; color: var(--cream);
  cursor: pointer; text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mlo-btn:hover   { transform: translateY(-2px); }
.mlo-btn--primary { background: var(--gold); color: var(--night-deep); box-shadow: var(--elev-rest); }
.mlo-btn--small  { height: var(--btn-h-sm); padding: var(--btn-pad-sm); font-size: var(--btn-font-sm); }
.mlo-btn:disabled { opacity: 0.4; cursor: default; transform: none; }

/* ── Cards (Rule 6): fixed size range, balanced grid ──────── */
.mlo-grid {
  display: grid;
  gap: var(--s-5, 24px);
  /* auto-FILL, not auto-fit: a lone card stays card-sized (R25 bug) */
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
}
.mlo-grid > * { max-width: var(--card-max); }
.mlo-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mlo-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1199px) { .mlo-grid--3, .mlo-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 759px)  { .mlo-grid--3, .mlo-grid--4 { grid-template-columns: 1fr; } }

.mlo-tile {
  background: var(--card-bg);
  border: 1.5px solid var(--card-line);
  border-radius: var(--corner-card);
  padding: var(--card-pad);
  box-shadow: var(--elev-rest);
  display: flex; flex-direction: column; gap: var(--s-2, 8px);
  color: var(--cream); text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.mlo-tile:hover { transform: translateY(-3px); box-shadow: var(--elev-hover); }
.mlo-tile__title { font-size: var(--t-h3); font-weight: 800; }
.mlo-tile__meta  { font-size: var(--t-small); opacity: 0.75; }

/* One badge shape for activity icons, lesson numbers and run steps (R25 rule 4) */
.mlo-badge {
  width: 56px; height: 56px; flex: 0 0 56px;
  display: grid; place-items: center;
  border-radius: var(--corner-card);
  border: 2px solid var(--gold); color: var(--gold);
  font-weight: 800; font-size: 22px;
}

/* ── Tabs (homepage levels; inside a level) ───────────────── */
.mlo-tabs { display: flex; gap: var(--s-2, 8px); flex-wrap: wrap; border-bottom: 1.5px solid var(--card-line); margin-bottom: var(--s-5, 24px); }
.mlo-tab {
  height: var(--btn-h-sm); padding: var(--btn-pad-sm);
  display: inline-flex; align-items: center;
  font: 800 var(--t-small)/1 var(--font); color: var(--cream);
  background: none; border: none; border-bottom: 3px solid transparent;
  cursor: pointer; opacity: 0.75;
}
.mlo-tab[aria-selected="true"], .mlo-tab.is-on { opacity: 1; color: var(--gold); border-bottom-color: var(--gold); }

/* ── Title screen (Rule 7): every activity and game ───────── */
.mlo-title-screen {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: var(--s-4, 16px); padding: var(--s-6, 32px) 0;
}
.mlo-title-screen__art { width: min(560px, 80vw); aspect-ratio: 16 / 9; border-radius: var(--corner-card); overflow: hidden; }
.mlo-title-screen__art img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.mlo-title-screen__sub { font-size: var(--t-h3); max-width: var(--w-prose); opacity: 0.85; }

/* ── Header bar (Rule 8) ──────────────────────────────────── */
.mlo-bar {
  height: var(--bar-h); display: flex; align-items: center; gap: var(--s-4, 16px);
  padding: 0 var(--gutter); box-sizing: border-box;
}
.mlo-bar__crumbs { flex: 1; font-size: var(--t-small); opacity: 0.8; }
.mlo-bar__crumbs a { color: inherit; text-decoration: none; }
.mlo-bar__crumbs a:hover { color: var(--gold); }

/* ── Interface icons (R25 rule 7): one set, one size ──────── */
.mlo-icon { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; flex: 0 0 24px; }
.mlo-btn--small .mlo-icon { width: 18px; height: 18px; flex-basis: 18px; }
