:root {
  --color-bg: #fff9e9;
  --color-panel: #e8d5aa;
  --color-panel-soft: #f5e8c9;
  --color-border: #a98a62;
  --color-accent: #795233;
  --color-accent-dark: #52351f;
  --color-text: #30271f;
  --color-text-muted: #756557;
  --color-success: #4e744c;
  --color-warn: #a66f18;
  --color-error: #c7352b;
  --color-brass: #c69a43;
  --color-brass-light: #e2be68;
  --color-rail: #45413c;
  --color-rail-light: #6e665d;
  --color-sleeper: #68492f;
  --color-stone: #b8a887;
  --color-roof: #934c35;
  --color-paper-grain: rgba(82, 53, 31, 0.055);
  --color-paper-line: rgba(121, 82, 51, 0.08);
  --color-backdrop: rgba(48, 39, 31, 0.48);
  --color-transparent: transparent;
  --color-white: #ffffff;
  --color-cream: #fff3d3;
  --color-green-soft: #9bb98b;
  --color-green-dark: #365a38;
  --color-sky: #b8d6d0;
  --color-window: #dde9d6;
  --font-display: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --radius-xs: 5px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 26px;
  --radius-pill: 999px;
  --border-thin: 1px;
  --border-medium: 2px;
  --border-heavy: 7px;
  --page-width: 1360px;
  --reading-width: 820px;
  --header-height: 82px;
  --gutter: 32px;
  --section-space: 96px;
  --transition-fast: 160ms ease;
  --transition-slow: 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  min-width: 0;
  scroll-behavior: smooth;
  background: var(--color-bg);
}

html.nav-open {
  overflow: hidden;
}

body {
  min-width: 0;
  margin: 0;
  overflow-x: clip;
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle at 12% 18%, var(--color-paper-grain) 0 1px, var(--color-transparent) 1.3px),
    radial-gradient(circle at 72% 58%, var(--color-paper-grain) 0 0.8px, var(--color-transparent) 1.2px),
    repeating-linear-gradient(7deg, var(--color-transparent) 0 12px, var(--color-paper-line) 12px 13px, var(--color-transparent) 13px 26px);
  background-size: 19px 19px, 23px 23px, 100% 100%;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main,
section,
article,
aside,
nav,
header,
footer,
div,
figure {
  min-width: 0;
}

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

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

