/* 全站共用字級。閱讀層級一致，表格與輔助文字保留各自的密度。 */
:root {
  --type-title: 3rem;
  --type-section: 2.25rem;
  --type-card: 1.25rem;
  --type-body: 1rem;
  --type-table: .9375rem;
  --type-small: .875rem;
  --leading-title: 1.3;
  --leading-section: 1.4;
  --leading-card: 1.5;
  --leading-body: 1.8;
}
@media (max-width: 1000px) {
  :root { --type-title: 2.5rem; --type-section: 2rem; }
}
@media (max-width: 600px) {
  :root { --type-title: 2rem; --type-section: 1.75rem; --type-card: 1.125rem; }
}

/* 首頁既有行內字級直接引用變數，避免用高優先權規則蓋掉。 */
.type-ccap main,
.type-assessment main { font-size: var(--type-body); line-height: var(--leading-body); }
.type-ccap .hero h1,
.type-assessment main h1 { font-size: var(--type-title); line-height: var(--leading-title); }
.type-ccap .section h2,
.type-assessment main h2 { font-size: var(--type-section); line-height: var(--leading-section); }
.type-ccap .section h3,
.type-ccap .ccap-report-heading h2,
.type-assessment .product-details h3,
.type-assessment .use-cases-grid h3,
.type-assessment .form-panel-title,
.type-assessment .product-name { font-size: var(--type-card); line-height: var(--leading-card); }

.type-ccap .hero-copy,
.type-ccap .about-copy,
.type-ccap .lead,
.type-ccap #practice .statement,
.type-assessment .intro p,
.type-assessment .use-cases-grid p,
.type-assessment input,
.type-assessment select,
.type-assessment textarea { font-size: var(--type-body); line-height: var(--leading-body); }

.type-ccap .note,
.type-ccap .chip,
.type-ccap .breadcrumb,
.type-assessment .breadcrumb,
.type-assessment .product-sub,
.type-assessment .product-details article p,
.type-assessment .contact { font-size: var(--type-small); }

.type-assessment table,
.type-assessment .choice { font-size: var(--type-table); line-height: 1.65; }
/* 比較表維持欄寬，較窄的產品卡片允許名稱自然換行。 */
.type-assessment .product-details h3 { white-space: normal; }

/* 內頁共用標題與正文比例。以頁面標記限定適用範圍，保留各頁既有版型。 */
body[data-site-type] {
  font-size: var(--type-body);
  line-height: var(--leading-body);
}

/* 首頁與 CDA 的 x-dc 也包住頁尾，因此只對內容區套用標題尺度。 */
body[data-site-type] :is(main, x-dc section) h1 {
  font-size: var(--type-title);
  line-height: var(--leading-title);
}

body[data-site-type] :is(main, x-dc section) h2 {
  font-size: var(--type-section);
  line-height: var(--leading-section);
}

body[data-site-type] :is(main, x-dc section) h3,
body[data-site-type] :is(.ws-report-heading, .report-dialog__heading) h2 {
  font-size: var(--type-card);
  line-height: var(--leading-card);
}

body[data-site-type] :is(.hero-copy, .about-copy, .lead, .framework-copy p, .summary, .hero-intro > p:last-child, .cda-role__lead, .cda-audience__copy),
body[data-site-type] #practice .statement {
  font-size: var(--type-body);
  line-height: var(--leading-body);
}

body[data-site-type] :is(.breadcrumb, .chip, .note, .small, figcaption) {
  font-size: var(--type-small);
}

body[data-site-type] table {
  font-size: var(--type-table);
  line-height: 1.65;
}

/* 並排卡片共用列高，讓同一項說明對齊，單欄時維持自然段落間距。 */
@supports (grid-template-rows: subgrid) {
  @media (min-width: 801px) {
    .type-assessment .use-cases-grid > article {
      display: grid;
      grid-row: span 3;
      grid-template-rows: subgrid;
      row-gap: 12px;
      align-items: start;
    }

    .type-assessment .use-cases-grid > article > :is(h3, p) {
      margin: 0;
    }
  }

  body[data-site-type] .product-info-grid > section {
    display: grid;
    grid-row: span 2;
    grid-template-rows: subgrid;
    row-gap: 6px;
    align-items: start;
  }

  body[data-site-type] .product-info-grid > section > :is(h3, p) {
    margin: 0;
  }
}

/* 沿用已確認的字級，統一字型備援與主要區塊的垂直留白。 */
:root {
  --font-body: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-heading: "Noto Serif TC", "PMingLiU", serif;
  --space-section: clamp(36px, 5vw, 56px);
  --space-hero: clamp(40px, 5.5vw, 64px);
  --space-heading: clamp(16px, 2vw, 24px);
}

body:has(main, x-dc),
main :is(button, input, select, textarea) {
  font-family: var(--font-body);
}

body :is(main, x-dc section) :is(h1, h2) {
  font-family: var(--font-heading);
}

body :is(main, x-dc section) h3 {
  font-family: var(--font-body);
}

main > section:is(.section, .measurement-band) {
  padding-block: var(--space-section);
}

/* 測評明細的底色包住內層區塊，留白只套用一次。 */
main > .measurement-band > .section {
  padding-block: 0;
}

main > section.hero[aria-labelledby] {
  padding-block: var(--space-hero);
}

main > section > h2,
main > section > .wrap > h2 {
  margin-block-end: var(--space-heading);
}

main > .applications > .section,
.type-assessment main > :is(.product-details, .use-cases, .inquiry),
.type-cfy main > section:not(.hero) {
  padding-block: var(--space-section);
}

/* CFY 的說明、課綱與常見問題使用正文比例，短標籤保留輔助字級。 */
.type-cfy main :is(.service p, .hero-level p, .syllabus details p, .entry, .wiley-points li, .route-body p, .route-entry, .assessment-note, .schedule-card dl div, .faq details p) {
  font-size: var(--type-body);
  line-height: var(--leading-body);
}

.type-cfy main :is(.crumb, .eyebrow, .pill, .slot, .tags span, .hero-note, .page-nav a, .footnote, .program-en, .day, .facets small, .tool-meta, .step) {
  font-size: var(--type-small);
}

.type-cfy main .hero-statement {
  font-size: var(--type-card);
  line-height: var(--leading-card);
}
