/* Additive adaptation only: original illustration, timing and desktop composition stay intact. */
:root { color-scheme: light; }

main img, main video, main iframe { max-width: 100%; }
.dogma-page-content, .dogma-page-content > section { min-width: 0; }
.dogma-page-content :is(p, li, a, figcaption) { overflow-wrap: break-word; }
.dogma-page-index { max-height: calc(100svh - var(--dogma-nav-clearance, 80px) - 20px); overflow-y: auto; }
.wiki-table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media(max-width:900px) {
  .dogma-page-frame { width:calc(100% - 20px); margin-inline:auto; padding-right:0; }
  .dogma-page-content .grid > * { min-width:0; overflow-wrap:anywhere; }
}
/* Never clip a tall reading composition to a single screen. The transition's
   pinned stage is deliberately excluded: its scroll-driven geometry is preserved. */
#main-scroll :is(.home-trna,.home-rhythm,.home-mismatch,.home-engineering,.home-application) {
  height: max(100svh, var(--home-content-height, 0px));
  min-height: 100svh;
}
@media(max-height:600px) {
  #main-scroll :is(.home-trna__inner,.home-rhythm__inner,.home-mismatch__inner,.home-engineering__inner,.home-application__inner,.home-aggregate__inner) {
    padding-block: 52px 20px; transform: none;
  }
  #main-scroll :is(.home-trna__copy,.home-rhythm__copy,.home-mismatch__copy,.home-engineering__copy,.home-application__copy) h2 {
    font-size: clamp(1.6rem, 3.4vw, 2.8rem);
  }
  #main-scroll .home-mismatch__visual { width: min(100%,900px,max(280px,calc((100svh - 205px)*1.59))); }
  #main-scroll .home-aggregate__inner { gap: 8px; }
  #main-scroll .home-aggregate__copy h2 { font-size: clamp(1.4rem,3vw,2.4rem); }
  #main-scroll .home-aggregate__visual { height: min(36svh,250px); }
  #main-scroll .home-explore { padding-block: 60px 32px; }
}
@media(max-width:700px) {
  /* Keep the chapter navigation available, but put it above the article instead
     of allocating a narrow permanent column to reading text. */
  .dogma-page-frame { width: calc(100% - 28px); margin-inline:auto; padding:0; grid-template-columns:minmax(0,1fr); gap:1.5rem; }
  .dogma-page-frame::after { display:none; }
  .dogma-page-frame > .dogma-page-index { position:relative; top:auto; grid-column:1; max-height:none; margin-top:1rem; padding-left:1rem; }
  .dogma-page-frame > .dogma-page-content { grid-column:1; }
  .dogma-page-frame > .dogma-page-index nav { display:flex; flex-wrap:wrap; gap:4px 14px; max-height:150px; overflow-y:auto; }
  .dogma-page-frame > .dogma-page-index a { max-width:100%; }
  .dogma-page-content :is(pre, math) { max-width:100%; overflow-x:auto; }
}
/* Education's desktop offsets are retained on wide screens. Only smaller
   viewports return its panels to normal flow; orbit/carousel/sea animation
   transforms are not reset. */
@media(max-width:1100px) {
  .education-page { --edu-ref-w:calc(100% - 28px); --edu-ref-pad:clamp(16px,3vw,32px); }
  .education-page > .members-snap-zone { top:0; margin-bottom:0; }
  .education-page .members-snap-zone > .members-snap-panel { transform:none!important; min-height:auto; padding-block:48px; grid-template-columns:minmax(0,1fr); }
  .education-page .members-snap-panel :is(article,header,div,p) { min-width:0; }
  .education-page .hp-panel-card { max-width:100%; box-sizing:border-box; }
  .education-page .hp-panel-index { white-space:normal; overflow-wrap:anywhere; font-size:clamp(.8rem,2vw,1.2rem); }
  .education-page :is(.edu-fb,.edu-outlook) { padding-inline:var(--edu-ref-pad); }
  .education-page #catalog { margin-left:0; margin-top:0; }
  .education-page #end { margin-bottom:0; }
  .education-page #voyage { margin-top:0; }
  .education-page #voyage .edu-sea-head .hp-panel-top { margin-top:0; margin-left:0; }
  .education-page :is(.edu-intro-box,.edu-hl,.edu-ouract-grid,.edu-evo-track) { transform:none!important; margin-inline:0; width:100%; }
  .education-page .edu-orbit { max-width:100%; margin-left:0; }
  .education-page .edu-end-scene { width:100%; margin-left:0; }
  .education-page :is(#eduTheoryFigA,#eduTheoryFigB,#eduTheoryFigWrapB figcaption) { transform:none!important; max-width:100%; }
  .education-page .edu-side-nav { display:none; }
  .education-page .edu-evo-card { width:auto; max-width:100%; margin-left:0; top:0; }
}

/* The sea background intentionally extends beyond its composition; clip only
   that decorative horizontal bleed, not content or vertical scrolling. */
html:has(body.education-page) { overflow-x:clip; }
@media(max-width:700px) {
  .education-page :is(.edu-full-body,.edu-case-grid--two,.edu-ouract-grid,.edu-observed-grid) { grid-template-columns:minmax(0,1fr); }
  .education-page .hp-panel-card { padding:20px 16px; }
  .education-page :is(.hp-quote-body p,.edu-brief-intro,.edu-anim-lede,.edu-intro-box p) { font-size:1rem; line-height:1.75; }
  .education-page .edu-intro-box { padding:16px; }
  .education-page .edu-actdetail-radar { flex-basis:auto; max-width:100%; }
  .education-page .edu-actdetail-body { flex-wrap:wrap; }
}
