/* signature / blocks.css — 區塊樣式名單 v1(2026-09-12)
 *
 * 這一份補的是 signature v1 缺的一塊:一頁由 title / chart / prose 三型區塊組成時,
 * 每一型有哪些樣式、每個樣式掛哪一條 class。名單是封閉的,見同目錄 SPEC-blocks.md。
 *
 * 規矩:本檔只吃 signature/tokens.css 的變數,不新造顏色;
 * 每一個數字都抄自已經上線的規則,來源註在該行旁邊。
 *   E = front-end/sites/economy/export/assets/export-base.css
 *   C = front-end/sites/caibias/assets/base.css
 */

/* ============ title / hero ============ */
.page-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 6rem);                        /* E:184 */
  align-items: end;
  padding: clamp(3.2rem, 8vw, 7rem) 0 clamp(2.8rem, 6vw, 5rem); /* E:186 */
}
.page-hero::after {                                    /* 頁首那條墨線,入場畫出來 */
  content: "";
  position: absolute;
  right: 0; bottom: 0; left: 0;
  height: 1px;
  background: var(--ink);
  transform-origin: left;
  animation: signature-rule-draw 1.2s var(--signature-ease) both; /* E:196 */
}
@keyframes signature-rule-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.page-hero__fig {                                      /* = block 的 fig 欄 */
  display: block;
  margin-bottom: .6rem;                                /* E:310 */
  color: var(--muted);                                 /* v1.9(SPEC §8.5 走甲):原 --faint 對 --paper 只 2.65:1、
                                                          pixel 實量 1.76–2.25(caibias eb4c8552d6c5,74 列),
                                                          而本條字級 11px 沒有 WCAG 大字豁免。--muted 是 4.82:1。
                                                          --faint 不動、留給非文字(邊框、裝飾)。 */
  font-family: var(--font-mono);
  font-size: .6875rem;                                 /* v1.4:原 .6rem = 9.6px,踩破 §8 的 11px 底線。
                                                          __fig 印的是圖號「加圖說」,圖說是主張。見 SPEC §8.1 */
  letter-spacing: .28em;                               /* E:313 */
}
.page-hero > :is(h1, h2) {                             /* = block 的 text 欄 */
  max-width: 11ch;                                     /* E:215 */
  font-family: var(--font-serif-cn);
  font-size: clamp(2.8rem, 7vw, 5.7rem);               /* E:217 */
  font-weight: 700;
  letter-spacing: .045em;                              /* E:219 */
  line-height: 1.02;                                   /* E:220 */
}
.page-hero__intro {                                    /* = block 的 intro 欄 */
  max-width: 50ch;                                     /* E:223 */
  margin: 1.25rem 0 0;                                 /* E:224 */
  color: var(--muted);
  font-family: var(--font-serif-cn);
  font-size: clamp(.94rem, 1.5vw, 1.08rem);            /* E:227 */
}
.page-hero__aside {                                    /* 殼的位置,不是 block 的欄 */
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

/* ============ title / section-head ============ */
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;                                         /* E:303 */
  align-items: end;
  margin-bottom: 1.8rem;                               /* E:305 */
}
.section-head__fig {
  display: block;
  margin-bottom: .6rem;                                /* E:310 */
  color: var(--muted);                                 /* v1.9(SPEC §8.5 走甲):原 --faint 對 --paper 只 2.65:1、
                                                          pixel 實量 1.76–2.25(caibias eb4c8552d6c5,74 列),
                                                          而本條字級 11px 沒有 WCAG 大字豁免。--muted 是 4.82:1。
                                                          --faint 不動、留給非文字(邊框、裝飾)。 */
  font-family: var(--font-mono);
  font-size: .6875rem;                                 /* v1.4:原 .6rem = 9.6px,踩破 §8 的 11px 底線。
                                                          __fig 印的是圖號「加圖說」,圖說是主張。見 SPEC §8.1 */
  letter-spacing: .28em;                               /* E:313 */
}
.section-head > :is(h2, h3) {
  font-size: clamp(1.45rem, 3vw, 2.05rem);             /* E:316 */
  letter-spacing: .02em;                               /* E:317 */
}
.section-head__intro {
  max-width: 64ch;                                     /* E:320 */
  margin: .5rem 0 0;                                   /* E:321 */
  color: var(--muted);
  font-size: .86rem;                                   /* E:323 */
}


