:root {
  --color-night: #060A14;
  --color-rail: #0C1424;
  --color-panel: #16223A;
  --color-orange: #FF6A2B;
  --color-paper: #F2F5FA;
  --color-body: #D6DEEA;
  --color-muted: #8C99AD;
  --color-line: #2A3852;
  --color-cyan: #3FD6C4;
  --color-violet: #6B4BD6;
  --color-warm: #E8E2D6;
  --color-warm-ink: #14171F;
  --font-display: "Arial Narrow", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", Georgia, serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --rail-w: 88px;
  --mobile-bar: 64px;
  --max-content: 1180px;
  --shadow-card: 0 18px 44px rgba(0, 0, 0, 0.26);
  --shadow-lift: 0 24px 58px rgba(0, 0, 0, 0.34);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  padding-left: var(--rail-w);
  background-color: var(--color-night);
  background-image:
    radial-gradient(circle at 88% 4%, rgba(107, 75, 214, 0.14), transparent 28rem),
    radial-gradient(circle at 10% 80%, rgba(63, 214, 196, 0.05), transparent 24rem),
    linear-gradient(rgba(42, 56, 82, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 56, 82, 0.16) 1px, transparent 1px);
  background-size: auto, auto, 72px 72px, 72px 72px;
  color: var(--color-body);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body,
button,
input,
textarea,
select {
  font-family: var(--font-body);
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
}

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

img {
  height: auto;
}

button {
  font: inherit;
}

a {
  color: var(--color-cyan);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

::selection {
  background: var(--color-orange);
  color: #0A0F18;
}

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 4px;
}

#main-content {
  display: block;
  min-height: 60vh;
}

#main-content:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: -2px;
}

[id] {
  scroll-margin-top: 24px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: calc(var(--rail-w) + 12px);
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px solid var(--color-orange);
  background: var(--color-orange);
  color: #0A0F18;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 180ms var(--ease-out);
}

.skip-link:focus {
  color: #0A0F18;
  transform: translateY(0);
}

/* Header rail */
.site-header {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  width: var(--rail-w);
  padding: 20px 0 18px;
  border-right: 1px solid var(--color-line);
  background:
    linear-gradient(180deg, rgba(12, 20, 36, 0.97), rgba(6, 10, 20, 0.99)),
    radial-gradient(circle at 50% 0%, rgba(255, 106, 43, 0.06), transparent 60%);
  color: var(--color-paper);
}

.site-header::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 112px;
  background: linear-gradient(var(--color-orange), transparent);
  opacity: 0.9;
}

.rail-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 0 8px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--color-paper);
  text-decoration: none;
}

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

.brand-mark {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-line);
  background:
    linear-gradient(90deg, transparent 49%, rgba(63, 214, 196, 0.35) 50%, transparent 51%),
    linear-gradient(transparent 49%, rgba(63, 214, 196, 0.35) 50%, transparent 51%),
    rgba(22, 34, 58, 0.48);
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255, 106, 43, 0.76);
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: var(--color-orange);
  box-shadow: 0 0 0 4px rgba(255, 106, 43, 0.12);
  transform: translate(-50%, -50%);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.brand-name {
  color: var(--color-paper);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-sub {
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  line-height: 1.2;
  white-space: nowrap;
}

.nav-toggle {
  position: relative;
  display: none;
  place-items: center;
  width: 44px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--color-line);
  border-radius: 2px;
  background: rgba(22, 34, 58, 0.6);
  color: var(--color-paper);
  cursor: pointer;
  transition: border-color 180ms var(--ease-out), color 180ms var(--ease-out), background 180ms var(--ease-out);
}

.nav-toggle:hover {
  border-color: rgba(255, 106, 43, 0.55);
  color: var(--color-orange);
}

.nav-toggle[aria-expanded="true"] {
  border-color: rgba(255, 106, 43, 0.7);
  background: rgba(255, 106, 43, 0.08);
  color: var(--color-orange);
}

