:root {
  --ink-900: #0a0a0a;
  --ink-800: #141414;
  --paper-50: #f5f0e6;
  --paper-200: #e3d7c3;
  --gold-500: #f5b40f;
  --gold-600: #d48a00;
  --purple-500: #6b21a8;
  --purple-700: #4c1d95;
  --teal-400: #2dd4bf;
  --glass: rgba(245,240,230,0.05);
  --serif: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --header-w: 280px;
  --header-h: 64px;
  --content-max: 1360px;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% 0%, rgba(107,33,168,0.16), transparent 30rem),
    radial-gradient(circle at 8% 100%, rgba(245,180,15,0.07), transparent 24rem),
    var(--ink-900);
  color: var(--paper-50);
  font-family: var(--sans);
  line-height: 1.75;
  font-weight: 400;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--paper-50);
  line-height: 1.2;
  margin: 0 0 0.4em;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--gold-500);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

ul, ol {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  font: inherit;
}

::selection {
  background: var(--gold-500);
  color: var(--ink-900);
}

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

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2000;
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--gold-500);
  color: var(--ink-900);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(0,0,0,0.4);
  transform: translateY(-220%);
  opacity: 0;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}

.skip-link:focus {
  transform: none;
  opacity: 1;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 1500;
  background: linear-gradient(90deg, var(--gold-500), var(--purple-500), var(--teal-400));
  pointer-events: none;
  box-shadow: 0 0 12px rgba(245,180,15,0.35);
}

.site-header {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--header-w);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 30% 8%, rgba(245,180,15,0.08), transparent 18rem),
    repeating-linear-gradient(135deg, rgba(245,240,230,0.015) 0 1px, transparent 1px 9px),
    linear-gradient(180deg, #101010, var(--ink-900));
  border-right: 1px solid rgba(245,180,15,0.2);
}

.header-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 28px 22px 24px;
}

.brand-lockup {
  position: relative;
  margin-bottom: 52px;
}

.brand-lockup::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -16px;
  width: 64px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-500), rgba(245,180,15,0));
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--paper-50);
}

.brand-crown {
  display: inline-flex;
  width: 42px;
  height: 42px;
  color: var(--gold-500);
  filter: drop-shadow(0 2px 12px rgba(245,180,15,0.55));
}

.brand-crown svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-word {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 2px;
}

.brand-sub {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2.4px;
  color: var(--gold-500);
  text-transform: uppercase;
}

.nav-toggle {
  display: none;
}

.nav-rail {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.nav-item {
  margin: 0;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 12px 10px;
  color: var(--paper-200);
  font-family: var(--sans);
  font-size: 15px;
  text-decoration: none;
  letter-spacing: 1px;
  border-left: 2px solid transparent;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.nav-link::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  background: var(--purple-500);
  transform: rotate(45deg);
  opacity: 0.75;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.nav-link:hover {
  color: var(--paper-50);
  background: linear-gradient(90deg, rgba(245,240,230,0.04), transparent);
  border-left-color: var(--purple-500);
}

.nav-link:hover::before {
  box-shadow: 0 0 12px rgba(107,33,168,0.8);
}

.nav-link[aria-current="page"] {
  color: var(--gold-500);
  background: linear-gradient(90deg, rgba(107,33,168,0.3), transparent);
  border-left-color: var(--gold-500);
}

.nav-link[aria-current="page"]::before {
  background: var(--gold-500);
  box-shadow: 0 0 14px rgba(245,180,15,0.9);
}

.nav-rail-foot {
  margin-top: auto;
  padding-top: 28px;
  display: grid;
  gap: 10px;
}

.nav-utility-link {
  display: block;
  padding: 10px 12px;
  border: 1px solid rgba(245,180,15,0.22);
  background: rgba(245,180,15,0.05);
  color: var(--paper-200);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.6px;
  text-decoration: none;
  text-align: center;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.nav-utility-link:hover {
  color: var(--gold-500);
  border-color: var(--gold-500);
  transform: translateY(-1px);
}

.main-content {
  padding-left: var(--header-w);
  min-height: 70vh;
  scroll-margin-top: 24px;
}

.container {
  width: min(100% - 40px, var(--content-max));
  margin-inline: auto;
}

.site-footer {
  margin-left: var(--header-w);
  position: relative;
  background:
    linear-gradient(180deg, transparent 0%, rgba(107,33,168,0.12) 100%),
    var(--ink-900);
  border-top: 1px solid rgba(107,33,168,0.4);
  color: var(--paper-200);
}

.footer-vault {
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--purple-500), var(--gold-500), transparent);
}

.footer-grid {
  max-width: var(--content-max);
  margin-inline: auto;
  padding: 64px clamp(24px, 5vw, 64px) 40px;
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr;
  gap: clamp(28px, 4vw, 64px);
}

.footer-brand-block {
  display: grid;
  align-content: start;
  gap: 18px;
}

.footer-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--paper-50);
  text-decoration: none;
}

