@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;1,400&display=swap');

/* ===== 根变量 ===== */
:root {
  --c-green: #87ff71;
  --c-yellow: #ffce5c;
  --c-dark: #192617;
  --c-dark2: #1f3019;
  --c-dark3: #253c22;
  --c-text: #d6f5ce;
  --c-muted: #7aa872;
  --c-border: #2e4a2a;
  --radius-card: 18px;
  --font-mono: 'JetBrains Mono', 'Fira Mono', 'Consolas', monospace;
  --nav-h: 96px;
  --transition: 0.22s cubic-bezier(.4,0,.2,1);
}

/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background: var(--c-dark);
  color: var(--c-text);
}

body {
  font-family: var(--font-mono);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--c-dark);
}

/* 无障碍隐藏 */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-green); text-decoration: none; }
a:hover { color: var(--c-yellow); }
ol { list-style: none; }
ul { list-style: none; }

/* ===== 站容器 ===== */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-dark);
  border-bottom: 2px solid var(--c-green);
  box-shadow: 0 2px 24px rgba(135,255,113,0.10);
}

.header-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  border-bottom: 1px dashed var(--c-border);
  gap: 1rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--c-green);
  font-weight: 500;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-link:hover { color: var(--c-yellow); }

.logo-mark { width: 40px; height: 40px; object-fit: contain; }

.logo-text-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  background: var(--c-green);
  color: var(--c-dark);
  font-size: 1.4rem;
  font-weight: 500;
  clip-path: polygon(15% 0%, 85% 0%, 100% 15%, 100% 85%, 85% 100%, 15% 100%, 0% 85%, 0% 15%);
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.15rem;
  letter-spacing: 0.06em;
}

/* 搜索框 */
.header-search {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--c-green);
  border-radius: 4px;
  overflow: hidden;
  background: var(--c-dark2);
  flex-shrink: 1;
  max-width: 320px;
  width: 100%;
}
.search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--c-text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.45rem 0.75rem;
  width: 100%;
  min-width: 0;
}
.search-input::placeholder { color: var(--c-muted); }
.search-btn {
  background: var(--c-green);
  border: none;
  color: var(--c-dark);
  font-size: 1.1rem;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 40px;
  min-width: 40px;
  font-family: var(--font-mono);
  transition: background var(--transition);
}
.search-btn:hover { background: var(--c-yellow); }

/* 导航行 */
.site-nav {
  padding: 0 2rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }

.site-nav > ol {
  display: flex;
  align-items: stretch;
  gap: 0;
  white-space: nowrap;
}

.site-nav > ol > li > a {
  display: flex;
  align-items: center;
  gap: 0.4em;
  color: var(--c-muted);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  min-height: 44px;
  border-right: 1px solid var(--c-border);
  transition: color var(--transition), background var(--transition);
  position: relative;
}
.site-nav > ol > li:first-child > a { border-left: 1px solid var(--c-border); }
.site-nav > ol > li > a:hover {
  color: var(--c-green);
  background: rgba(135,255,113,0.06);
}
.site-nav > ol > li > a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--c-yellow);
  transform: scaleX(0);
  transition: transform var(--transition);
  transform-origin: left;
}
.site-nav > ol > li > a:hover::after { transform: scaleX(1); }

/* scroll-margin for sticky nav */
div[id] {
  scroll-margin-top: calc(var(--nav-h) + 8px);
}

/* ===== HERO ===== */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
  background: var(--c-dark);
}

/* 超大背景文字 */
.hero-bg-text {
  position: absolute;
  top: 50%;
  left: -0.1em;
  transform: translateY(-50%);
  font-size: clamp(8rem, 22vw, 18rem);
  font-weight: 500;
  color: transparent;
  -webkit-text-stroke: 2px var(--c-dark3);
  letter-spacing: -0.04em;
  pointer-events: none;
  z-index: 0;
  user-select: none;
  white-space: nowrap;
}

/* Memphis 装饰 */
.hero-deco { position: absolute; inset: 0; pointer-events: none; z-index: 1; }

.deco-tri {
  position: absolute;
  width: 0; height: 0;
}
.deco-tri-1 {
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-bottom: 104px solid var(--c-yellow);
  top: 12%;
  left: 8%;
  transform: rotate(-18deg);
  opacity: 0.55;
}
.deco-tri-2 {
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 70px solid var(--c-green);
  bottom: 22%;
  left: 15%;
  transform: rotate(12deg);
  opacity: 0.45;
}
.deco-circle-1 {
  position: absolute;
  width: 120px; height: 120px;
  border: 12px solid var(--c-yellow);
  border-radius: 50%;
  bottom: 15%;
  left: 5%;
  opacity: 0.3;
}
.deco-squiggle {
  position: absolute;
  top: 65%;
  left: 3%;
  color: var(--c-green);
  font-size: 1.6rem;
  letter-spacing: -0.3em;
  opacity: 0.4;
  transform: rotate(-8deg);
}

