/* 各讲 lesson/index.html 统一目录版式（与课程总目录视觉一致） */
@import url("grammar-logo.css");

:root {
  --bg-deep: #0f172a;
  --paper: #fffbf5;
  --ink: #1e293b;
  --muted: #64748b;
  --accent: #0ea5e9;
  --accent-deep: #0369a1;
  --stripe: linear-gradient(90deg, #0ea5e9, #6366f1);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.5;
  padding: 1.5rem 1rem 2.5rem;
}

.g-index-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 75% 50% at 8% -5%, rgba(14, 165, 233, 0.32), transparent 55%),
    radial-gradient(ellipse 55% 40% at 98% 12%, rgba(99, 102, 241, 0.22), transparent 50%),
    linear-gradient(165deg, #0f172a 0%, #1e3a5f 45%, #0f172a 100%);
}

.g-index-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image:
    linear-gradient(#fff 1px, transparent 1px),
    linear-gradient(90deg, #fff 1px, transparent 1px);
  background-size: 40px 40px;
}

.g-index {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  background: var(--paper);
  border-radius: 20px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 24px 48px rgba(0, 0, 0, 0.35);
  padding: 1.35rem 1.25rem 1.5rem;
  overflow: hidden;
}

.g-index::before {
  content: "";
  display: block;
  height: 4px;
  margin: -1.35rem -1.25rem 1.1rem;
  background: var(--stripe);
}

.g-index-brand {
  margin: 0 0 0.35rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: none;
}

.g-index h1 {
  margin: 0 0 1.15rem;
  font-size: clamp(1.25rem, 3.5vw, 1.65rem);
  font-weight: 900;
  text-align: center;
  letter-spacing: -0.02em;
  color: var(--accent-deep);
  line-height: 1.25;
}

.g-index ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.g-index li {
  margin: 0.5rem 0;
}

.g-index li a {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #fff;
  text-decoration: none;
  color: var(--accent-deep);
  transition: background 0.18s, border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.g-index li a:hover {
  background: #f0f9ff;
  border-color: rgba(14, 165, 233, 0.45);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.12);
  transform: translateY(-1px);
}

.g-index li a:focus-visible {
  outline: 3px solid #38bdf8;
  outline-offset: 2px;
}

.g-index .num {
  flex: 0 0 auto;
  min-width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(99, 102, 241, 0.12));
  color: var(--accent-deep);
  font-size: 0.8rem;
  font-weight: 800;
}

.g-index .link-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.g-index .label {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.35;
  color: #0f172a;
}

.g-index .desc {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--muted);
}

/* 仅 label、无 link-body 时保持垂直居中 */
.g-index li a:not(:has(.link-body)) {
  align-items: center;
}

.g-index li a:not(:has(.link-body)) .label {
  flex: 1;
}

.g-index .back {
  margin: 1.35rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  text-align: center;
  font-size: 0.88rem;
}

.g-index .back a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  color: #475569;
  font-weight: 700;
  text-decoration: none;
  background: rgba(148, 163, 184, 0.12);
  transition: background 0.18s, color 0.18s;
}

.g-index .back a:hover {
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent-deep);
}

.g-index .hint {
  margin-top: 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px dashed rgba(14, 165, 233, 0.35);
  background: rgba(224, 242, 254, 0.65);
  font-size: 0.82rem;
  color: #475569;
  line-height: 1.45;
}

.g-index .hint a {
  color: var(--accent-deep);
  font-weight: 800;
}

.g-index li a.pending {
  pointer-events: none;
  opacity: 0.55;
}

@media (max-width: 480px) {
  body {
    padding: 1rem 0.65rem 2rem;
  }
  .g-index {
    padding: 1.15rem 1rem 1.25rem;
    border-radius: 16px;
  }
  .g-index::before {
    margin: -1.15rem -1rem 1rem;
  }
}

/* —— 课程总目录（根 index.html，与 L13 同系白卡片 + 列表） —— */
.g-index--home {
  max-width: 720px;
}

.g-index-search {
  margin: 0 0 1.1rem;
  position: relative;
}

.g-index-search input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.45rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.g-index-search input::placeholder {
  color: #94a3b8;
}

.g-index-search input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.g-index-search .icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0.45;
  pointer-events: none;
}

.g-index li.hidden {
  display: none;
}

.g-index-empty {
  display: none;
  margin: 0 0 0.75rem;
  padding: 0.85rem;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  border-radius: 12px;
  background: rgba(224, 242, 254, 0.5);
}

.g-index-empty.show {
  display: block;
}

.g-index-foot {
  margin: 1.35rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .g-index li a {
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}
