/* ============================================================
   合乐会馆 · 共享样式表 /assets/site.css
   墨绿牌匾 · 砂金线条 · 朱砂强调 · 青瓷提亮 · 纸白底
   ============================================================ */

/* ---------- 1. Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 7rem;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body { margin: 0; }

img,
svg,
picture,
video { display: block; max-width: 100%; }

button,
input,
select,
textarea { font: inherit; color: inherit; }

ul,
ol { margin: 0; padding: 0; }

p,
h1,
h2,
h3,
h4,
h5 { margin: 0; }

/* ---------- 2. Tokens ---------- */
:root {
  --green: #0E2A22;
  --green-2: #17453A;
  --gold: #C9A24B;
  --gold-soft: #F0E2C4;
  --cinnabar: #B5342A;
  --cinnabar-deep: #96281F;
  --celadon: #6FA9A2;
  --paper: #FAF6EE;
  --paper-2: #F2EADB;
  --ink: #1A1A17;
  --ink-soft: #4A4A44;
  --white: #FFFFFF;

  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-body: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --wrap: 1180px;
  --cut: 12px;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --hairline: rgba(201, 162, 75, 0.32);
}

/* ---------- 3. Base typography ---------- */
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(26, 26, 23, 0.018) 0 1px, transparent 1px 4px),
    radial-gradient(1100px 560px at 10% -8%, rgba(201, 162, 75, 0.14), transparent 68%),
    radial-gradient(900px 520px at 94% 4%, rgba(111, 169, 162, 0.11), transparent 70%);
  background-repeat: repeat, no-repeat, no-repeat;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-break: strict;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--green);
}

p { text-wrap: pretty; }

a {
  color: var(--green-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.22s var(--ease);
}

a:hover { color: var(--cinnabar); }

:focus-visible {
  outline: 2px solid var(--celadon);
  outline-offset: 3px;
}

::selection {
  background: var(--gold-soft);
  color: var(--green);
}

.num,
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- 4. Skip link ---------- */
.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 300;
  padding: 0.65rem 1.1rem;
  background: var(--gold-soft);
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid var(--cinnabar);
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 1rem;
  color: var(--green);
}

/* ---------- 5. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--green);
  background-image:
    linear-gradient(180deg, rgba(23, 69, 58, 0.55), rgba(14, 42, 34, 0.96)),
    repeating-linear-gradient(90deg, rgba(201, 162, 75, 0.07) 0 1px, transparent 1px 84px);
  color: var(--paper);
  border-bottom: 1px solid var(--hairline);
  transition: box-shadow 0.24s var(--ease);
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: var(--scroll-progress, 0%);
  background: linear-gradient(90deg, var(--gold), var(--cinnabar));
  transition: width 0.18s linear;
  pointer-events: none;
}

.site-header[data-compact="true"] {
  box-shadow: 0 10px 26px rgba(14, 42, 34, 0.22);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas:
    "issue brand account"
    "nav   nav   nav";
  align-items: center;
  row-gap: 0.35rem;
  width: min(var(--wrap), 92vw);
  margin-inline: auto;
  padding-block: clamp(1rem, 1.9vw, 1.6rem) 0.7rem;
  transition: padding 0.24s var(--ease);
}

/* 期号 */
.header-issue {
  grid-area: issue;
  justify-self: start;
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  color: rgba(250, 246, 238, 0.55);
}

.issue-label {
  text-transform: none;
}

.issue-num {
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--gold);
}

/* 报头品牌 */
.brand {
  grid-area: brand;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
}

.brand:hover { color: inherit; }

.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: var(--celadon);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: var(--gold-soft);
  transition: font-size 0.24s var(--ease), letter-spacing 0.24s var(--ease), color 0.22s var(--ease);
}

.brand:hover .brand-name { color: var(--white); }

/* 账户设置入口 */
.account-entry {
  grid-area: account;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.7rem 0.42rem 0.85rem;
  background: rgba(201, 162, 75, 0.1);
  border: 1px solid rgba(201, 162, 75, 0.48);
  color: var(--gold-soft);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%);
  transition: background-color 0.22s var(--ease), color 0.22s var(--ease), border-color 0.22s var(--ease);
}

.account-entry:hover,
.account-entry:focus-visible {
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  color: var(--white);
}

.account-label { white-space: nowrap; }

.account-nums {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.06rem 0.34rem;
  background: rgba(201, 162, 75, 0.22);
  color: var(--gold);
}

.account-entry:hover .account-nums {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
}

/* 移动导航按钮 */
.nav-toggle {
  grid-area: toggle;
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  background: transparent;
  border: 1px solid rgba(201, 162, 75, 0.45);
  color: var(--gold-soft);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: border-color 0.22s var(--ease), background-color 0.22s var(--ease);
}

