@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@700&display=swap');

:root {
  --cream: #F5F0E4;
  --ink: #111111;
  --flare: #FF3B00;
  --paper: #FFFCF4;
  --dock: 64px;
  --edge: rgba(17, 17, 17, 0.18);
}

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

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

body {
  margin: 0;
  padding-bottom: calc(var(--dock) + env(safe-area-inset-bottom, 0px));
  background: var(--cream);
  color: var(--ink);
  font-family: 'Space Grotesk', system-ui, -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 17px;
  line-height: 1.72;
  overflow-x: hidden;
}

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

a { color: var(--flare); text-decoration-thickness: 2px; text-underline-offset: 3px; }

main [id] { scroll-margin-top: 2rem; }

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: clamp(1.1rem, 4vw, 2.6rem) clamp(1.1rem, 4vw, 2.6rem) calc(var(--dock) + 1rem);
  overflow: hidden;
  border-bottom: 3px solid var(--ink);
  background: var(--cream);
}

.bgword {
  position: absolute;
  right: -0.04em;
  bottom: -0.1em;
  z-index: 0;
  font-size: clamp(3.6rem, 21vw, 12rem);
  font-weight: 700;
  line-height: 0.78;
  letter-spacing: -0.055em;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 2px rgba(17, 17, 17, 0.22);
  user-select: none;
  pointer-events: none;
  animation: drift 14s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(-0.06em); }
}

.hero-title {
  position: relative;
  z-index: 2;
  margin: 0;
  max-width: 20ch;
  font-size: clamp(2.4rem, 9.6vw, 6.4rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.045em;
  text-wrap: balance;
  animation: heroIn 0.65s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(0.25em); }
  to { opacity: 1; transform: none; }
}

.ch {
  display: inline-block;
  white-space: pre;
  animation: charIn 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) backwards;
  animation-delay: calc(var(--i, 0) * 34ms);
}

@keyframes charIn {
  from { opacity: 0; transform: translateY(0.36em) scale(0.9); }
  to { opacity: 1; transform: none; }
}

.hero-figure {
  position: relative;
  z-index: 1;
  margin-top: auto;
  max-height: 44vh;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--ink);
  box-shadow: 0 18px 40px rgba(17, 17, 17, 0.2);
}

.hero-figure:empty { display: none; }

.hero-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.06) saturate(1.05);
}

/* ---------- 主区 ---------- */
.wrap {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(1.1rem, 3vw, 2.4rem);
  align-items: start;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(1.6rem, 4vw, 2.8rem) clamp(1.1rem, 4vw, 2.6rem) 3rem;
}

.side {
  position: sticky;
  top: 1rem;
  padding-top: 0.7rem;
  border-top: 3px solid var(--ink);
}

.side small {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--flare);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.side h2 {
  margin: 0 0 0.8rem;
  font-size: 1.45rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.toc {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.15rem;
}

.toc a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0.15rem 0.6rem;
  border-left: 3px solid transparent;
  color: var(--ink);
  font-size: 16px;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.toc a:hover,
.toc a:focus-visible {
  background: rgba(255, 59, 0, 0.1);
  border-left-color: var(--flare);
  transform: translateX(2px);
}

.body { min-width: 0; }

.prose {
  padding: clamp(1.1rem, 3vw, 2.6rem);
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 0 16px 36px rgba(17, 17, 17, 0.09);
}

.prose article + article {
  margin-top: 2.6rem;
  padding-top: 2.2rem;
  border-top: 2px dashed var(--edge);
}

.prose small {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--flare);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.prose h2 {
  margin: 0 0 0.9rem;
  font-size: clamp(1.65rem, 4.4vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.prose h3 {
  margin: 1.5rem 0 0.6rem;
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.prose h2 + h3 { margin-top: 0.4rem; }

.prose p { margin: 0 0 1.1rem; }

.prose ul,
.prose ol { margin: 0 0 1.1rem; padding-left: 1.3em; }

.prose li { margin-bottom: 0.4rem; }

.prose strong { font-weight: 700; }

.prose blockquote {
  margin: 1.2rem 0;
  padding: 0.6rem 0 0.6rem 1rem;
  border-left: 4px solid var(--flare);
  font-size: 1.05em;
}

.prose figure { margin: 1.2rem 0; }

.prose img { border: 2px solid var(--ink); }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

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

/* ---------- 页脚 ---------- */
.site-foot {
  padding: 2.4rem clamp(1.1rem, 4vw, 2.6rem) 1.4rem;
  background: var(--paper);
  border-top: 3px solid var(--ink);
}

.foot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.6rem;
  max-width: 1100px;
  margin: 0 auto;
}

.foot-id {
  font-style: normal;
  font-size: 16px;
  line-height: 1.6;
  word-break: break-all;
}

.foot-id strong { font-size: 1.1rem; letter-spacing: -0.01em; }

.foot-links {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  font-size: 16px;
}

.foot-links li { margin-bottom: 0.35rem; }

.foot-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

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

.foot-words {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(17, 17, 17, 0.72);
}

.copy {
  max-width: 1100px;
  margin: 1.8rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--edge);
  text-align: center;
  font-size: 15px;
  color: rgba(17, 17, 17, 0.68);
}

/* ---------- 底部固定条 ---------- */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  background: var(--ink);
  color: var(--cream);
  border-top: 3px solid var(--flare);
}

.dock .brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 46px;
  padding: 0.2rem;
  border: 2px solid var(--flare);
  color: var(--cream);
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease;
}

