:root {
  --paper: #fafaf8;
  --pencil: #4a4a4a;
  --ink: #1a1a1a;
  --edge: 2px solid var(--ink);
  --hard: 4px 4px 0 var(--ink);
}

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

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

body {
  margin: 0;
  font-family: 'Poppins', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 17px;
  line-height: 1.68;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(90deg, rgba(26, 26, 26, 0.035) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(0deg, rgba(26, 26, 26, 0.035) 0 1px, transparent 1px 8px);
  -webkit-font-smoothing: antialiased;
}

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

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

p {
  margin: 0 0 1em;
}

.wrap {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 22px;
}

/* ---------- 顶部细条 ---------- */

.ticker {
  background: var(--ink);
  color: var(--paper);
  border-bottom: var(--edge);
  overflow: hidden;
}

.ticker .rail {
  display: flex;
  gap: 26px;
  width: max-content;
  padding: 8px 0;
  font-family: 'Righteous', 'Poppins', sans-serif;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  white-space: nowrap;
  animation: rail 38s linear infinite;
}

.ticker .rail span::after {
  content: '·';
  margin-left: 26px;
  opacity: 0.6;
}

@keyframes rail {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- 页头 ---------- */

.masthead {
  border-bottom: 3px solid var(--ink);
  background: var(--paper);
}

.brandrow {
  margin: 0;
  padding: 16px 0 6px;
  border-bottom: 2px dashed rgba(74, 74, 74, 0.5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Righteous', 'Poppins', sans-serif;
  font-size: clamp(1.6rem, 4.4vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
  transform: rotate(-1.4deg);
  padding: 4px 0;
}

.brand .mark {
  width: 36px;
  height: auto;
  border: var(--edge);
}

.menurow {
  padding: 14px 0 18px;
}

.menu summary {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 20px;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: 0.1em;
  color: var(--paper);
  background: var(--ink);
  border: var(--edge);
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
  transform: rotate(-0.8deg);
  transition: transform 0.1s steps(2, end), box-shadow 0.1s steps(2, end);
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu summary:hover {
  transform: rotate(1deg) translate(-1px, -1px);
  box-shadow: var(--hard);
}

.menu summary:focus-visible {
  outline: 3px dashed var(--ink);
  outline-offset: 3px;
}

details[open] > menu {
  display: flex;
}

details:not([open]) > menu {
  display: none;
}

details > menu {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  flex-wrap: wrap;
  gap: 9px;
}

details > menu > li > a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 16px;
  font-size: 16px;
  line-height: 1.4;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  border: var(--edge);
  border-radius: 999px;
  transition: transform 0.1s steps(2, end), box-shadow 0.1s steps(2, end), background 0.1s steps(2, end);
}

details > menu > li:nth-child(2n) > a {
  transform: rotate(-0.9deg);
}

details > menu > li:nth-child(3n) > a {
  transform: rotate(1.1deg);
}

details > menu > li > a:hover,
details > menu > li > a:focus-visible {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 3px 3px 0 var(--pencil);
  transform: rotate(-1.4deg) translate(-1px, -1px);
}

/* ---------- 题头 ---------- */

.hero {
  position: relative;
  min-height: 45vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  text-align: right;
  padding: 44px 0 40px;
  border-bottom: 3px solid var(--ink);
}

.hero h1 {
  margin: 0;
  font-family: 'Righteous', 'Poppins', sans-serif;
  font-size: clamp(2.2rem, 9vw, 5.2rem);
  line-height: 1;
  letter-spacing: -0.01em;
  max-width: 17ch;
  text-shadow: 3px 3px 0 rgba(26, 26, 26, 0.13);
}

.stamp {
  position: absolute;
  top: 20px;
  left: 0;
  margin: 0;
  padding: 7px 14px;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  background: #fff;
  border: 2px dashed var(--ink);
  transform: rotate(-5deg);
  box-shadow: 3px 3px 0 rgba(74, 74, 74, 0.35);
}

/* ---------- 版式 ---------- */

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 42px;
  align-items: start;
  padding: 42px 0 60px;
}

.side {
  position: sticky;
  top: 20px;
}

.note {
  position: relative;
  background: #fff;
  border: var(--edge);
  padding: 20px 16px 14px;
  transform: rotate(-0.7deg);
  box-shadow: 5px 5px 0 rgba(26, 26, 26, 0.14);
}

.note::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  width: 78px;
  height: 22px;
  margin-left: -39px;
  background: rgba(74, 74, 74, 0.17);
  border: 1px solid rgba(26, 26, 26, 0.15);
  transform: rotate(-2.5deg);
}

.note h2 {
  margin: 0;
  font-family: 'Righteous', 'Poppins', sans-serif;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: 0.16em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
}

.note ol {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.note li + li {
  border-top: 1px dashed rgba(74, 74, 74, 0.45);
}

.note a {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 11px 2px;
  font-size: 16px;
  line-height: 1.45;
  text-decoration: none;
  color: var(--ink);
}

.note a i {
  font-family: 'Righteous', 'Poppins', sans-serif;
  font-size: 14px;
  font-style: normal;
  color: var(--pencil);
}

.note a:hover,
.note a:focus-visible {
  background: var(--ink);
  color: var(--paper);
  padding-left: 8px;
}

.note a:hover i,
.note a:focus-visible i {
  color: var(--paper);
}

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

main {
  min-width: 0;
}

section {
  max-width: 70ch;
}

section > article {
  padding: 26px 0 32px;
  border-bottom: 2px dashed rgba(74, 74, 74, 0.55);
  scroll-margin-top: 26px;
}

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

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

section h2 {
  font-family: 'Righteous', 'Poppins', sans-serif;
  font-size: clamp(1.35rem, 3.6vw, 1.85rem);
  line-height: 1.28;
  margin: 0 0 14px;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
  text-decoration-color: rgba(26, 26, 26, 0.35);
}

section h3 {
  font-family: 'Righteous', 'Poppins', sans-serif;
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 22px 0 10px;
}

section p {
  max-width: 68ch;
}

section ul,
section ol {
  padding-left: 1.4em;
  margin: 0 0 1em;
}

section li {
  margin-bottom: 0.5em;
}

section a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

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

section blockquote {
  margin: 0 0 1em;
  padding: 12px 16px;
  border-left: 4px solid var(--ink);
  background: #fff;
  transform: rotate(-0.3deg);
}

section img {
  border: var(--edge);
  margin: 8px 0 16px;
}

section hr {
  border: 0;
  border-top: 2px dashed rgba(74, 74, 74, 0.5);
  margin: 22px 0;
}

.inked {
  animation: ink 0.3s steps(4, end) both;
}

@keyframes ink {
  from {
    opacity: 0.2;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.colophon {
  border-top: 3px solid var(--ink);
  background: #fff;
  padding: 34px 0 18px;
  overflow: hidden;
}

.bigmark {
  margin: 0 0 26px;
  font-family: 'Righteous', 'Poppins', sans-serif;
  font-size: clamp(2.5rem, 14vw, 8.5rem);
  line-height: 0.9;
  letter-spacing: -0.02em;
  word-break: break-word;
  opacity: 0.92;
  transform: rotate(-0.6deg);
}

.cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
  padding-bottom: 22px;
  border-bottom: 2px dashed rgba(74, 74, 74, 0.45);
}

.col h3 {
  margin: 0 0 12px;
  font-family: 'Righteous', 'Poppins', sans-serif;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: 0.12em;
  display: inline-block;
  padding-bottom: 3px;
  border-bottom: var(--edge);
}

.col dl {
  margin: 0;
}

.col dt {
  font-size: 16px;
  line-height: 1.5;
  color: var(--pencil);
  margin-bottom: 4px;
}

.col dd {
  margin: 0 0 12px;
}

.col dd a {
  display: inline-block;
  padding: 9px 13px;
  font-size: 16px;
  line-height: 1.4;
  text-decoration: none;
  border: var(--edge);
  background: var(--paper);
  transition: transform 0.1s steps(2, end), box-shadow 0.1s steps(2, end), background 0.1s steps(2, end);
}

.col dd a:hover,
.col dd a:focus-visible {
  background: var(--ink);
  color: var(--paper);
  transform: translate(-1px, -1px) rotate(-1deg);
  box-shadow: 3px 3px 0 var(--pencil);
}

.col dd.stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.col dd.stack a {
  margin: 0;
}

.copyright {
  margin: 16px 0 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--pencil);
  letter-spacing: 0.06em;
}

/* ---------- 回到顶部 ---------- */

.totop {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  padding: 11px 16px;
  font-size: 16px;
  line-height: 1.4;
  text-decoration: none;
  color: var(--paper);
  background: var(--ink);
  border: var(--edge);
  transform: rotate(2deg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s steps(2, end);
}

.totop.on {
  opacity: 1;
  pointer-events: auto;
}

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

@media (max-width: 880px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding: 28px 0 44px;
  }

  .side {
    position: static;
  }

  .note {
    transform: none;
    box-shadow: 4px 4px 0 rgba(26, 26, 26, 0.12);
  }

  .hero {
    min-height: 0;
    align-items: flex-start;
    text-align: left;
    padding: 26px 0 30px;
  }

  .hero h1 {
    max-width: 100%;
  }

  .stamp {
    position: static;
    display: inline-block;
    margin-bottom: 14px;
    transform: rotate(-2deg);
  }

  .cols {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .bigmark {
    font-size: clamp(2.2rem, 16vw, 4.5rem);
  }

  details > menu > li > a {
    min-height: 42px;
    padding: 8px 14px;
  }
}

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

  .ticker .rail {
    animation: none;
  }

  .inked {
    animation-duration: 0.001s;
  }

  .totop {
    transition: none;
  }

  a,
  summary {
    transition: none;
  }
}

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