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

html { -webkit-text-size-adjust: 100%; scrollbar-color: #2C473E #06100D; }

body, h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* ============ 2. Tokens ============ */
:root {
  --ink: #06100D;
  --board: #0C211B;
  --charcoal: #141B19;
  --edge: #2C473E;
  --mist: #EAF6F1;
  --muted: #9DB8AE;
  --cyan: #53F2D2;
  --amber: #FFB35E;
  --glow: #C9FFF4;
  --press: #0E6F61;

  --rail-w: 92px;
  --status-h: 34px;
  --mobile-bar-h: 62px;

  --font-sans: "思源黑体", "HarmonyOS Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-num: "Barlow Condensed", "DIN Condensed", "Oswald", "HarmonyOS Sans SC", system-ui, sans-serif;

  --r-lg: 32px;
  --r-md: 22px;
  --r-sm: 14px;
  --r-pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(16px, 3vw, 40px);
  --maxw: 1360px;
}

/* ============ 3. Base ============ */
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  padding-left: var(--rail-w);
  padding-top: var(--status-h);
  background:
    radial-gradient(1200px 520px at 80% -10%, rgba(83, 242, 210, 0.10), transparent 62%),
    radial-gradient(760px 440px at 4% 108%, rgba(255, 179, 94, 0.07), transparent 60%),
    var(--ink);
  color: var(--mist);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.14; font-weight: 900; letter-spacing: 0.01em; }

::selection { background: var(--cyan); color: #04120F; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ============ 4. Header : frame navigation ============ */
.site-header { position: relative; z-index: 60; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  transform: translateY(-180%);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--cyan);
  color: #04120F;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  transition: transform 0.2s var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); }

.status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--status-h);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 20px;
  background: rgba(6, 16, 13, 0.94);
  border-bottom: 1px solid var(--edge);
  font-family: var(--font-num);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  backdrop-filter: blur(8px);
}
.status-bar__signal {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--mist);
  letter-spacing: 0.14em;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(83, 242, 210, 0.16), 0 0 14px var(--cyan);
}
.status-bar__note { color: var(--amber); letter-spacing: 0.12em; }
.status-bar__coords { color: var(--edge); }

.frame-rail {
  position: fixed;
  top: var(--status-h);
  left: 0;
  bottom: 0;
  width: var(--rail-w);
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 18px 10px 20px;
  background: linear-gradient(180deg, rgba(12, 33, 27, 0.98), rgba(6, 16, 13, 0.98));
  border-right: 1px solid var(--edge);
}

.rail-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--edge);
}
.rail-brand__mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--cyan);
  color: #04120F;
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(201, 255, 244, 0.4), 0 8px 22px rgba(83, 242, 210, 0.22);
  transition: background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.rail-brand:hover .rail-brand__mark { background: var(--glow); box-shadow: 0 0 0 2px var(--cyan), 0 10px 26px rgba(83, 242, 210, 0.34); }
.rail-brand__name {
  writing-mode: vertical-rl;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--muted);
}

.rail-nav {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  scrollbar-width: none;
}
.rail-nav::-webkit-scrollbar { display: none; }
.rail-nav__list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
}

.rail-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 68px;
  padding: 12px 6px;
  border-radius: 18px;
  color: var(--muted);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.rail-link:hover { color: var(--mist); background: rgba(83, 242, 210, 0.07); }
.rail-link__idx {
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--edge);
  transition: color 0.2s var(--ease);
}
.rail-link__label {
  writing-mode: vertical-rl;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1;
}
.rail-link[aria-current="page"] {
  color: var(--cyan);
  background: rgba(83, 242, 210, 0.10);
}
.rail-link[aria-current="page"] .rail-link__idx { color: var(--cyan); }
.rail-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  transform: translateY(-50%);
  box-shadow: 0 0 12px var(--cyan);
}

.rail-foot {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--edge);
}
.rail-foot__line { width: 1px; height: 26px; background: linear-gradient(180deg, var(--cyan), transparent); }
.rail-foot__code {
  writing-mode: vertical-rl;
  font-family: var(--font-num);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--edge);
}

.mobile-bar { display: none; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--edge);
  background: rgba(20, 27, 25, 0.9);
  color: var(--mist);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.nav-toggle:hover { border-color: var(--cyan); color: var(--cyan); }
.nav-toggle__bars { position: relative; display: block; width: 18px; height: 10px; }
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--cyan);
  transition: transform 0.2s var(--ease);
}
.nav-toggle__bars::before { top: 0; }
.nav-toggle__bars::after { bottom: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-4px) rotate(-45deg); }
.nav-toggle__text { line-height: 1; }

.nav-drawer { display: none; }

