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

/* ============================================================
   基础重置与自定义属性
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fafaf8;
  --ink: #1a1a1a;
  --mid: #4a4a4a;
  --accent: #c8773a;
  --accent2: #7a3a8c;
  --card-r: 28px;
  --sidebar-w: 240px;
  --font-main: 'Archivo', 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'Space Grotesk', monospace;
  --paper-noise: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(26,26,26,0.018) 2px,
    rgba(26,26,26,0.018) 4px
  );
  --sketch-shadow: 3px 3px 0 rgba(26,26,26,0.12), 6px 6px 0 rgba(26,26,26,0.06);
}

html {
  scroll-behavior: smooth;
  font-size: 17px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-main);
}

body {
  overflow-x: hidden;
  background: var(--bg);
  background-image: var(--paper-noise);
  min-height: 100vh;
}

/* ============================================================
   排版基础
   ============================================================ */
h1, h2, h3, h4, h5 {
  font-family: var(--font-main);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.5rem); }

p { margin-bottom: 1rem; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }

/* article 滚动偏移（固定导航补偿）*/
article[id] {
  scroll-margin-top: 80px;
}

/* ============================================================
   页面总骨架：侧栏 + 主区
   ============================================================ */
.page-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ============================================================
   左侧固定竖排导航
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  background: var(--ink);
  color: var(--bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 8px,
    rgba(250,250,248,0.03) 8px,
    rgba(250,250,248,0.03) 9px
  );
  pointer-events: none;
}

.sidebar-inner {
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  z-index: 1;
  height: 100%;
}

.sidebar-announce {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(250,250,248,0.5);
  background: rgba(250,250,248,0.08);
  border: 1px solid rgba(250,250,248,0.15);
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 24px;
  font-family: var(--font-mono);
  transform: rotate(-0.5deg);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 32px;
  min-height: 44px;
  padding: 4px 0;
}

.logo-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.nav-brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--bg);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: rgba(250,250,248,0.75);
  font-size: 0.9rem;
  font-weight: 500;
  transition: none;
  position: relative;
  min-height: 44px;
}

.sidebar-link:hover {
  background: rgba(250,250,248,0.1);
  color: var(--bg);
  transform: translateX(2px) rotate(0.3deg);
}

.sidebar-link:active {
  transform: translateX(1px) rotate(0.1deg);
  background: rgba(250,250,248,0.15);
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  opacity: 0.8;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
}

.sidebar-tagline {
  font-size: 0.72rem;
  color: rgba(250,250,248,0.35);
  line-height: 1.5;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(250,250,248,0.1);
}

/* ============================================================
   主区域
   ============================================================ */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   Hero 区域：满屏 + 圆弧底边
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 40px,
      rgba(250,250,248,0.025) 40px,
      rgba(250,250,248,0.025) 41px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 60px,
      rgba(250,250,248,0.015) 60px,
      rgba(250,250,248,0.015) 61px
    );
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 80px 40px 120px;
  max-width: 760px;
  width: 100%;
}

.hero-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--ink);
  background: var(--bg);
  padding: 6px 18px;
  border-radius: 999px;
  margin-bottom: 28px;
  transform: rotate(-1.5deg);
  font-family: var(--font-mono);
}

.hero-h1 {
  color: var(--bg);
  margin-bottom: 20px;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.3);
}

.hero-sub {
  color: rgba(250,250,248,0.7);
  font-size: 1.05rem;
  margin-bottom: 36px;
  line-height: 1.6;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--ink);
  padding: 14px 36px;
  border-radius: var(--card-r);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  letter-spacing: 0.02em;
  transform: rotate(-0.5deg);
  box-shadow: var(--sketch-shadow);
  transition: none;
  min-height: 48px;
}

.hero-cta:hover {
  transform: rotate(0.5deg) translateY(-2px);
  box-shadow: 5px 5px 0 rgba(26,26,26,0.2), 10px 10px 0 rgba(26,26,26,0.1);
  color: var(--ink);
}

.hero-float-tag {
  position: absolute;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  background: rgba(250,250,248,0.12);
  border: 1px solid rgba(250,250,248,0.25);
  color: rgba(250,250,248,0.8);
  padding: 6px 14px;
  border-radius: 6px;
  z-index: 3;
  white-space: nowrap;
}

.hero-float-1 { top: 18%; left: 8%; transform: rotate(-3deg); }
.hero-float-2 { top: 25%; right: 6%; transform: rotate(2.5deg); }
.hero-float-3 { bottom: 22%; left: 12%; transform: rotate(1.5deg); }

.hero-arc {
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 80px 80px 0 0;
  z-index: 4;
}

/* ============================================================
   正文容器：main > div.wrap > article > section
   ============================================================ */
