/* 共用元件（依 SITE_REDESIGN_SPEC §4.2） */
.btn, .button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 10px 20px; border: 1px solid transparent; border-radius: var(--radius); font: 700 var(--fs-base)/1.4 var(--font-sans); text-decoration: none; cursor: pointer; }
.btn-primary, .button-primary { background: var(--ink); color: var(--surface); }
.btn-primary:hover, .button-primary:hover { background: var(--accent); color: var(--surface); }
.btn-secondary, .button-secondary { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-secondary:hover, .button-secondary:hover { background: var(--surface-2); color: var(--ink); }

.link-arrow { color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link-arrow::after { content: " →"; }
.link-arrow[target="_blank"]::after, .link-arrow[rel~="external"]::after { content: " ↗"; }
.link-arrow:hover { color: var(--accent-dark); }

.tag { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: 700; line-height: 1.6; white-space: nowrap; }
.tag-olive { background: var(--olive-soft); color: var(--olive); }
.tag-muted { background: var(--surface-2); color: var(--ink-2); }

.card { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: var(--sp-5); color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--ink); transform: translateY(-1px); color: var(--ink); }

.callout { border-left: 3px solid var(--olive); background: var(--olive-soft); padding: var(--sp-4) var(--sp-5); border-radius: 0 var(--radius) var(--radius) 0; }
.callout-info { border-left-color: var(--olive); background: var(--olive-soft); }
.callout-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout-danger { border-left-color: var(--danger); background: var(--danger-soft); }

.prompt-block { position: relative; background: #1f2320; color: #f1efe6; border-radius: var(--radius); padding: var(--sp-5) var(--sp-5) var(--sp-4); font: var(--fs-sm)/1.7 var(--font-mono); overflow-x: auto; }
.prompt-block code { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; color: inherit; }
.prompt-block [data-copy] { position: absolute; top: 8px; right: 8px; min-height: 32px; padding: 4px 12px; border: 1px solid #6b7068; border-radius: var(--radius-sm); background: transparent; color: #f1efe6; font: 600 var(--fs-xs) var(--font-sans); cursor: pointer; }
.prompt-block [data-copy]:hover { background: #343a35; }
.prompt-block pre { margin: 0; padding-top: 18px; }

.table-scroll { overflow-x: auto; max-width: 100%; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== V2 元件（SITE_REDESIGN_SPEC_V2 §4.2） ===== */
.btn, .button { box-shadow: none; }
.btn-sm { min-height: 36px; padding: 4px 14px; font-size: var(--fs-sm); }

.page-hero { padding: var(--sp-7) 0 var(--sp-6); border-bottom: 1px solid var(--rule); }
.page-hero h1 { margin: 0 0 var(--sp-3); font: 600 clamp(1.75rem, 3.2vw, 2.5rem)/1.25 var(--font-serif); letter-spacing: -.01em; max-width: 20em; text-wrap: balance; }
.page-hero .lead { margin: 0; max-width: 40em; font-size: var(--fs-md); line-height: 1.7; color: var(--ink-2); }
.page-hero .lead code, .page-hero .hero-meta code { font: .92em var(--font-mono); background: var(--surface-2); padding: 1px 6px; border-radius: var(--radius-sm); color: var(--ink); }
.page-hero .hero-meta { margin: var(--sp-3) 0 0; font-size: var(--fs-sm); color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.page-hero .hero-meta a { color: var(--accent); }
.page-hero-actions { margin-top: var(--sp-5); display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-5); }
.eyebrow { margin: 0 0 var(--sp-2); font: 700 var(--fs-xs)/1.5 var(--font-sans); letter-spacing: .04em; color: var(--accent); }

.section { padding: var(--sp-7) 0 0; }
.section > h2 { margin: 0 0 var(--sp-5); font: 600 var(--fs-xl)/1.3 var(--font-serif); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.section > h2 small { font: 600 var(--fs-sm) var(--font-sans); color: var(--ink-2); }

.toc-chips { margin-top: var(--sp-5); display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.toc-chips a { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 14px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }
.toc-chips a:hover { background: var(--accent-soft); color: var(--accent); }

.phase-list { display: grid; gap: var(--sp-4); }
.phase > header { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.phase > header h3 { margin: 0; font: 600 var(--fs-lg)/1.35 var(--font-serif); }
.phase-num { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--olive); color: #fff; font: 700 var(--fs-sm) var(--font-mono); }
.phase-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.phase-text > :first-child { margin-top: 0; }
.phase-text p, .phase-text li { color: var(--ink-2); font-size: 15px; line-height: 1.7; }
.phase-text p { margin: 0 0 var(--sp-3); }
.phase-text ul { margin: 0 0 var(--sp-3); padding-left: 1.2em; }
.phase-text code { font: .9em var(--font-mono); background: var(--surface-2); padding: 1px 5px; border-radius: var(--radius-sm); color: var(--ink); overflow-wrap: anywhere; }
.phase-text .callout { margin-bottom: var(--sp-3); }
.phase-text .callout p:last-child { margin-bottom: 0; }
.phase .prompt-block { margin: 0; padding: var(--sp-4) var(--sp-5); }
.phase .prompt-block pre { padding-top: 0; white-space: pre-wrap; overflow-wrap: break-word; }
.phase .prompt-block code { overflow-wrap: break-word; }
@media (max-width: 820px) { .phase-body { grid-template-columns: 1fr; } }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
.stat { border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); padding: var(--sp-4) var(--sp-5); }
.stat .stat-num { font: 600 var(--fs-2xl)/1.1 var(--font-serif); color: var(--ink); }
.stat .stat-num small { font: 600 var(--fs-sm) var(--font-sans); color: var(--ink-2); margin-left: 4px; }
.stat .stat-label { margin: 6px 0 2px; font-weight: 700; font-size: var(--fs-sm); }
.stat .stat-sub { margin: 0; font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.5; }
@media (max-width: 820px) { .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.tabs { display: flex; gap: var(--sp-5); border-bottom: 1px solid var(--rule); margin: 0; padding: 0; list-style: none; }
.tabs > * { flex: none; padding: 10px 2px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--ink-2); font: 600 var(--fs-sm)/1.4 var(--font-sans); cursor: pointer; white-space: nowrap; text-decoration: none; min-height: 44px; }
.tabs > *:hover { color: var(--ink); }
.tabs > [aria-selected="true"], .tabs > .active, .tabs > [aria-current="true"] { color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 640px) {
  .tabs { overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; gap: var(--sp-4); padding-right: 24px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs > * { scroll-snap-align: center; }
}

.scroll-x { overflow-x: auto; max-width: 100%; }
.scroll-hint { display: none; margin: 0 0 6px; font-size: var(--fs-xs); color: var(--ink-2); }
@media (max-width: 820px) { .scroll-hint { display: block; } }
.wk-crumbs { margin: 0 0 24px; color: var(--ink-2); font-size: var(--fs-sm); }
.wk-crumbs a { color: var(--ink-2); }


/* ===== 水墨版元件調整 ===== */
.btn, .button { letter-spacing: .12em; border-radius: var(--radius); }
.btn-primary, .button-primary { background: var(--seal); color: #fff8ec; }
.btn-primary:hover, .button-primary:hover { background: var(--ink); color: var(--paper); }
html[data-theme="night"] .btn-primary:hover, html[data-theme="night"] .button-primary:hover { background: var(--gold); color: #14110f; }
.btn-secondary, .button-secondary { border-color: var(--ink); color: var(--ink); }
.link-arrow { text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; font-weight: 600; letter-spacing: .06em; }
.card { background: transparent; border-color: var(--rule); }
a.card:hover { border-color: var(--ink); background: var(--surface); }
.tag { background: var(--surface-2); color: var(--ink); letter-spacing: .06em; }
.tag-olive { background: transparent; color: var(--gold); border: 1px solid var(--gold); }
.callout, .callout-info { border-left-color: var(--gold); background: var(--surface-2); }
.eyebrow { color: var(--gold); letter-spacing: .4em; font-family: var(--font-serif); font-weight: 500; }
.page-hero { border-bottom-color: var(--rule); }
.page-hero h1 { font-weight: 500; letter-spacing: .06em; }
.section > h2 { font-weight: 500; }
.phase-num { background: transparent; color: var(--seal); border: 1.5px solid var(--seal); border-radius: var(--radius); font-family: var(--font-serif); }
html[data-theme="night"] .phase-num { color: var(--gold); border-color: var(--gold); }
.toc-chips a { background: transparent; border: 1px solid var(--rule); letter-spacing: .06em; }
.toc-chips a:hover { background: transparent; border-color: var(--ink); color: var(--ink); }
.stat { background: transparent; }
.stat .stat-num { font-weight: 500; }

/* 直排側標（首頁與影片頁的區塊標題） */
.side-title { margin: 6px 0 0; writing-mode: vertical-rl; font: 500 26px/1.2 var(--font-serif); letter-spacing: .5em; white-space: nowrap; }
.side-note { margin: 6px 0 0; writing-mode: vertical-rl; font: 14px/1.2 var(--font-serif); letter-spacing: .5em; color: var(--gold); border-right: 1px solid var(--rule); padding-right: 20px; white-space: nowrap; }
.side-grid { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 48px; }
@media (max-width: 720px) { .side-grid { grid-template-columns: 28px minmax(0, 1fr); gap: 20px; } .side-title { font-size: 20px; } }