/* ============ 5. Footer ============ */
.site-footer {
  position: relative;
  margin-top: clamp(48px, 6vw, 88px);
  background: linear-gradient(180deg, var(--board), var(--ink) 72%);
  border-top: 1px solid var(--edge);
}
.footer-belt {
  height: 4px;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--cyan) 22%, var(--amber) 62%, transparent 100%);
  opacity: 0.85;
}
.footer-inner {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: clamp(34px, 4vw, 60px) var(--gutter) 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr 1fr 1.25fr;
  gap: clamp(24px, 3vw, 48px);
}
.footer-col { min-width: 0; }
.footer-brand__name { font-size: clamp(24px, 2.4vw, 32px); font-weight: 900; letter-spacing: 0.02em; }
.footer-brand__line {
  margin-top: 8px;
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.24em;
  color: var(--cyan);
  text-transform: uppercase;
}
.footer-statement { margin-top: 16px; max-width: 38ch; color: var(--muted); font-size: 15px; }
.footer-title {
  margin-bottom: 14px;
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--amber);
}
.footer-links { display: grid; gap: 10px; }
.footer-link {
  display: inline-block;
  color: var(--muted);
  font-size: 15px;
  transition: color 0.18s var(--ease), transform 0.18s var(--ease);
}
.footer-link:hover { color: var(--mist); transform: translateX(3px); }
.footer-contact__row { display: grid; gap: 2px; margin-bottom: 12px; }
.footer-contact__label {
  font-family: var(--font-num);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--edge);
}
.footer-contact__value { font-size: 15px; color: var(--mist); word-break: break-word; }
.footer-note { color: var(--muted); font-size: 13px; line-height: 1.65; }
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: clamp(28px, 3vw, 44px);
  padding-top: 18px;
  border-top: 1px solid var(--edge);
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.footer-icp { color: var(--mist); }
.footer-sign { color: var(--muted); }

/* ============ 6. Layout helpers ============ */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.page-main { display: block; padding-block: clamp(24px, 3.4vw, 52px) clamp(40px, 5vw, 72px); }

.page-head {
  display: grid;
  gap: 14px;
  padding-block: clamp(14px, 2vw, 28px) clamp(18px, 2.4vw, 30px);
  border-bottom: 1px solid var(--edge);
}
.page-head__title { font-size: clamp(32px, 5.4vw, 64px); line-height: 1.05; }
.page-head__lead { max-width: 62ch; color: var(--muted); font-size: clamp(15px, 1.3vw, 18px); }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.breadcrumbs a { color: var(--muted); transition: color 0.18s var(--ease); }
.breadcrumbs a:hover { color: var(--cyan); }
.breadcrumbs__sep { color: var(--edge); }
.breadcrumbs [aria-current="page"] { color: var(--mist); }

.section { margin-top: clamp(40px, 5vw, 72px); }
.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--edge);
}

.chapter { display: flex; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.chapter__num {
  font-family: var(--font-num);
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 700;
  line-height: 0.8;
  color: var(--edge);
}
@supports (-webkit-text-stroke: 1px #000) {
  .chapter__num { color: transparent; -webkit-text-stroke: 1.5px var(--cyan); opacity: 0.75; }
}
.chapter__title { font-size: clamp(22px, 2.6vw, 32px); }

.eyebrow {
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============ 7. Components ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--cyan); color: #04120F; box-shadow: 0 10px 26px rgba(83, 242, 210, 0.22); }
.btn--primary:hover { background: var(--glow); }
.btn--ghost { background: transparent; color: var(--mist); border-color: var(--edge); }
.btn--ghost:hover { color: var(--cyan); border-color: var(--cyan); }
.btn--amber { background: var(--amber); color: #20130A; }
.btn--amber:hover { background: #FFCB92; }
.btn--sm { min-height: 38px; padding: 0 18px; font-size: 13px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  background: var(--charcoal);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: color 0.16s ease-out, border-color 0.16s ease-out, background-color 0.16s ease-out;
}
.pill:hover { color: var(--mist); border-color: var(--cyan); }
.pill[aria-pressed="true"] {
  background: var(--press);
  border-color: var(--cyan);
  color: var(--glow);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(83, 242, 210, 0.12);
  color: var(--cyan);
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.tag--amber { background: rgba(255, 179, 94, 0.14); color: var(--amber); }

.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 20px);
}
.bento__cell {
  position: relative;
  grid-column: span 12;
  padding: clamp(18px, 2.2vw, 30px);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--board), var(--charcoal));
  overflow: hidden;
}
.bento__cell--diagonal { border-top-right-radius: 4px; }
@media (min-width: 720px) {
  .bento__cell--half { grid-column: span 6; }
  .bento__cell--third { grid-column: span 4; }
  .bento__cell--wide { grid-column: span 8; }
  .bento__cell--full { grid-column: span 12; }
}