main {
  flex: 1;
  background: var(--bg);
  padding: 60px 0 40px;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px;
}

.content-section {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

/* aside 在内容左侧 */
.content-aside {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
}

.aside-inner {
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--card-r);
  padding: 24px 20px;
  transform: rotate(-0.4deg);
  box-shadow: var(--sketch-shadow);
  position: relative;
  overflow: visible;
}

.aside-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--bg);
  margin-bottom: 12px;
  font-family: var(--font-mono);
}

.aside-inner hr {
  border: none;
  border-top: 1px dashed rgba(250,250,248,0.25);
  margin-bottom: 16px;
}

.aside-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aside-nav dd {
  margin: 0;
}

.aside-nav dd a {
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  color: rgba(250,250,248,0.72);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1.4;
  min-height: 36px;
}

.aside-nav dd a:hover {
  background: rgba(250,250,248,0.1);
  color: var(--bg);
}

.aside-note {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(250,250,248,0.2);
  font-size: 0.72rem;
  color: rgba(250,250,248,0.45);
  line-height: 1.5;
}

.aside-inner::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  background: var(--bg);
  border: 2px solid var(--ink);
  border-radius: 50%;
  transform: rotate(15deg);
}

/* 正文文章 */
.content-article {
  flex: 1;
  min-width: 0;
}

.page-content {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink);
}

.page-content article {
  margin-bottom: 60px;
  padding-bottom: 40px;
  border-bottom: 1px dashed rgba(26,26,26,0.15);
}

.page-content article:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.page-content h2 {
  margin-bottom: 6px;
  position: relative;
}

.page-content h2 + hr {
  border: none;
  border-top: 2px solid var(--ink);
  margin-bottom: 20px;
  width: 60px;
  transform: rotate(-0.5deg);
  transform-origin: left;
}

.page-content h3 {
  margin-top: 28px;
  margin-bottom: 12px;
}

.page-content p {
  margin-bottom: 1rem;
}

.page-content ul,
.page-content ol {
  padding-left: 1.4em;
  margin-bottom: 1rem;
}

.page-content li {
  margin-bottom: 0.4rem;
  line-height: 1.65;
}

.page-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-content strong {
  font-weight: 700;
}

.page-content .card,
.page-content [class*="card"] {
  background: rgba(26,26,26,0.05);
  border-radius: var(--card-r);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: none;
  border: none;
}

/* ============================================================
   页脚：footer > article×n
   ============================================================ */
.site-footer {
  background: var(--ink);
  color: var(--bg);
  margin-top: auto;
}

.footer-brand-section {
  padding: 60px 40px 40px;
  border-bottom: 1px solid rgba(250,250,248,0.1);
}

.footer-brand-huge {
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--bg);
  line-height: 1;
  margin-bottom: 12px;
  transform: rotate(-0.5deg);
  display: inline-block;
}

.footer-slogan {
  font-size: 0.9rem;
  color: rgba(250,250,248,0.5);
  margin: 0;
}

.footer-nav-section {
  padding: 32px 40px;
  border-bottom: 1px solid rgba(250,250,248,0.08);
}

