/* Local font roles for the Shiyujiu interface and reading pages. */
:root {
  --cc-latin-display: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --cc-latin-reading: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --cc-latin-ui: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

/* Shared footer and comments also render on Chinese pages. */
.home-footer-renewed header > p,
.home-footer-bottom :is([lang=en], [lang=es], [lang=fr]) {
  font-family: var(--cc-latin-reading);
  letter-spacing: .025em;
}

#CommentsLifa :is(.atk-list-header, .atk-dropdown, .atk-send-btn) {
  font-family: var(--cc-latin-ui);
  letter-spacing: normal;
}

:is(html:lang(en), html:lang(es), html:lang(fr)) {
  --syj-type-display: var(--cc-latin-display);
  --syj-type-section: var(--cc-latin-display);
  --syj-type-directory: var(--cc-latin-display);
  --syj-type-reading: var(--cc-latin-reading);
  --syj-type-ui: Optima, Candara, "Segoe UI Variable", "Segoe UI", sans-serif;
  --syj-directory-size: clamp(32px, calc(20px + 3vw), 52px);
}

html:lang(ja) {
  --cc-ja-reading: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", "BIZ UDPMincho", "MS PMincho", "Noto Serif SC", "Songti SC", serif;
  --cc-ja-heading: "Yu Gothic", YuGothic, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --syj-type-display: var(--cc-ja-reading);
  --syj-type-section: var(--cc-ja-heading);
  --syj-type-directory: var(--cc-ja-heading);
  --syj-type-reading: var(--cc-ja-reading);
  --syj-type-ui: var(--cc-ja-heading);
  --syj-directory-size: clamp(32px, calc(20px + 3vw), 49px);
}

:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) {
  --syj-display-size: clamp(32px, calc(18px + 2.65vw), 48px);
  --syj-section-size: 27px;
  --syj-card-size: clamp(17px, calc(15px + .4vw), 21px);
  --syj-control-size: 15px;
}

:is(html:lang(en), html:lang(es), html:lang(fr)) body {
  font-family: var(--syj-type-reading);
}

/* Keep the existing reading font for original verse and translator credits. */
:is(html:lang(en), html:lang(es), html:lang(fr)) .work-single--v2
:is(.work-single__line, .work-single__preface, .work-single__foreign-translation-content p:where(.work-single__translator-credit)) {
  font-family: var(--cc-latin-reading);
  letter-spacing: normal;
}

:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
:is(.work-single--v2 .work-single__title, .poet-hero .poet-hero__name,
    .cc-browse__hero > h1, .syj-theme-domain__intro > h1, .d21-hero__copy h1, .syj-page-hero__copy > h1) {
  font-family: var(--syj-type-display);
  font-size: var(--syj-display-size);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: .01em;
  overflow-wrap: anywhere;
}

:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) .syj-minglu .syj-theme-domain__intro > h1 {
  font-family: var(--syj-type-directory);
  font-size: var(--syj-directory-size);
}

:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
:is(.work-single--v2 .work-single__heading, .work-single--v2 .work-card__title,
    .poet-single__section .poet-single__heading, .poet-single__prose h2,
    .cc-browse__children > h2, .cc-browse__results > h2, .syj-theme-domain__heading > h2,
    .d21-heading > h2, .syj-poet-portal__heading h2, .syj-hub h2.syj-section-title,
    .cc-theme-hub h2.syj-section-title, .home-footer-renewed header h2) {
  font-family: var(--syj-type-section);
  font-size: var(--syj-section-size);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: .01em;
  overflow-wrap: anywhere;
}

:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
:is(.work-single--v2 .work-single__heading-bar, .work-single--v2 .work-card__title-bar) {
  height: .85em;
}

:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
:is(.cc-browse-card h3, .syj-theme-domain__card h3, .d21-card__body h3,
    .poet-catalog h3, .poet-catalog__feature-title, .poet-single__prose h3,
    .work-tail__poet-heading h3, .work-tail__related-body h3, .work-single__prose h3) {
  font-family: var(--syj-type-display);
  font-size: var(--syj-card-size);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: .01em;
  overflow-wrap: anywhere;
}

:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
:is(.work-single__prose, .work-single__prose :is(p, li), .work-couplet__text,
    .poet-single__prose :is(p, li), .poet-hero__intro, .cc-browse__intro, .d21-intro,
    .syj-theme-domain__intro > p) {
  font-family: var(--syj-type-reading);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: normal;
}

/* Functional UI inherits the role, with explicit controls for existing component fonts. */
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
:is(.cc-poetry-header .cc-poetry-navigation,
    .cc-poetry-header .cc-poetry-search-icon, .cc-poetry-header .cc-poetry-search :is(input, button, label),
    .cc-poetry-header .syj-language-switcher :is(summary, a), .cc-poetry-header .syj-language-switcher__label,
    .poet-single__nav, .poet-catalog__all-link, .work-single__reading-notes summary,
    .syj-minglu__modes, .syj-minglu .syj-minglu__facet :is(h2, a, button),
    .syj-minglu .syj-theme-domain__children :is(h2, a), .syj-minglu .syj-theme-domain__heading > p,
    .syj-theme-domain__pagination, .d21-nav, .d21-filter :is(label, input, select, button, a),
    .d21-pages, .cc-browse__filters :is(label, select, input, button), .cc-browse__pagination) {
  font-family: var(--syj-type-ui);
}

:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) .cc-poetry-header .cc-poetry-navigation {
  font-size: var(--syj-control-size);
  letter-spacing: .02em;
}

:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) .cc-poetry-header .cc-poetry-navigation a {
  font-weight: 500;
}

/* Shared reading identity: wordmark, breadcrumb and author metadata.
 * One literary display family + one humanist utility family; no external fonts.
 * Restrict to non-Chinese languages. The header/navigation remains reusable
 * across homepage, catalog and detail pages without changing Chinese typography. */
:is(html:lang(en), html:lang(es), html:lang(fr)) .cc-poetry-header .cc-poetry-brand {
  font-family: var(--syj-type-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .045em;
  line-height: 1.25;
}
html:lang(ja) .cc-poetry-header .cc-poetry-brand {
  font-family: var(--syj-type-section);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1.25;
}
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) .cc-poetry-header
:is(.cc-poetry-search-icon, .syj-language-switcher__label) {
  font-family: var(--syj-type-ui);
  letter-spacing: .025em;
}
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) .work-single--v2 nav.breadcrumb {
  font-family: var(--syj-type-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .045em;
  line-height: 1.65;
}
html:lang(ja) .work-single--v2 nav.breadcrumb {
  font-family: var(--syj-type-ui);
  letter-spacing: .035em;
}
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
.work-single--v2 nav.breadcrumb :is(a, span) {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
}
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
.work-single--v2 .work-single__identity-primary,
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
.work-single--v2 .work-single__identity-primary :is(.work-single__byline, .work-single__identity-era, .work-single__identity-types, a) {
  font-family: var(--syj-type-display);
}
@media (max-width: 768px) {
  :is(html:lang(en), html:lang(es), html:lang(fr)) .cc-poetry-header .cc-poetry-brand {
    font-size: clamp(15px, 4.15vw, 17px);
    letter-spacing: .035em;
  }
  html:lang(ja) .cc-poetry-header .cc-poetry-brand {
    font-size: clamp(15px, 4.15vw, 17px);
    letter-spacing: .045em;
  }
}


:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
.syj-minglu :is(.syj-minglu__facet > h2, .syj-theme-domain__children > h2) {
  font-size: var(--syj-control-size);
  font-weight: 500;
  line-height: 1.5;
  align-self: start;
  padding-block: .25em;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  :is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) {
    --syj-directory-size: clamp(32px, 5vw, 36px);
    --syj-section-size: 22px;
    --syj-control-size: 14px;
  }
}

/* The home layouts share markup while each locale keeps its assigned type roles. */
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) #home-hero-title {
  font-family: var(--syj-type-display);
  font-size: var(--syj-display-size);
  font-weight: 500;
  letter-spacing: .01em;
  line-height: 1.25;
}
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) .cc-home-portal h2.syj-section-title {
  font-family: var(--syj-type-section);
  font-size: var(--syj-section-size);
  font-weight: 500;
}
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) .cc-home-portal
:is(.cc-home-gate__title, .cc-home-v2__gallery-identity h3, .cc-home-v2__gallery-companion-copy h3, .cc-home-v2__reading-caption strong, .syj-shanhe-card__dynasty) {
  font-family: var(--syj-type-display);
  overflow-wrap: anywhere;
}
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) .cc-home-portal
:is(.cc-home-v2__gallery-identity h3, .cc-home-v2__gallery-companion-copy h3, .cc-home-v2__reading-caption strong, .syj-shanhe-card__dynasty) {
  font-size: var(--syj-card-size);
  font-weight: 500;
  letter-spacing: normal;
}
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja)) .cc-home-portal .syj-shanhe-card__dynasty {
  flex: 0 1 auto;
  min-width: 0;
}
:is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
:is(#poetry-search, .cc-home-portal .cc-home-v2__module-toolbar) {
  font-family: var(--syj-type-ui);
}

/* Very narrow mobile header: retain a single-line localized wordmark.
 * The language summary already has aria-label="Change language" and its globe
 * icon; hiding only its visible text keeps the control available. */
@media (max-width: 419px) {
  :is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
  .cc-poetry-header .syj-language-switcher__label {
    display: none;
  }
  :is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
  .cc-poetry-header__brand .cc-poetry-logo {
    width: 42px;
    height: auto;
    flex: 0 0 42px;
  }
  :is(html:lang(en), html:lang(es), html:lang(fr), html:lang(ja))
  .cc-poetry-header .cc-poetry-brand {
    white-space: nowrap;
    overflow-wrap: normal;
  }
  :is(html:lang(en), html:lang(es), html:lang(fr))
  .cc-poetry-header .cc-poetry-brand {
    font-size: 14px;
    letter-spacing: .025em;
  }
}
