/* ============================================================
   Queen-Memo 文章頁共用元件樣式 — article-components.css
   theory-box / stat-card / scrolly / pull-quote / factor /
   formula / conclusion / compare-table / caveat / footer 等。
   依賴 article-base.css 的 tokens（含 --theme）。
   ============================================================ */

/* ── Theory Box ── */
.theory-box {
  background: var(--glass-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border); border-radius: 10px;
  padding: 24px 28px; margin: 32px 0;
  position: relative; overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.theory-box::before {
  content: ''; position: absolute;
  top: 0; left: 0; bottom: 0; width: 3px;
  border-radius: 10px 0 0 10px;
  background: var(--theme);
}
.theory-box.red-border::before { background: var(--red); }
.theory-box.teal-border::before { background: var(--teal); }
.theory-box.purple-border::before { background: var(--purple); }
.theory-box.accent-border::before { background: var(--accent); }
.theory-box.blue-border::before { background: var(--blue); }
.theory-box:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
.theory-box-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--purple); margin-bottom: 8px;
}
.theory-box-label.red { color: var(--red); }
.theory-box-label.teal { color: var(--teal); }
.theory-box-label.accent { color: var(--theme); }
.theory-box-label.purple { color: var(--purple); }
.theory-box-label.blue { color: var(--blue); }
.theory-box p { font-size: 14px; color: var(--text-dim); line-height: 1.7; margin-bottom: 8px; }
.theory-box .attr { font-size: 12px; color: var(--text-muted); }

/* ── Stat Card Grid ── */
.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; max-width: 640px; margin: 0 auto;
}
.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 28px 20px; text-align: center;
  position: relative; overflow: hidden;
  transition: var(--transition-lift);
}
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  border-radius: 12px 12px 0 0;
  background: var(--theme); opacity: 0.5;
  transition: opacity 0.3s;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(255, 255, 255, 0.1);
}
.stat-card:hover::before { opacity: 1; }
.stat-card.red-top::before { background: var(--red); }
.stat-card.teal-top::before { background: var(--teal); }
.stat-card.accent-top::before { background: var(--accent); }
.stat-card.purple-top::before { background: var(--purple); }
.stat-card.blue-top::before { background: var(--blue); }
.stat-card-num {
  font-size: 48px; font-weight: 900; line-height: 1; margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.stat-card-num.red { color: var(--red); }
.stat-card-num.accent { color: var(--theme); }
.stat-card-num.teal { color: var(--teal); }
.stat-card-num.purple { color: var(--purple); }
.stat-card-num.blue { color: var(--blue); }
.stat-card-label { font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.stat-card-sub { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ── Scrollytelling ── */
.scrolly {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
}
.scrolly-graphic {
  position: sticky; top: 0; height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.scrolly-steps { padding: 40vh 40px 40vh; }
.scrolly-step {
  min-height: 60vh;
  display: flex; align-items: center;
  padding: 40px 0;
  opacity: 0.2; transition: opacity 0.5s;
}
.scrolly-step.active { opacity: 1; }
.step-content { max-width: 400px; }
.step-num {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; color: var(--theme);
  text-transform: uppercase; margin-bottom: 12px;
}
.step-title {
  font-size: 24px; font-weight: 800;
  line-height: 1.3; margin-bottom: 12px; letter-spacing: -0.01em;
}
.step-desc { font-size: 15px; color: var(--text-dim); line-height: 1.7; }
.step-highlight {
  display: inline-block; padding: 4px 12px;
  border-radius: 4px; font-size: 13px; font-weight: 700; margin-top: 12px;
}
.step-highlight.teal { background: var(--teal-dim); color: var(--teal); }
.step-highlight.red { background: var(--red-dim); color: var(--red); }
.step-highlight.accent { background: var(--accent-dim); color: var(--accent); }
.step-highlight.purple { background: var(--purple-dim); color: var(--purple); }
.step-highlight.blue { background: var(--blue-dim); color: var(--blue); }

/* ── Scrolly Progress Dots ── */
.scrolly-progress {
  position: fixed; right: 24px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 12px;
  z-index: 100; opacity: 0; transition: opacity 0.4s;
}
.scrolly-progress.visible { opacity: 1; }
.scrolly-progress-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rule); border: 1.5px solid var(--text-muted);
  transition: all 0.3s; cursor: pointer; padding: 0;
}
.scrolly-progress-dot.active {
  background: var(--theme); border-color: var(--theme);
  transform: scale(1.4);
  box-shadow: 0 0 8px color-mix(in srgb, var(--theme) 40%, transparent);
}

/* ── Pull Quote ── */
.pull-quote {
  margin: 48px 0; padding: 32px 0 32px 28px;
  border-left: 2px solid var(--theme);
}
.pull-quote-text {
  font-size: clamp(18px, 2.5vw, 24px); font-weight: 700;
  line-height: 1.6; color: var(--text);
}
.pull-quote-text em { font-style: normal; color: var(--theme); }
.pull-quote-attr { font-size: 13px; color: var(--text-muted); margin-top: 12px; }

/* ── Section Divider ── */
.section-divider {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 24px 0; opacity: 0.25;
}
.section-divider::before, .section-divider::after {
  content: ''; width: 40px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule), transparent);
}
.section-divider-dot {
  width: 4px; height: 4px; border-radius: 50%; background: var(--theme);
}

