/* ============================================================
   Intelligence Inflation — 智慧通膨
   Static long-read stylesheet. Light theme only.
   ============================================================ */

:root {
  --bg: #fbfaf8;
  --bg-raised: #ffffff;
  --bg-sunken: #f3f1ec;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-mute: #7a7670;
  --rule: #e2ded6;
  --rule-strong: #cdc7bb;
  --accent: #2c3e6b;
  --accent-soft: #e8ecf5;
  --alert: #a34733;
  --alert-soft: #f7ece8;

  --serif: "Newsreader", "Noto Serif TC", "Songti TC", Georgia, serif;
  --sans: "Inter", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;

  --measure: 68ch;
  --shell: 1180px;
  --header-h: 58px;

  --step--1: clamp(0.82rem, 0.8rem + 0.1vw, 0.88rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  --step-1: clamp(1.18rem, 1.1rem + 0.35vw, 1.35rem);
  --step-2: clamp(1.45rem, 1.3rem + 0.7vw, 1.85rem);
  --step-3: clamp(1.85rem, 1.55rem + 1.3vw, 2.6rem);
  --step-4: clamp(2.3rem, 1.8rem + 2.2vw, 3.6rem);
}

/* ---------- reset ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.85;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
}

/* ---------- language switching ---------- */
/* Only the block matching the active language is rendered. */

html[data-lang="zh"] .lang[data-lang="en"],
html[data-lang="en"] .lang[data-lang="zh"] {
  display: none;
}

html[data-lang="zh"] {
  --serif: "Noto Serif TC", "Newsreader", "Songti TC", serif;
  --sans: "Noto Sans TC", "Inter", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --measure: 46em;
}

html[data-lang="zh"] body {
  line-height: 1.95;
  letter-spacing: 0.01em;
}

/* ---------- typography ---------- */

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0 0 1.15em;
  max-width: var(--measure);
}

strong {
  font-weight: 700;
  color: var(--ink);
}

em {
  font-style: italic;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

code,
.mono {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  font-size: 0.9em;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--rule);
}

.site-header__inner {
  max-width: var(--shell);
  height: 100%;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  font-family: var(--serif);
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-right: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand span {
  color: var(--ink-mute);
  font-weight: 400;
}

/* language toggle */

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 2px;
  background: var(--bg-raised);
  flex: none;
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--ink-mute);
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.lang-switch button:hover {
  color: var(--ink);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.lang-switch button:focus-visible,
.toc-toggle:focus-visible,
.toc a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* reading progress */

.progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: var(--accent);
}

/* ---------- hero ---------- */

.hero {
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 7rem) clamp(1rem, 4vw, 2.5rem) clamp(2.5rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--rule);
}

.eyebrow {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--alert);
  margin: 0 0 1.4rem;
}

.hero h1 {
  font-size: var(--step-4);
  font-weight: 700;
  letter-spacing: -0.025em;
  max-width: 16ch;
}

.hero__sub {
  font-family: var(--serif);
  font-size: var(--step-1);
  color: var(--ink-soft);
  margin: 1.1rem 0 0;
  max-width: 42ch;
  font-style: italic;
}

html[data-lang="zh"] .hero__sub {
  font-style: normal;
}

.hero__lede {
  margin-top: 2.6rem;
  padding-top: 2.2rem;
  border-top: 1px solid var(--rule);
  font-size: var(--step-1);
  line-height: 1.7;
  max-width: 54ch;
  color: var(--ink-soft);
}

.hero__meta {
  margin-top: 2.4rem;
  font-size: var(--step--1);
  color: var(--ink-mute);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
}

/* ---------- layout ---------- */

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem) 6rem;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

/* ---------- table of contents ---------- */

.toc {
  position: sticky;
  top: calc(var(--header-h) + 2.5rem);
  padding: 2.5rem 0 0;
  font-size: var(--step--1);
}

.toc__title {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 1rem;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--rule);
}

.toc a {
  display: flex;
  gap: 0.6rem;
  padding: 0.42rem 0 0.42rem 0.9rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-mute);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc a:hover {
  color: var(--ink);
}

.toc a .num {
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  padding-top: 0.15em;
  opacity: 0.65;
  flex: none;
}

.toc a.is-current {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

.toc-toggle {
  display: none;
}

/* ---------- article ---------- */

.article {
  padding-top: 2.5rem;
  min-width: 0;
}

.section {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
  border-bottom: 1px solid var(--rule);
}

.section:last-child {
  border-bottom: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2rem;
}

.section-num {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--alert);
  padding-top: 0.4em;
  flex: none;
}