.footer-brand-link .brand-crown {
  width: 36px;
  height: 36px;
}

.footer-brand-link .brand-word {
  font-size: 18px;
  letter-spacing: 1.5px;
}

.footer-brand-link .brand-sub {
  font-size: 9px;
}

.footer-about {
  max-width: 56ch;
  font-size: 15px;
  line-height: 1.8;
  color: var(--paper-200);
  margin: 0;
}

.footer-trust {
  max-width: 62ch;
  font-size: 13px;
  line-height: 1.7;
  color: var(--paper-200);
  opacity: 0.75;
  border-left: 2px solid var(--purple-500);
  padding-left: 14px;
  margin: 0;
}

.footer-links-block {
  display: grid;
  align-content: start;
}

.footer-title {
  font-family: var(--serif);
  color: var(--gold-500);
  font-size: 16px;
  letter-spacing: 2px;
  margin-bottom: 18px;
}

.footer-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--paper-200);
  text-decoration: none;
  padding: 4px 0;
  transition: color 0.2s var(--ease);
}

.footer-link::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  background: var(--purple-500);
  transform: rotate(45deg);
  transition: background 0.2s var(--ease);
}

.footer-link:hover {
  color: var(--gold-500);
}

.footer-link:hover::before {
  background: var(--gold-500);
}

.footer-contact-block {
  display: grid;
  align-content: start;
}

.footer-line {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  margin: 8px 0;
  font-size: 14px;
}

.footer-line-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold-500);
  letter-spacing: 1px;
}

.footer-line-value {
  color: var(--paper-200);
  word-break: break-word;
}

.footer-bottom {
  border-top: 1px solid rgba(245,240,230,0.07);
  padding: 22px clamp(24px, 5vw, 64px);
  max-width: var(--content-max);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.footer-icp {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--paper-200);
  letter-spacing: 0.5px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-family: var(--sans);
  font-size: 14px;
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: var(--ink-900);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245,180,15,0.25);
}

.btn-ghost {
  border-color: rgba(245,180,15,0.4);
  color: var(--gold-500);
}

.btn-ghost:hover {
  background: rgba(245,180,15,0.08);
  transform: translateY(-1px);
}

.breadcrumb {
  margin: 0 0 28px;
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 14px;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--purple-500);
  transform: rotate(45deg);
  margin-right: 8px;
}

.breadcrumb-link {
  color: var(--paper-200);
  text-decoration: none;
}

.breadcrumb-link:hover {
  color: var(--gold-500);
}

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

.section-head {
  margin-bottom: clamp(24px, 4vw, 56px);
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--gold-500);
  text-transform: uppercase;
}

.section-eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--gold-500);
  box-shadow: 0 0 8px rgba(245,180,15,0.6);
}

.section-title {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(30px, 4.6vw, 56px);
  line-height: 1.15;
  color: var(--paper-50);
}

.section-subtitle {
  max-width: 62ch;
  color: var(--paper-200);
  font-size: 16px;
  line-height: 1.8;
}

.chapter-number {
  font-family: var(--mono);
  font-size: clamp(56px, 10vw, 96px);
  font-weight: 700;
  line-height: 0.9;
  color: transparent;
  -webkit-text-stroke: 1px rgba(245,180,15,0.5);
  text-shadow: 0 0 24px rgba(245,180,15,0.15);
}