/* ── Factor Block ── */
.factor-block {
  padding: 48px 0 48px 32px;
  border-bottom: none; border-left: 2px solid var(--rule);
  position: relative; margin-left: 8px;
  transition: border-color 0.4s;
}
.factor-block::before {
  content: ''; position: absolute;
  left: -5px; top: 56px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--theme); opacity: 0.4;
  transition: opacity 0.3s, transform 0.3s;
}
.factor-block.active { border-color: var(--theme); }
.factor-block.active::before { opacity: 1; transform: scale(1.3); }
.factor-num {
  font-size: clamp(60px, 10vw, 100px); font-weight: 900;
  color: var(--theme); line-height: 1; margin-bottom: 16px; opacity: 0.3;
}
.factor-title {
  font-size: clamp(22px, 3.5vw, 32px); font-weight: 800;
  margin-bottom: 12px; letter-spacing: -0.01em;
}
.factor-desc {
  font-size: 16px; color: var(--text-dim); line-height: 1.8;
  max-width: 580px; margin-bottom: 16px;
}
.factor-data { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.factor-pill {
  padding: 5px 14px; border-radius: 6px; font-size: 13px; font-weight: 700;
}
.factor-pill.teal { background: var(--teal-dim); color: var(--teal); }
.factor-pill.red { background: var(--red-dim); color: var(--red); }
.factor-pill.accent { background: var(--accent-dim); color: var(--accent); }
.factor-pill.purple { background: var(--purple-dim); color: var(--purple); }
.factor-pill.blue { background: var(--blue-dim); color: var(--blue); }
.factor-pill.dpp { background: rgba(0, 200, 112, 0.14); color: var(--dpp); }
.factor-pill.kmt { background: rgba(75, 158, 255, 0.14); color: var(--kmt); }
.factor-pill.tpp { background: rgba(0, 196, 204, 0.14); color: var(--tpp); }

/* ── Compare Table ── */
.compare-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 14px; margin: 40px 0;
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--rule);
}
.compare-table th {
  text-align: left; padding: 14px 16px;
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--rule);
  font-weight: 700; font-size: 13px; color: var(--text-dim);
}
.compare-table td {
  padding: 14px 16px; border-bottom: 1px solid rgba(42, 42, 42, 0.5);
  color: var(--text-dim); vertical-align: top; line-height: 1.5;
  transition: background 0.2s;
}
.compare-table td:first-child { font-weight: 700; color: var(--text); white-space: nowrap; }
.compare-table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.compare-table tr:last-child td { border-bottom: none; }

/* ── Formula Section ── */
.formula-section {
  min-height: 70vh;
  display: flex; align-items: center; justify-content: center;
  padding: 80px 24px; text-align: center;
}
.formula-eq {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; flex-wrap: wrap;
}
.formula-box {
  background: var(--glass-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 10px; padding: 24px 28px;
  text-align: center; min-width: 160px;
  transition: transform 0.3s, box-shadow 0.3s;
}
.formula-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.formula-box-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px;
}
.formula-box-text { font-size: 14px; font-weight: 700; line-height: 1.5; }
.formula-op { font-size: 28px; color: var(--text-muted); font-weight: 300; }

/* ── Conclusion ── */
.conclusion-section {
  min-height: 80vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 80px 24px;
  position: relative;
}
.conclusion-section::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 50%, color-mix(in srgb, var(--theme) 6%, transparent) 0%, transparent 70%);
  pointer-events: none;
}
.concl-eq {
  font-size: clamp(18px, 3.5vw, 28px); font-weight: 800;
  line-height: 1.7; max-width: 620px; margin: 0 auto 48px;
}
.concl-eq em { font-style: normal; }
.concl-eq .c-teal { color: var(--teal); }
.concl-eq .c-red { color: var(--red); }
.concl-eq .c-accent { color: var(--theme); }
.concl-eq .c-purple { color: var(--purple); }
.concl-eq .c-blue { color: var(--blue); }

