:root {
  --header-bg: #5f5f5d;
  --paper: #f5f1e6;
  --ink: #060606;
  --muted-ink: #202020;
  --cream: #f8f5e9;
  --gold: #c9a214;
  --red: #a91717;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
}

.site-header {
  min-height: 0;
  padding: 4px 8vw 4px 46px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  background: var(--header-bg);
  border-bottom: 20px solid var(--gold);
  box-shadow: inset 0 -5px 0 var(--cream), inset 0 -8px 0 #b9b1a0;
}

.brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--cream);
  text-decoration: none;
}

.brand:hover,
.brand:focus,
.brand:visited,
.brand * {
  color: var(--cream);
  text-decoration: none;
}

.brand-mark {
  width: 164px;
  height: 224px;
  object-fit: contain;
  object-position: 50% 47%;
  filter: invert(1) brightness(1.08);
}

.brand-copy {
  padding-top: 0;
}

.brand-name {
  display: none;
}

.brand-copy p {
  display: none;
}

.site-nav {
  flex: 1 1 auto;
  margin-top: 142px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(12px, 1.25vw, 24px);
  flex-wrap: nowrap;
  min-width: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--cream);
  font-size: clamp(21px, 1.9vw, 34px);
  font-family: "Courier New", Courier, monospace;
  font-style: normal;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  background-image: url("elements/gate.png");
  background-size: cover;
  background-position: top left;
  background-repeat: no-repeat;
  filter: invert(1) brightness(1.08);
}

.site-nav a.active::before {
  transform: rotate(-90deg);
}

.site-nav a:hover,
.site-nav a.active {
  color: #ffffff;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 5px;
  text-underline-offset: 15px;
}

.hero {
  position: relative;
  min-height: calc(100vh - 305px);
  overflow: hidden;
  padding: 107px 9.2vw 110px;
  background: var(--paper);
}

.watermark {
  display: none;
}

.hero-lockup,
.intro-copy {
  position: relative;
  z-index: 1;
}

.hero-lockup {
  width: min(884px, 78vw);
  margin: 0 auto;
  text-align: center;
}

.hero-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 64px;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(72px, 7.1vw, 136px);
  line-height: 0.95;
  font-weight: 500;
}

.pike-mark {
  width: clamp(116px, 10.6vw, 198px);
  height: clamp(116px, 10.6vw, 198px);
  object-fit: contain;
  object-position: 50% 52%;
}

.scheme-name {
  margin-top: 24px;
  padding-left: 24px;
  color: var(--red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 4.25vw, 82px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;
}

.intro-copy {
  width: min(1580px, 82vw);
  margin: 88px auto 0;
}

.intro-copy h2,
.content-band h2 {
  margin: 0 0 16px;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
}

.intro-copy p,
.content-band p {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
  color: var(--muted-ink);
  overflow-wrap: break-word;
}

.content-band {
  padding: 72px 9.2vw;
  background: #fffaf0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.content-band-dark {
  color: var(--cream);
  background: var(--header-bg);
}

.content-band-dark p {
  color: rgba(248, 245, 233, 0.86);
}

.home-section {
  position: relative;
  min-height: calc(100vh - 252px);
  overflow: hidden;
  padding: 96px 9.2vw 112px;
  background: var(--paper);
}

.home-section::before,
.home-section::after,
.page-main::before,
.page-main::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 50%;
  width: min(430px, 31vw);
  aspect-ratio: 2187 / 2877;
  background-image: url("elements/奇门logo_透明底.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.08;
  filter: grayscale(1);
  pointer-events: none;
  transform: translateY(-50%);
}

.home-section::before,
.page-main::before {
  left: max(-215px, -15.5vw);
}

.home-section::after,
.page-main::after {
  right: max(-215px, -15.5vw);
}

.home-lockup {
  position: relative;
  z-index: 1;
  width: min(1000px, 78vw);
  margin: 0 auto;
  text-align: center;
}

.home-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(34px, 5vw, 88px);
}

.home-title-row h1 {
  font-size: clamp(88px, 9vw, 164px);
}

.home-logo {
  width: clamp(140px, 13vw, 240px);
  height: clamp(140px, 13vw, 240px);
  object-fit: contain;
  object-position: 50% 52%;
}

.home-section .suite-lead {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 52px auto 0;
  font-size: clamp(17px, 1.25vw, 24px);
  line-height: 1.3;
  color: var(--muted-ink);
}

