@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
  --ink: #000000;
  --pa: #ffffff;
  --wash: #f3f2ef;
  --px: "Press Start 2P", ui-monospace, "Courier New", monospace;
  --cn: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "VT323", ui-monospace, "Courier New", monospace;
  --soft: 0 18px 38px rgba(0, 0, 0, .13);
}

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

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

body {
  margin: 0;
  background: var(--pa);
  color: var(--ink);
  font: 400 17px/1.75 var(--cn);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
ol, ul { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
time { font-family: var(--mono); font-size: 1.06em; letter-spacing: .04em; }
button { font-family: inherit; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 80;
  background: var(--ink);
  color: var(--pa);
  padding: 12px 18px;
  border-radius: 0 0 12px 0;
  font-weight: 700;
}
.skip:focus { left: 0; }

/* ---------- masthead ---------- */
.mast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px clamp(14px, 3vw, 30px);
  border-bottom: 4px solid var(--ink);
  background: var(--pa);
}

.mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 10px;
}
.mark svg { width: 20px; fill: var(--pa); }

.mast-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .12em;
  margin: 0;
  white-space: nowrap;
}

.burger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  background: var(--pa);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.burger-box { display: grid; gap: 3px; width: 16px; }
.burger-box i { display: block; height: 3px; background: var(--ink); }

.top { display: none; }
.top ol { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.top a {
  display: block;
  padding: 10px 8px;
  font-size: 16px;
  line-height: 24px;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.top a:hover, .top a:focus-visible { border-bottom-color: var(--ink); }

.cta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  background: var(--ink);
  color: var(--pa);
  border: 3px solid var(--ink);
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

/* ---------- sticky anchor rail ---------- */
.ticker {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ink);
  color: var(--pa);
  clip-path: polygon(0 0, 100% 5px, 100% 100%, 0 100%);
  padding-top: 5px;
}
.ticker ol {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 6px clamp(8px, 2vw, 18px);
  scrollbar-width: thin;
}
.ticker a {
  display: block;
  padding: 9px 12px;
  min-height: 42px;
  line-height: 24px;
  font-size: 16px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--pa);
  border: 2px solid transparent;
  border-radius: 8px;
}
.ticker a:hover, .ticker a:focus-visible { border-color: var(--pa); }

/* ---------- hero ---------- */
main { overflow: hidden; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(14px, 3vw, 36px);
  min-height: 45vh;
  padding: clamp(26px, 5vw, 54px) clamp(16px, 4vw, 44px) clamp(58px, 8vw, 88px);
  background: var(--wash);
}
.hero::after {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: 0;
  height: 20px;
  background: var(--ink);
  transform: skewY(-1.6deg);
  transform-origin: left bottom;
}

.hero h1 {
  margin: 0 0 14px;
  font-family: var(--px), var(--cn);
  font-weight: 800;
  font-size: clamp(22px, 5.2vw, 42px);
  line-height: 1.42;
  letter-spacing: .01em;
}
.lead {
  max-width: 36ch;
  font-size: 17px;
  line-height: 1.72;
  color: #161616;
}

.art {
  margin: 0;
  width: clamp(80px, 20vw, 168px);
  padding: 10px;
  background: var(--pa);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 8px 8px 0 var(--ink);
}
.art svg { width: 100%; height: auto; color: var(--ink); }

/* ---------- reader grid ---------- */
.reader {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(22px, 4vw, 44px);
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(26px, 5vw, 56px) clamp(16px, 4vw, 44px);
}

.prose { min-width: 0; overflow-wrap: break-word; }

.prose > section {
  background: var(--pa);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--soft);
  padding: clamp(20px, 3.4vw, 40px);
  margin: 0 0 30px;
  scroll-margin-top: 116px;
}
.prose > section:last-child { margin-bottom: 0; }

.prose h2 {
  font-family: var(--px), var(--cn);
  font-size: clamp(18px, 2.6vw, 24px);
  line-height: 1.45;
  margin: 0 0 10px;
  padding-bottom: 10px;
  border-bottom: 4px solid var(--ink);
}
.prose h3 {
  font-family: var(--px), var(--cn);
  font-size: 17px;
  line-height: 1.5;
  margin: 26px 0 8px;
}
.prose p { margin: 0 0 1.05em; }
.prose p:last-child { margin-bottom: 0; }

.prose > section > p:first-of-type::first-letter {
  float: left;
  font-family: var(--px), var(--cn);
  font-size: 2.6em;
  line-height: .95;
  margin: 8px 10px 0 0;
  font-weight: 800;
}

.prose ul { margin: 0 0 1.05em; }
.prose ul li {
  position: relative;
  padding-left: 24px;
  margin: .45em 0;
}
.prose ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 9px;
  height: 9px;
  background: var(--ink);
}
.prose ol {
  list-style: decimal;
  padding-left: 1.5em;
  margin: 0 0 1.05em;
}
.prose ol li { margin: .4em 0; }

