:root {
  --bg: #fafaf9;
  --fg: #1c1917;
  --muted: #78716c;
  --muted-2: #a8a29e;
  --card-bg: #ffffff;
  --card-bg-hover: #fafaf9;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --accent: #c2410c;
  --accent-soft: #fed7aa;
  --accent-bg: #fff7ed;
  --live-fg: #047857;
  --live-bg: #ecfdf5;
  --live-border: #a7f3d0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.landing {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 32px 80px;
}

/* ---------- header ---------- */
.landing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 16px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg);
}
.logo:hover { text-decoration: none; }
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  line-height: 1;
}
.logo-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
}
.landing-nav a {
  color: var(--muted);
  font-size: 14px;
}
.landing-nav a:hover { color: var(--fg); text-decoration: none; }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 56px 0 64px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.hero-text h1 {
  font-size: 36px;
  line-height: 1.3;
  margin: 0 0 20px;
  letter-spacing: -0.4px;
  font-weight: 700;
  /* CJK 友好的换行：不在中文词中间断；让浏览器自动平衡 */
  word-break: keep-all;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.hero-text .lede {
  font-size: 16px;
  color: var(--muted);
  margin: 0;
  line-height: 1.7;
  max-width: 540px;
}
.hero-art {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}
.hero-art-image {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

/* ---------- modes ---------- */
.modes {
  display: grid;
  gap: 12px;
  margin-bottom: 48px;
}
.mode-card {
  display: grid;
  grid-template-columns: 56px 1fr 32px;
  gap: 20px;
  align-items: center;
  padding: 24px 24px 24px 28px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.mode-card:hover {
  background: var(--card-bg-hover);
  border-color: var(--border-strong);
  text-decoration: none;
  transform: translateY(-1px);
}
.mode-card.live {
  border-color: var(--accent-soft);
  background: linear-gradient(180deg, var(--accent-bg) 0%, var(--card-bg) 60%);
}
.mode-card.live:hover {
  border-color: var(--accent);
}
.mode-num {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 22px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.mode-body { min-width: 0; }
.mode-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.mode-card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.badge {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 500;
  border: 1px solid;
  letter-spacing: 0.2px;
}
.badge.live {
  background: var(--live-bg);
  color: var(--live-fg);
  border-color: var(--live-border);
}
.badge.planned {
  background: #f5f5f4;
  color: var(--muted);
  border-color: var(--border);
}
.badge.preview {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}
.mode-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}
.mode-meta {
  margin-top: 6px !important;
  font-size: 12px !important;
  color: var(--muted-2) !important;
}
.mode-arrow {
  color: var(--muted-2);
  font-size: 20px;
  transition: transform 0.15s, color 0.15s;
}
.mode-card:hover .mode-arrow {
  color: var(--accent);
  transform: translateX(2px);
}

/* ---------- mode-primary (01: live tool, full-width, strong CTA) ---------- */
.mode-primary {
  grid-template-columns: 56px 1fr auto;
  padding: 28px 28px 28px 32px;
}
.mode-primary .mode-num {
  font-size: 26px;
}
.mode-primary h2 {
  font-size: 20px;
}
.mode-primary p {
  font-size: 14.5px;
}
.mode-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.mode-primary:hover .mode-cta {
  background: var(--accent);
  color: #fff;
  transform: translateX(2px);
}

/* ---------- modes-secondary (02/03: paired educational previews) ---------- */
.modes-secondary-label {
  margin: 28px 0 12px;
  font-size: 12px;
  color: var(--muted-2);
  text-transform: none;
  letter-spacing: 0;
  text-align: center;
}
.modes-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  /* default align-items: stretch so 03 grows to 02's height; the code
     preview inside 03 takes flex:1 to fill that extra space gracefully */
}
.mode-secondary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 22px 18px;
  /* override the 3-column grid layout from .mode-card */
  grid-template-columns: none;
}
.mode-secondary .mode-secondary-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.mode-secondary .mode-num {
  font-size: 17px;
  color: var(--muted);
}
.mode-secondary h2 {
  font-size: 15px;
  margin: 0;
}
.mode-secondary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.mode-preview-banner {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: #0E1A2B;
  position: relative;
}
.mode-preview-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.mode-preview-count {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #F5F1E8;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.mode-preview-code {
  margin: 0;
  padding: 14px 16px;
  background: var(--card-bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.75;
  color: var(--muted);
  white-space: pre-wrap;
  overflow: hidden;
  flex: 1;            /* fill the remaining height of the secondary card */
  min-height: 110px;
}
.mode-cta-link {
  margin-top: 4px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  transition: transform 0.15s;
}
.mode-secondary:hover .mode-cta-link {
  transform: translateX(2px);
}

/* ---------- footer ---------- */
.landing-foot {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.landing-foot a { color: var(--muted); }
.landing-foot a:hover { color: var(--fg); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .landing { padding: 16px 20px 60px; }
  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 32px 0 40px;
  }
  .hero-text h1 { font-size: 28px; }
  .hero-art { order: -1; min-height: 0; }
  .hero-art-image { max-height: 200px; }
  .mode-card {
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
    padding: 18px 20px;
    gap: 14px;
  }
  .mode-arrow { display: none; }
  .mode-num { font-size: 18px; }
  .mode-card h2 { font-size: 16px; }

  /* primary card on mobile: body spans both cols, CTA below */
  .mode-primary {
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
  }
  .mode-primary .mode-cta {
    grid-column: 1 / -1;
    justify-self: start;
    margin-top: 4px;
    padding: 8px 14px;
    font-size: 13px;
  }
  .mode-primary h2 { font-size: 17px; }

  /* secondary pair stacks vertically on mobile */
  .modes-secondary {
    grid-template-columns: 1fr;
  }
  .mode-secondary {
    padding: 16px 18px;
  }
}

/* ---------- empty state for stub mode pages ---------- */
.empty-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.empty-page .empty-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.empty-page .empty-body .card {
  max-width: 480px;
  text-align: center;
  padding: 40px 32px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.empty-page .empty-body h2 {
  margin: 0 0 12px;
  font-size: 22px;
}
.empty-page .empty-body p {
  margin: 8px 0;
  color: var(--muted);
}
.empty-page .empty-body a { color: var(--accent); }

/* ===================================================================
   Sub-page common (mode-2 education page, mode-3 education page)
   =================================================================== */

.subpage {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 32px 80px;
}

.subpage-hero {
  padding: 48px 0 40px;
}
.subpage-hero h1 {
  font-size: 32px;
  line-height: 1.3;
  margin: 0 0 16px;
  letter-spacing: -0.3px;
  font-weight: 700;
  word-break: keep-all;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.subpage-hero .lede {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 28px;
  line-height: 1.7;
  max-width: 620px;
}

.cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cta-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.cta-primary:hover {
  background: #9a3409;
  border-color: #9a3409;
  text-decoration: none;
}
.cta-secondary {
  background: var(--card-bg);
  color: var(--fg);
  border-color: var(--border-strong);
}
.cta-secondary:hover {
  background: var(--card-bg-hover);
  border-color: var(--muted-2);
  text-decoration: none;
}

.section {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}
.section-head {
  margin-bottom: 24px;
}
.section-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.section-head .section-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- mode-2 gallery (horizontal scroll snap, 小红书 carousel feel) ---------- */
.gallery {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 4px 18px;
  margin: 0 -4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.gallery::-webkit-scrollbar { height: 8px; }
.gallery::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
}
.gallery-item {
  flex: 0 0 auto;
  width: 260px;
  scroll-snap-align: start;
  border-radius: 12px;
  overflow: hidden;
  background: #0E1A2B;
  border: 1px solid var(--border);
  position: relative;
  cursor: zoom-in;
}
.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}
.gallery-item .gallery-num {
  position: absolute;
  top: 8px;
  left: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  padding: 2px 7px;
  background: rgba(0,0,0,0.45);
  color: #F5F1E8;
  border-radius: 6px;
  letter-spacing: 0.5px;
}
.gallery-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted-2);
}

/* ---------- caption sample block ---------- */
.caption-sample {
  margin-top: 28px;
  padding: 24px 28px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.caption-sample .caption-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.caption-sample .caption-meta::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--muted-2);
}
.caption-sample h3 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
}
.caption-sample .caption-body {
  margin: 0 0 14px;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}