.nav-toggle:hover { border-color: var(--gold); background: rgba(201, 162, 75, 0.12); }

.nav-toggle-glyph {
  position: relative;
  display: block;
  width: 16px;
  height: 10px;
  flex: 0 0 auto;
}

.nav-toggle-glyph::before,
.nav-toggle-glyph::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: currentColor;
  transition: top 0.24s var(--ease), transform 0.24s var(--ease);
}

.nav-toggle-glyph::before { top: 0; }
.nav-toggle-glyph::after { top: 8px; }

.site-header[data-open="true"] .nav-toggle-glyph::before { top: 4px; transform: rotate(45deg); }
.site-header[data-open="true"] .nav-toggle-glyph::after { top: 4px; transform: rotate(-45deg); }

/* 主导航 */
.primary-nav {
  grid-area: nav;
  width: 100%;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  list-style: none;
}

.nav-list li {
  display: flex;
  align-items: center;
}

.nav-list li + li::before {
  content: "";
  display: block;
  width: 1px;
  height: 11px;
  margin-inline: 0.85rem;
  background: rgba(201, 162, 75, 0.42);
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 0.45rem 0.1rem;
  color: rgba(250, 246, 238, 0.82);
  font-size: 0.94rem;
  letter-spacing: 0.07em;
  text-decoration: none;
  transition: color 0.22s var(--ease);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--gold);
  transform: translateX(-50%);
  transition: width 0.24s var(--ease), background-color 0.24s var(--ease);
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--white);
}

.nav-link:hover::after,
.nav-link:focus-visible::after { width: 100%; }

.nav-link[aria-current="page"] {
  color: var(--white);
}

.nav-link[aria-current="page"]::after {
  width: 100%;
  background: var(--cinnabar);
}

/* 滚动后紧凑态（桌面） */
@media (min-width: 861px) {
  .site-header[data-compact="true"] .header-inner {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand nav account";
    column-gap: 2rem;
    row-gap: 0;
    padding-block: 0.5rem;
  }

  .site-header[data-compact="true"] .header-issue { display: none; }

  .site-header[data-compact="true"] .brand {
    justify-self: start;
    flex-direction: row;
    align-items: baseline;
    gap: 0.6rem;
  }

  .site-header[data-compact="true"] .brand-sub { font-size: 0.6rem; letter-spacing: 0.2em; }

  .site-header[data-compact="true"] .brand-name {
    font-size: 1.28rem;
    letter-spacing: 0.14em;
    text-indent: 0.14em;
  }

  .site-header[data-compact="true"] .nav-list { justify-content: flex-end; }

  .site-header[data-compact="true"] .nav-link {
    font-size: 0.86rem;
    padding-block: 0.35rem;
  }

  .site-header[data-compact="true"] .account-entry { padding-block: 0.34rem; }
}

/* ---------- 6. Mobile header ---------- */
@media (max-width: 860px) {
  .header-inner {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "toggle brand account"
      "nav    nav   nav";
    column-gap: 0.75rem;
    row-gap: 0.5rem;
    padding-block: 0.8rem;
  }

  .header-issue { display: none; }

  .nav-toggle { display: inline-flex; }

  .brand { justify-self: center; }

  .brand-sub { font-size: 0.58rem; letter-spacing: 0.24em; }

  .brand-name {
    font-size: clamp(1.25rem, 5.4vw, 1.6rem);
    letter-spacing: 0.16em;
    text-indent: 0.16em;
  }

  .account-entry { padding: 0.38rem 0.55rem; font-size: 0.74rem; }

  .account-nums { display: none; }

  .primary-nav {
    display: none;
    margin-top: 0.6rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(201, 162, 75, 0.3);
  }

  .site-header[data-open="true"] .primary-nav { display: block; }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-list li { display: block; }

  .nav-list li + li::before { display: none; }

  .nav-list li + li { border-top: 1px solid rgba(250, 246, 238, 0.1); }

  .nav-link {
    display: block;
    padding: 0.85rem 0.25rem;
    font-size: 1rem;
  }

  .nav-link::after { display: none; }

  .nav-link[aria-current="page"] {
    color: var(--gold);
    box-shadow: inset 3px 0 0 var(--cinnabar);
    padding-left: 0.7rem;
  }
}

/* ---------- 7. Footer ---------- */
.site-footer {
  margin-top: clamp(4rem, 8vw, 8rem);
  background: var(--green);
  background-image:
    linear-gradient(180deg, rgba(23, 69, 58, 0.5), rgba(11, 33, 27, 0.98)),
    repeating-linear-gradient(90deg, rgba(201, 162, 75, 0.06) 0 1px, transparent 1px 96px);
  color: rgba(250, 246, 238, 0.78);
  border-top: 3px solid var(--gold);
}