/* ── Caveat Box ── */
.caveat-box {
  background: var(--bg-card); border: 1px solid var(--rule);
  border-left: 3px solid var(--text-muted); border-radius: 8px;
  padding: 28px 32px;
}
.caveat-title { font-size: 16px; font-weight: 800; color: var(--text-muted); margin-bottom: 16px; }
.caveat-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.caveat-list li {
  font-size: 14px; color: var(--text-muted); line-height: 1.7;
  padding-left: 20px; position: relative;
}
.caveat-list li::before { content: '※'; position: absolute; left: 0; font-size: 12px; }

/* ── Source Note & Footer ── */
.source-note {
  font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--rule); padding-top: 20px;
  margin-top: 40px; line-height: 1.8;
}
.pudding-footer {
  padding: 48px 24px; text-align: center;
  font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--rule);
  line-height: 1.8;
}

/* ── Screen Reader Only ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── 元件響應式 ── */
@media (max-width: 768px) {
  .scrolly { display: block; position: relative; }
  .scrolly-graphic {
    position: sticky; top: 0;
    height: 40vh; height: 40dvh;
    z-index: 10; padding: 16px;
    border-bottom: 1px solid var(--glass-border);
  }
  .scrolly-graphic svg { max-width: 320px; }
  .scrolly-steps { padding: 20px 20px 30vh; position: relative; z-index: 20; }
  .scrolly-step { min-height: 50vh; padding: 20px 0; }
  .step-content {
    background: rgba(15, 15, 15, 0.88);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: var(--glass-radius);
    padding: 20px; box-shadow: var(--glass-shadow); max-width: 100%;
  }
  .scrolly-progress { display: none; }
  .step-title { font-size: 18px; }
  .step-desc { font-size: 14px; }
  .theory-box { padding: 20px; margin: 24px 0; }
  .theory-box p { font-size: 13px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .formula-eq { flex-direction: column; gap: 8px; }
  .compare-table { display: block; overflow-x: auto; }
  .pull-quote { margin: 32px 0; padding: 24px 0 24px 20px; }
  .factor-block { padding-left: 24px; }
  .scrolly-graphic svg text[font-size="8"],
  .scrolly-graphic svg text[font-size="9"] { font-size: 11px !important; }
  .scrolly-graphic svg text[font-size="10"],
  .scrolly-graphic svg text[font-size="11"] { font-size: 13px !important; }
}

@media (max-width: 480px) {
  .scrolly-graphic { height: 35vh; height: 35dvh; padding: 12px; }
  .scrolly-graphic svg { max-width: 260px; }
  .scrolly-steps { padding: 16px 16px 25vh; }
  .scrolly-step { min-height: 45vh; }
  .step-content { padding: 16px; }
  .step-title { font-size: 17px; }
  .step-desc { font-size: 13px; line-height: 1.65; }
  .step-highlight { font-size: 12px; padding: 3px 10px; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 20px 16px; }
  .stat-card-num { font-size: 36px; }
  .compare-table { font-size: 12px; }
  .compare-table th { padding: 10px; font-size: 11px; }
  .compare-table td { padding: 10px; }
  .compare-table td:first-child { white-space: normal; }
  .pull-quote { margin: 24px 0; padding: 20px 0 20px 16px; }
  .pull-quote-text { font-size: 16px; }
  .theory-box { padding: 16px; margin: 20px 0; }
  .caveat-box { padding: 16px; }
  .caveat-list li { font-size: 13px; padding-left: 16px; }
  .factor-block { margin-left: 0; padding: 32px 0 32px 16px; }
  .factor-num { font-size: clamp(40px, 10vw, 64px); }
  .factor-title { font-size: clamp(18px, 4vw, 24px); }
  .factor-desc { font-size: 14px; }
  .formula-section { padding: 48px 16px; min-height: 40vh; }
  .formula-box { padding: 16px 14px; min-width: 120px; }
  .formula-box-label { font-size: 9px; }
  .formula-box-text { font-size: 12px; }
  .formula-op { font-size: 22px; }
  .conclusion-section { padding: 48px 16px; min-height: 60vh; }
  .concl-eq { font-size: clamp(16px, 4vw, 22px); }
  .pudding-footer { padding: 32px 16px; }
  .source-note { font-size: 11px; }
}