.caption-sample .caption-tags {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  line-height: 1.7;
  word-break: break-all;
}

/* ---------- how-it-works (3 steps) ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.step {
  padding: 22px 22px 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.step h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}
.step p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.step code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--card-bg-hover);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ---------- mode-3 before/after example pair ---------- */
.example-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.example-col {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.example-label {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}
.example-code {
  margin: 0;
  padding: 14px 16px;
  background: var(--card-bg-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg);
  white-space: pre-wrap;
  overflow-x: auto;
  flex: 1;
}

/* ---------- status / planning banner (for incomplete features) ---------- */
.status-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  border-radius: 10px;
  color: var(--accent);
  font-size: 13px;
  line-height: 1.65;
  margin-top: 24px;
}
.status-banner strong { font-weight: 600; }

/* ---------- lightbox (image preview overlay) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(14, 26, 43, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  cursor: zoom-out;
}
.lightbox.is-open { display: flex; }
.lightbox img {
  max-width: min(100%, 720px);
  max-height: 92vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  font-size: 28px;
  color: #F5F1E8;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 4px 10px;
}

/* ---------- subpage responsive ---------- */
@media (max-width: 760px) {
  .subpage { padding: 16px 20px 60px; }
  .subpage-hero { padding: 28px 0 24px; }
  .subpage-hero h1 { font-size: 26px; }
  .section { padding: 28px 0; }
  .steps { grid-template-columns: 1fr; }
  .gallery-item { width: 200px; }
  .example-pair { grid-template-columns: 1fr; }
}