.nav-toggle-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 18px;
}

.nav-toggle-box span {
  display: block;
  width: 100%;
  height: 1px;
  background: currentColor;
  transition: transform 180ms var(--ease-out), opacity 180ms var(--ease-out);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-box span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-box span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-box span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

.nav-toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.site-nav {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  padding: 24px 8px;
  overflow-y: auto;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  list-style: none;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 4px;
  border: 1px solid transparent;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  transition: color 180ms var(--ease-out), background 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.nav-link::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -1px;
  width: 2px;
  height: 20px;
  background: var(--color-orange);
  transform: translateY(-50%) scaleY(0);
  transform-origin: center;
  transition: transform 180ms var(--ease-out);
}

.nav-link:hover {
  border-color: rgba(42, 56, 82, 0.7);
  background: rgba(22, 34, 58, 0.56);
  color: var(--color-paper);
}

.nav-link[aria-current="page"] {
  border-color: rgba(42, 56, 82, 0.65);
  background: linear-gradient(90deg, rgba(255, 106, 43, 0.15), transparent);
  color: var(--color-paper);
}

.nav-link[aria-current="page"]::before {
  transform: translateY(-50%) scaleY(1);
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px 0;
  border-top: 1px solid var(--color-line);
}

.header-actions-coord {
  margin-bottom: 2px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  line-height: 1.2;
  opacity: 0.75;
  writing-mode: vertical-rl;
  height: 64px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--color-line);
  border-radius: 2px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms var(--ease-out), border-color 180ms var(--ease-out), background 180ms var(--ease-out), box-shadow 180ms var(--ease-out), color 180ms var(--ease-out);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn--primary {
  border-color: var(--color-orange);
  background: var(--color-orange);
  color: #0A0F18;
  box-shadow: 0 8px 22px rgba(255, 106, 43, 0.14);
}

.btn--primary:hover {
  border-color: #FF8A55;
  background: #FF8A55;
  color: #0A0F18;
  box-shadow: 0 12px 26px rgba(255, 106, 43, 0.22);
}

.btn--ghost {
  background: rgba(22, 34, 58, 0.48);
  color: var(--color-paper);
}

.btn--ghost:hover {
  border-color: rgba(63, 214, 196, 0.45);
  background: rgba(22, 34, 58, 0.82);
  color: var(--color-paper);
}

.btn--rail {
  width: 100%;
  max-width: 72px;
  min-height: 38px;
  padding: 8px 4px;
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.scroll-progress {
  --scroll-progress: 0;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 280;
  width: 3px;
  background: rgba(42, 56, 82, 0.34);
  pointer-events: none;
}

.scroll-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, var(--color-cyan), var(--color-orange));
  transform: scaleY(var(--scroll-progress));
  transform-origin: top center;
  will-change: transform;
}

.to-top {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 320;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--color-line);
  border-radius: 2px;
  background: rgba(12, 20, 36, 0.9);
  color: var(--color-paper);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 180ms var(--ease-out), visibility 180ms var(--ease-out), transform 180ms var(--ease-out), border-color 180ms var(--ease-out), color 180ms var(--ease-out);
  backdrop-filter: blur(10px);
}

.to-top[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.to-top:hover {
  border-color: rgba(255, 106, 43, 0.7);
  color: var(--color-orange);
}

.to-top-text {
  margin-top: -3px;
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1;
}

/* Footer coordinate bed */
.site-footer {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--color-line);
  background:
    radial-gradient(circle at 78% 10%, rgba(107, 75, 214, 0.13), transparent 24rem),
    linear-gradient(180deg, var(--color-rail), #070B14 74%);
  color: var(--color-body);
}

.footer-bed {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(42, 56, 82, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 56, 82, 0.24) 1px, transparent 1px);
  background-size: 88px 88px;
  opacity: 0.42;
}