.card {
  padding: clamp(16px, 2vw, 24px);
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  background: var(--charcoal);
}

.stat { display: grid; gap: 4px; }
.stat__value {
  font-family: var(--font-num);
  font-size: clamp(28px, 3.4vw, 44px);
  font-weight: 700;
  line-height: 1;
  color: var(--cyan);
}
.stat__label { font-size: 12px; letter-spacing: 0.16em; color: var(--muted); }

.image-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(135deg, rgba(83, 242, 210, 0.14), rgba(6, 16, 13, 0.9) 58%),
    repeating-linear-gradient(90deg, rgba(44, 71, 62, 0.55) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(0deg, rgba(44, 71, 62, 0.55) 0 1px, transparent 1px 42px),
    var(--board);
}
.image-frame img { width: 100%; height: 100%; object-fit: cover; }
.image-frame--wide { aspect-ratio: 21 / 9; }
.image-frame--tall { aspect-ratio: 3 / 4; }
.image-frame--square { aspect-ratio: 1 / 1; }
.image-frame--cut { clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; }
.filter-empty {
  margin-top: 16px;
  padding: 18px;
  border: 1px dashed var(--edge);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 14px;
}

.accordion { display: grid; gap: 10px; }
.accordion__item {
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  background: var(--charcoal);
  overflow: hidden;
}
.accordion__trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  color: var(--mist);
  transition: color 0.18s var(--ease);
}
.accordion__trigger:hover { color: var(--cyan); }
.accordion__trigger::after {
  content: "+";
  font-family: var(--font-num);
  font-size: 20px;
  line-height: 1;
  color: var(--cyan);
  transition: transform 0.2s var(--ease);
}
.accordion__trigger[aria-expanded="true"]::after { transform: rotate(45deg); }
.accordion__panel { padding: 0 20px 18px; color: var(--muted); font-size: 15px; }

/* ============ 8. Reveal ============ */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.42s var(--ease), transform 0.42s var(--ease);
}
html.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* ============ 9. Breakpoints ============ */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  body { padding-left: 0; padding-top: calc(var(--status-h) + var(--mobile-bar-h)); }

  .frame-rail { display: none; }

  .status-bar { justify-content: flex-start; padding: 0 14px; font-size: 10px; letter-spacing: 0.14em; }
  .status-bar__coords { display: none; }

  .mobile-bar {
    position: fixed;
    top: var(--status-h);
    left: 0;
    right: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: var(--mobile-bar-h);
    padding: 0 14px;
    background: rgba(12, 33, 27, 0.97);
    border-bottom: 1px solid var(--edge);
    backdrop-filter: blur(10px);
  }
  .mobile-bar__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 0.08em;
  }
  .mobile-bar__brand::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--cyan);
    transform: rotate(45deg);
    box-shadow: 0 0 12px rgba(83, 242, 210, 0.6);
  }

  .nav-drawer {
    display: block;
    position: fixed;
    top: calc(var(--status-h) + var(--mobile-bar-h));
    left: 0;
    right: 0;
    z-index: 58;
    max-height: calc(100vh - var(--status-h) - var(--mobile-bar-h) - 10px);
    padding: 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--charcoal);
    border-bottom: 1px solid var(--edge);
    border-radius: 0 0 26px 26px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), visibility 0.22s;
  }
  .nav-drawer[data-open="true"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .drawer-nav__list { display: grid; gap: 6px; }
  .drawer-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: var(--mist);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.04em;
    transition: background-color 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
  }
  .drawer-link:hover { background: rgba(83, 242, 210, 0.07); color: var(--cyan); }
  .drawer-link__idx {
    font-family: var(--font-num);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--edge);
  }
  .drawer-link__label { line-height: 1.2; }
  .drawer-link[aria-current="page"] {
    background: rgba(83, 242, 210, 0.10);
    border-color: rgba(83, 242, 210, 0.35);
    color: var(--cyan);
  }
  .drawer-link[aria-current="page"] .drawer-link__idx { color: var(--cyan); }

  .drawer-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--edge);
  }
  .drawer-foot__note { color: var(--muted); font-size: 13px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .bento__cell { border-radius: 24px; }
}

@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-meta { flex-direction: column; align-items: flex-start; gap: 6px; }
  .page-head__title { font-size: clamp(28px, 8vw, 40px); }
  .chapter { gap: 10px; }
}

/* ============ 10. Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html.js [data-reveal] { opacity: 1; transform: none; }
}