/* =====================================================
   4-mode grid (新主页布局，v8) — 2x2 平铺
   每张卡同等地位，状态徽章区分形态
   ===================================================== */

.modes-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 0 auto;
  max-width: 1100px;
}

.mode4-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 24px;
  background: var(--card, #fbf6e8);
  border: 1px solid var(--card-edge, #e7dcc1);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink, #1d1612);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  min-height: 240px;
}
.mode4-card:hover {
  transform: translateY(-2px);
  border-color: var(--madder, #a4302a);
  box-shadow: 0 6px 22px rgba(28, 22, 18, 0.08);
}

.mode4-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mode4-card .mode-num {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 13px;
  color: var(--ink-mute, #6c5b48);
  letter-spacing: 0.05em;
}
.mode4-card h2 {
  font-size: 18px;
  margin: 0;
  line-height: 1.3;
  font-weight: 700;
}
.mode4-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft, #3a2f25);
  margin: 0;
  flex-grow: 1;
}
.mode4-card .mode4-meta {
  font-size: 12px;
  color: var(--ink-mute, #6c5b48);
  font-family: var(--mono, "JetBrains Mono", monospace);
  flex-grow: 0;
  border-top: 1px dashed var(--rule, #c8b994);
  padding-top: 8px;
  margin-top: auto;
}
.mode4-preview-img {
  margin: 6px 0;
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper, #f3ecdc);
  border: 1px solid var(--rule, #c8b994);
  border-radius: 6px;
  padding: 8px;
  min-height: 80px;
}
.mode4-preview-img img {
  max-height: 100px;
  width: auto;
  border-radius: 3px;
}

/* 状态徽章 */
.mode4-card .badge {
  display: inline-block;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.mode4-card .badge.live { background: var(--evergreen-mute, rgba(47, 82, 64, 0.12)); color: var(--evergreen, #2f5240); }
.mode4-card .badge.preview { background: var(--ochre-mute, rgba(176, 120, 32, 0.16)); color: var(--ochre, #b07820); }
.mode4-card .badge.skill { background: var(--madder-mute, rgba(164, 48, 42, 0.14)); color: var(--madder, #a4302a); }
.mode4-card .badge.planned { background: rgba(108, 91, 72, 0.14); color: var(--ink-mute, #6c5b48); }

.mode4-card .mode-cta,
.mode4-card .mode-cta-link {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 13px;
  color: var(--madder, #a4302a);
  margin-top: 2px;
  font-weight: 600;
}

.modes-foot {
  text-align: center;
  margin: 22px auto 0;
  max-width: 700px;
}

@media (max-width: 760px) {
  .modes-grid-4 {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .mode4-card { min-height: auto; padding: 18px 18px; }
  .mode4-card h2 { font-size: 16px; }
}
