/* =========================================================
   CECIL Official v1.0.114 — Sitewide PC/SP line-breaking system
   ---------------------------------------------------------
   Principles
   1. Static template copy wraps naturally by default.
   2. Japanese text uses phrase-aware line opportunities where supported.
   3. Hard <br> breaks are opt-in only.
   4. PC-only / SP-only / structural breaks are explicit.
   5. Visual Editor variants keep the user's device-specific manual breaks.
========================================================= */

/* ---------- Reading engine ---------- */
main :where(h1,h2,h3,h4,h5,h6,p,li,dt,dd,summary,blockquote,figcaption,small,strong,span,.btn,.cecil-hero-detail-catch,.cecil-hero-detail-lead){
  line-break:strict;
  word-break:normal;
  overflow-wrap:normal;
  white-space:normal;
}

html[lang="ja"] main :where(h1,h2,h3,h4,h5,h6,p,li,dt,dd,summary,blockquote,figcaption,small,strong,span,.btn,.cecil-hero-detail-catch,.cecil-hero-detail-lead){
  word-break:normal;
  word-break:auto-phrase;
}

/* Headings should avoid orphaned fragments, but must not be forcibly balanced
   into equal-width rows. This is the main change from the previous system. */
main :where(h1,h2,h3,h4,h5,h6,.cecil-hero-detail-catch,.section-title){
  text-wrap:pretty;
}

main :where(p,li,dd,summary,blockquote,figcaption,small,.cecil-hero-detail-lead){
  text-wrap:pretty;
}

/* ---------- Hard-break policy ----------
   A raw <br> in static page copy no longer controls layout.
   Use one of the explicit classes below only when the break carries meaning. */
main :where(h1,h2,h3,h4,h5,h6,p,li,dt,dd,summary,blockquote,figcaption,small,strong,span) > br:not(.cecil-br-keep):not(.cecil-br-pc):not(.cecil-br-sp):not(.cecil-br-structural){
  display:none!important;
}

/* Editor-generated text is the exception: the page editor already stores
   desktop/mobile text independently, so its explicit newlines must remain. */
main .cecil-edit-variant > br{
  display:inline!important;
}

/* Structural/manual opt-ins. */
main br.cecil-br-keep,
main br.cecil-br-structural,
main .cecil-preserve-breaks br{
  display:inline!important;
}

/* Desktop-only break. */
main br.cecil-br-pc{
  display:inline!important;
}

/* Smartphone-only break is disabled on desktop. */
main br.cecil-br-sp{
  display:none!important;
}

/* Explicit helper for rare copy that benefits from optical balancing. */
main .cecil-balance-lines{
  text-wrap:balance!important;
}

/* Explicit helper for copy that should never be broken internally. */
main .cecil-nowrap{
  white-space:nowrap!important;
  word-break:keep-all!important;
}

/* ---------- Multilingual safeguards ---------- */
html[lang="en"] main :where(h1,h2,h3,h4,h5,h6,p,li,dd,summary,small,strong,span,.btn),
.language-page--en :where(h1,h2,h3,h4,h5,h6,p,li,dd,summary,small,strong,span,.btn){
  word-break:normal!important;
  hyphens:none!important;
}
html[lang="en"] main :where(p,li,dd,summary,small),
.language-page--en :where(p,li,dd,summary,small){
  overflow-wrap:break-word!important;
}

html[lang="ko"] main :where(h1,h2,h3,h4,h5,h6,p,li,dd,summary,small,strong,span,.btn),
.language-page--ko :where(h1,h2,h3,h4,h5,h6,p,li,dd,summary,small,strong,span,.btn){
  word-break:keep-all!important;
  overflow-wrap:normal!important;
  hyphens:none!important;
}
html[lang="ko"] main :where(p,li,dd,summary,small),
.language-page--ko :where(p,li,dd,summary,small){
  overflow-wrap:break-word!important;
}

html[lang="zh-CN"] main :where(h1,h2,h3,h4,h5,h6,p,li,dd,summary,small,strong,span,.btn),
.language-page--zh :where(h1,h2,h3,h4,h5,h6,p,li,dd,summary,small,strong,span,.btn){
  word-break:normal!important;
  overflow-wrap:normal!important;
  line-break:strict!important;
  hyphens:none!important;
}

/* ---------- Smartphone composition ---------- */
@media (max-width:760px){
  /* Mobile headings re-compose by phrase and balance line lengths.
     Explicit .cecil-br-sp breaks still take precedence where copy requires
     exact editorial choreography. */
  main :where(h1,h2,h3,h4,h5,h6,.cecil-hero-detail-catch,.section-title){
    text-wrap:balance!important;
  }

  html[lang="ja"] main :where(h1,h2,h3,h4,h5,h6,p,li,dd,summary,small,strong,span,.btn,.cecil-hero-detail-catch,.cecil-hero-detail-lead){
    word-break:normal!important;
    word-break:auto-phrase!important;
    overflow-wrap:normal!important;
  }

  /* PC choreography is released on small screens. */
  main br.cecil-br-pc{
    display:none!important;
  }

  main br.cecil-br-sp{
    display:inline!important;
  }

  /* Leads use the full safe content width instead of creating narrow columns. */
  main :where(.cecil-hero-detail-lead,.language-lead,.language-final-copy){
    max-inline-size:100%!important;
  }
}

/* Very narrow devices: do not fall back to arbitrary character breaking. */
@media (max-width:380px){
  html[lang="ja"] main :where(h1,h2,h3,h4,h5,h6,.cecil-hero-detail-catch){
    line-break:strict!important;
    overflow-wrap:normal!important;
  }
}