/* ============ 兩欄頭的放置契約(v1.3) ============
 * 上面兩個頭預設都是單欄。有 __aside 的時候才切兩欄,而且切兩欄的同時必須:
 *   ① 給 __aside 明確的放置(grid-column / grid-row),不靠自動放置;
 *   ② 交出一個窄寬斷點,窄的時候塌回單欄。
 * 不這樣做的後果:三個以上直接子項時自動放置按行優先填格,標題會被擠到右欄、
 * __aside 攤在左欄——左右顛倒。兩個子項時剛好落在意圖上,所以 v1 到 v1.2 都沒抓到。
 * 斷點 760 沿用 certificate.css:161 與 demo.html:68,沒有新開數字。
 * 這一段是 design/signature 的權威修法,原樣收進(SPEC.md §7.3;量尺與量到的數在
 * design/signature/t030-兩欄頭-20260912/)。不要就地重寫——裡面避開了兩個會靜默失敗的坑:
 * grid-row: 1 / -1 不跨列;窄寬用覆寫回單欄會輸特異性,而且會讓 aside 排到標題前面。
 */
.page-hero:has(> .page-hero__aside),
.section-head:has(> .section-head__aside) { grid-template-columns: minmax(0, 1fr); }

@media (width > 760px) {
  .page-hero:has(> .page-hero__aside)  { grid-template-columns: minmax(0, 1.45fr) minmax(180px, .55fr); }
  .section-head:has(> .section-head__aside) { grid-template-columns: minmax(0, 1fr) auto; }

  .page-hero:has(> .page-hero__aside) > .page-hero__aside,
  .section-head:has(> .section-head__aside) > .section-head__aside {
    grid-column: 2; grid-row: 1 / span 1; align-self: end;
  }
  .page-hero:has(> .page-hero__aside):has(> .page-hero__fig) > .page-hero__aside,
  .page-hero:has(> .page-hero__aside):has(> .page-hero__intro) > .page-hero__aside,
  .section-head:has(> .section-head__aside):has(> .section-head__fig) > .section-head__aside,
  .section-head:has(> .section-head__aside):has(> .section-head__intro) > .section-head__aside {
    grid-row: 1 / span 2;
  }
  .page-hero:has(> .page-hero__aside):has(> .page-hero__fig):has(> .page-hero__intro) > .page-hero__aside,
  .section-head:has(> .section-head__aside):has(> .section-head__fig):has(> .section-head__intro) > .section-head__aside {
    grid-row: 1 / span 3;
  }
}

/* ============ chart / frame ============ */
.chart-frame {
  position: relative;
  min-width: 0;
  padding: .65rem .4rem .3rem;                         /* E:337 */
  border-top: 1px solid var(--ink);
}
.chart-frame::before,
.chart-frame::after {                                  /* 兩個角,像圖版的裁切標記 */
  content: "";
  position: absolute;
  top: .65rem;                                         /* E:344 */
  width: 12px; height: 12px;                           /* E:345 */
  border-top: 1px solid var(--ink);
}
.chart-frame::before { left: 0;  border-left: 1px solid var(--ink); }
.chart-frame::after  { right: 0; border-right: 1px solid var(--ink); }

.chart-frame__caption {
  max-width: 64ch;                                     /* E:320 */
  margin: .5rem 0 0;                                   /* E:321 */
  color: var(--muted);
  font-size: .86rem;                                   /* E:323 */
}

/* ============ prose / note(圖下附註與段落附註同一條規則) ============ */
.prose-note,
.chart-frame__note {
  margin: 1rem 0 0;                                    /* E:326 */
  padding-left: .8rem;                                 /* E:327 */
  border-left: 2px solid var(--hairline-strong);       /* E:328 */
  color: var(--muted);
  font-family: var(--font-serif-cn);
  font-size: .78rem;                                   /* E:331 */
}

/* ============ prose / card ============ */
.prose-card {
  padding: 1.4rem;                                     /* E:303 的 1.4rem */
  background: var(--paper-raise);
  border: 1px solid var(--hairline);
}
.prose-card__heading {
  margin: 0 0 .5rem;                                   /* E:321 */
  font-family: var(--font-serif-cn);
  font-size: 1.08rem;                                  /* E:227 clamp 的上限 */
  line-height: 1.2;
}
.prose-card > p:last-child { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  .page-hero::after { animation: none; }
}