.section-head h2 {
  font-size: var(--step-3);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.article h3 {
  font-size: var(--step-2);
  margin: 3rem 0 1rem;
}

.article h4 {
  font-family: var(--sans);
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: 0;
  margin: 2.2rem 0 0.75rem;
}

.article h4::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.55em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.08em;
}

.article ul,
.article ol {
  max-width: var(--measure);
  padding-left: 1.35em;
  margin: 0 0 1.35em;
}

.article li {
  margin-bottom: 0.5em;
}

.article li::marker {
  color: var(--ink-mute);
}

.lead {
  font-size: var(--step-1);
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 50ch;
}

.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.75rem 0;
  max-width: var(--measure);
}

/* ---------- pull quote ---------- */

.pull {
  margin: 2.25rem 0;
  padding: 0.4rem 0 0.4rem 1.5rem;
  border-left: 3px solid var(--accent);
  font-family: var(--serif);
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink);
  max-width: var(--measure);
}

.pull p {
  margin: 0;
}

.pull.is-alert {
  border-left-color: var(--alert);
}

/* ---------- callout ---------- */

.callout {
  margin: 2rem 0;
  padding: 1.15rem 1.35rem;
  background: var(--bg-sunken);
  border-radius: 6px;
  font-size: 0.95em;
  max-width: var(--measure);
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.5rem;
}

.callout.is-alert {
  background: var(--alert-soft);
}

.callout.is-alert .callout__label {
  color: var(--alert);
}

/* ---------- formula ---------- */

.formula {
  margin: 2rem 0;
  padding: 1.6rem 1.25rem;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 6px;
  text-align: center;
  font-family: var(--serif);
  font-size: var(--step-1);
  line-height: 1.6;
  max-width: var(--measure);
}

.formula .op {
  color: var(--ink-mute);
  padding: 0 0.35em;
  font-family: var(--sans);
}

.formula .term {
  border-bottom: 2px solid var(--accent-soft);
  padding-bottom: 0.1em;
  white-space: nowrap;
}

.formula .zero {
  color: var(--alert);
  font-weight: 700;
}

.formula__note {
  display: block;
  margin-top: 0.9rem;
  font-family: var(--sans);
  font-size: var(--step--1);
  color: var(--ink-mute);
}

/* ---------- cards ---------- */

.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin: 2rem 0 2.5rem;
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.35rem 1.4rem;
}

.card h4 {
  margin: 0 0 0.55rem;
  font-family: var(--serif);
  font-size: var(--step-1);
  font-weight: 600;
}

.card h4::before {
  display: none;
}

.card__idx {
  display: block;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--alert);
  margin-bottom: 0.7rem;
}

.card p {
  margin: 0;
  font-size: 0.94em;
  line-height: 1.7;
  color: var(--ink-soft);
}

.card p + p {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-mute);
  font-size: 0.88em;
}

/* ---------- tables ---------- */

.table-wrap {
  margin: 2rem 0;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-raised);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: 0.94em;
  line-height: 1.6;
}

caption {
  caption-side: top;
  text-align: left;
  padding: 0.9rem 1.1rem 0;
  font-size: var(--step--1);
  color: var(--ink-mute);
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--rule);
}

thead th {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-mute);
  background: var(--bg-sunken);
  white-space: nowrap;
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}