.dock .brand:hover { transform: rotate(-4deg); background: rgba(255, 59, 0, 0.18); }

.brand-img { width: 32px; height: 32px; object-fit: contain; }

.brand-glyph { font-size: 16px; font-weight: 700; letter-spacing: 0.06em; }

.dock details { position: relative; min-width: 0; }

.dock summary {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 0.9rem;
  border: 2px solid rgba(245, 240, 228, 0.4);
  color: var(--cream);
  font-size: 16px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

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

.dock details[open] summary { border-color: var(--flare); color: var(--flare); }

.dock menu {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 0.1rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.dock menu a {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 0.7rem;
  color: var(--cream);
  font-size: 16px;
  white-space: nowrap;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.dock menu a:hover,
.dock menu a:focus-visible { color: var(--flare); border-bottom-color: var(--flare); }

.dock .contact {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  margin-left: auto;
  padding: 0 1rem;
  background: var(--flare);
  color: var(--cream);
  font-size: 16px;
  text-decoration: none;
  transition: filter 0.16s ease;
}

.dock .contact:hover { filter: brightness(1.12); }

@media (min-width: 761px) {
  .dock details { flex: 1; }
  .dock details > menu { display: flex; }
}

@media (max-width: 760px) {
  .dock details > menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 0.5rem);
    display: none;
    flex-direction: column;
    max-height: 58vh;
    overflow-y: auto;
    padding: 0.4rem;
    background: var(--ink);
    border: 3px solid var(--flare);
  }
  .dock details[open] > menu { display: flex; }
  .dock details > menu a { width: 100%; min-height: 48px; padding: 0 0.7rem; }
  .dock details > menu a + a { border-top: 1px solid rgba(245, 240, 228, 0.14); }
}

/* ---------- 动效 ---------- */
.rv {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

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

/* ---------- 断点 ---------- */
@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; }
  .side {
    position: static;
    padding: 0 0 0.9rem;
    border-top: none;
    border-bottom: 2px solid var(--ink);
  }
  .toc { display: flex; flex-wrap: wrap; gap: 0.3rem; }
  .toc a {
    min-height: 42px;
    padding: 0.15rem 0.65rem;
    border: 2px solid var(--ink);
    border-radius: 0;
  }
  .toc a:hover,
  .toc a:focus-visible {
    background: var(--flare);
    border-color: var(--flare);
    color: var(--cream);
    transform: none;
  }
  .foot-grid { grid-template-columns: 1fr; gap: 1.2rem; }
  .foot-links { columns: 2; }
  .hero-figure { max-height: 38vh; }
}

@media (max-width: 420px) {
  body { font-size: 16px; }
  .hero-figure { max-height: 30vh; }
  .bgword { opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; transition: none; }
  .hero-title,
  .ch,
  .bgword { animation: none; }
  .toc a,
  .dock .brand { transition: none; }
}

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