/* 糖心官方指南 · neubrutalist single page */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --blue: #3bb1ff;
  --red: #ff5252;
  --ink: #000000;
  --paper: #ffffff;
  --tint: #eaf7ff;
  --tint2: #ffecec;
  --line: 3px solid #000000;
  --hard: 5px 5px 0 #000000;
  --r: 18px;
  --dock-h: 118px;
}

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

body {
  margin: 0;
  padding-bottom: var(--dock-h);
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.75;
  font-weight: 400;
}

main { display: block; }

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

/* ---------- 底部固定条（含品牌居中） ---------- */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  border-top: 3px solid var(--ink);
}

.dock-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-width: 0;
}

.dock-left { justify-content: flex-end; }
.dock-right { justify-content: flex-start; }

.dock-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0.3rem 0.5rem;
  border: var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
}

.dock-list a:hover { background: var(--blue); }
.dock-list a:active { transform: translate(2px, 2px); }
.dock-list a:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.ico {
  flex: none;
  width: 7px;
  height: 7px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
}

.dock-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.3rem 0.55rem;
  border: var(--line);
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.dock-brand:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.mark-txt {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  font-size: 0.7rem;
  line-height: 1;
}

.mark-img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border: 2px solid var(--ink);
  border-radius: 6px;
}

.dock-name { white-space: nowrap; }

/* ---------- 区块骨架 ---------- */
main > section {
  position: relative;
  overflow: hidden;
  padding: clamp(1.75rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2.5rem);
  border-top: var(--line);
  scroll-margin-top: 18px;
}

main > section > :first-child { margin-top: 0; }

main > section:nth-child(even) { background: var(--tint); }
main > section:nth-child(3n) { background: var(--tint2); }

/* ---------- 首屏 ---------- */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
  min-height: 0;
  background: var(--paper) !important;
}

.stage::before {
  content: "01";
  position: absolute;
  right: -0.06em;
  bottom: -0.36em;
  font-size: clamp(7rem, 26vw, 19rem);
  font-weight: 700;
  line-height: 0.75;
  letter-spacing: -0.06em;
  color: #d9efff;
  pointer-events: none;
  z-index: 0;
}

.stage-copy { order: 1; position: relative; z-index: 1; }

.stage-h1 {
  margin: 0 0 0.7rem;
  font-size: clamp(1.9rem, 5.2vw, 3.6rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stage-lede {
  max-width: 42ch;
  margin: 0 0 1.3rem;
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.65;
}

.stage-cta {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0.65rem 1.3rem;
  border: var(--line);
  border-radius: 12px;
  background: var(--red);
  box-shadow: var(--hard);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.stage-cta:hover { background: var(--blue); }
.stage-cta:active { transform: translate(5px, 5px); box-shadow: none; }
.stage-cta:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ---------- 目录侧栏 ---------- */
.rail {
  order: 3;
  position: relative;
  z-index: 1;
  padding: 0.9rem;
  border: var(--line);
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--hard);
}

.rail-title, .closer-title {
  margin: 0 0 0.7rem;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  line-height: 1.4;
}

.rail-title > span, .closer-title > span {
  display: inline-block;
  padding: 0.12em 0.5em;
  border: var(--line);
  border-radius: 7px;
  background: var(--red);
  box-shadow: none;
  transform: none;
  font-size: 0.85rem;
}

.toc {
  counter-reset: n;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.toc li { counter-increment: n; }

.toc a {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.35rem 0.45rem;
  border: 2px solid var(--ink);
  border-radius: 9px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.toc a::before {
  content: counter(n, decimal-leading-zero);
  font-size: 0.72rem;
  opacity: 0.65;
}

.toc a:hover { background: var(--blue); }

/* ---------- 图片 / 装饰块 ---------- */
.stage-art, .closer-art {
  order: 2;
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  margin: 0;
  min-height: 170px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: var(--line);
  border-radius: var(--r);
  background: var(--blue);
  box-shadow: 8px 8px 0 var(--ink);
}

.art-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.art-blob {
  width: 52%;
  aspect-ratio: 1;
  border: var(--line);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 6px 6px 0 var(--ink);
}

.art-blob.alt { background: var(--blue); box-shadow: 6px 6px 0 var(--ink); }

/* ---------- 正文通用 ---------- */
main > section h2, main > section h3 {
  margin: 0 0 1rem;
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  line-height: 1.22;
  letter-spacing: -0.01em;
  max-width: 34ch;
}

main > section h2 > span, main > section h3 > span {
  display: inline-block;
  padding: 0.08em 0.32em;
  border: var(--line);
  border-radius: 10px;
  background: var(--blue);
  box-shadow: var(--hard);
  transform: rotate(-1.2deg);
}

main > section p {
  max-width: 70ch;
  margin: 0 0 1rem;
  line-height: 1.8;
}

main > section ul, main > section ol {
  max-width: 70ch;
  margin: 0 0 1.2rem;
  padding-left: 1.35rem;
}

main > section li { margin: 0.35rem 0; }

main > section p a, main > section li a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
}

main > section p a:hover, main > section li a:hover { background: var(--red); color: var(--paper); }

main > section figure:not(.stage-art):not(.closer-art) {
  margin: 1.4rem 0;
  padding: 0.6rem;
  border: var(--line);
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--hard);
}

main > section blockquote {
  margin: 1.2rem 0;
  padding: 0.8rem 1.1rem;
  border: var(--line);
  border-left-width: 10px;
  border-radius: 12px;
  background: var(--paper);
  font-weight: 500;
}

main > section table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.95rem;
}

main > section th, main > section td {
  border: 2px solid var(--ink);
  padding: 0.5rem 0.6rem;
  text-align: left;
}

main > section th { background: var(--blue); }

main > section code {
  padding: 0.1em 0.35em;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: var(--tint2);
  font-size: 0.9em;
}

/* ---------- 收尾区 ---------- */
.closer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
  background: var(--ink) !important;
  color: var(--paper);
}

