@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ============================================================
   CSS 变量 & Reset
   ============================================================ */
:root {
  --c-bg: #1A1A2E;
  --c-red: #E63946;
  --c-light: #F1F1F1;
  --c-bg2: #22223a;
  --c-bg3: #2d2d4a;
  --c-muted: #8888aa;
  --c-border: #333355;
  --c-red-dark: #b02a34;
  --c-text: #F1F1F1;
  --c-text-dim: #c0c0d8;
  --ff-mono: 'JetBrains Mono', 'Courier New', monospace;
  --ff-sans: 'IBM Plex Sans', system-ui, sans-serif;
  --radius: 4px;
  --radius-card: 10px;
  --header-h: 104px;
  --transition: 160ms ease;
}

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

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

body {
  font-family: var(--ff-sans);
  font-size: 1rem;
  line-height: 1.65;
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-text);
  overflow-x: hidden;
}

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

a {
  color: var(--c-red);
  text-decoration: none;
  transition: color var(--transition), opacity var(--transition);
}

a:hover, a:focus-visible {
  color: var(--c-light);
  outline: 2px solid var(--c-red);
  outline-offset: 2px;
}

ul, ol { list-style: none; }
dl, dt, dd { display: block; }

/* ============================================================
   全局排版
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff-mono);
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-light);
}

p { line-height: 1.7; color: var(--c-text-dim); }

code, pre {
  font-family: var(--ff-mono);
  background: var(--c-bg3);
  border-radius: var(--radius);
  font-size: 0.9em;
}

code { padding: 0.1em 0.4em; }
pre { padding: 1rem; overflow-x: auto; }

/* ============================================================
   Site Wrapper
   ============================================================ */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   Header：两行（品牌行 + 菜单行）
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-bg);
  border-bottom: 2px solid var(--c-red);
}

.header-brand {
  display: flex;
  align-items: center;
  padding: 0.75rem 2rem;
  border-bottom: 1px solid var(--c-border);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  outline-offset: 4px;
}

.brand-link:hover { opacity: 0.85; color: inherit; }
.brand-link:focus-visible { outline: 2px solid var(--c-red); }

.logo-img {
  width: 36px;
  height: 36px;
  display: block;
}

.brand-name {
  font-family: var(--ff-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--c-light);
  letter-spacing: 0.04em;
}

.header-nav-row {
  background: var(--c-bg2);
  padding: 0 2rem;
}

.header-nav-inner {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.header-nav-inner::-webkit-scrollbar { display: none; }

.hnav-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  font-family: var(--ff-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--c-text-dim);
  white-space: nowrap;
  border-right: 1px solid var(--c-border);
  transition: background var(--transition), color var(--transition);
  letter-spacing: 0.03em;
}

.hnav-link:first-child { border-left: 1px solid var(--c-border); }

.hnav-link:hover,
.hnav-link:focus-visible {
  background: var(--c-red);
  color: var(--c-light);
  outline: none;
}

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

/* ============================================================
   Hero：双图错位拼贴，满屏 100vh，文案左对齐
   ============================================================ */
.hero {
  min-height: 100vh;
  background: var(--c-bg);
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--c-border);
  position: relative;
  overflow: hidden;
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 5rem 2rem 4rem;
}

.hero-text {
  flex: 1 1 480px;
  max-width: 560px;
}

.hero-eyebrow {
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-red);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.hero-h1 {
  font-family: var(--ff-mono);
  font-size: clamp(2rem, 5vw, 3.8rem);
  font-weight: 700;
  color: var(--c-light);
  line-height: 1.1;
  margin-bottom: 1.4rem;
  letter-spacing: -0.01em;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--c-text-dim);
  line-height: 1.7;
  margin-bottom: 2rem;
  max-width: 420px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--c-red);
  color: var(--c-light);
  font-family: var(--ff-mono);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.8rem 2rem;
  border-radius: var(--radius);
  border: 2px solid var(--c-red);
  transition: background var(--transition), color var(--transition);
  min-height: 44px;
  letter-spacing: 0.04em;
}

.hero-cta:hover, .hero-cta:focus-visible {
  background: transparent;
  color: var(--c-red);
  outline: none;
}

/* 双图错位拼贴 */
.hero-media {
  flex: 0 0 420px;
  position: relative;
  height: 420px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
}

