/* wiki.css — layout styles for wiki homepage and sidebar */

/* ── Override PaperMod's narrow container for all wiki pages ─────────────── */

/* PaperMod uses --main-width: 720px; override it when a wiki layout is present */
body:has(.wiki-layout),
body:has(.wiki-home) {
  --main-width: 1300px;
}

/* ── Table borders ───────────────────────────────────────────────────────── */

/* PaperMod strips table borders entirely. Restore thin bordered tables for
   readability in wiki content. Same root cause as the list/spacing resets. */
.wiki-body table {
  border-collapse: collapse;
  width: 100%;
}

.wiki-body table th,
.wiki-body table td {
  border: 1px solid var(--border);
  padding: 0.4em 0.75em;
  text-align: left;
}

.wiki-body table th {
  background: var(--code-bg);
  font-weight: 600;
}

.wiki-body table tr:nth-child(even) {
  background: var(--entry);
}

/* ── Hyperlink visibility ────────────────────────────────────────────────── */

/* PaperMod renders body links as plain text color with no underline, making
   them invisible. Force a distinct color and underline for all links inside
   wiki content so users can distinguish them from surrounding text. */
.wiki-body a {
  color: #4a9eda;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wiki-body a:hover {
  color: #74bcf7;
}

/* Dark mode: slightly brighter to maintain contrast */
.dark .wiki-body a {
  color: #74bcf7;
}

.dark .wiki-body a:hover {
  color: #a8d4f8;
}

/* ── PaperMod content resets — fix list indentation and vertical spacing ──── */

/* PaperMod's reset CSS zeros out ul/ol padding, which pushes bullet markers
   outside the visible box so they disappear. Restore standard browser indentation.
   Same fix applied in tony-talks-site-generator/layouts/partials/extend_head.html. */
.wiki-body ul,
.wiki-body ol {
  padding-left: 2em;
  margin-left: 0;
}

.wiki-body ul ul,
.wiki-body ol ol,
.wiki-body ul ol,
.wiki-body ol ul {
  padding-left: 1.5em;
}

/* PaperMod collapses vertical margins between block elements in article content.
   Restore breathing room between paragraphs, headings, lists, and code blocks. */
.wiki-body p,
.wiki-body ul,
.wiki-body ol,
.wiki-body blockquote,
.wiki-body pre,
.wiki-body table {
  margin-bottom: 1.2em;
}

.wiki-body h2,
.wiki-body h3,
.wiki-body h4 {
  margin-top: 1.8em;
  margin-bottom: 0.6em;
}

/* ── Wiki section layout (sidebar + content) ─────────────────────────────── */

.wiki-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

.wiki-sidebar-wrap {
  flex: 0 0 220px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.wiki-content {
  flex: 1;
  min-width: 0;
}

/* ── Sidebar nav ─────────────────────────────────────────────────────────── */

.wiki-sidebar {
  font-size: 0.85rem;
}

.sidebar-home {
  margin-bottom: 1rem;
  font-weight: 600;
}

.sidebar-home a {
  color: var(--secondary);
  text-decoration: none;
}

.sidebar-home a:hover {
  color: var(--primary);
}

.sidebar-section {
  margin-bottom: 1rem;
}

.sidebar-category {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--secondary);
  margin-bottom: 0.3rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--border);
}

.wiki-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wiki-sidebar ul li {
  margin: 0;
  padding: 0;
}

.wiki-sidebar ul li a {
  display: block;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  color: var(--content);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wiki-sidebar ul li a:hover {
  background: var(--code-bg);
  color: var(--primary);
}

.wiki-sidebar ul li.active a {
  background: var(--tertiary);
  color: var(--primary);
  font-weight: 600;
}

/* ── Wiki page header ────────────────────────────────────────────────────── */

.wiki-page-header h1 {
  margin-bottom: 0.5rem;
}

.wiki-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.wiki-tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  background: var(--code-bg);
  color: var(--secondary);
}

.wiki-status {
  font-size: 0.8rem;
  color: var(--secondary);
}

/* ── Wiki homepage ───────────────────────────────────────────────────────── */

.wiki-home {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.wiki-home-header {
  margin-bottom: 2rem;
}

.wiki-home-intro {
  color: var(--secondary);
  font-size: 1.05rem;
}

.wiki-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.wiki-category-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  background: var(--entry);
  transition: border-color 0.2s;
}

.wiki-category-card:hover {
  border-color: var(--primary);
}

.wiki-category-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.wiki-category-card-header h2 {
  font-size: 1rem;
  margin: 0;
  border: none;
}

.wiki-category-icon {
  font-size: 1.2rem;
}

.wiki-category-desc {
  font-size: 0.82rem;
  color: var(--secondary);
  margin-bottom: 0.75rem;
}

.wiki-category-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wiki-category-links li {
  margin: 0;
  padding: 0;
}

.wiki-category-links li a {
  display: block;
  font-size: 0.85rem;
  padding: 0.2rem 0;
  color: var(--content);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.wiki-category-links li a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .wiki-layout {
    flex-direction: column;
  }

  .wiki-sidebar-wrap {
    position: static;
    flex: none;
    width: 100%;
    max-height: none;
  }
}