.footer-nav-dl {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.footer-nav-dl dt,
.footer-nav-dl dd {
  margin: 0;
}

.footer-nav-dl dt a,
.footer-nav-dl dd a {
  font-size: 0.85rem;
  color: rgba(250,250,248,0.65);
  text-decoration: none;
  padding: 10px 4px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  line-height: 1.4;
}

.footer-nav-dl dt a:hover,
.footer-nav-dl dd a:hover {
  color: var(--bg);
}

.footer-bottom-section {
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copy {
  font-size: 0.78rem;
  color: rgba(250,250,248,0.4);
  font-family: var(--font-mono);
}

.footer-disclaimer {
  font-size: 0.78rem;
  color: rgba(250,250,248,0.35);
  font-family: var(--font-mono);
}

/* ============================================================
   hr 通用样式
   ============================================================ */
hr {
  border: none;
  border-top: 1.5px dashed rgba(26,26,26,0.2);
  margin: 12px 0 20px;
}

.site-footer hr {
  border-color: rgba(250,250,248,0.15);
}

/* ============================================================
   动效：Stagger List + Scroll Reveal（纯CSS）
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .hero-badge {
    animation: sketchDrop 0.5s cubic-bezier(0.22,1,0.36,1) both;
    animation-delay: 0.1s;
  }
  .hero-h1 {
    animation: sketchDrop 0.55s cubic-bezier(0.22,1,0.36,1) both;
    animation-delay: 0.22s;
  }
  .hero-sub {
    animation: sketchDrop 0.55s cubic-bezier(0.22,1,0.36,1) both;
    animation-delay: 0.34s;
  }
  .hero-cta {
    animation: sketchDrop 0.55s cubic-bezier(0.22,1,0.36,1) both;
    animation-delay: 0.46s;
  }
  .hero-float-1 {
    animation: floatJitter 0.6s cubic-bezier(0.22,1,0.36,1) both;
    animation-delay: 0.55s;
  }
  .hero-float-2 {
    animation: floatJitter 0.6s cubic-bezier(0.22,1,0.36,1) both;
    animation-delay: 0.65s;
  }
  .hero-float-3 {
    animation: floatJitter 0.6s cubic-bezier(0.22,1,0.36,1) both;
    animation-delay: 0.75s;
  }

  .sidebar-nav li:nth-child(1) { animation: slideIn 0.4s ease both 0.1s; }
  .sidebar-nav li:nth-child(2) { animation: slideIn 0.4s ease both 0.18s; }
  .sidebar-nav li:nth-child(3) { animation: slideIn 0.4s ease both 0.26s; }
  .sidebar-nav li:nth-child(4) { animation: slideIn 0.4s ease both 0.34s; }
  .sidebar-nav li:nth-child(5) { animation: slideIn 0.4s ease both 0.42s; }
  .sidebar-nav li:nth-child(6) { animation: slideIn 0.4s ease both 0.50s; }
  .sidebar-nav li:nth-child(7) { animation: slideIn 0.4s ease both 0.58s; }

  .page-content article {
    animation: revealUp 0.6s cubic-bezier(0.22,1,0.36,1) both;
    animation-timeline: view();
    animation-range: entry 0% entry 30%;
  }

  @keyframes sketchDrop {
    from { opacity: 0; transform: translateY(-12px) rotate(-1deg); }
    to   { opacity: 1; transform: translateY(0) rotate(0deg); }
  }

  @keyframes floatJitter {
    from { opacity: 0; transform: scale(0.85) rotate(var(--r, -3deg)); }
    to   { opacity: 1; transform: scale(1) rotate(var(--r, -3deg)); }
  }

  @keyframes slideIn {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
  }

  @keyframes revealUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
   移动端：≤768px
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
  }

  html {
    font-size: 16px;
  }

  body {
    overflow-x: hidden;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    flex-direction: row;
    z-index: 200;
    overflow-x: hidden;
    overflow-y: visible;
  }

  .sidebar-inner {
    flex-direction: row;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    width: 100%;
    height: 56px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sidebar-inner::-webkit-scrollbar {
    display: none;
  }

  .sidebar-announce { display: none; }
  .sidebar-tagline { display: none; }

  .nav-logo {
    margin-bottom: 0;
    flex-shrink: 0;
    min-height: 44px;
    padding: 0;
    gap: 6px;
  }

  .nav-brand {
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .sidebar-nav {
    flex-direction: row;
    flex: 1;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar-nav li {
    flex-shrink: 0;
  }

  .sidebar-link {
    padding: 8px 10px;
    border-radius: 8px;
    min-height: 44px;
    font-size: 0.78rem;
    gap: 4px;
    white-space: nowrap;
  }

  .nav-icon { display: none; }

  .main-area {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }

  .hero {
    min-height: 100svh;
    width: 100%;
  }

  .hero-inner {
    padding: 48px 20px 90px;
    max-width: 100%;
  }

  .hero-float-1 { top: 10%; left: 3%; font-size: 0.62rem; padding: 4px 10px; }
  .hero-float-2 { top: 14%; right: 3%; font-size: 0.62rem; padding: 4px 10px; }
  .hero-float-3 { bottom: 16%; left: 4%; font-size: 0.62rem; padding: 4px 10px; }

  .wrap {
    padding: 0 16px;
  }

  .content-section {
    flex-direction: column;
    gap: 28px;
  }

  .content-aside {
    width: 100%;
    position: static;
  }

  .aside-inner {
    transform: rotate(-0.2deg);
  }

  .aside-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .aside-nav dd a {
    font-size: 0.78rem;
    min-height: 40px;
    padding: 8px 10px;
  }

  .footer-brand-section {
    padding: 40px 20px 28px;
  }

  .footer-nav-section {
    padding: 24px 20px;
  }

  .footer-bottom-section {
    padding: 16px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  article[id] {
    scroll-margin-top: 64px;
  }

  .page-shell {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .hero-float-tag {
    display: none;
  }

  .footer-brand-huge {
    font-size: clamp(2.2rem, 11vw, 3.5rem);
  }

  .footer-nav-dl {
    gap: 4px 12px;
  }

  .hero-inner {
    padding: 40px 16px 80px;
  }

  .wrap {
    padding: 0 14px;
  }
}