.tag {
  display: inline-block;
  padding: 0.2em 0.7em;
  border: 1px solid rgba(45,212,191,0.35);
  background: rgba(45,212,191,0.08);
  color: var(--teal-400);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.6px;
}

.media-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(135deg, rgba(107,33,168,0.4), rgba(245,180,15,0.15));
  border: 1px solid rgba(245,240,230,0.12);
}

.media-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(-45deg, rgba(245,240,230,0.04) 0 1px, transparent 1px 10px);
  pointer-events: none;
}

.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-frame--wide {
  aspect-ratio: 16 / 9;
}

.media-frame--square {
  aspect-ratio: 1 / 1;
}

.vault-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(16px, 2vw, 24px);
}

.vault-cell {
  grid-column: span 12;
  min-width: 0;
}

.tabs {
  position: relative;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid rgba(245,240,230,0.12);
  margin-bottom: 24px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--paper-200);
  font-family: var(--sans);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.tab-btn::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--purple-500);
  transform: rotate(45deg);
}

.tab-btn:hover {
  color: var(--paper-50);
}

.tab-btn[aria-selected="true"] {
  color: var(--gold-500);
  border-bottom-color: var(--gold-500);
  background: linear-gradient(0deg, rgba(245,180,15,0.08), transparent);
}

.tab-btn[aria-selected="true"]::before {
  background: var(--gold-500);
}

.tab-panel {
  display: block;
}

.tab-panel[hidden] {
  display: none !important;
}

@media (min-width: 700px) {
  .vault-cell--half {
    grid-column: span 6;
  }
}

@media (min-width: 1024px) {
  .vault-cell--third {
    grid-column: span 4;
  }

  .vault-cell--two-thirds {
    grid-column: span 8;
  }

  .vault-cell--half {
    grid-column: span 6;
  }
}

@media (max-width: 1023px) {
  .site-header {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    background:
      radial-gradient(circle at 80% -20%, rgba(107,33,168,0.28), transparent 20rem),
      repeating-linear-gradient(135deg, rgba(245,240,230,0.02) 0 1px, transparent 1px 8px),
      linear-gradient(180deg, #101010, var(--ink-900));
    border-right: 0;
    border-bottom: 1px solid rgba(245,180,15,0.25);
  }

  .header-shell {
    height: auto;
    min-height: var(--header-h);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
  }

  .brand-lockup {
    margin-bottom: 0;
    padding: 0;
  }

  .brand-lockup::after {
    display: none;
  }

  .brand-crown {
    width: 32px;
    height: 32px;
  }

  .brand-word {
    font-size: 18px;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    background: rgba(245,180,15,0.08);
    border: 1px solid rgba(245,180,15,0.3);
    color: var(--gold-500);
    cursor: pointer;
  }

  .nav-toggle-label {
    font-size: 13px;
    font-weight: 600;
  }

  .nav-toggle-bars {
    display: inline-grid;
    gap: 4px;
    width: 18px;
  }

  .nav-toggle-bar {
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
  }

  .nav-toggle.is-active .nav-toggle-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .nav-toggle.is-active .nav-toggle-bar:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.is-active .nav-toggle-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .nav-rail {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    padding: 24px clamp(20px, 6vw, 40px) 36px;
    overflow-y: auto;
    background:
      radial-gradient(circle at 90% 10%, rgba(107,33,168,0.25), transparent 18rem),
      repeating-linear-gradient(135deg, rgba(245,240,230,0.02) 0 1px, transparent 1px 8px),
      var(--ink-900);
  }

  .nav-rail[data-open="true"] {
    display: flex;
  }

  .nav-list {
    gap: 4px;
  }

  .nav-link {
    padding: 14px 18px;
    font-size: 16px;
  }

  .nav-rail-foot {
    margin-top: 28px;
    grid-template-columns: 1fr 1fr;
  }

  .main-content {
    padding-left: 0;
  }

  .site-footer {
    margin-left: 0;
  }
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand-block {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-brand-block {
    grid-column: auto;
  }

  .footer-line {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

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