.footer-bed::after {
  content: "";
  position: absolute;
  top: 0;
  right: 8%;
  width: 1px;
  height: 100%;
  background: linear-gradient(transparent, rgba(63, 214, 196, 0.34), transparent);
}

.footer-inner {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 48px), var(--max-content));
  margin-inline: auto;
  padding: 68px 0 24px;
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr);
  gap: clamp(36px, 6vw, 76px);
  align-items: start;
}

.footer-brand-block {
  position: relative;
  padding-left: 24px;
}

.footer-brand-block::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 0;
  width: 2px;
  height: 74px;
  background: linear-gradient(var(--color-orange), transparent);
}

.footer-brand {
  display: inline-block;
  color: var(--color-paper);
  font-family: var(--font-serif);
  font-size: clamp(34px, 4.4vw, 54px);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-decoration: none;
}

.footer-brand:hover {
  color: var(--color-paper);
}

.footer-tagline {
  max-width: 20em;
  margin-top: 18px;
  color: var(--color-paper);
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.8vw, 21px);
  line-height: 1.7;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 20px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

.coord {
  color: var(--color-cyan);
}

.footer-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(22px, 4vw, 42px);
}

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

.footer-column--contact {
  min-width: 0;
}

.footer-heading {
  margin-bottom: 18px;
  color: var(--color-orange);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.footer-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  list-style: none;
}