.closer-rail {
  padding: 0.9rem;
  border: 3px solid var(--paper);
  border-radius: var(--r);
  background: #111111;
}

.closer-title { margin: 0; }
.closer-title > span { background: var(--blue); color: var(--ink); border-color: var(--paper); }

.closer-copy { display: flex; }

.to-top {
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding: 0.65rem 1.5rem;
  border: var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 5px 5px 0 var(--blue);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.to-top:hover { background: var(--blue); }
.to-top:active { transform: translate(5px, 5px); box-shadow: none; }
.to-top:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.closer-art {
  order: 0;
  border-color: var(--paper);
  background: var(--red);
  box-shadow: 8px 8px 0 var(--blue);
  aspect-ratio: 16 / 7;
  min-height: 120px;
}

/* ---------- 页脚（仅 p / small） ---------- */
.foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  padding: 1.6rem clamp(1rem, 4vw, 2.5rem) 2rem;
  border-top: var(--line);
  background: var(--blue);
}

.foot p { margin: 0; }

.foot-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
}

.foot-sub { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.foot-sub input {
  flex: 1 1 8rem;
  min-width: 0;
  min-height: 44px;
  padding: 0.35rem 0.95rem;
  border: var(--line);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  font: inherit;
  font-size: 0.9rem;
}

.foot-sub input:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.foot-sub button {
  min-height: 44px;
  padding: 0.35rem 1.15rem;
  border: var(--line);
  border-radius: 999px;
  background: var(--red);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.foot-sub button:hover { background: var(--paper); }
.foot-sub button:active { transform: translate(3px, 3px); box-shadow: none; }

.foot-legal {
  display: block;
  font-size: 0.8rem;
  line-height: 1.6;
  word-break: break-word;
}

.foot-legal a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

/* ---------- 滚动显现 ---------- */
.js main > section:not(.stage) {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.js main > section.in { opacity: 1; transform: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 620px) {
  .dock-list a { font-size: 0.72rem; padding: 0.28rem 0.42rem; gap: 0.28rem; }
  .dock-brand { padding: 0.28rem 0.42rem; }
  .dock-name { display: none; }
  .stage-cta { width: 100%; justify-content: center; }
}

@media (min-width: 621px) {
  .dock-list a { font-size: 0.82rem; }
}

@media (min-width: 861px) {
  :root { --dock-h: 92px; }

  .stage {
    grid-template-columns: minmax(0, 215px) minmax(0, 1fr) minmax(0, 0.9fr);
    min-height: 45vh;
    padding-top: clamp(2rem, 4vw, 3.2rem);
  }

  .stage-copy { order: 0; }
  .stage-art { order: 0; }
  .rail { order: 0; }

  .closer {
    grid-template-columns: minmax(0, 215px) minmax(0, 1fr) minmax(0, 0.9fr);
    padding-top: 2.4rem;
    padding-bottom: 2.4rem;
  }

  .closer-art { order: 0; }

  .foot {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: center;
  }

  .foot-legal { text-align: right; }
}

@media (min-width: 1100px) {
  .dock {
    max-width: 1180px;
    margin: 0 auto;
    border-left: var(--line);
    border-right: var(--line);
    padding: 0.6rem 1.4rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }

  .dock-list a { font-size: 0.9rem; padding: 0.4rem 0.75rem; }
  .dock-name { font-size: 0.9rem; }
}

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

  .js main > section:not(.stage) {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .stage-cta:active, .to-top:active, .dock-list a:active { transform: none; }
}

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