button,
a {
  -webkit-tap-highlight-color: var(--color-transparent);
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
ul,
ol,
figure,
blockquote {
  margin-top: 0;
}

p {
  margin-bottom: 1.15em;
}

ul,
ol {
  padding-left: 1.35em;
}

h1,
h2,
h3,
h4 {
  color: var(--color-accent-dark);
  font-family: var(--font-display);
  text-wrap: balance;
}

h1 {
  margin: 0;
  font-size: clamp(3.25rem, 6vw, 4.875rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.065em;
}

h2 {
  margin: 0 0 22px;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

h3 {
  margin: 0 0 14px;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  font-weight: 800;
  line-height: 1.35;
}

h4 {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 800;
}

strong {
  font-weight: 800;
}

small {
  color: var(--color-text-muted);
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
}

:not(pre) > code {
  padding: 0.12em 0.38em;
  border: var(--border-thin) solid var(--color-border);
  border-radius: var(--radius-xs);
  background: var(--color-panel-soft);
  overflow-wrap: anywhere;
  word-break: break-word;
}

pre {
  max-width: 100%;
  margin: 22px 0;
  padding: 18px 20px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: var(--border-medium) solid var(--color-accent-dark);
  border-radius: var(--radius-sm);
  color: var(--color-cream);
  background: var(--color-accent-dark);
  font-size: 0.875rem;
  line-height: 1.7;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
}

pre code {
  padding: 0;
  border: 0;
  background: none;
  overflow-wrap: normal;
  word-break: normal;
}

hr {
  margin: 38px 0;
  border: 0;
  border-top: var(--border-thin) dashed var(--color-border);
}

::selection {
  color: var(--color-white);
  background: var(--color-accent);
}

:focus-visible {
  outline: var(--border-medium) solid var(--color-error);
  outline-offset: 3px;
}

.wrap {
  width: 100%;
  max-width: calc(var(--page-width) + (var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.reading-wrap {
  width: 100%;
  max-width: calc(var(--reading-width) + (var(--gutter) * 2));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-top: var(--section-space);
  padding-bottom: var(--section-space);
  overflow-x: clip;
}

.section-soft {
  border-block: var(--border-thin) solid var(--color-border);
  background: var(--color-panel-soft);
}

.section-heading {
  max-width: 760px;
  margin-bottom: 42px;
}

.section-kicker,
.eyebrow {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 18px;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-kicker::before,
.eyebrow::before {
  width: 36px;
  height: 3px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--color-error);
  content: "";
}

.lead {
  max-width: 720px;
  color: var(--color-text-muted);
  font-size: 1.08rem;
  line-height: 1.85;
}

.muted {
  color: var(--color-text-muted);
}

.mono {
  font-family: var(--font-mono);
}

.title-accent,
.text-error {
  color: var(--color-error);
}

.text-success {
  color: var(--color-success);
}

.actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 13px;
}

.button {
  min-height: 54px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border: var(--border-medium) solid var(--color-accent-dark);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  transition: transform var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

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

.button:active {
  transform: translateY(0);
}

.button-primary {
  color: var(--color-white);
  border-color: var(--color-accent-dark);
  background: var(--color-error);
}

.button-primary:hover {
  background: var(--color-accent-dark);
}

.button-secondary {
  color: var(--color-accent-dark);
  background: var(--color-panel-soft);
}

.button-secondary:hover {
  background: var(--color-panel);
}

.button-quiet {
  min-height: 44px;
  color: var(--color-accent-dark);
  border-style: dashed;
  background: var(--color-bg);
}

.button[disabled],
.button.is-disabled {
  cursor: not-allowed;
  color: var(--color-text-muted);
  border-color: var(--color-border);
  background: var(--color-panel);
  transform: none;
}

.button svg,
.inline-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel,
.card {
  min-width: 0;
  border: var(--border-medium) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.panel {
  padding: clamp(20px, 3vw, 34px);
}

.card {
  padding: 24px;
  transition: border-color var(--transition-fast), transform var(--transition-fast), background-color var(--transition-fast);
}

.card:hover {
  border-color: var(--color-accent);
  background: var(--color-panel-soft);
}

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

.chip-row,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.chip,
.badge {
  max-width: 100%;
  min-height: 30px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  border: var(--border-thin) solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  background: var(--color-bg);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.chip-dot,
.status-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-success);
}

.badge-recommended {
  color: var(--color-white);
  border-color: var(--color-success);
  background: var(--color-success);
}

.badge-primary {
  color: var(--color-white);
  border-color: var(--color-error);
  background: var(--color-error);
}

.badge-archived {
  color: var(--color-accent-dark);
  border-color: var(--color-warn);
  background: var(--color-brass-light);
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: var(--border-medium) solid var(--color-border);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  background: var(--color-bg);
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: var(--border-thin) solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--color-accent-dark);
  background: var(--color-panel);
  font-size: 0.875rem;
  font-weight: 800;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.tilt,
.tilt-card {
  transform: rotate(-0.35deg);
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal.shown {
  opacity: 1;
  transform: none;
}

.site-header {
  position: relative;
  z-index: 100;
  height: var(--header-height);
  border-bottom: var(--border-thin) solid var(--color-border);
  background: var(--color-bg);
}

.header-inner {
  width: 100%;
  max-width: calc(var(--page-width) + (var(--gutter) * 2));
  height: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  color: var(--color-text);
  font-size: 1.18rem;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.brand-logo {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.desktop-nav {
  height: 100%;
  margin-left: auto;
  display: flex;
  align-items: stretch;
  gap: 30px;
}

.nav-link {
  position: relative;
  height: 100%;
  display: inline-flex;
  align-items: center;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  font-weight: 650;
  white-space: nowrap;
}

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

.nav-link[aria-current="page"]::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 4px;
  border-radius: var(--radius-pill) var(--radius-pill) 0 0;
  background: var(--color-error);
  content: "";
}

.header-tools {
  position: relative;
  margin-left: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.language-button {
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: var(--border-thin) solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  background: var(--color-panel-soft);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.language-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 168px;
  padding: 7px;
  display: none;
  border: var(--border-medium) solid var(--color-accent-dark);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.language-menu.is-open {
  display: grid;
}

.language-menu a {
  min-height: 42px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-xs);
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.language-menu a:hover,
.language-menu a[aria-current="true"] {
  color: var(--color-accent-dark);
  background: var(--color-panel-soft);
}

.menu-toggle {
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  display: none;
  place-items: center;
  border: var(--border-thin) solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-panel-soft);
}

.menu-toggle-lines,
.menu-toggle-lines::before,
.menu-toggle-lines::after {
  width: 20px;
  height: 2px;
  display: block;
  background: var(--color-accent-dark);
  content: "";
  transition: transform var(--transition-fast);
}

.menu-toggle-lines {
  position: relative;
}

.menu-toggle-lines::before {
  position: absolute;
  top: -6px;
}

.menu-toggle-lines::after {
  position: absolute;
  top: 6px;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-lines {
  background: var(--color-transparent);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-lines::before {
  top: 0;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-lines::after {
  top: 0;
  transform: rotate(-45deg);
}

.mobile-drawer {
  position: fixed;
  z-index: 112;
  top: var(--header-height);
  right: 0;
  left: 0;
  max-height: calc(100dvh - var(--header-height));
  padding: 12px var(--gutter) 24px;
  display: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-bottom: var(--border-medium) solid var(--color-accent-dark);
  background: var(--color-bg);
}

.mobile-drawer.is-open {
  display: block;
}

.mobile-drawer a {
  width: 100%;
  min-height: 48px;
  padding: 11px 8px;
  display: flex;
  align-items: center;
  border-bottom: var(--border-thin) dashed var(--color-border);
  color: var(--color-text-muted);
  font-weight: 750;
}

.mobile-drawer a[aria-current="page"],
.mobile-drawer a[aria-current="true"] {
  color: var(--color-error);
}

.drawer-label {
  margin: 18px 8px 4px;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.nav-veil {
  position: fixed;
  z-index: 90;
  inset: var(--header-height) 0 0;
  display: none;
  border: 0;
  background: var(--color-backdrop);
}

.nav-veil.is-open {
  display: block;
}

.site-footer {
  border-top: var(--border-heavy) solid var(--color-accent-dark);
  background: var(--color-panel-soft);
}

.footer-main {
  padding-top: 58px;
  padding-bottom: 44px;
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(150px, 0.7fr) minmax(260px, 1.2fr) minmax(150px, 0.7fr);
  gap: 42px;
}

.footer-brand p {
  max-width: 360px;
  margin: 18px 0 0;
  color: var(--color-text-muted);
}

.footer-title {
  margin-bottom: 14px;
  color: var(--color-accent-dark);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.footer-links {
  display: grid;
  gap: 9px;
}

.footer-links a {
  width: fit-content;
  max-width: 100%;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.footer-links a:hover {
  color: var(--color-error);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer-bottom {
  padding-top: 19px;
  padding-bottom: 22px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-top: var(--border-thin) dashed var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.footer-bottom-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.prose {
  color: var(--color-text);
}

.prose h2 {
  margin-top: 2.2em;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.prose h3 {
  margin-top: 1.8em;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.prose a {
  color: var(--color-error);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.prose img {
  height: auto;
  margin-block: 28px;
  border: var(--border-medium) solid var(--color-border);
  border-radius: var(--radius-sm);
}

@media (max-width: 1100px) {
  .desktop-nav {
    gap: 18px;
  }

  .header-tools {
    margin-left: 18px;
  }

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

@media (max-width: 860px) {
  :root {
    --header-height: 70px;
    --gutter: 22px;
    --section-space: 72px;
  }

  .desktop-nav,
  .desktop-language {
    display: none;
  }

  .header-tools {
    margin-left: auto;
  }

  .menu-toggle {
    display: grid;
  }

  .footer-main {
    gap: 34px;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
    --section-space: 58px;
  }

  body {
    font-size: 15px;
  }

  h1 {
    font-size: clamp(2.8rem, 14vw, 4rem);
  }

  h2 {
    font-size: clamp(1.75rem, 9vw, 2.45rem);
  }

  .brand {
    gap: 9px;
    font-size: 1rem;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

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

  .button-row,
  .actions {
    align-items: stretch;
  }

  .button-row .button,
  .actions .button {
    flex: 1 1 100%;
  }

  .tilt,
  .tilt-card {
    transform: none;
  }

  .footer-main {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 44px;
  }

  .footer-bottom {
    flex-direction: column;
  }

  .data-table th,
  .data-table td {
    padding: 12px;
  }
}

@media (max-width: 360px) {
  .brand span:last-child {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

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

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

  .reveal {
    opacity: 1;
    transform: none;
  }
}