/* ============================================================
   home.css — Hero · Chapters · Topic rows  (index.html only)
   ============================================================ */

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #3730a3 0%, #4f46e5 45%, #7c3aed 100%);
  padding: 72px 0 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* subtle mesh overlay */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 40%, rgba(255,255,255,.05) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 70%, rgba(6,182,212,.08) 0%, transparent 55%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,.65);
  margin-bottom: 18px;
}

.hero-eyebrow::before,
.hero-eyebrow::after {
  content: '';
  display: block;
  width: 28px;
  height: 1px;
  background: rgba(255,255,255,.3);
}

.hero-inner h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.6px;
  line-height: 1.15;
  margin-bottom: 18px;
}

.hero-inner h1 em {
  font-style: normal;
  background: linear-gradient(90deg, #a5f3fc, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-inner > p {
  font-size: 1.05rem;
  color: rgba(255,255,255,.78);
  max-width: 480px;
  margin: 0 auto 36px;
  line-height: 1.65;
}

/* CTA button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px 28px;
  border-radius: var(--r-xl);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,.22);
}

.btn-primary svg { width: 16px; height: 16px; }

/* ── Hero Stats strip ──────────────────────────────────────── */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-top: 44px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--r-l);
  padding: 18px 32px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  backdrop-filter: blur(6px);
}

.hero-stat {
  flex: 1;
  text-align: center;
}

.hero-stat + .hero-stat {
  border-left: 1px solid rgba(255,255,255,.15);
}

.hero-stat-val {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  margin-bottom: 4px;
}

.hero-stat-val span {
  font-size: 0.9rem;
  font-weight: 600;
  opacity: .7;
}

.hero-stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,.55);
}

/* ── Chapters Section ──────────────────────────────────────── */
.chapters-section {
  padding-top: 52px;
  padding-bottom: 60px;
}

.section-header {
  margin-bottom: 28px;
}

.section-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
  margin-bottom: 6px;
}

.chapters-section > .section-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

/* ── Chapter Card ──────────────────────────────────────────── */
.chapter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--sh-xs);
  transition: box-shadow var(--t) var(--ease), transform var(--t) var(--ease);
}

.chapter-card:hover { box-shadow: var(--sh-s); transform: translateY(-1px); }

.chapter-card.coming-soon {
  opacity: 0.5;
  pointer-events: none;
  border-style: dashed;
}

/* ── Chapter Header ────────────────────────────────────────── */
.chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  cursor: pointer;
  user-select: none;
  gap: 16px;
  transition: background var(--t) var(--ease);
}

.chapter-header:hover { background: var(--surface-2); }

.chapter-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.chapter-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-s);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.chapter-title {
  font-size: 1.04rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Chapter right side ────────────────────────────────────── */
.chapter-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* chapter-level progress bar strip */
.chapter-progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 120px;
}

.chapter-progress-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.chapter-progress-track {
  width: 100%;
  height: 6px;
  background: var(--surface-3);
  border-radius: 50px;
  overflow: hidden;
}

.chapter-progress-fill {
  height: 100%;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  width: 0%;
  transition: width 0.5s var(--ease);
}

.topic-badge {
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: var(--r-xl);
  white-space: nowrap;
  flex-shrink: 0;
}

.chevron {
  font-size: 0.8rem;
  color: var(--text-light);
  transition: transform 0.3s var(--ease);
  display: inline-block;
  flex-shrink: 0;
}

.chevron.open { transform: rotate(180deg); }

/* ── Topic List ────────────────────────────────────────────── */
.topic-list {
  border-top: 1px solid var(--border);
  display: none;
}

.topic-list.open { display: block; }

/* ── Topic Item ────────────────────────────────────────────── */
a.topic-item {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t) var(--ease);
  color: inherit;
  position: relative;
}

a.topic-item:last-child { border-bottom: none; }

a.topic-item:hover { background: var(--primary-light); }

a.topic-item:hover .topic-arrow { transform: translateX(3px); color: var(--primary); }

/* green left stripe when done */
a.topic-item.topic-done {
  background: var(--success-light);
}

a.topic-item.topic-done::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--success);
  border-radius: 0 2px 2px 0;
}

[data-theme="dark"] a.topic-item.topic-done {
  background: rgba(22,163,74,.08);
}

/* Number badge */
.topic-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t), color var(--t);
}

a.topic-item.topic-done .topic-num {
  background: var(--success);
  color: #fff;
}

.topic-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.topic-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  transition: color var(--t);
}

.topic-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

a.topic-item.topic-done .topic-name {
  color: var(--success);
}

.topic-arrow {
  font-size: 0.95rem;
  color: var(--text-light);
  transition: transform var(--t) var(--ease), color var(--t) var(--ease);
  flex-shrink: 0;
}

/* ── Topic check toggle ────────────────────────────────────── */
.topic-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  transition: border-color var(--t), background var(--t), transform 0.12s var(--ease);
  position: relative;
}

.topic-check::after {
  content: '';
  display: block;
  width: 10px;
  height: 6px;
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(-45deg) translateY(-1px);
  transition: border-color var(--t);
}

.topic-check:hover {
  border-color: var(--success);
  transform: scale(1.1);
}

.topic-check:hover::after { border-color: var(--success); }

.topic-check.checked {
  background: var(--success);
  border-color: var(--success);
  transform: scale(1.0);
}

.topic-check.checked::after {
  border-color: #ffffff;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .chapter-progress-wrap { display: none; }
  .topic-desc { display: none; }
  a.topic-item { grid-template-columns: 28px 1fr auto auto; gap: 10px; padding: 11px 16px; }
}

@media (max-width: 480px) {
  .chapter-right { gap: 8px; }
  .topic-badge { display: none; }
}

/* ── Chapter Search ────────────────────────────────────────── */
.chapter-search-wrap {
  margin-bottom: 24px;
}

.chapter-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xs);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  overflow: hidden;
}

.chapter-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.chapter-search-icon {
  width: 17px;
  height: 17px;
  color: var(--text-light);
  flex-shrink: 0;
  margin-left: 16px;
  pointer-events: none;
}

.chapter-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.95rem;
  color: var(--text);
  padding: 13px 12px;
  min-width: 0;
}

.chapter-search-input::placeholder {
  color: var(--text-light);
}

/* hide the native "x" that browsers add to search inputs */
.chapter-search-input::-webkit-search-cancel-button { display: none; }

.chapter-search-clear {
  display: none;   /* shown via JS when input has value */
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-right: 8px;
  border: none;
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t), color var(--t);
}

.chapter-search-clear:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.chapter-search-clear.visible { display: flex; }

.chapter-search-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 32px 0 8px;
}

/* highlighted match text inside topic names */
.search-highlight {
  background: rgba(79,70,229,.15);
  color: var(--primary);
  border-radius: 2px;
  padding: 0 1px;
  font-weight: 700;
}

/* topic items hidden during search */
a.topic-item.search-hidden { display: none; }

/* chapter card hidden when all its topics are hidden */
.chapter-card.search-hidden { display: none; }