.home-suite {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: clamp(24px, 4vw, 64px);
  margin-top: 48px;
}

.suite-half {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  padding: clamp(20px, 3vw, 40px) clamp(12px, 2vw, 28px);
  color: var(--ink);
  text-decoration: none;
  border-radius: 14px;
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.home-suite::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 1px;
  height: 60%;
  background: var(--rule, rgba(0, 0, 0, 0.18));
  pointer-events: none;
}

.suite-half:hover,
.suite-half:focus-visible {
  background: rgba(0, 0, 0, 0.03);
  transform: translateY(-3px);
}

.suite-name {
  font-size: clamp(24px, 2.4vw, 40px);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.suite-desc {
  color: var(--muted-ink);
  font-size: clamp(16px, 1.2vw, 22px);
  line-height: 1.25;
}

.suite-logo {
  width: clamp(88px, 8vw, 140px);
  height: clamp(88px, 8vw, 140px);
  flex: 0 0 auto;
  object-fit: contain;
  object-position: 50% 52%;
}

.page-main {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 230px);
  background: var(--paper);
}

.page-section {
  position: relative;
  z-index: 1;
  width: min(1200px, 82vw);
  margin: 0 auto;
  padding: 96px 0 120px;
}

.page-section h1 {
  margin-bottom: 34px;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(42px, 4.5vw, 72px);
  line-height: 1;
  font-weight: 400;
}

.page-section p {
  max-width: 980px;
  margin: 0 0 18px;
  font-size: clamp(17px, 1.35vw, 22px);
  line-height: 1.45;
  color: var(--muted-ink);
}

.page-section p:last-child {
  margin-bottom: 0;
}

.page-subsection {
  margin-top: 52px;
  scroll-margin-top: 28px;
}

.page-section > h1 + .page-subsection,
.page-section > h1 + .content-subsection,
.page-section > h1 + .team-text {
  padding-top: 38px;
  border-top: 4px solid var(--gold);
}

.page-subsection + .page-subsection {
  margin-top: 70px;
  padding-top: 38px;
  border-top: 4px solid var(--gold);
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.18);
}

.page-section h2 {
  margin: 0 0 18px;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(30px, 3vw, 48px);
  font-weight: 400;
  line-height: 1;
}

.content-subsection + .content-subsection {
  margin-top: 52px;
  padding-top: 38px;
  border-top: 4px solid var(--gold);
}

.inline-gate {
  display: inline-block;
  width: 1.35em;
  height: 1.35em;
  margin: 0 0.12em;
  vertical-align: -0.22em;
  background-image: url("elements/gate.png");
  background-size: cover;
  background-position: top left;
  background-repeat: no-repeat;
}

.repo-card,
.detail-list {
  max-width: 980px;
}

.repo-card {
  margin-bottom: 28px;
}

.resource-stack {
  display: grid;
  gap: 24px;
}

.resource-group h3 {
  margin: 0 0 6px;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 400;
  line-height: 1;
}

.resource-group .link-group {
  margin-top: 0;
}

.paper-list {
  display: grid;
  gap: 16px;
  max-width: 980px;
}

.paper-entry p {
  margin-bottom: 6px;
}

.paper-entry .paper-title {
  color: var(--ink);
  font-weight: 700;
}

.paper-entry .paper-authors {
  font-size: clamp(15px, 1.1vw, 18px);
}

.button-link {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 14px 9px;
  color: var(--cream);
  background: var(--header-bg);
  font-family: "Courier New", Courier, monospace;
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  border-bottom: 5px solid var(--gold);
}

.button-link:hover,
.button-link:focus {
  background: #454543;
}

.link-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  max-width: 980px;
}

.resource-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.resource-list li {
  margin: 0 0 10px;
}

