/* /ziwei/… learning pages. Loaded AFTER /site/about.css, which supplies the
   colour and type tokens (Tiffany + coral, five sizes), the header, footer,
   buttons and the 命盤 (.ring). This file is the article layout only. Same
   house style as the home page: square corners, surfaces told apart by flat
   tone, never by a line or a shadow. System fonts only, mobile first. */

body.kb { background: var(--bg); }

/* 免費排盤 in the header on every width: the learning pages have no form. */
.head-start {
  white-space: nowrap; text-decoration: none; background: var(--accent-deep); color: #fff !important; font-weight: 700;
  min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center;
  transition: background-color .2s, transform .15s var(--ease);
}
.head-start:hover { background: var(--accent-ink); transform: translateY(-1px); }
@media (max-width: 400px) { .kb .head-cta { display: none; } }

/* Section tabs under the header */
.subnav { background: var(--band); }
.subnav .wrap { display: flex; gap: 4px; overflow-x: auto; white-space: nowrap; padding-top: 0; padding-bottom: 0; scrollbar-width: none; }
.subnav a { text-decoration: none; color: var(--body); padding: 12px 14px; font-size: var(--s-small); font-weight: 500; transition: background-color .2s; }
.subnav a:hover { background: var(--accent-soft); }
.subnav a[aria-current="page"] { background: var(--accent-deep); color: #fff; font-weight: 700; }

/* Article column */
.lwrap { max-width: 860px; margin: 0 auto; padding: 32px 20px 80px; display: flex; flex-direction: column; gap: 56px; }
.lwrap.wide { max-width: 1180px; }
.lhead { display: flex; flex-direction: column; gap: 16px; }
.lhead h1 { font-size: clamp(34px, 10vw, 56px); line-height: 1.2; font-weight: 800; letter-spacing: -.005em; }
.lhead h1.long { font-size: clamp(22px, 6vw, 56px); }
.h1-note { color: var(--accent-deep); font-weight: 700; }
.crumbs { font-size: var(--s-small); color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs a { color: var(--muted); }
.byline { font-size: var(--s-small); color: var(--muted); }
.kicker-line { color: var(--accent-deep); font-weight: 700; }

/* The one-line answer: what an answer engine (and a hurried reader) takes away */
.answer { background: var(--accent-soft); padding: 22px 22px 24px; display: flex; flex-direction: column; gap: 8px; }
.answer strong { font-size: var(--s-small); color: var(--accent-deep); }
.answer p { line-height: 1.8; color: var(--text); }
@media (min-width: 720px) { .answer p { font-size: var(--s-lead); line-height: 1.7; } }

/* The engine's chart, on a Tiffany field */
.chart-fig { background: var(--accent); padding: 16px 12px 14px; display: flex; flex-direction: column; gap: 12px; margin: 8px -20px 0; }
.chart-fig figcaption { font-size: var(--s-small); line-height: 1.6; color: var(--accent-ink); padding: 0 4px; }
.chart-fig .ring-mid { color: var(--accent-ink); }
.chart-fig .ring-mid strong { font-size: var(--s-text); font-weight: 800; line-height: 1.4; }
.chart-fig .ring-mid span { font-size: var(--s-small); line-height: 1.55; }

.lsec { display: flex; flex-direction: column; gap: 16px; }
.lsec > h2 { font-size: clamp(24px, 1rem + 2vw, 40px); line-height: 1.3; font-weight: 800; }
.lsec > p { line-height: 1.85; color: var(--body); }
.lsec a { color: var(--accent-deep); }
.note { font-size: var(--s-text) !important; }
.fine { font-size: var(--s-small); line-height: 1.8; color: var(--muted); }

/* Tiles (入門, 延伸閱讀) */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px; }
.tile { text-decoration: none; padding: 24px; display: flex; flex-direction: column; gap: 8px; color: var(--text) !important; background: var(--band); transition: background-color .2s, transform .15s var(--ease); }
.tile:hover { background: var(--accent-soft); transform: translateY(-2px); }
.tile strong { font-size: var(--s-lead); line-height: 1.4; }
.tile span { line-height: 1.75; color: var(--body); }
.tile .tile-tag { font-size: var(--s-small); font-weight: 700; color: var(--accent-deep); }
.tile .more { margin-top: auto; font-weight: 700; color: var(--accent-deep); }

/* Steps: a real list; order is said by the number in the text column */
.steps-list { padding: 0; margin: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.steps-list li { display: flex; gap: 16px; padding: 16px 18px; background: var(--band); line-height: 1.8; color: var(--body); }
.steps-list .num { flex: none; width: 1.2em; font-weight: 800; color: var(--accent-deep); }
.steps-list strong { color: var(--text); margin-right: 4px; }

/* FAQ */
.faq { display: flex; flex-direction: column; gap: 6px; }
.faq > div, .faq > section { background: var(--band); padding: 20px 22px; }
.faq h3 { font-size: var(--s-text); font-weight: 800; margin-bottom: 6px; }
.faq p { line-height: 1.85; color: var(--body); }

/* Call to action */
.cta-box { background: var(--accent); padding: 32px 24px; }
.cta-box > h2 { color: var(--accent-ink); }
.cta-box > p { color: var(--accent-ink); }
.cta-box .btn-primary { align-self: flex-start; color: #fff !important; text-decoration: none; }

/* Star hub cards: the star's own character on a small Tiffany square */
.star-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.star-card { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--text) !important; padding: 14px; background: var(--band); transition: background-color .2s, transform .15s var(--ease); }
.star-card:hover { background: var(--accent-soft); transform: translateY(-2px); }
.star-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.star-text strong { font-size: var(--s-lead); line-height: 1.3; }
.star-title { font-size: var(--s-small); font-weight: 700; color: var(--accent-deep); }
.star-kw { font-size: var(--s-small); color: var(--muted); }
.glyph { flex: none; width: 56px; height: 56px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; }

/* Star page */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px; }
.trait { padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.trait strong { font-size: var(--s-lead); }
.trait ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.7; color: var(--body); }
.trait.good { background: var(--accent-soft); }
.trait.good strong { color: var(--accent-deep); }
.trait.watch { background: var(--pop-soft); }
.trait.watch strong { color: var(--pop-ink); }
.combo-list { display: flex; flex-direction: column; gap: 4px; }
.combo { display: grid; grid-template-columns: minmax(96px, 140px) minmax(72px, 110px) minmax(0, 1fr); gap: 12px; padding: 14px 16px; background: var(--band); line-height: 1.7; color: var(--body); align-items: baseline; }
.combo strong { color: var(--text); }
.combo .where { font-size: var(--s-small); font-weight: 700; color: var(--accent-deep); }
.hua-row { display: flex; flex-wrap: wrap; gap: 6px; }
.hua { display: inline-flex; gap: 8px; align-items: baseline; padding: 8px 14px; background: var(--accent-soft); color: var(--accent-deep); font-size: var(--s-small); font-weight: 700; }
.hua.ji { background: var(--pop-soft); color: var(--pop-ink); }
.prevnext { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.prevnext a { color: var(--accent-deep); font-weight: 700; text-decoration: none; background: var(--band); padding: 14px 18px; transition: background-color .2s; }
.prevnext a:hover { background: var(--accent-soft); }

/* Tables: real tables, rows told apart by tone */
.table-wrap { overflow-x: auto; }
.ltable { width: 100%; border-collapse: collapse; line-height: 1.7; }
.ltable caption { caption-side: bottom; text-align: left; padding: 12px 0; font-size: var(--s-small); color: var(--muted); }
.ltable thead th { background: var(--accent-ink); color: #fff; }
.ltable th, .ltable td { text-align: left; padding: 12px 14px; vertical-align: top; }
.ltable tbody tr:nth-child(odd) { background: var(--band); }
.ltable tbody th { font-weight: 700; white-space: nowrap; }
.ltable .alias { display: block; font-size: var(--s-small); font-weight: 500; color: var(--muted); }
.sihua-table td.ji, .sihua-table td.ji a { color: var(--pop-ink); font-weight: 700; }
/* Five two-character columns fit a phone: no side scroll (taste review 2026-11-14). */
.sihua-table th, .sihua-table td { padding: 10px 8px; }

/* 四化 guide */
.toc { display: flex; flex-direction: column; gap: 2px; background: var(--band); padding: 18px 20px; }
.toc strong { font-size: var(--s-small); margin-bottom: 4px; }
.toc a { color: var(--accent-deep); text-decoration: none; padding: 4px 0; font-weight: 500; }
.toc a:hover { text-decoration: underline; }
.hua-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px; }
.hua-card { padding: 22px; display: flex; flex-direction: column; gap: 6px; background: var(--accent-soft); line-height: 1.75; color: var(--body); }
.hua-card strong { font-size: clamp(24px, 1rem + 2vw, 40px); line-height: 1.2; color: var(--accent-ink); }
.hua-card .kw { font-size: var(--s-small); font-weight: 700; color: var(--accent-deep); }
.hua-card.ji { background: var(--pop); }
.hua-card.ji strong, .hua-card.ji .kw, .hua-card.ji { color: #2a0e06; }
.plain-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.85; color: var(--body); }

/* Glossary */
.term-cats { display: flex; flex-wrap: wrap; gap: 4px; }
.term-cats a { text-decoration: none; font-size: var(--s-small); font-weight: 700; color: var(--accent-deep); background: var(--accent-soft); padding: 10px 14px; transition: background-color .2s; }
.term-cats a:hover { background: var(--accent); color: var(--accent-ink); }
.terms { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.terms > div { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 16px 18px; background: var(--band); }
.terms dt { font-weight: 800; font-size: var(--s-lead); line-height: 1.4; }
.terms .aka { margin-left: 8px; font-size: var(--s-small); font-weight: 500; color: var(--muted); }
.terms dd { margin: 0; line-height: 1.85; color: var(--body); }
.terms dd a { color: var(--accent-deep); font-weight: 700; white-space: nowrap; }
.lsec[id], .lsec [id] { scroll-margin-top: 90px; }

/* Motion: parts rise as they enter (scroll-driven: no script, and nothing
   hidden where it is not supported); the chart's palaces come in round the ring. */
@media (prefers-reduced-motion: no-preference) {
  .chart-fig .cell { animation: cell-in .5s var(--ease) calc(var(--i, 0) * 90ms) both; }
  .chart-fig .cell::after { animation: walk 8s ease-in-out calc(1.6s + var(--i, 0) * 240ms) infinite; }
  .chart-fig .cell.sf { animation: cell-in .5s var(--ease) calc(var(--i, 0) * 90ms) both, breathe 6s ease-in-out 1.8s infinite; }
  .lhead > * { animation: rise .6s var(--ease) both; }
  .lhead > :nth-child(2) { animation-delay: .06s; }
  .lhead > :nth-child(3) { animation-delay: .12s; }
  .lhead > :nth-child(n+4) { animation-delay: .18s; }
  @supports (animation-timeline: view()) {
    .lsec > *, .tiles > *, .star-grid > *, .steps-list li, .combo, .terms > div, .hua-cards > *, .two-col > *, .faq > * {
      animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 55%;
    }
  }
}

@media (min-width: 720px) {
  .lwrap { padding: 56px 32px 112px; gap: 80px; }
  .lhead h1, .lhead h1.long { font-size: clamp(36px, 5vw, 48px); }
  .lhead h1:not(.long) { font-size: clamp(44px, 6vw, 64px); }
  .chart-fig { margin: 8px 0 0; padding: 28px; }
  .chart-fig .ring { grid-auto-rows: minmax(104px, auto); }
  .chart-fig .cell .st.major { font-size: var(--s-text); }
  .chart-fig .ring-mid { padding: 24px; }
  .chart-fig .ring-mid strong { font-size: var(--s-lead); }
  .chart-fig .ring-mid span { font-size: var(--s-text); }
  .terms > div { grid-template-columns: 200px minmax(0, 1fr); gap: 20px; padding: 18px 22px; }
  .cta-box { padding: 48px; }
}
@media (max-width: 520px) {
  .combo { grid-template-columns: 1fr; gap: 2px; }
}

/* SEO round 1 (2026-11-23): diagrams, star-in-palace lists, the 2027 jump table. */
.svg-fig { margin: 20px 0 0; }
.svg-fig svg { display: block; width: 100%; max-width: 520px; height: auto; }
.svg-fig figcaption { margin-top: 8px; font-size: var(--s-small); color: var(--faint); }
.in-palaces dt a { font-weight: 700; }
.bright-table td, .bright-table th { text-align: center; padding-inline: 4px; }
.jump-table td { text-align: center; }
.lede-more { margin-top: 14px; }

/* ── Follow bar (site/buybar.js; only /ziwei/2027 for now) ─────────────
   Docked to the bottom, on screen from the moment the page opens, and
   stepping aside for the closing CTA box and the footer. */
.buybar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: var(--accent-ink); color: #fff; border-top: 1px solid rgba(127,205,205,.3); padding-bottom: env(safe-area-inset-bottom); transform: translateY(0); visibility: visible; transition: transform .24s var(--ease), visibility 0s; }
.buybar[data-state="hidden"] { transform: translateY(100%); visibility: hidden; transition: transform .24s var(--ease), visibility 0s .24s; }
.buybar-in { max-width: 860px; margin: 0 auto; padding: 10px 16px; min-height: 64px; display: flex; align-items: center; gap: 10px; }
.buybar :focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.buybar-dot, .buybar-pitch { display: none; }
.buybar-price { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.buybar-row { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.buybar-row, .buybar-left { max-width: 100%; overflow: hidden; }
.buybar.is-tight-row .buybar-was, .buybar.is-tight-left .buybar-more { display: none; }
.buybar-now { font-size: 19px; font-weight: 800; letter-spacing: .01em; color: #ffa48c; }
.buybar-was { font-size: 13px; color: rgba(255,255,255,.62); }
.buybar-left { font-size: 13px; color: rgba(255,255,255,.86); white-space: nowrap; }
.buybar-left b { color: #fff; font-weight: 800; }
.buybar-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 14px; white-space: nowrap; background: var(--accent); color: var(--accent-ink) !important; text-decoration: none; font-size: 16px; font-weight: 800; letter-spacing: .02em; transition: background-color .2s, transform .15s var(--ease); }
.buybar-btn svg { display: none; width: 16px; height: 16px; flex: none; transition: transform .2s var(--ease); }
.buybar-btn:hover { background: #a3dcdc; transform: translateY(-2px); }
.buybar-btn:hover svg { transform: translateX(4px); }
.buybar-btn:active { transform: translateY(0) scale(.98); }
.buybar-x { flex: none; width: 44px; height: 44px; margin-right: -10px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; cursor: pointer; color: rgba(255,255,255,.7); transition: background-color .2s, color .2s; }
.buybar-x svg { width: 16px; height: 16px; }
.buybar-x:hover { color: #fff; background: rgba(255,255,255,.1); }
.buybar-x:active { background: rgba(255,255,255,.16); }
@media (max-width: 374px) { .buybar-in { padding-left: 14px; padding-right: 14px; } .buybar-btn { padding: 0 12px; font-size: 15px; } }
@media (min-width: 720px) {
  .buybar-in { gap: 20px; padding-left: 32px; padding-right: 32px; min-height: 72px; }
  .buybar-btn { padding: 0 18px; }
  .buybar-btn svg { display: block; }
  .buybar-dot { display: block; width: 12px; height: 12px; border: 3px solid var(--accent); flex: none; }
  .buybar-pitch { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.4; }
  .buybar-title { font-size: 17px; font-weight: 800; color: #fff; }
  .buybar-sub { display: none; font-size: 14px; color: rgba(255,255,255,.74); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .buybar-price { flex: none; align-items: flex-end; text-align: right; }
  .buybar .buybar-left.buybar-reg { display: none; }
}
@media (min-width: 1024px) { .buybar-sub { display: block; } }
@media (prefers-reduced-motion: reduce) {
  .buybar, .buybar[data-state="hidden"] { transition: none; }
  .buybar-btn, .buybar-btn svg { transition: background-color .2s; }
  .buybar-btn:hover, .buybar-btn:hover svg, .buybar-btn:active { transform: none; }
  .buybar-btn:active { background: #6cc0c0; }
}
@media print { .buybar { display: none !important; } }