/* Hero 图片 */
.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero-media-empty {
  background: linear-gradient(135deg, var(--c-dark2) 0%, #0d1a0c 100%);
}
.hero-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(25,38,23,0.95) 30%, rgba(25,38,23,0.55) 100%);
}

/* Hero 文案 — 右对齐 */
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 560px;
  margin-right: clamp(2rem, 8vw, 8rem);
  text-align: right;
}

.hero-content h1 {
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  font-weight: 500;
  line-height: 1.2;
  color: var(--c-green);
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
  text-shadow: 0 0 30px rgba(135,255,113,0.4);
}

.hero-desc {
  font-size: 1rem;
  color: var(--c-text);
  line-height: 1.7;
  margin-bottom: 2rem;
  opacity: 0.9;
}

.hero-cta {
  display: inline-block;
  background: var(--c-green);
  color: var(--c-dark);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 0.85rem 2.2rem;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  text-decoration: none;
  min-height: 48px;
}
.hero-cta:hover {
  background: var(--c-yellow);
  color: var(--c-dark);
  transform: translateY(-2px);
}

/* Hero 斜切底边 */
.hero-wave {
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  z-index: 3;
  line-height: 0;
}
.hero-wave svg {
  width: 100%;
  height: 80px;
  display: block;
}

/* ===== 主内容区 ===== */
.site-main {
  flex: 1;
  padding: 3rem 0 4rem;
  background: var(--c-dark);
  position: relative;
}

/* Memphis repeating pattern background */
.site-main::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(135,255,113,0.04) 1px, transparent 1px),
    radial-gradient(circle, rgba(255,206,92,0.03) 1px, transparent 1px);
  background-size: 40px 40px, 70px 70px;
  background-position: 0 0, 20px 20px;
  pointer-events: none;
  z-index: 0;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 1;
}

/* 四层正文容器契约：main > section.wrap > div > article */
.content-section {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2.5rem;
  align-items: start;
}

.content-article {
  min-width: 0;
}

.content-body {
  color: var(--c-text);
  font-size: 1rem;
  line-height: 1.75;
}

/* 正文内部元素 */
.content-body h2 {
  font-size: 1.5rem;
  color: var(--c-green);
  margin: 2.5rem 0 0.75rem;
  letter-spacing: 0.04em;
  border-left: 4px solid var(--c-yellow);
  padding-left: 0.75rem;
}
.content-body h3 {
  font-size: 1.15rem;
  color: var(--c-yellow);
  margin: 1.8rem 0 0.5rem;
  letter-spacing: 0.03em;
}
.content-body p { margin: 0 0 1.1rem; }
.content-body ul, .content-body ol {
  margin: 0 0 1.1rem 1.5rem;
  list-style: disc;
}
.content-body ol { list-style: decimal; }
.content-body li { margin-bottom: 0.4rem; }
.content-body a {
  color: var(--c-green);
  border-bottom: 1px dashed var(--c-green);
  transition: color var(--transition), border-color var(--transition);
}
.content-body a:hover { color: var(--c-yellow); border-color: var(--c-yellow); }
.content-body strong { color: var(--c-yellow); font-weight: 500; }
.content-body em { color: var(--c-green); font-style: italic; }
.content-body blockquote {
  border-left: 3px solid var(--c-yellow);
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: rgba(255,206,92,0.06);
  color: var(--c-text);
}
.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}
.content-body th {
  background: var(--c-dark3);
  color: var(--c-green);
  padding: 0.6rem 0.9rem;
  text-align: left;
  border-bottom: 2px solid var(--c-green);
}
.content-body td {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--c-border);
}
.content-body tr:hover td { background: rgba(135,255,113,0.03); }

/* div 区块内容（page.content 里的 div） */
.content-body div {
  margin: 0 0 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px dashed var(--c-border);
}
.content-body div:last-child { border-bottom: none; }

/* ===== ASIDE ===== */
.content-aside {
  position: sticky;
  top: calc(var(--nav-h) + 16px);
}

.aside-inner {
  background: var(--c-dark2);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: 6px 6px 0 var(--c-dark3), 0 8px 32px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}