.hero-tile {
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.hero-tile-a {
  grid-column: 1;
  grid-row: 1 / 3;
  transform: translateY(-20px);
}

.hero-tile-b {
  grid-column: 2;
  grid-row: 1;
  transform: translateY(20px);
}

.hero-tile-c {
  grid-column: 2;
  grid-row: 2;
  transform: translateY(10px);
}

.tile-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.2rem;
  position: relative;
}

.tile-inner-a {
  background: var(--c-red);
  min-height: 280px;
}

.tile-inner-b {
  background: var(--c-bg3);
  border: 2px solid var(--c-border);
  min-height: 130px;
}

.tile-inner-c {
  background: var(--c-bg2);
  border: 2px solid var(--c-red);
  min-height: 130px;
}

.tile-label {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(241,241,241,0.6);
  display: block;
  margin-bottom: 0.3rem;
}

.tile-num {
  font-family: var(--ff-mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--c-light);
  line-height: 1;
}

/* ============================================================
   Main Layout：侧边栏左 + 正文右
   ============================================================ */
.site-main {
  flex: 1;
  background: var(--c-bg);
}

.main-layout {
  display: flex;
  align-items: flex-start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 2rem;
  gap: 2.5rem;
}

/* ============================================================
   Aside 侧边栏（在左）
   ============================================================ */
.site-aside {
  flex: 0 0 240px;
  position: sticky;
  top: calc(var(--header-h) + 16px);
  align-self: flex-start;
}

.aside-inner {
  background: var(--c-bg2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
}

.aside-title {
  font-family: var(--ff-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--c-light);
  margin-bottom: 0.3rem;
  letter-spacing: 0.06em;
}

.aside-inner > .subtitle {
  font-size: 0.76rem;
  color: var(--c-muted);
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.aside-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 1.5rem;
}

.aside-item { display: block; }

.aside-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius);
  color: var(--c-text-dim);
  font-size: 0.82rem;
  font-family: var(--ff-mono);
  transition: background var(--transition), color var(--transition);
  min-height: 40px;
}

.aside-link:hover, .aside-link:focus-visible {
  background: var(--c-red);
  color: var(--c-light);
  outline: none;
}

.aside-num {
  font-size: 0.7rem;
  color: var(--c-red);
  font-weight: 700;
  min-width: 22px;
}

.aside-link:hover .aside-num,
.aside-link:focus-visible .aside-num {
  color: var(--c-light);
}

.aside-name { flex: 1; }

.aside-brand-block {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--c-border);
}

.aside-brand-text {
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-muted);
  line-height: 1.5;
}

/* ============================================================
   正文容器：main > div.wrap > section > article
   ============================================================ */
.wrap {
  flex: 1;
  min-width: 0;
}

.content-section {
  display: block;
}

.content-article {
  display: block;
}

/* 正文内容样式 */
.content-article h1 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 1rem;
  color: var(--c-light);
}

.content-article h2 {
  font-family: var(--ff-mono);
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
  font-weight: 700;
  color: var(--c-light);
  margin-top: 3rem;
  margin-bottom: 0.6rem;
  padding-left: 1rem;
  border-left: 4px solid var(--c-red);
  line-height: 1.25;
}

.content-article h2 + p,
.content-article h2 + .subtitle,
.content-article h2 + p.subtitle {
  color: var(--c-muted);
  font-size: 0.92rem;
  margin-bottom: 1rem;
  padding-left: 1.3rem;
  line-height: 1.6;
}

.content-article h3 {
  font-family: var(--ff-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--c-red);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.content-article p {
  margin-bottom: 1.1rem;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--c-text-dim);
}

.content-article ul,
.content-article ol {
  padding-left: 1.5rem;
  margin-bottom: 1.2rem;
  list-style: disc;
}

.content-article ol { list-style: decimal; }

.content-article li {
  color: var(--c-text-dim);
  margin-bottom: 0.4rem;
  line-height: 1.7;
  font-size: 1rem;
}

.content-article a {
  color: var(--c-red);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.content-article a:hover {
  color: var(--c-light);
}

.content-article blockquote {
  border-left: 4px solid var(--c-red);
  padding: 0.8rem 1.2rem;
  background: var(--c-bg2);
  margin: 1.5rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--c-text-dim);
}

.content-article section {
  padding: 3rem 0;
  border-bottom: 1px solid var(--c-border);
}

