/* 外文页的逐页版式修正（让外文页与中文页一致）。由 scripts/i18n/postprocess.py 挂到所有外文页，排在 i18n-foreign.css 与字体 CSS 之后。
   只写 html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) 开头的选择器；中文页不加载。 */

/* 人物页与主题页：面包屑自然换行，避免窄屏把整段 hero 撑出页面；文案保留原字号。 */
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .p-hero{min-width:0;overflow-x:clip}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .p-hero__content{min-width:0;max-width:100%;box-sizing:border-box;overflow-x:clip}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .p-hero__block{min-width:0;max-width:100%;box-sizing:border-box;overflow-x:clip}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .p-hero__block::before{left:0;right:0;max-width:100%}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .p-hero__breadcrumb,
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .breadcrumb{max-width:100%;white-space:normal;overflow-wrap:anywhere;line-height:1.6}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .breadcrumb ol{display:flex;flex-wrap:wrap;white-space:normal;gap:.25rem 0;min-width:0;max-width:100%}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .breadcrumb ol li{min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .chapter__title.fit-line[data-fit-state]{max-width:100%;white-space:normal!important;text-wrap:wrap;word-break:normal;overflow-wrap:anywhere}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .cta{min-height:0;height:auto}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .cta .wrap{min-height:0;height:auto}

/* 我们页标题装饰框保持中文双字宽度；长外文标题在框中正常换行。 */
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.about-page .dy-hero>header.dy-head{box-sizing:border-box!important;max-width:calc(100vw - 2.5rem)!important;margin-inline:auto!important}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.about-page .dy-hero>header.dy-head :is(h1,h2,.dy-title){max-width:100%;white-space:normal;overflow-wrap:anywhere}

/* 功能页的长外文标题/经文按现有卡片宽度自然换行；底栏保持视口宽度。 */
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body :is(.mb-pg,.mb-pg *):not(.mb-pv):not(.mb-h1):not(.mb-e):not(.mb-e *){box-sizing:border-box;min-width:0;max-width:100%;white-space:normal!important;text-wrap:wrap!important;overflow-wrap:anywhere}
/* 日记/代祷列表的摘录：中文版就是单行 + 省略号，外文保持一致（不展开，否则几条日记的文字叠在一起） */
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body .mb-pg .mb-e h3{box-sizing:border-box;min-width:0;white-space:nowrap!important;text-overflow:ellipsis;overflow:hidden}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body .mb-pg .mb-pv{box-sizing:border-box;min-width:0;white-space:nowrap!important;text-overflow:ellipsis;overflow:hidden}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body .app-wrapper>nav.bottom-nav{box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:100vw!important;overflow:visible!important;overflow-x:visible!important}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body .app-wrapper>nav.bottom-nav .nav-item,
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body .app-wrapper>nav.bottom-nav .nav-item>span:not(.nav-icon){box-sizing:border-box;white-space:nowrap!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:normal!important}
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body .verse-box :is(p,span,cite){white-space:normal;overflow-wrap:anywhere;word-break:normal}

/* Reading-plan sidebar and shared navigation keep the source page geometry. */
html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.ms-plan .rp-year-picker select{box-sizing:border-box;width:5.75rem}
html[lang=ja] body.ms-plan .rp-year-picker{gap:1.625rem}
html:is([lang=en],[lang=es],[lang=pt],[lang=vi]) body.ms-plan.ms-plan :is(a,button,label,select,summary),
html:is([lang=en],[lang=es],[lang=pt],[lang=vi]) body.ms-plan.ms-plan a *{font-family:Arial,"DejaVu Sans",sans-serif!important}
html:is([lang=en],[lang=es],[lang=pt],[lang=vi]) body.ms-plan .site-footer .footer-group__title a{letter-spacing:0!important}
html:is([lang=en],[lang=es],[lang=pt],[lang=vi]) body.ms-plan .rp-cycle-state{box-sizing:border-box;width:100%;max-width:100%;white-space:normal!important;overflow-wrap:anywhere}
html[lang=en] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-header a.rp-start.rp-start::before{content:"Start reading"!important;font-family:Arial,"DejaVu Sans",sans-serif!important;letter-spacing:.04em!important}
html[lang=es] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-header a.rp-start.rp-start::before{content:"Empezar a leer"!important;font-family:Arial,"DejaVu Sans",sans-serif!important;letter-spacing:.02em!important}
html[lang=ja] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-header a.rp-start.rp-start::before{content:"読み始める"!important}
html[lang=en] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-body a.rp-all.rp-all::before{content:"Reading plan"!important}
html[lang=es] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-body a.rp-all.rp-all::before{content:"Plan de lectura"!important}
html[lang=ja] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-body a.rp-all.rp-all::before{content:"通読計画"!important}

/* ko/pt/vi：读经计划「开始阅读」伪元素文案 */
html[lang=ko] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-header a.rp-start.rp-start::before{content:"읽기 시작"!important}
html[lang=pt] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-header a.rp-start.rp-start::before{content:"Começar a ler"!important;font-family:Arial,"DejaVu Sans",sans-serif!important;letter-spacing:.02em!important}
html[lang=vi] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-header a.rp-start.rp-start::before{content:"Bắt đầu đọc"!important;font-family:Arial,"DejaVu Sans",sans-serif!important;letter-spacing:.02em!important}

html[lang=ko] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-body a.rp-all.rp-all::before{content:"읽기 계획"!important}
html[lang=pt] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-body a.rp-all.rp-all::before{content:"Plano de leitura"!important}
html[lang=vi] body:not(#zz1):not(#zz2):not(#zz3):not(#zz4) .rp-sidebar-body a.rp-all.rp-all::before{content:"Kế hoạch đọc"!important}

/* 人物页首屏分享按钮：葡/越语词长，按钮不超出 hero 块 */
html:is([lang=pt],[lang=vi],[lang=ko]) body.figure-page .p-hero__actions{max-width:100%;box-sizing:border-box}
html:is([lang=pt],[lang=vi],[lang=ko]) body.figure-page .p-hero__actions .share-classic{box-sizing:border-box!important;max-width:100%!important;padding-left:1rem!important;padding-right:1rem!important;min-width:0!important;white-space:nowrap}
html[lang=ko] body.ms-plan .rp-year-picker{gap:1.6875rem}

/* 日记月份标题：西/葡/越语月份名较长，缩小字号，右侧翻月按钮不与首行文字相碰 */
@media (min-width:900px){html:is([lang=es],[lang=pt],[lang=vi]) body .journal-app.mb #calendarMonth{font-size:2rem!important}}

/* Mobile hub heroes: keep titles above the tab bar, matching zh.
   Foreign breadcrumbs wrap (rules above) and were in the hero's flex flow,
   which pushed the title into the bottom nav. Long Latin/Vietnamese titles
   were also taller than the Chinese name. Take the crumb out of flow and
   slightly tighten the hub eyebrow/title; do not change dy-head sizes. */
@media (max-width: 899px) {
  html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .p-hero .breadcrumb,
  html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .p-hero .p-hero__breadcrumb {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 2;
    box-sizing: border-box;
  }
  html:is([lang=en],[lang=es],[lang=ja],[lang=ko],[lang=pt],[lang=vi]) body.figure-page .p-hero--hub .eyebrow {
    letter-spacing: 0.08em;
    font-size: .8125rem;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Give foreign about headings a real vertical gap, with natural subtitle wrapping. */
html:not([lang^=zh]) body.about-page:not(#about-spacing) .ab-hero header.dy-head{display:flex!important;flex-direction:column!important;align-items:center!important;gap:.75rem!important;height:auto!important;margin:0!important;padding:0!important;min-width:0!important;width:100%!important}
html:not([lang^=zh]) body.about-page:not(#about-spacing) .ab-hero .dy-title{line-height:1.3!important;margin:0!important;letter-spacing:.08em!important}
html:not([lang^=zh]) body.about-page:not(#about-spacing) .ab-hero .dy-sub{margin:0!important;line-height:1.6!important;text-wrap:wrap!important;letter-spacing:.02em!important;white-space:normal!important}
@media(max-width:820px){html:not([lang^=zh]) body.about-page:not(#about-spacing) .ab-hero{padding-inline:9%!important}}
/* Long translated choices keep readable type and determine their own height. */
/* 外文祷告事项：列数、间距跟中文一模一样（桌面 6 列、手机 3 列），长标签在格子里换行，不再改成 5 列 + 整行“宽项”（那样最后一行靠左、还会来回重排） */
html:not([lang^=zh]) body:not(#choice1):not(#choice2):not(#choice3):not(#choice4) .tone-group{align-items:start!important}
html:not([lang^=zh]) body:not(#choice1):not(#choice2):not(#choice3):not(#choice4) .tone-group .tone-option>label{width:100%!important;max-width:100%!important;height:auto!important;min-height:2.75rem!important;white-space:normal!important;letter-spacing:0!important;font-size:.8125rem!important;line-height:1.3!important;gap:.5rem!important}
html:not([lang^=zh]) body:not(#choice1):not(#choice2):not(#choice3):not(#choice4) .tone-group .tone-option>label>span:last-child{width:100%!important;max-width:100%!important;white-space:normal!important;word-break:normal!important;overflow-wrap:normal!important;letter-spacing:0!important;line-height:1.45!important;padding:.3125rem .4375rem!important;min-height:0!important;height:auto!important;border-radius:.5rem!important}
html:not([lang^=zh]) body:not(#choice1):not(#choice2):not(#choice3):not(#choice4) #figures .moods .mood{height:auto!important;padding-block:.375rem!important;white-space:normal!important;letter-spacing:0!important;font-size:.9375rem!important;line-height:1.45!important}
html:not([lang^=zh]) body:not(#choice1):not(#choice2):not(#choice3):not(#choice4) #figures .moods .mood>span[data-i18n]{width:100%!important;max-width:100%!important;white-space:normal!important;word-break:normal!important;overflow-wrap:normal!important;font-size:.9375rem!important;letter-spacing:0!important;line-height:1.45!important}

/* A single readable row fits long Latin words without reducing the type. */
@media(max-width:600px){
 html:is([lang=en],[lang=es],[lang=pt],[lang=vi]) body:not(#mood-row1):not(#mood-row2):not(#mood-row3):not(#mood-row4) #figures .moods{grid-template-columns:minmax(0,1fr)!important;gap:.625rem!important}
 html:is([lang=en],[lang=es],[lang=pt],[lang=vi]) body:not(#mood-row1):not(#mood-row2):not(#mood-row3):not(#mood-row4) #figures .moods .mood{display:flex!important;flex-direction:row!important;justify-content:flex-start!important;align-items:center!important;gap:1rem!important;min-height:3.25rem!important;padding:.5rem 1rem!important;text-align:left!important}
 html:is([lang=en],[lang=es],[lang=pt],[lang=vi]) body:not(#mood-row1):not(#mood-row2):not(#mood-row3):not(#mood-row4) #figures .moods .mood svg.mood__icon{width:2.25rem!important;height:2.25rem!important;flex:0 0 2.25rem!important}
 html:is([lang=en],[lang=es],[lang=pt],[lang=vi]) body:not(#mood-row1):not(#mood-row2):not(#mood-row3):not(#mood-row4) #figures .moods .mood>span[data-i18n]{width:auto!important;flex:1 1 0!important;text-align:left!important;hyphens:auto}
}
html[lang=ko] body:not(#choice1):not(#choice2):not(#choice3):not(#choice4) .tone-group .tone-option>label>span:last-child{word-break:keep-all!important}
/* 11-25：章节概览标题——中文用 text-indent 补字距（.22em），拉丁文字距已收回，再缩进就整行偏右约 3px */
html:is([lang=en],[lang=es],[lang=pt],[lang=vi]) body.reader-page.ms-study .b-chapter-overview h2{text-indent:0!important}
