/* ── index-layout.css — Page-specific layout for index.html ── */

/* ── Sticky Title ── */
.title-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  padding: 24px 0 16px 0;
  margin-bottom: 2rem;
  transition: padding 0.35s cubic-bezier(.4,0,.2,1), border-color 0.35s ease, margin 0.35s ease;
  border-bottom: 1px solid transparent;
}
.title-bar.scrolled {
  border-bottom-color: var(--border);
  padding: 8px 0 8px 0;
  margin-bottom: 0;
}
.title-bar h1 {
  display: flex;
  align-items: center;
  gap: 16px;
  transform-origin: left center;
  transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  margin: 0;
}
.title-bar.scrolled h1 {
  transform: scale(0.6);
}

.title-label {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 10px;
  opacity: 1;
  max-height: 28px;
  transition: opacity 0.35s ease, max-height 0.35s ease, margin 0.35s ease;
}
.title-bar.scrolled .title-label {
  opacity: 0;
  max-height: 0;
  margin-bottom: 0;
}
.title-subtitle {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 6px;
  opacity: 1;
  transition: opacity 0.35s ease, max-height 0.35s ease, margin 0.35s ease;
}
.title-bar.scrolled .title-subtitle {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
}
.title-links {
  display: flex;
  gap: 1.25rem;
  margin-top: 14px;
  opacity: 1;
  max-height: 32px;
  transition: opacity 0.35s ease, max-height 0.35s ease, margin 0.35s ease;
}
.title-bar.scrolled .title-links {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
}
.title-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: none;
  transition: color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.title-link svg { flex-shrink: 0; width: 16px; height: 16px; }
.title-link:hover { color: var(--text); border-bottom: none; }
.title-link.disabled { color: var(--text-muted); pointer-events: none; opacity: 0.5; }

/* ── Page Layout ── */
.page-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  max-width: 1000px;
  margin: 0 auto;
  gap: 0;
}

@media (max-width: 900px) {
  .page-layout {
    grid-template-columns: 1fr;
  }
  .toc-sidebar { display: none; }
}

/* ── TOC Sidebar ── */
.toc-sidebar {
  position: relative;
}

.toc-inner {
  position: sticky;
  top: 2rem;
  padding: 1rem 0 1rem 1rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  scrollbar-width: none;
}
.toc-inner::-webkit-scrollbar { display: none; }

.toc-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 12px;
  padding-left: 12px;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
  line-height: 1.3;
  border-left: 2px solid transparent;
  margin-bottom: 1px;
}
.toc-link:hover {
  color: var(--text-secondary);
  background: var(--surface);
}
.toc-link.active {
  color: var(--text);
  border-left-color: var(--accent);
  background: var(--surface);
  font-weight: 500;
}
.toc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border);
  transition: background 0.2s;
}
.toc-link.toc-sub {
  padding-left: 24px;
  font-size: 11px;
}
.toc-link.toc-sub .toc-dot {
  width: 4px;
  height: 4px;
}
.toc-link.active .toc-dot {
  background: var(--accent);
}

/* ── Article ── */
.article {
  max-width: var(--content-width);
  padding: 2rem 1.5rem 6rem;
}

/* ── Typography (index overrides) ── */
h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.2; color: #fff; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; color: #fff; margin-top: 4rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-top: 2rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; color: var(--text); }
.subtitle { font-size: 1.1rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 2rem; }
strong { color: #fff; font-weight: 600; }
em { color: var(--text-secondary); font-style: italic; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.15s; }
a:hover { border-bottom-color: var(--accent); }

/* ── Sections ── */
section { margin-top: 3rem; }
section:first-of-type { margin-top: 0; }
.section-number { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.25rem; }
.section-number + h2 { margin-top: 1rem; }

/* ── Code ── */
code { font-family: var(--mono); font-size: 0.875em; background: var(--surface); color: var(--success); padding: 0.15em 0.4em; border-radius: 3px; }
pre { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1rem 1.25rem; overflow-x: auto; margin: 1rem 0 1.5rem; font-family: var(--mono); font-size: 0.8rem; line-height: 1.6; color: var(--text-secondary); }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.9rem; }
th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-secondary); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
td { color: var(--text); }

/* ── Lists ── */
ul, ol { margin: 0.75rem 0 1.25rem 1.5rem; color: var(--text); }
li { margin-bottom: 0.4rem; }
li::marker { color: var(--text-muted); }

/* ── Callouts ── */
.callout { background: var(--accent-dim); border-left: 3px solid var(--accent); padding: 1rem 1.25rem; border-radius: 0 6px 6px 0; margin: 1.5rem 0; font-size: 0.95rem; }

/* ── Stats Row ── */
.stats-row {
  display: flex;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 1.5rem 0;
}
.stat-item {
  flex: 1;
  background: var(--surface);
  padding: 1rem;
  text-align: center;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Interactive Placeholder ── */
.interactive-placeholder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2.5rem 1.5rem;
  margin: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.placeholder-content {
  text-align: center;
  color: var(--text-muted);
}
.placeholder-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}
.placeholder-label {
  font-size: 0.85rem;
  font-weight: 500;
}
.placeholder-desc {
  font-size: 0.75rem;
  margin-top: 0.25rem;
  opacity: 0.7;
}

/* ── Separator ── */
hr { border: none; border-top: 1px solid var(--border); margin: 3rem 0; }

/* ── Footer ── */
.footer { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.85rem; }
.footer a { color: var(--text-secondary); }
