@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --ink: #000000;
  --paper: #ffffff;
  --dim: rgba(255, 255, 255, 0.66);
  --line: rgba(255, 255, 255, 0.24);
  --hair: rgba(255, 255, 255, 0.12);
  --max: 1200px;
  --sans: Inter, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --disp: "Space Grotesk", Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
}

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

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

p {
  margin: 0 0 1.1rem;
}

:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--disp);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.012em;
}

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

.skip {
  position: absolute;
  top: -3.4rem;
  left: 1rem;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.9rem;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  border-radius: 10px;
  font-size: 16px;
  transition: top 0.2s ease;
}

.skip:focus {
  top: 0.7rem;
}

/* masthead */

.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1.1rem;
  align-items: center;
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px 24px;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.brand-mark-rule {
  border: 1px solid var(--paper);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--disp);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  white-space: nowrap;
}

.primary {
  display: flex;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.primary::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 0.6rem;
  font-size: 16px;
  line-height: 1.2;
  color: var(--dim);
  text-decoration: none;
  white-space: nowrap;
  border-radius: 10px;
  transition: color 0.22s ease, background-color 0.22s ease;
}

.nav-link::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: currentColor;
}

.nav-link:hover,
.nav-link[aria-current] {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.09);
}

.search {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--paper);
  border-radius: 10px;
  overflow: hidden;
}

.search-input {
  width: 148px;
  height: 40px;
  padding: 0 0.7rem;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-btn {
  height: 40px;
  padding: 0 0.85rem;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--disp);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.22s ease;
}

.search-btn:hover {
  background: rgba(255, 255, 255, 0.82);
}

/* main shell */

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 2rem;
  align-items: center;
  min-height: 70vh;
  padding: 3.4rem 0 3rem;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  order: 2;
  text-align: right;
}

.hero-copy h1 {
  font-size: clamp(2.15rem, 4.6vw, 3.7rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin-bottom: 1.4rem;
}

.hero-lede {
  max-width: 44ch;
  margin: 0 0 0 auto;
  color: var(--dim);
  font-size: 17px;
  line-height: 1.65;
}

.hero-figure {
  order: 1;
  position: relative;
  margin: 0;
  min-height: 46vh;
}

.plate {
  position: absolute;
  overflow: hidden;
  background: #070707;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.plate-a {
  top: 0;
  left: 0;
  width: 62%;
  height: 80%;
  animation: rise 0.55s ease-out 0.05s both;
}

.plate-b {
  right: 0;
  bottom: 0;
  width: 54%;
  height: 56%;
  animation: rise 0.55s ease-out 0.18s both;
}

.plate-b::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  pointer-events: none;
}

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* content + rail */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 272px;
  gap: 3rem;
  align-items: start;
  padding: 3.4rem 0 4rem;
}

.prose {
  min-width: 0;
}

.prose > article {
  padding: 2.7rem 0;
}

.prose > article:first-child {
  padding-top: 0;
}

.prose > article.hit {
  outline: 2px solid var(--paper);
  outline-offset: 10px;
}

.prose h2 {
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  margin: 0 0 1rem;
}

.prose h2 > span {
  display: block;
  padding-top: 0.85rem;
  border-top: 2px solid var(--paper);
}

.prose h3 {
  font-size: 1.24rem;
  margin: 1.9rem 0 0.8rem;
}

.prose h3 > span {
  display: block;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}

.prose p,
.prose li {
  color: rgba(255, 255, 255, 0.86);
  max-width: 68ch;
}

.prose strong {
  color: var(--paper);
  font-weight: 600;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(255, 255, 255, 0.42);
  transition: text-decoration-color 0.22s ease;
}

.prose a:hover {
  text-decoration-color: var(--paper);
}

.prose ul,
.prose ol {
  margin: 0 0 1.2rem;
  padding-left: 1.3rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

.prose blockquote {
  margin: 1.7rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 2px solid var(--paper);
  color: var(--dim);
}

.prose figure {
  margin: 1.7rem 0;
}

.prose img {
  border-radius: 10px;
  border: 1px solid var(--hair);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  margin: 0 0 1.4rem;
}

.prose th,
.prose td {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--hair);
  text-align: left;
  vertical-align: top;
}