.footer-inner {
  width: min(var(--wrap), 92vw);
  margin-inline: auto;
  padding-block: clamp(2.8rem, 5vw, 4.2rem) 1.6rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.5fr;
  gap: clamp(1.6rem, 3.2vw, 3rem);
}

.footer-col { min-width: 0; }

.footer-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  color: var(--gold-soft);
  line-height: 1.3;
}

.footer-tagline {
  margin-top: 0.5rem;
  font-size: 0.88rem;
  color: var(--celadon);
  letter-spacing: 0.04em;
}

.footer-icp {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: rgba(250, 246, 238, 0.45);
}

.footer-col-title {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.74rem;
  letter-spacing: 0.24em;
  color: var(--gold);
  padding-bottom: 0.55rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid rgba(201, 162, 75, 0.26);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
}

.footer-links a {
  color: rgba(250, 246, 238, 0.78);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.22s var(--ease), padding-left 0.22s var(--ease);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--gold-soft);
  padding-left: 0.28rem;
}

.footer-contact {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.footer-contact li {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.contact-key {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: rgba(201, 162, 75, 0.85);
}

.contact-val {
  font-size: 0.88rem;
  line-height: 1.65;
  color: rgba(250, 246, 238, 0.86);
  overflow-wrap: anywhere;
}

.footer-bottom {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.6rem;
  margin-top: clamp(2rem, 4vw, 3.2rem);
  padding-top: 1.2rem;
  border-top: 1px solid rgba(201, 162, 75, 0.26);
}

.footer-legal,
.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  color: rgba(250, 246, 238, 0.5);
}

.footer-copy { margin-left: auto; }

.footer-mark {
  display: block;
  color: rgba(201, 162, 75, 0.4);
  line-height: 0;
}

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-col--brand { grid-column: 1 / -1; }
  .footer-copy { margin-left: 0; }
  .footer-mark { margin-left: auto; }
}

@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .footer-mark { margin-left: 0; margin-top: 0.6rem; }
}

/* ---------- 8. Layout primitives ---------- */
.container {
  width: min(var(--wrap), 92vw);
  margin-inline: auto;
}

.section { padding-block: clamp(3rem, 6.5vw, 7rem); }

.section--tint { background: var(--paper-2); }

.section--deep {
  background: var(--green-2);
  color: rgba(250, 246, 238, 0.86);
}

.section--deep .section-title { color: var(--gold-soft); }

.section--deep .section-lead { color: rgba(250, 246, 238, 0.7); }

.section-head {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 44rem;
  margin-bottom: clamp(1.6rem, 3vw, 2.6rem);
}

.chapter-num {
  display: block;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: rgba(201, 162, 75, 0.22);
  -webkit-text-stroke: 1px rgba(201, 162, 75, 0.72);
}

.section--deep .chapter-num {
  color: rgba(201, 162, 75, 0.14);
  -webkit-text-stroke: 1px rgba(201, 162, 75, 0.6);
}

.section-title {
  font-size: clamp(1.65rem, 3.1vw, 2.5rem);
}

.section-lead {
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.8;
  max-width: 40rem;
}

.rule-gold {
  display: block;
  width: 64px;
  height: 2px;
  background: var(--gold);
  border: 0;
  margin: 1rem 0;
}

/* ---------- 9. Breadcrumb ---------- */
.breadcrumb {
  padding-block: 1.1rem 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.55rem;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.breadcrumb li + li::before {
  content: "/";
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.breadcrumb a {
  color: var(--ink-soft);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--cinnabar); }

.breadcrumb [aria-current="page"] { color: var(--green); }

/* ---------- 10. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.78rem 1.5rem;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
  transition: background-color 0.22s var(--ease), color 0.22s var(--ease), transform 0.22s var(--ease);
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--cinnabar);
  color: var(--white);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--cinnabar-deep);
  color: var(--white);
}

.btn--ghost {
  background: transparent;
  color: var(--green);
  box-shadow: inset 0 0 0 1px var(--gold);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: var(--gold-soft);
  color: var(--green);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  background: rgba(26, 26, 23, 0.12);
  color: rgba(26, 26, 23, 0.42);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ---------- 11. Cards ---------- */
.card {
  background: var(--paper);
  border: 1px solid rgba(26, 26, 23, 0.1);
  padding: clamp(1.1rem, 2.2vw, 1.7rem);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%);
}

.card--tint {
  background: var(--gold-soft);
  border-color: transparent;
}

.card--deep {
  background: var(--green-2);
  border-color: transparent;
  color: rgba(250, 246, 238, 0.86);
}

