@charset "utf-8";

:root {
  --paper: #fafaf8;
  --paper-2: #f2f1ec;
  --graphite: #4a4a4a;
  --ink: #1a1a1a;
  --rule: #d4d2c9;
  --wrap: 68rem;
}

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

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

body {
  margin: 0;
  font-family: 'Atkinson Hyperlegible', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.78;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(26, 26, 26, .065) .5px, transparent .7px),
    repeating-linear-gradient(0deg, rgba(74, 74, 74, .028) 0 1px, transparent 1px 6px);
  background-size: 6px 6px, 100% 100%;
  overflow-x: hidden;
}

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

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

a:focus-visible,
button:focus-visible {
  outline: 2px dashed var(--ink);
  outline-offset: 3px;
}

/* ---------- 页头：品牌独占一行，菜单行在下 ---------- */

.masthead {
  padding: .5rem clamp(1rem, 4vw, 2.5rem) 0;
  border-bottom: 2px solid var(--ink);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(90deg, rgba(26, 26, 26, .035) 0 1px, transparent 1px 9px);
}

.brand-line {
  display: flex;
  align-items: center;
  padding: .2rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: .3rem .1rem;
  color: var(--ink);
  font-size: 1.16rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-decoration: none;
}

.brand-mark {
  color: var(--graphite);
  overflow: visible;
  transform: rotate(-6deg);
}

.brand:hover .brand-mark { transform: rotate(4deg); }

.brand-text { border-bottom: 2px solid var(--ink); }

.menu { padding: 0 0 .35rem; }

.menu p {
  display: flex;
  flex-wrap: wrap;
  gap: 0 .35rem;
  margin: 0;
}

.menu a {
  display: inline-block;
  min-height: 44px;
  padding: .55rem .55rem;
  color: var(--graphite);
  font-size: .98rem;
  line-height: 1.5;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.menu a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
  transform: rotate(-1.2deg);
}

/* ---------- 主体 ---------- */

main {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 2.5rem) 3rem;
}

.lede {
  display: grid;
  grid-template-columns: 11.5rem 8.5rem minmax(0, 1fr);
  grid-template-areas:
    "rail fig hero"
    "rail fig body"
    "rail .   body";
  gap: .5rem 1.5rem;
  align-items: start;
}

/* 左侧栏 */
.rail {
  grid-area: rail;
  padding: .2rem 1rem .2rem 0;
  border-right: 1px dashed var(--rule);
  font-size: .96rem;
}

.rail-title,
.foot-title {
  margin: 0 0 .55rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--graphite);
}

.rail-title > span,
.foot-title > span {
  display: inline-flex;
  align-items: center;
  padding-bottom: .2rem;
  border-bottom: 2px solid var(--graphite);
}

.tick {
  display: inline-block;
  width: .5em;
  height: .5em;
  margin-right: .45em;
  border: 1.6px solid var(--graphite);
  transform: rotate(14deg);
}

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

.rail-list li + li { margin-top: .1rem; }

.rail-list a {
  display: block;
  min-height: 40px;
  padding: .45rem .1rem;
  color: var(--graphite);
  text-decoration: none;
  border-bottom: 1px solid rgba(26, 26, 26, .12);
}

.rail-list a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
  transform: translateX(2px) rotate(-.5deg);
}

/* 手绘插画 */
.doodle {
  grid-area: fig;
  margin: 0;
  align-self: start;
  color: var(--graphite);
  position: relative;
  transform: rotate(-3.5deg);
  filter: contrast(1.05);
}

.doodle .sheet { opacity: .95; }

.doodle::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 38%;
  width: 52px;
  height: 16px;
  background: rgba(74, 74, 74, .13);
  transform: rotate(-8deg);
}

/* 主标题 */
.hero {
  grid-area: hero;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 42vh;
  padding: .5rem 0 1rem;
  text-align: right;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4.6vw, 3rem);
  line-height: 1.26;
  letter-spacing: .01em;
}

.hero h1::after {
  content: "";
  display: block;
  width: 8rem;
  height: 3px;
  margin: .85rem 0 0 auto;
  background: var(--ink);
  opacity: .7;
  transform: rotate(-1deg);
}

/* ---------- 正文 ---------- */

.prose { grid-area: body; min-width: 0; }

.prose > section,
.prose > article,
.prose > div {
  padding: 1.5rem 0 1.9rem;
  border-bottom: 1px dashed var(--rule);
}

.prose:last-child > section:last-child { border-bottom: 0; }

