/* CIRA CLASSROOM independent embedding mode. Activated only by ?embed=1.
   Canonical lesson HTML/data and runtime remain at Cloudflare, never in the CMS theme. */
html.cira-embedded { scroll-behavior:auto; scrollbar-gutter:auto; }
html.cira-embedded body { min-width:0 !important; margin:0 !important; min-height:0 !important; background:#fffdf8; }
html.cira-embedded :is(#site-header,#site-footer) { display:none !important; }
html.cira-embedded :is(.skip-link,[data-unit-roadmap],.classroom-roadmap,
  .classroom-breadcrumbs,.continue-block,.grammar-next,.classroom-bottom-nav) { display:none !important; }
html.cira-embedded .classroom-page {
  min-height:0 !important; max-width:100% !important;
  margin:0 auto !important; padding:4px 0 16px !important;
}
html.cira-embedded .classroom-page__inner {
  width:100% !important; max-width:100% !important;
  margin:0 auto !important; padding:0 clamp(8px,2.5vw,22px) !important;
}
html.cira-embedded .classroom-identity,
html.cira-embedded .classroom-stage-header {
  min-height:0 !important;
}
html.cira-embedded .classroom-working-area {
  min-height:0 !important;
}
html.cira-embedded .story-reading,
html.cira-embedded .story-audio,
html.cira-embedded .vocabulary-card-list,
html.cira-embedded .culture-note { max-width:100%; }
@media (max-width:620px){
  html.cira-embedded .classroom-page__inner{padding:0 6px !important;}
  html.cira-embedded .story-reading{padding:16px !important;}
}

/* Compact layout is an explicit host presentation opt-in, never a standalone override. */
/* Proposal: presentation changes only, scoped to embedded Vocabulary. */
html.cira-embedded-compact #unit-vocabulary .classroom-identity,
html.cira-embedded-compact #unit-vocabulary .classroom-stage-header { display:none; }
html.cira-embedded-compact #unit-vocabulary .classroom-working-title {
  position:absolute; width:1px; height:1px; margin:-1px; padding:0;
  overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0;
}
html.cira-embedded-compact #unit-vocabulary .classroom-working-area {
  display:grid; grid-template-columns:minmax(0,1fr) auto; gap:0 20px;
}
html.cira-embedded-compact #unit-vocabulary .classroom-working-header { display:contents; }
html.cira-embedded-compact #unit-vocabulary .classroom-view-selector {
  grid-column:2; grid-row:1; align-self:center; margin:0 0 20px;
}
html.cira-embedded-compact #unit-vocabulary .vocabulary-cards__instruction {
  grid-column:1; grid-row:1; align-self:center; width:100%; margin:0 0 20px;
}
html.cira-embedded-compact #unit-vocabulary .classroom-working-area > :not(.classroom-working-header):not(.vocabulary-cards__instruction) {
  grid-column:1 / -1;
}
@media(max-width:620px) {
  html.cira-embedded-compact #unit-vocabulary .classroom-working-area { grid-template-columns:minmax(0,1fr); }
  html.cira-embedded-compact #unit-vocabulary .classroom-view-selector {
    grid-column:1; grid-row:1; justify-self:start; margin-bottom:12px;
  }
  html.cira-embedded-compact #unit-vocabulary .vocabulary-cards__instruction {
    grid-column:1; grid-row:2; margin-bottom:18px;
  }
}

html.cira-embedded-compact .classroom-identity { display:none; }
html.cira-embedded-compact .classroom-stage-header__eyebrow,
html.cira-embedded-compact .classroom-stage-header__title,
html.cira-embedded-compact .classroom-working-title {
  position:absolute; width:1px; height:1px; margin:-1px; padding:0;
  overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0;
}
html.cira-embedded-compact:not(:has(#unit-vocabulary)) .classroom-working-header { display:none; }

/* Optional neutral presentation. Existing standalone and embed views are unchanged. */
html.cira-embedded-neutral {
  --cira-bg:#fcfcfa; --cira-primary:#263442; --cira-text:#263442;
  --cira-text-muted:#65717d; --cira-red:#c8202f; --cira-border:#dfe3e5;
  --cira-surface:#fff; --cira-surface-soft:#f5f6f5;
}
html.cira-embedded-neutral body { background:#fcfcfa !important; }
html.cira-embedded-neutral .classroom-page { padding:0 !important; }
html.cira-embedded-neutral .classroom-page__inner { padding:0 !important; }
/* Compact instructions sit outside the padded working area. Give them their
   own inset instead of restoring outer padding and narrowing every activity. */
html.cira-embedded-neutral.cira-embedded-compact .classroom-stage-header {
  box-sizing:border-box; max-width:100%; margin:0; padding:20px 28px;
}
html.cira-embedded-neutral .classroom-working-area { box-shadow:none; border-radius:8px; padding:28px; }
html.cira-embedded-neutral .vocab-flip-card__face {
  background:#fff; border:1px solid #dfe3e5; border-top:2px solid #a8b2b9;
  box-shadow:none; border-radius:8px;
}
html.cira-embedded-neutral .vocab-flip-card__face--back { background:#f5f6f5; border-top-color:#c8202f; }
html.cira-embedded-neutral .vocab-flip-card__term { font-weight:650; }
html.cira-embedded-neutral .vocab-flip-card__number { color:#65717d; font-weight:600; }
html.cira-embedded-neutral .classroom-view-selector__button { font-weight:600; }
html.cira-embedded-neutral :is(.vocab-audio-button,.vocab-flip-card__turn) { min-height:44px; font-weight:550; }
html.cira-embedded-neutral .culture-note { border-radius:8px; box-shadow:none; }
@media(max-width:767px) {
  html.cira-embedded-neutral.cira-embedded-compact .classroom-stage-header { padding:16px; }
  html.cira-embedded-neutral .classroom-working-area { padding:16px; }
  html.cira-embedded-neutral .vocabulary-card-list { grid-template-columns:minmax(0,1fr); }
  html.cira-embedded-neutral .vocab-flip-card__face { padding:18px; }
  html.cira-embedded-neutral :is(.vocab-flip-card,.vocab-flip-card__inner) { min-height:220px; height:220px; }
}

/* Legacy navigation opt-in and the complete Unit share a header-free shell. */
html.cira-embedded:is(.cira-embedded-navigation,.cira-embedded-unit) :is([data-unit-roadmap],.classroom-roadmap) { display:block !important; }
html.cira-embedded-unit,html.cira-embedded-unit body { height:auto !important; min-height:0 !important; overflow-anchor:none; }
html.cira-embedded-unit body { display:flow-root; }
html.cira-embedded-unit .classroom-roadmap { position:static !important; margin-top:0 !important; }
html.cira-embedded-unit :is(.classroom-bottom-nav,.continue-block,.grammar-next) { display:flex !important; }
html.cira-embedded-unit [data-cira-outside-unit] { display:none !important; }
/* Retain each continuation block's layout instead of forcing a horizontal row. */
html.cira-embedded-unit :is(.continue-block,.grammar-next) { display:block !important; }
/* Maintain the single-row mobile chapter footer inside ?embed=1&scope=unit. */
html.cira-embedded-unit .classroom-bottom-nav { flex-wrap:nowrap; }