.card--deep h3,
.card--deep .card-title { color: var(--gold-soft); }

/* ---------- 12. Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.24rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--cinnabar);
  background: rgba(181, 52, 42, 0.08);
  border: 1px solid rgba(181, 52, 42, 0.28);
}

.badge--gold {
  color: var(--green-2);
  background: rgba(201, 162, 75, 0.16);
  border-color: rgba(201, 162, 75, 0.5);
}

/* ---------- 13. Media frame (image placeholder base) ---------- */
.media-frame {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(150deg, var(--green-2), var(--green));
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
}

.media-frame > img,
.media-frame > picture,
.media-frame > video,
.media-frame > svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(14, 42, 34, 0.5) 0.5px, transparent 0.6px);
  background-size: 3px 3px;
  opacity: 0.14;
  transition: opacity 0.32s var(--ease);
}

.media-frame:hover::after,
.media-frame[data-lit="true"]::after { opacity: 0.06; }

.media-frame--portrait { aspect-ratio: 3 / 4; }
.media-frame--wide { aspect-ratio: 16 / 9; }
.media-frame--square { aspect-ratio: 1 / 1; }

.media-frame figcaption,
.media-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.7rem 0.95rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(250, 246, 238, 0.86);
  background: linear-gradient(0deg, rgba(14, 42, 34, 0.86), rgba(14, 42, 34, 0));
}

/* ---------- 14. Accordion ---------- */
.accordion {
  border-top: 1px solid rgba(26, 26, 23, 0.14);
}

.accordion-item {
  border-bottom: 1px solid rgba(26, 26, 23, 0.14);
}

.accordion-trigger {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 1.05rem 0.25rem;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--green);
  transition: color 0.22s var(--ease);
}

.accordion-trigger:hover { color: var(--cinnabar); }

.accordion-trigger::after {
  content: "";
  flex: 0 0 auto;
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--cinnabar);
  border-bottom: 2px solid var(--cinnabar);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.24s var(--ease);
}

.accordion-trigger[aria-expanded="true"]::after {
  transform: rotate(225deg) translateY(-3px);
}

.accordion-panel {
  overflow: hidden;
  height: 0;
  transition: height 0.28s var(--ease);
}

.accordion-panel > div {
  padding: 0 0.25rem 1.3rem;
  color: var(--ink-soft);
  font-size: 0.96rem;
  line-height: 1.8;
}

.accordion-panel > div > :first-child { margin-top: 0; }
.accordion-panel > div > :last-child { margin-bottom: 0; }

/* ---------- 15. Tab rail ---------- */
.tab-rail {
  display: flex;
  gap: 0.15rem;
  overflow-x: auto;
  border-bottom: 1px solid rgba(26, 26, 23, 0.14);
  scrollbar-width: thin;
}

.tab {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.75rem 1.05rem;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  transition: color 0.22s var(--ease), background-color 0.22s var(--ease);
}

.tab:hover { color: var(--green); background: rgba(201, 162, 75, 0.12); }

.tab-num {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--gold);
}

.tab[aria-selected="true"] { color: var(--green); font-weight: 500; }

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--gold);
  transform-origin: center;
  animation: tab-open 0.24s var(--ease) both;
}

@keyframes tab-open {
  from { transform: scaleX(0.15); }
  to { transform: scaleX(1); }
}

.tab-panel { padding-top: 1.4rem; }
.tab-panel[hidden] { display: none; }

/* ---------- 16. Ledger table ---------- */
.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  line-height: 1.7;
}

.ledger thead th {
  text-align: left;
  padding: 0.75rem 0.9rem;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--gold);
  white-space: nowrap;
}

.ledger tbody td {
  padding: 1rem 0.9rem;
  vertical-align: top;
  border-bottom: 1px solid rgba(26, 26, 23, 0.08);
}

.ledger tbody tr:nth-child(even) { background: rgba(240, 226, 196, 0.38); }

.ledger tbody tr {
  transition: background-color 0.22s var(--ease);
}

.ledger tbody tr:hover { background: var(--gold-soft); }

.cell-num {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--green-2);
  white-space: nowrap;
  transition: color 0.22s var(--ease);
}

.ledger tbody tr:hover .cell-num { color: var(--cinnabar); }

/* ---------- 17. Reveal ---------- */
[data-reveal][data-reveal-armed] {
  opacity: 0;
  transform: translateY(12px);
}

[data-reveal] {
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

[data-reveal][data-reveal-armed].is-visible {
  opacity: 1;
  transform: none;
}

[data-reveal][data-reveal-armed] > * {
  transition: opacity 0.3s var(--ease) 0.08s;
}

/* ---------- 18. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal][data-reveal-armed] {
    opacity: 1;
    transform: none;
  }
}