tbody th {
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

td .neg {
  color: var(--alert);
  font-weight: 600;
}

td .pos {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- chain diagram ---------- */

.chain {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 8px;
  max-width: var(--measure);
}

.chain__step {
  position: relative;
  padding: 0.55rem 0 0.55rem 1.6rem;
  font-size: 0.95em;
  line-height: 1.55;
}

.chain__step::before {
  content: "";
  position: absolute;
  left: 0.32rem;
  top: 1.15em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.chain__step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0.6rem;
  top: 2.1em;
  bottom: -0.35em;
  width: 1px;
  background: var(--rule-strong);
}

.chain__step:last-child {
  font-weight: 700;
}

.chain__step:last-child::before {
  background: var(--alert);
}

/* ---------- K-shape diagram ---------- */

.kshape {
  margin: 2rem 0;
  padding: 1.75rem 1.5rem;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 8px;
  display: grid;
  gap: 0.6rem;
  max-width: var(--measure);
}

.kshape__arm {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.95rem;
  border-radius: 6px;
  font-size: 0.94em;
  line-height: 1.5;
}

.kshape__arm .glyph {
  font-size: 1.2rem;
  line-height: 1;
  flex: none;
}

.kshape__arm.up {
  background: var(--accent-soft);
  color: var(--accent);
  margin-left: clamp(0rem, 6vw, 3.5rem);
}

.kshape__arm.mid {
  background: var(--bg-sunken);
  color: var(--ink-mute);
  text-decoration-line: line-through;
  text-decoration-color: var(--rule-strong);
}

.kshape__arm.down {
  background: var(--alert-soft);
  color: var(--alert);
  margin-left: clamp(0rem, 6vw, 3.5rem);
}

.kshape__arm strong {
  color: inherit;
}

/* ---------- two-column comparison ---------- */

.compare {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 2rem 0;
}

.compare__col {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.25rem 1.35rem;
  background: var(--bg-raised);
}

.compare__col h4 {
  margin: 0 0 0.75rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.compare__col h4::before {
  display: none;
}

.compare__col.is-old {
  border-style: dashed;
  background: transparent;
}

.compare__col.is-old h4 {
  color: var(--ink-mute);
}

.compare__col.is-new h4 {
  color: var(--accent);
}

.compare__col ul {
  margin: 0;
  padding-left: 1.1em;
  font-size: 0.94em;
}

/* ---------- action columns ---------- */

.actions {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin: 2rem 0;
}

.actions__col {
  border-top: 3px solid var(--accent);
  padding-top: 1.1rem;
}

.actions__col:nth-child(2) {
  border-top-color: var(--ink-soft);
}

.actions__col:nth-child(3) {
  border-top-color: var(--alert);
}

.actions__col h4 {
  margin: 0 0 0.8rem;
  font-family: var(--serif);
  font-size: var(--step-1);
}

.actions__col h4::before {
  display: none;
}

.actions__col ol {
  margin: 0;
  padding-left: 1.15em;
  font-size: 0.94em;
}

/* ---------- closing ---------- */

.closing {
  border-top: 1px solid var(--rule);
  background: var(--bg-sunken);
  margin-top: 2rem;
}

.closing__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6rem) clamp(1rem, 4vw, 2.5rem);
}

.closing p {
  font-family: var(--serif);
  font-size: var(--step-2);
  line-height: 1.5;
  max-width: 24ch;
  margin: 0;
  text-wrap: balance;
}

.closing p strong {
  box-shadow: inset 0 -0.42em 0 var(--accent-soft);
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  font-size: var(--step--1);
  color: var(--ink-mute);
}

.site-footer__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 2.5rem clamp(1rem, 4vw, 2.5rem) 4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  justify-content: space-between;
}

.site-footer p {
  margin: 0;
  max-width: 46ch;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .toc-toggle {
    display: block;
    width: 100%;
    margin-top: 2rem;
    padding: 0.8rem 1rem;
    appearance: none;
    background: var(--bg-raised);
    border: 1px solid var(--rule);
    border-radius: 8px;
    font: inherit;
    font-size: var(--step--1);
    font-weight: 600;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
  }

  .toc-toggle::after {
    content: "＋";
    float: right;
    color: var(--ink-mute);
  }

  .toc-toggle[aria-expanded="true"]::after {
    content: "－";
  }

  .toc {
    position: static;
    padding: 0;
  }

  .toc__title {
    display: none;
  }

  .toc ol {
    display: none;
    margin-top: 0.75rem;
  }

  .toc.is-open ol {
    display: block;
  }

  .article {
    padding-top: 1rem;
  }
}

@media (max-width: 560px) {
  .brand span {
    display: none;
  }

  .section-head {
    display: block;
  }

  .section-num {
    display: block;
    margin-bottom: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}

/* ---------- print ---------- */

@media print {
  :root {
    --bg: #fff;
    --bg-raised: #fff;
    --bg-sunken: #fff;
  }

  .site-header,
  .toc,
  .toc-toggle,
  .progress {
    display: none !important;
  }

  .shell {
    display: block;
    max-width: none;
    padding: 0;
  }

  body {
    font-size: 10.5pt;
    line-height: 1.6;
  }

  .section {
    break-inside: avoid-page;
    border-bottom: 1px solid #ccc;
  }

  .card,
  .callout,
  .formula,
  .table-wrap,
  .chain,
  .kshape {
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
