@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700&family=Barlow:wght@300;400;500;600;700&display=swap');

:root {
  --ink: #000000;
  --paper: #ffffff;
  --edge: #000000;
  --cond: "Barlow Condensed", "Arial Narrow", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --sans: Barlow, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

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

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

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

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

/* ---------- header ---------- */
.top {
  position: relative;
  z-index: 30;
  background: var(--paper);
  border-bottom: 1px solid var(--edge);
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 1rem;
  padding: 0.9rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--edge);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--cond);
  font-weight: 700;
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  letter-spacing: -0.02em;
}

.mark-box {
  display: block;
  width: 14px;
  height: 14px;
  background: var(--ink);
  flex: none;
  transition: transform 0.25s ease;
}

.mark:hover .mark-box { transform: rotate(45deg) scale(1.15); }

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

.search input {
  width: min(46vw, 220px);
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
}

.search input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -3px;
}

.search button {
  min-height: 44px;
  padding: 0 0.9rem;
  border: 0;
  border-left: 1px solid var(--edge);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--cond);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.search button:hover { background: var(--paper); color: var(--ink); }

.menu { background: var(--ink); color: var(--paper); }

.menu p {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0.1rem clamp(0.5rem, 3.4vw, 2.6rem);
}

.m-link {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0.6rem 0.7rem;
  color: var(--paper);
  text-decoration: none;
  font-family: var(--cond);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  border-bottom: 3px solid transparent;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.m-link:hover { border-bottom-color: var(--paper); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 45vh;
  padding: clamp(3.6rem, 8vw, 6rem) clamp(1rem, 4vw, 3rem) clamp(2.6rem, 6vw, 4rem);
  text-align: center;
  border-bottom: 1px solid var(--edge);
}

.badge {
  position: absolute;
  top: 1rem;
  right: clamp(1rem, 4vw, 3rem);
  margin: 0;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--edge);
  border-radius: 4px;
  font-family: var(--cond);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  animation: rise 0.6s ease-out both;
}

.hero h1 {
  margin: 0;
  max-width: 16ch;
  font-family: var(--cond);
  font-weight: 700;
  font-size: clamp(3rem, 11vw, 8.5rem);
  line-height: 0.9;
  letter-spacing: -0.05em;
  animation: rise 0.75s 0.06s ease-out both;
}

.lede {
  margin: 1.6rem 0 0;
  max-width: 52ch;
  font-size: 1rem;
  line-height: 1.7;
  animation: rise 0.75s 0.14s ease-out both;
}

/* ---------- body ---------- */
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem);
}

.cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  padding: clamp(2.2rem, 5vw, 4rem) 0;
}

.prose article[id] {
  scroll-margin-top: 7rem;
  padding: clamp(2.2rem, 4vw, 3.2rem) 0;
  border-top: 1px solid var(--edge);
}

.prose article[id]:first-child {
  padding-top: 0;
  border-top: 0;
}

.prose h2,
.prose h3 {
  font-family: var(--cond);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  margin: 0 0 1rem;
}

.prose h2 { font-size: clamp(2rem, 5vw, 3.4rem); }

.prose h3 { font-size: clamp(1.4rem, 3.2vw, 2.1rem); margin-top: 2rem; }

.prose h2 span,
.prose h3 span { display: inline-block; }

.prose p { max-width: 70ch; margin: 0 0 1.1rem; }

.prose ul,
.prose ol { max-width: 70ch; margin: 0 0 1.2rem; padding-left: 1.2rem; }

.prose li { margin: 0 0 0.5rem; }

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

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.prose blockquote {
  margin: 0 0 1.2rem;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 4px solid var(--edge);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.2rem;
  font-size: 1rem;
}

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

/* ---------- aside ---------- */
.side {
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 1.25rem;
  align-self: start;
}

.side h2 {
  font-family: var(--cond);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  margin: 0 0 0.8rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--edge);
}

.side h2 + * { margin-bottom: 0; }

.side > * + h2 { margin-top: 1.6rem; }

.side-nav {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.s-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--edge);
  border-radius: 4px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  animation: rise 0.5s ease-out both;
}

.s-nav .s-link:nth-child(2),
.side-nav .s-link:nth-child(2) { animation-delay: 0.04s; }
.side-nav .s-link:nth-child(3) { animation-delay: 0.08s; }
.side-nav .s-link:nth-child(4) { animation-delay: 0.12s; }
.side-nav .s-link:nth-child(5) { animation-delay: 0.16s; }
.side-nav .s-link:nth-child(6) { animation-delay: 0.2s; }
.side-nav .s-link:nth-child(7) { animation-delay: 0.24s; }

.s-link:hover {
  background: var(--ink);
  color: var(--paper);
  transform: translateX(3px);
}

.side-top { margin: 0; }

.to-top {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--edge);
  border-radius: 4px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.2rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.to-top:hover { background: var(--ink); color: var(--paper); }

/* ---------- footer ---------- */
.foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.1rem;
  padding: clamp(2.2rem, 5vw, 3.5rem) clamp(1rem, 4vw, 3rem) 2rem;
  border-top: 1px solid var(--edge);
}

.foot-brand {
  margin: 0;
  font-family: var(--cond);
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
  margin: 0;
}

.f-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
}

.f-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.foot-desc { margin: 0; max-width: 46ch; font-size: 1rem; }

.foot-copy,
.foot-top { display: block; font-size: 1rem; }

.foot-top a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
}

.foot-top a:hover { text-decoration: underline; text-underline-offset: 4px; }

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

/* ---------- breakpoints ---------- */
@media (min-width: 820px) {
  .top { position: sticky; top: 0; }
}

@media (min-width: 900px) {
  .cols {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 4rem;
  }

  .side { position: sticky; top: 1.5rem; }
}

@media (min-width: 760px) {
  .foot {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    column-gap: 3rem;
  }

  .foot-brand { grid-area: 1 / 1; }
  .foot-links { grid-area: 1 / 2; justify-content: flex-end; }
  .foot-desc { grid-area: 2 / 1; }
  .foot-copy { grid-area: 3 / 1; }
  .foot-top { grid-area: 3 / 2; text-align: right; }
}

@media (max-width: 420px) {
  .search { flex: 1 1 100%; }
  .search input { width: 100%; flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
}

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