.prose blockquote {
  margin: 24px 0;
  padding: 16px 20px;
  border-left: 9px solid var(--ink);
  background: var(--wash);
  border-radius: 0 14px 14px 0;
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.7;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose figure { margin: 24px 0; }
.prose figcaption {
  font-size: 16px;
  color: #2b2b2b;
  padding-top: 8px;
  border-top: 2px dashed #b9b7b1;
  margin-top: 8px;
}
.prose img { border-radius: 14px; border: 3px solid var(--ink); }

.prose table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.prose th, .prose td {
  border: 2px solid var(--ink);
  padding: 10px 12px;
  text-align: left;
  font-size: 16px;
}
.prose th { background: var(--ink); color: var(--pa); font-weight: 700; }

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

.prose pre {
  overflow-x: auto;
  background: var(--ink);
  color: var(--pa);
  padding: 16px;
  border-radius: 14px;
  font-family: var(--mono);
  font-size: 17px;
}

@media (min-width: 1024px) {
  .prose > section > p ~ p {
    column-count: 2;
    column-gap: 38px;
    orphans: 2;
    widows: 2;
  }
}

/* ---------- aside ---------- */
.rail {
  align-self: start;
  background: var(--pa);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--soft);
  padding: 20px;
  scroll-margin-top: 116px;
}
.rail h2 {
  font-family: var(--px), var(--cn);
  font-size: 18px;
  line-height: 1.4;
  margin: 0 0 6px;
}
.subtitle {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .06em;
  padding-bottom: 12px;
  border-bottom: 3px dashed #b9b7b1;
}
.rail ol { display: grid; gap: 8px; }
.rail a {
  display: block;
  padding: 9px 12px;
  min-height: 44px;
  line-height: 24px;
  font-size: 16px;
  text-decoration: none;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--pa);
}
.rail a:hover, .rail a:focus-visible { background: var(--ink); color: var(--pa); }

@media (min-width: 900px) {
  .reader { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .rail { position: sticky; top: 78px; }
}

/* ---------- drawer ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--pa);
  transform: translateY(-102%);
  transition: transform .34s cubic-bezier(.2, .7, .3, 1);
  overflow-y: auto;
  padding: clamp(18px, 6vw, 56px);
}
.drawer.open { transform: translateY(0); }
.drawer ol { display: grid; gap: 10px; max-width: 560px; margin: 0 auto; }
.drawer a {
  display: block;
  padding: 14px 4px;
  font-family: var(--px), var(--cn);
  font-size: 19px;
  line-height: 1.5;
  text-decoration: none;
  border-bottom: 3px solid var(--ink);
}
.drawer a:hover, .drawer a:focus-visible { background: var(--ink); color: var(--pa); }
body.lock { overflow: hidden; }

/* ---------- footer ---------- */
footer {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--ink);
  color: var(--pa);
  padding: clamp(26px, 5vw, 48px) clamp(16px, 4vw, 44px) 22px;
  border-top: 5px solid var(--ink);
}
footer > article { flex: 1 1 170px; min-width: 0; }
footer .mark { background: var(--pa); border-color: var(--pa); }
footer .mark svg { fill: var(--ink); }
.f-brand p { margin: 10px 0 0; font-weight: 800; letter-spacing: .1em; }

.f-nav ol { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.f-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 16px;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.f-nav a:hover, .f-nav a:focus-visible { border-bottom-color: var(--pa); }

.f-sub form { display: flex; flex-wrap: wrap; gap: 8px; }
.f-sub input {
  flex: 1 1 120px;
  min-height: 44px;
  padding: 0 12px;
  background: var(--ink);
  color: var(--pa);
  border: 2px solid var(--pa);
  border-radius: 10px;
  font: 400 16px var(--cn);
}
.f-sub input::placeholder { color: #cfcfcf; }
.f-sub button {
  min-height: 44px;
  padding: 0 18px;
  background: var(--pa);
  color: var(--ink);
  border: 2px solid var(--pa);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.f-meta {
  flex: 1 1 100%;
  text-align: center;
  border-top: 2px solid var(--pa);
  padding-top: 14px;
  font-size: 16px;
}

/* ---------- to top ---------- */
.totop {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  min-height: 44px;
  padding: 0 16px;
  background: var(--pa);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
}
.totop.on { opacity: 1; pointer-events: auto; }

/* ---------- motion ---------- */
.js .rv { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js .rv.in { opacity: 1; transform: none; }

.js .rail li { opacity: 0; transform: translateY(8px); transition: opacity .42s ease, transform .42s ease; }
.js .rail.in li { opacity: 1; transform: none; }
.js .rail.in li:nth-child(2) { transition-delay: .05s; }
.js .rail.in li:nth-child(3) { transition-delay: .1s; }
.js .rail.in li:nth-child(4) { transition-delay: .15s; }
.js .rail.in li:nth-child(5) { transition-delay: .2s; }
.js .rail.in li:nth-child(6) { transition-delay: .25s; }
.js .rail.in li:nth-child(7) { transition-delay: .3s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rv, .js .rail li { opacity: 1; transform: none; transition: none; }
  .drawer { transition: none; }
}

/* ---------- breakpoints ---------- */
@media (max-width: 560px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .art { width: 116px; box-shadow: 6px 6px 0 var(--ink); }
  .mast-name { display: none; }
}

@media (min-width: 641px) and (max-width: 900px) {
  .mast-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
}

@media (min-width: 1040px) {
  .top { display: block; }
  .burger { display: none; }
}

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