.footer-link {
  display: inline-flex;
  color: var(--color-body);
  font-size: 14px;
  line-height: 1.6;
  text-decoration: none;
  transition: color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.footer-link:hover {
  color: var(--color-paper);
  transform: translateX(4px);
}

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

.footer-contact-line {
  color: var(--color-body);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.footer-label {
  display: block;
  margin-bottom: 2px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  line-height: 1.4;
}

.footer-address {
  color: var(--color-muted);
  font-style: normal;
}

.footer-coordinate {
  position: absolute;
  right: -0.04em;
  bottom: 40px;
  z-index: 0;
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 9rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 0.8;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.34;
  -webkit-text-stroke: 1px rgba(140, 153, 173, 0.28);
}

.footer-bottom {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
  margin-top: clamp(48px, 7vw, 86px);
  padding-top: 20px;
  border-top: 1px solid var(--color-line);
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.footer-legal-link {
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.5;
  text-decoration: none;
  transition: color 180ms var(--ease-out);
}

.footer-legal-link:hover {
  color: var(--color-orange);
}

.footer-copyright {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  line-height: 1.5;
}

.footer-icp {
  color: var(--color-muted);
}

/* Shared content primitives */
.container {
  width: min(calc(100% - 48px), var(--max-content));
  margin-inline: auto;
}

.section {
  position: relative;
  padding-block: clamp(56px, 8vw, 112px);
}

.section--tight {
  padding-block: clamp(36px, 5vw, 64px);
}

.grid {
  display: grid;
  gap: clamp(16px, 2.4vw, 30px);
}

.grid--12 {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.card {
  position: relative;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid var(--color-line);
  border-radius: 2px;
  background:
    linear-gradient(145deg, rgba(22, 34, 58, 0.86), rgba(12, 20, 36, 0.92)),
    radial-gradient(circle at 100% 0%, rgba(63, 214, 196, 0.08), transparent 60%);
  box-shadow: var(--shadow-card);
  transition: transform 180ms var(--ease-out), border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.card:hover,
.card:focus-within {
  border-color: rgba(255, 106, 43, 0.42);
  box-shadow: var(--shadow-lift);
  transform: translateY(-4px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--color-orange);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--color-orange);
}

.display-title {
  color: var(--color-paper);
  font-family: var(--font-display);
  font-size: clamp(42px, 8vw, 92px);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1.02;
  text-wrap: balance;
}

.section-title {
  color: var(--color-paper);
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1.16;
  text-wrap: balance;
}

.lede {
  max-width: 62ch;
  color: var(--color-body);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.8;
}

.mono-label {
  color: var(--color-cyan);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  list-style: none;
}

.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  color: var(--color-line);
}

.breadcrumbs a {
  color: var(--color-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--color-orange);
}

.media-frame {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: 2px;
  background:
    linear-gradient(135deg, rgba(22, 34, 58, 0.78), rgba(6, 10, 20, 0.94)),
    linear-gradient(rgba(42, 56, 82, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 56, 82, 0.35) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
  aspect-ratio: 16 / 9;
}

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 106, 43, 0.16), transparent 18%),
    linear-gradient(135deg, transparent 56%, rgba(255, 106, 43, 0.06));
}

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

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

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

.media-frame__caption {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.chapter-rail {
  position: sticky;
  top: 32px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-left: 15px;
  border-left: 1px solid var(--color-line);
}

.chapter-link {
  position: relative;
  display: block;
  padding: 6px 0;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.5;
  text-decoration: none;
  transition: color 180ms var(--ease-out);
}

.chapter-link::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -16px;
  width: 2px;
  height: 14px;
  background: var(--color-orange);
  transform: translateY(-50%) scaleY(0);
  transition: transform 180ms var(--ease-out);
}

.chapter-link:hover {
  color: var(--color-paper);
}

.chapter-link[aria-current="location"] {
  color: var(--color-paper);
}

.chapter-link[aria-current="location"]::before {
  transform: translateY(-50%) scaleY(1);
}

.paper-panel {
  padding: clamp(24px, 5vw, 64px);
  border: 1px solid #C9C1B2;
  background:
    linear-gradient(90deg, rgba(20, 23, 31, 0.04) 1px, transparent 1px),
    var(--color-warm);
  background-size: 40px 40px;
  color: var(--color-warm-ink);
}

.paper-panel a {
  color: #873713;
}

.paper-panel a:hover {
  color: #4D1D08;
}

@media (min-width: 861px) and (max-height: 760px) {
  .site-header {
    padding-top: 14px;
    padding-bottom: 12px;
  }

  .rail-head {
    gap: 12px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand-sub,
  .header-actions-coord {
    display: none;
  }

  .site-nav {
    padding-block: 14px;
  }

  .nav-link {
    min-height: 37px;
    font-size: 11px;
  }

  .btn--rail {
    min-height: 34px;
  }
}

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

  .footer-columns {
    max-width: 760px;
  }
}

@media (max-width: 860px) {
  body {
    padding-left: 0;
    padding-top: var(--mobile-bar);
    background-size: auto, auto, 48px 48px, 48px 48px;
  }

  [id] {
    scroll-margin-top: calc(var(--mobile-bar) + 22px);
  }

  .skip-link {
    left: 12px;
  }

  .site-header {
    inset: 0 0 auto 0;
    width: 100%;
    height: var(--mobile-bar);
    padding: 0 16px;
    border-right: 0;
    border-bottom: 1px solid var(--color-line);
    background: rgba(6, 10, 20, 0.94);
    backdrop-filter: blur(16px);
  }

  .site-header::after {
    display: none;
  }

  .rail-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    gap: 16px;
  }

  .brand {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand-copy {
    align-items: flex-start;
    gap: 0;
  }

  .brand-name {
    font-size: 14px;
    letter-spacing: 0.08em;
  }

  .brand-sub {
    font-size: 8px;
  }

  .nav-toggle {
    display: inline-grid;
    flex: 0 0 auto;
  }

  .site-nav {
    position: fixed;
    inset: var(--mobile-bar) 0 0 0;
    z-index: 250;
    display: block;
    padding: 20px 18px 190px;
    overflow-y: auto;
    border-top: 1px solid var(--color-line);
    background:
      radial-gradient(circle at 80% 10%, rgba(107, 75, 214, 0.13), transparent 22rem),
      linear-gradient(rgba(42, 56, 82, 0.18) 1px, transparent 1px),
      linear-gradient(90deg, rgba(42, 56, 82, 0.18) 1px, transparent 1px),
      rgba(6, 10, 20, 0.985);
    background-size: auto, 48px 48px, 48px 48px, auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 180ms var(--ease-out), visibility 180ms var(--ease-out), transform 180ms var(--ease-out);
  }

  .site-header[data-open="true"] .site-nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-list {
    width: min(100%, 460px);
    margin-inline: auto;
    gap: 0;
  }

  .nav-link {
    justify-content: space-between;
    min-height: 58px;
    padding: 13px 4px;
    border: 0;
    border-bottom: 1px solid var(--color-line);
    background: transparent;
    color: var(--color-paper);
    font-size: 18px;
    letter-spacing: 0.04em;
    text-align: left;
  }

  .nav-link::before {
    top: 50%;
    right: 2px;
    left: auto;
    width: 22px;
    height: 2px;
    transform: translateY(-50%) scaleX(0);
    transform-origin: right center;
  }

  .nav-link:hover {
    border-color: var(--color-line);
    background: rgba(22, 34, 58, 0.4);
  }

  .nav-link[aria-current="page"] {
    border-color: var(--color-line);
    background: transparent;
    color: var(--color-orange);
  }

  .nav-link[aria-current="page"]::before {
    transform: translateY(-50%) scaleX(1);
  }

  .header-actions {
    position: fixed;
    right: 14px;
    bottom: 76px;
    left: auto;
    z-index: 330;
    width: 74px;
    padding: 0;
    border: 0;
    gap: 8px;
    transition: opacity 180ms var(--ease-out), visibility 180ms var(--ease-out), transform 180ms var(--ease-out);
  }

  .header-actions-coord {
    display: none;
  }

  .btn--rail {
    width: 74px;
    max-width: none;
    min-height: 40px;
    padding: 7px 4px;
    font-size: 11px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  }

  .site-header[data-open="true"] .header-actions {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px);
  }

  .scroll-progress {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: 2px;
  }

  .scroll-progress span {
    width: 100%;
    height: 100%;
    transform: scaleX(var(--scroll-progress));
    transform-origin: left center;
  }

  .to-top {
    right: 16px;
    bottom: 18px;
    width: 42px;
    height: 42px;
  }

  .footer-inner {
    width: min(calc(100% - 36px), var(--max-content));
    padding-top: 48px;
  }

  .footer-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px;
  }

  .footer-column--contact {
    grid-column: 1 / -1;
  }

  .footer-coordinate {
    bottom: 72px;
    font-size: clamp(2.4rem, 12vw, 5rem);
    opacity: 0.25;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
    margin-top: 52px;
  }

  .chapter-rail {
    position: static;
    flex-direction: row;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
    border-top: 1px solid var(--color-line);
    border-left: 0;
    white-space: nowrap;
  }

  .chapter-link {
    padding: 4px 0;
  }

  .chapter-link::before {
    top: auto;
    right: auto;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    transform: scaleX(0);
    transform-origin: left center;
  }

  .chapter-link[aria-current="location"]::before {
    transform: scaleX(1);
  }
}

@media (max-width: 640px) {
  .container {
    width: min(calc(100% - 32px), var(--max-content));
  }

  .grid--12 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .footer-brand-block {
    padding-left: 16px;
  }

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

  .footer-column--contact {
    grid-column: auto;
  }

  .footer-legal {
    gap: 10px 18px;
  }

  .footer-copyright {
    flex-direction: column;
    gap: 4px;
  }

  .media-frame,
  .media-frame--wide {
    aspect-ratio: 4 / 3;
  }

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

@media (max-width: 380px) {
  .brand-sub {
    display: none;
  }

  .header-actions {
    right: 10px;
  }

  .btn--rail {
    width: 68px;
    font-size: 10px;
  }
}

@media (max-width: 860px) {
  html.nav-open,
  html.nav-open body {
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .card:hover,
  .card:focus-within,
  .btn:hover,
  .footer-link:hover {
    transform: none;
  }
}