.content-article section:last-of-type {
  border-bottom: none;
}

.content-article strong {
  color: var(--c-light);
  font-weight: 600;
}

.content-article em {
  color: var(--c-red);
  font-style: normal;
  font-weight: 500;
}

.content-article table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.content-article th {
  background: var(--c-bg3);
  color: var(--c-light);
  font-family: var(--ff-mono);
  font-weight: 600;
  padding: 0.6rem 0.8rem;
  text-align: left;
  border: 1px solid var(--c-border);
}

.content-article td {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--c-border);
  color: var(--c-text-dim);
}

.content-article tr:nth-child(even) td {
  background: var(--c-bg2);
}

/* 区块分隔装饰 */
.content-article section:first-of-type {
  padding-top: 0;
}

/* ============================================================
   页脚：footer 单行（logo + nav + copyright 横排）
   ============================================================ */
.site-footer {
  background: var(--c-bg2);
  border-top: 2px solid var(--c-red);
  padding: 2rem;
}

.footer-bar {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.footer-brand-name {
  font-family: var(--ff-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-light);
}

.footer-nav {
  flex: 1;
}

.footer-dl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0;
}

.footer-dt {
  display: block;
}

.footer-dd {
  display: block;
  margin: 0;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.2rem 0.8rem;
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  color: var(--c-muted);
  transition: color var(--transition);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.footer-link:hover, .footer-link:focus-visible {
  color: var(--c-red);
  outline: none;
}

.footer-copy {
  flex: 0 0 auto;
  text-align: right;
}

.copy-text {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  color: var(--c-muted);
  margin-bottom: 0.3rem;
  line-height: 1.5;
}

.copy-note {
  font-size: 0.72rem;
  color: #555577;
  line-height: 1.5;
}

/* ============================================================
   Scroll Reveal 动效
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.45s ease, transform 0.45s ease;
  }
  .reveal.visible {
    opacity: 1;
    transform: none;
  }

  .hero-tile {
    transition: transform 0.5s ease;
  }

  .hero-tile-a { animation: floatA 6s ease-in-out infinite alternate; }
  .hero-tile-b { animation: floatB 5s ease-in-out infinite alternate; }
  .hero-tile-c { animation: floatC 7s ease-in-out infinite alternate; }

  @keyframes floatA {
    from { transform: translateY(-20px); }
    to   { transform: translateY(-32px); }
  }
  @keyframes floatB {
    from { transform: translateY(20px); }
    to   { transform: translateY(10px); }
  }
  @keyframes floatC {
    from { transform: translateY(10px); }
    to   { transform: translateY(22px); }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1024px) {
  .hero-media {
    flex: 0 0 320px;
    height: 340px;
  }
  .tile-inner-a { min-height: 200px; }
  .tile-inner-b, .tile-inner-c { min-height: 100px; }
  .tile-num { font-size: 1.8rem; }

  .site-aside { flex: 0 0 200px; }
}

@media (max-width: 768px) {
  :root { --header-h: 88px; }

  .header-brand { padding: 0.65rem 1rem; }
  .header-nav-row { padding: 0 1rem; }
  .hnav-link { padding: 0 0.6rem; font-size: 0.75rem; }

  .hero-content {
    flex-direction: column;
    align-items: flex-start;
    padding: 6rem 1rem 3rem;
    gap: 2rem;
  }

  .hero-media {
    flex: 0 0 auto;
    width: 100%;
    height: 220px;
  }

  .tile-inner-a { min-height: 160px; }
  .tile-inner-b, .tile-inner-c { min-height: 80px; }
  .tile-num { font-size: 1.5rem; }

  .main-layout {
    flex-direction: column;
    padding: 2rem 1rem;
    gap: 1.5rem;
  }

  .site-aside {
    flex: 0 0 auto;
    width: 100%;
    position: static;
  }

  .aside-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }

  .footer-bar {
    flex-direction: column;
    gap: 1.2rem;
    align-items: flex-start;
  }

  .footer-copy { text-align: left; }

  .footer-dl { gap: 0; }
}

@media (max-width: 480px) {
  .brand-name { font-size: 1rem; }
  .hero-h1 { font-size: 1.8rem; }
  .hero-cta { width: 100%; justify-content: center; }

  .aside-list { grid-template-columns: 1fr; }

  .content-article h2 { font-size: 1.15rem; }
}