.resource-list a {
  color: var(--muted-ink);
  font-size: clamp(17px, 1.35vw, 22px);
  line-height: 1.45;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

.resource-list a:hover,
.resource-list a:focus {
  color: var(--ink);
}

.detail-list p {
  font-size: clamp(16px, 1.25vw, 20px);
}

.table-note {
  max-width: 1100px;
  font-size: clamp(15px, 1.15vw, 19px);
}

.table-stack {
  display: grid;
  gap: 14px;
  margin-top: 30px;
}

.table-stack h2,
.table-stack h3 {
  margin: 20px 0 0;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(24px, 2.2vw, 36px);
  font-weight: 400;
  line-height: 1;
}

.table-wrap {
  width: min(1180px, 100%);
  overflow-x: auto;
  position: relative;
  z-index: 1;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  color: var(--muted-ink);
  background: rgba(245, 241, 230, 0.72);
  font-size: clamp(13px, 0.95vw, 16px);
  line-height: 1.2;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  text-align: right;
  white-space: nowrap;
}

.data-table th {
  color: var(--ink);
  font-weight: 700;
}

.data-table thead th {
  background: rgba(95, 95, 93, 0.12);
  text-align: center;
}

.data-table tbody th {
  text-align: left;
}

.code-container {
  position: relative;
  max-width: 980px;
  margin-top: 12px;
}

.code-container pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  color: var(--cream);
  background: var(--header-bg);
  border-bottom: 5px solid var(--gold);
}

.code-container code {
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(13px, 1vw, 15px);
  line-height: 1.5;
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 6px 12px 5px;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--gold);
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.copy-btn:hover,
.copy-btn:focus {
  color: var(--ink);
  background: var(--gold);
}

.team-text {
  max-width: 980px;
}

.team-text p {
  margin-bottom: 8px;
  font-size: clamp(17px, 1.3vw, 22px);
  line-height: 1.4;
}

@media (max-width: 980px) {
  .site-header {
    min-height: auto;
    padding: 26px 26px 30px;
    flex-direction: column;
    gap: 22px;
    border-bottom-width: 20px;
    box-shadow: inset 0 -6px 0 var(--cream), inset 0 -9px 0 #b9b1a0;
  }

  .brand-mark {
    width: 112px;
    height: 150px;
  }

  .brand-copy {
    padding-top: 0;
  }

  .brand-name {
    font-size: 28px;
  }

  .brand-copy p {
    font-size: 22px;
  }

  .site-nav {
    width: 100%;
    margin-top: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px 18px;
  }

  .site-nav a {
    font-size: 22px;
  }

  .site-nav a::before {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }

  .site-nav a:hover,
  .site-nav a.active {
    text-decoration-thickness: 3px;
    text-underline-offset: 8px;
  }

  .hero {
    min-height: auto;
    padding: 72px 28px 82px;
  }

  .hero-title-row {
    gap: 24px;
  }

  .intro-copy {
    width: min(100%, 720px);
    margin-top: 64px;
  }

  .intro-copy h2,
  .content-band h2 {
    font-size: 24px;
  }

  .intro-copy p,
  .content-band p {
    font-size: 18px;
  }
}

@media (max-width: 620px) {
  body {
    overflow-x: hidden;
  }

  .brand {
    gap: 14px;
  }

  .brand-mark {
    width: 82px;
    height: 112px;
  }

  .brand-copy {
    padding-top: 0;
  }

  .brand-name {
    font-size: 23px;
  }

  .brand-copy p {
    margin-top: 10px;
    font-size: 17px;
  }

  .site-nav {
    display: grid;
    grid-template-columns: max-content max-content;
    justify-content: start;
    gap: 10px 14px;
    max-width: min(342px, calc(100vw - 52px));
  }

  .site-nav a {
    flex: 0 0 auto;
    font-size: 16px;
    gap: 6px;
  }

  .site-nav a::before {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }

  .page-section {
    width: min(342px, calc(100vw - 48px));
    margin-right: 0;
    margin-left: 24px;
    padding-top: 72px;
  }

  .page-section p {
    max-width: 100%;
  }

  .hero {
    padding: 56px 24px 66px;
  }

  .hero-lockup {
    width: 100%;
  }

  .hero-title-row {
    flex-direction: column;
    gap: 18px;
  }

  .home-suite {
    flex-direction: column;
    gap: 8px;
  }

  .home-suite::before {
    top: 50%;
    left: 0;
    right: 0;
    width: auto;
    height: 1px;
    transform: translateY(-50%);
  }

  h1 {
    font-size: 60px;
  }

  .pike-mark {
    width: 112px;
    height: 112px;
  }

  .scheme-name {
    margin-top: 16px;
    padding-left: 0;
    font-size: 42px;
  }

  .intro-copy {
    width: min(100%, 342px);
    max-width: calc(100vw - 48px);
    margin-right: auto;
    margin-left: 0;
    margin-top: 50px;
  }

  .intro-copy h2,
  .content-band h2 {
    font-size: 22px;
  }

  .intro-copy p,
  .content-band p {
    font-size: 16px;
  }

  .content-band {
    padding: 52px 22px;
  }
}