.aside-eyebrow {
  display: block;
  font-size: 0.72rem;
  color: var(--c-yellow);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.aside-title {
  font-size: 1rem;
  color: var(--c-green);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--c-border);
  letter-spacing: 0.04em;
}

.aside-nav ol {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.aside-nav ol li a {
  display: flex;
  align-items: center;
  gap: 0.5em;
  color: var(--c-muted);
  font-size: 0.82rem;
  padding: 0.45rem 0.5rem;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
  min-height: 40px;
}
.aside-nav ol li a:hover {
  color: var(--c-green);
  background: rgba(135,255,113,0.07);
}

/* aside 装饰三角 */
.aside-deco {
  position: absolute;
  bottom: -20px;
  right: -20px;
  pointer-events: none;
}
.aside-tri {
  display: block;
  width: 0; height: 0;
  border-left: 50px solid transparent;
  border-bottom: 50px solid rgba(135,255,113,0.08);
  transform: rotate(0deg);
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--c-dark2);
  border-top: 2px solid var(--c-green);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}

/* footer 只含 p + small（契约要求） */
.site-footer::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  background: var(--c-yellow);
  opacity: 0.06;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  pointer-events: none;
}

.footer-contact {
  color: var(--c-text);
  font-size: 0.9rem;
  line-height: 1.5;
}

.footer-copy {
  color: var(--c-muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

/* ===== 动效 ===== */
@media (prefers-reduced-motion: no-preference) {
  /* Parallax hero bg text */
  .hero-bg-text {
    will-change: transform;
    transition: transform 0.1s linear;
  }

  /* Stagger list animation */
  .site-nav > ol > li {
    opacity: 0;
    transform: translateY(-8px);
    animation: fadeInDown 0.4s ease forwards;
  }
  .site-nav > ol > li:nth-child(1) { animation-delay: 0.05s; }
  .site-nav > ol > li:nth-child(2) { animation-delay: 0.10s; }
  .site-nav > ol > li:nth-child(3) { animation-delay: 0.15s; }
  .site-nav > ol > li:nth-child(4) { animation-delay: 0.20s; }
  .site-nav > ol > li:nth-child(5) { animation-delay: 0.25s; }
  .site-nav > ol > li:nth-child(6) { animation-delay: 0.30s; }
  .site-nav > ol > li:nth-child(7) { animation-delay: 0.35s; }

  .content-body div {
    opacity: 0;
    transform: translateY(24px);
    animation: fadeInUp 0.5s ease forwards;
  }

  @keyframes fadeInDown {
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
  }

  /* Deco triangles subtle rotation */
  .deco-tri-1 {
    animation: triFloat 6s ease-in-out infinite alternate;
  }
  .deco-tri-2 {
    animation: triFloat 8s ease-in-out infinite alternate-reverse;
  }
  @keyframes triFloat {
    from { transform: rotate(-18deg) translateY(0); }
    to { transform: rotate(-10deg) translateY(-12px); }
  }
}

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

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .content-section {
    grid-template-columns: 1fr;
  }
  .content-aside {
    position: static;
    order: -1;
  }
  .aside-inner { border-radius: 12px; }
}

@media (max-width: 640px) {
  :root { --nav-h: 110px; }

  .header-brand-row {
    padding: 0.6rem 1rem;
    flex-wrap: wrap;
  }
  .brand-name { font-size: 1rem; }
  .header-search { max-width: 100%; order: 3; flex: 1 1 100%; }

  .site-nav { padding: 0 1rem; }
  .site-nav > ol > li > a { padding: 0.7rem 0.7rem; font-size: 0.78rem; }

  .hero-content {
    margin: 0 1rem;
    text-align: left;
    max-width: 100%;
  }
  .hero-content h1 { font-size: clamp(1.6rem, 8vw, 2.5rem); }

  .hero-bg-text { font-size: 5rem; opacity: 0.3; }

  .wrap { padding: 0 1rem; }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 375px) {
  .hero-content h1 { font-size: 1.5rem; }
  .site-nav > ol > li > a { padding: 0.65rem 0.5rem; font-size: 0.74rem; }
}

/* ===== Memphis 装饰花纹 (repeating) ===== */
.site-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--c-green) 0px, var(--c-green) 20px,
    var(--c-yellow) 20px, var(--c-yellow) 40px,
    var(--c-dark3) 40px, var(--c-dark3) 60px
  );
  pointer-events: none;
}
.site-header { position: sticky; }

/* mix-blend-mode overlay on hero */
.hero-content h1 {
  mix-blend-mode: normal;
}
.deco-tri-1, .deco-tri-2, .deco-circle-1 {
  mix-blend-mode: screen;
}