.prose section,
.prose [id] { scroll-margin-top: 1.25rem; }

.prose h2 {
  margin: 0 0 .85rem;
  font-size: clamp(1.32rem, 2.6vw, 1.72rem);
  line-height: 1.42;
}

.prose h2 > span {
  display: inline-block;
  padding-bottom: .18rem;
  background-image: linear-gradient(transparent 78%, rgba(26, 26, 26, .32) 78%);
  transform: rotate(-.35deg);
}

.prose h3 {
  margin: 1.6rem 0 .6rem;
  font-size: 1.16rem;
  line-height: 1.5;
}

.prose h3 > span { border-bottom: 1px dotted var(--graphite); }

.prose p { margin: 0 0 1rem; max-width: 42em; }

.prose ul,
.prose ol { margin: 0 0 1rem; padding-left: 1.4rem; }

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

.prose a {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.prose a:hover { background: rgba(26, 26, 26, .06); }

.prose blockquote {
  margin: 1.2rem 0;
  padding: .2rem 0 .2rem 1rem;
  border-left: 3px solid var(--graphite);
  color: var(--graphite);
}

.prose figure {
  margin: 1.2rem 0;
  padding: .4rem;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  transform: rotate(-.5deg);
}

.prose figure figcaption {
  font-size: .9rem;
  color: var(--graphite);
  padding-top: .3rem;
}

.prose aside {
  margin: 1.3rem 0;
  padding: .9rem 1rem;
  background: var(--paper-2);
  border: 1px dashed var(--graphite);
  transform: rotate(.4deg);
}

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

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: .97rem;
}

.prose th,
.prose td {
  border: 1px solid var(--rule);
  padding: .45rem .55rem;
  text-align: left;
}

.prose pre {
  overflow-x: auto;
  padding: .8rem;
  background: var(--paper-2);
  border: 1px solid var(--rule);
}

.prose code { font-size: .95em; }

.prose hr {
  border: 0;
  border-top: 1px dashed var(--rule);
  margin: 1.6rem 0;
}

/* ---------- 页脚 ---------- */

footer {
  border-top: 2px solid var(--ink);
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 1.2rem;
  background-color: var(--paper-2);
  background-image: repeating-linear-gradient(0deg, rgba(26, 26, 26, .035) 0 1px, transparent 1px 4px);
}

.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem 2rem;
  max-width: var(--wrap);
  margin: 0 auto;
}

.foot-brand address {
  font-style: normal;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding-bottom: .3rem;
  border-bottom: 2px solid var(--ink);
  display: inline-block;
  transform: rotate(-.6deg);
}

.foot-links ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
}

.foot-links a {
  display: inline-block;
  min-height: 44px;
  padding: .55rem 0;
  color: var(--graphite);
  text-decoration: none;
  border-bottom: 1px dashed var(--rule);
}

.foot-links a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.foot-end {
  max-width: var(--wrap);
  margin: 1.4rem auto 0;
  padding-top: .85rem;
  border-top: 1px dashed var(--rule);
  text-align: center;
  font-size: .92rem;
  color: var(--graphite);
}

.foot-end p { margin: 0; }

.to-top {
  display: inline-block;
  margin-left: .4rem;
  padding: .45rem .2rem;
  min-height: 40px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
}

/* ---------- 滚动显现（JS 加类，无 JS 也可读） ---------- */

.reveal {
  opacity: 0;
  transform: translateY(10px) rotate(-.4deg);
  transition: opacity .34s steps(4), transform .34s steps(4);
}

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

/* ---------- 窄屏 ---------- */

@media (max-width: 859px) {
  .lede {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "fig"
      "hero"
      "body"
      "rail";
    gap: .4rem 0;
  }

  .doodle {
    justify-self: end;
    width: 5.6rem;
    margin: .2rem .4rem 0 0;
  }

  .hero {
    min-height: 0;
    justify-content: flex-start;
    text-align: left;
    padding: .4rem 0 .9rem;
  }

  .hero h1::after { margin: .7rem 0 0 0; width: 6rem; }

  .rail {
    margin-top: 1.4rem;
    padding: 1rem 0 0;
    border-right: 0;
    border-top: 1px dashed var(--rule);
  }

  .broadcast { display: block; }

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

@media (min-width: 860px) {
  .masthead {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .prose section,
  .prose [id] { scroll-margin-top: 8.5rem; }
}

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

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

  .doodle,
  .brand-mark,
  .tick { transform: none; }
}

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