/* ========================================
   cpp-tui docs — Custom navigation styles
   ======================================== */

/* --- Navigation Bar --- */
.site-nav {
  background: #1b2a38;
  border-bottom: 2px solid #159957;
  padding: 0;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 64rem;
  margin-left: auto;
  margin-right: auto;
}

.nav-item a {
  display: block;
  padding: 0.7rem 1.2rem;
  color: #ffffffcc;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.2s, background 0.2s;
}

.nav-item a:hover {
  color: #fff;
  background: #ffffff15;
}

.nav-item.active a {
  color: #fff;
  background: #159957;
  border-radius: 0;
}

/* --- Page Navigation (Prev / Next) --- */
.page-nav {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e0e0e0;
}

.page-nav-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.page-nav-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  padding: 0.75rem 1rem;
  border: 1px solid #dce6f0;
  border-radius: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
  max-width: 45%;
}

.page-nav-link:hover {
  border-color: #159957;
  box-shadow: 0 2px 8px rgba(21, 153, 87, 0.12);
}

.page-nav-next {
  text-align: right;
  margin-left: auto;
}

.page-nav-direction {
  font-size: 0.8rem;
  color: #6a737d;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.page-nav-title {
  font-size: 1rem;
  font-weight: 600;
  color: #159957;
}

/* --- API Reference TOC --- */
.api-toc {
  background: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
}

.api-toc summary {
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  color: #24292e;
  padding: 0.25rem 0;
}

.api-toc ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.2rem;
  columns: 2;
  column-gap: 2rem;
}

.api-toc li {
  margin-bottom: 0.3rem;
  break-inside: avoid;
  font-size: 0.92rem;
}

.api-toc a {
  color: #0366d6;
  text-decoration: none;
}

.api-toc a:hover {
  text-decoration: underline;
}

.api-toc .toc-category {
  font-weight: 700;
  font-size: 0.85rem;
  color: #586069;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.6rem;
  margin-bottom: 0.2rem;
  list-style: none;
  break-inside: avoid;
}

/* --- Homepage Cards --- */
.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.doc-card {
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  padding: 1.2rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
}

.doc-card:hover {
  border-color: #159957;
  box-shadow: 0 4px 12px rgba(21, 153, 87, 0.1);
  transform: translateY(-2px);
}

.doc-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  color: #159957;
}

.doc-card p {
  margin: 0;
  font-size: 0.9rem;
  color: #586069;
  flex: 1;
}

/* --- API Reference: Section Headers --- */
.api-section-header {
  background: linear-gradient(135deg, #159957, #155799);
  color: #fff !important;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  margin-top: 2.5rem;
  font-size: 1.3rem;
}

/* --- API Reference: Tables --- */
.main-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0 1.2rem;
  font-size: 0.92rem;
}

.main-content table th {
  background: #f1f3f5;
  font-weight: 700;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #d1d5da;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #24292e;
}

.main-content table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #eaecef;
  vertical-align: top;
}

.main-content table tr:nth-child(even) td {
  background: #f9fafb;
}

.main-content table tr:hover td {
  background: #eef7f2;
}

.main-content table code {
  background: #eff1f3;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
  color: #c7254e;
}

/* --- API Reference: Back to Top --- */
.back-to-top {
  text-align: right;
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
}

.back-to-top a {
  color: #6a737d;
  text-decoration: none;
  transition: color 0.15s;
}

.back-to-top a:hover {
  color: #159957;
}

/* --- API Reference: Widget Name Headers (h4) --- */
.main-content h4 {
  background: linear-gradient(135deg, #20a76a, #1a7f8f);
  color: #fff;
  padding: 0.45rem 0.9rem;
  border-radius: 5px;
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  font-size: 1.05rem;
}

.main-content h4 code {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  font-size: 0.95em;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* --- Clickable Heading Anchors --- */
.heading-anchor-link {
  color: inherit;
  text-decoration: none;
}

.heading-anchor-link:hover {
  text-decoration: none;
  color: inherit;
}

.heading-anchor-icon {
  opacity: 0;
  font-size: 0.7em;
  transition: opacity 0.2s;
  vertical-align: middle;
}

.main-content h3:hover .heading-anchor-icon,
.main-content h4:hover .heading-anchor-icon {
  opacity: 1;
}

.main-content h3 .heading-anchor-link,
.main-content h4 .heading-anchor-link {
  cursor: pointer;
}

/* --- API Reference: Note Blockquotes --- */
.main-content blockquote {
  border-left: 4px solid #159957;
  background: #f0faf5;
  padding: 0.6rem 1rem;
  margin: 1rem 0;
  border-radius: 0 4px 4px 0;
  color: #24292e;
}

.main-content blockquote strong {
  color: #159957;
}

/* --- Code Block Refinements --- */
.main-content pre {
  border-radius: 6px;
  border: 1px solid #e1e4e8;
}

/* --- HR Dividers between widgets --- */
.main-content hr {
  border: none;
  border-top: 1px solid #eaecef;
  margin: 2rem 0;
}

/* --- Responsive --- */
@media screen and (max-width: 600px) {
  .nav-list {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-item a {
    text-align: center;
    padding: 0.6rem 1rem;
  }

  .page-nav-inner {
    flex-direction: column;
  }

  .page-nav-link {
    max-width: 100%;
  }

  .api-toc ul {
    columns: 1;
  }

  .doc-cards {
    grid-template-columns: 1fr;
  }

  .main-content table {
    font-size: 0.85rem;
  }

  .main-content table th,
  .main-content table td {
    padding: 0.35rem 0.5rem;
  }
}