.prose th {
  font-family: var(--disp);
  font-weight: 600;
  color: var(--paper);
}

.prose code,
.prose kbd {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 0.08em 0.35em;
  border: 1px solid var(--hair);
  border-radius: 4px;
}

.rail {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 1.5rem;
}

.rail-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.1rem;
}

.rail-block h2 {
  font-size: 16px;
  letter-spacing: 0.08em;
  margin-bottom: 0.7rem;
}

.rail-block h2 > span {
  display: block;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: rail;
}

.rail-list li {
  display: grid;
  grid-template-columns: 2.2ch minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid var(--hair);
  counter-increment: rail;
  animation: rise 0.45s ease-out both;
}

.rail-list li:last-child {
  border-bottom: 0;
}

.rail-list li::before {
  content: counter(rail, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.42);
}

.rail-list li:nth-child(1) {
  animation-delay: 0.04s;
}

.rail-list li:nth-child(2) {
  animation-delay: 0.08s;
}

.rail-list li:nth-child(3) {
  animation-delay: 0.12s;
}

.rail-list li:nth-child(4) {
  animation-delay: 0.16s;
}

.rail-list li:nth-child(5) {
  animation-delay: 0.2s;
}

.rail-list li:nth-child(6) {
  animation-delay: 0.24s;
}

.rail-list li:nth-child(7) {
  animation-delay: 0.28s;
}

.rail-list a {
  display: flex;
  align-items: center;
  min-height: 40px;
  font-size: 16px;
  line-height: 1.3;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.rail-brand {
  font-family: var(--disp);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.rail-key {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--dim);
}

/* footer */

.colophon {
  border-top: 2px solid var(--paper);
  padding: 2.8rem 0 2rem;
}

.colophon-grid,
.colophon-base {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.colophon-grid {
  display: grid;
  grid-template-columns: 1.3fr 1.7fr 1fr 1fr;
  gap: 2rem;
}

.colophon-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.colophon-grid dl {
  margin: 0;
}

.colophon-grid dt {
  font-family: var(--disp);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.07em;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.colophon-grid dd {
  margin: 0;
  color: var(--dim);
  font-size: 16px;
  line-height: 1.5;
}

.colophon-nav dd a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.2s ease;
}

.colophon-nav dd a:hover {
  color: var(--paper);
}

.colophon-meta dd {
  color: var(--paper);
  margin-bottom: 0.8rem;
}

.colophon-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--hair);
  font-size: 16px;
  color: var(--dim);
}

.colophon-base p {
  margin: 0;
}

.totop {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.7rem;
  color: var(--paper);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: background-color 0.22s ease;
}

.totop:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* breakpoints */

@media (max-width: 980px) {
  .masthead {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand search"
      "primary primary";
    gap: 0.55rem 1rem;
    padding-bottom: 4px;
  }

  .brand {
    grid-area: brand;
  }

  .search {
    grid-area: search;
  }

  .primary {
    grid-area: primary;
    padding-bottom: 4px;
  }

  .search-input {
    width: 118px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    padding: 2rem 0 2.4rem;
    gap: 1.6rem;
  }

  .hero-copy {
    order: 1;
    text-align: left;
  }

  .hero-lede {
    margin-left: 0;
    max-width: none;
  }

  .hero-figure {
    order: 2;
    min-height: 62vw;
  }

  .split {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    padding: 2.4rem 0 3rem;
  }

  .rail {
    position: static;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
  }

  .colophon-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.6rem;
  }

  .colophon-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .masthead,
  main,
  .colophon-grid,
  .colophon-base {
    padding-left: 18px;
    padding-right: 18px;
  }

  .brand-link {
    font-size: 16px;
  }

  .search-input {
    width: 96px;
  }

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

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

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
  }
}

button[aria-expanded]{min-width:44px;min-height:44px}
