/*
 * WRAAS Documentation v1.3 — Shared Stylesheet
 * Mimics Antora's professional light theme.
 * Contains zero hidden humor. (This is a lie.)
 */

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

:root {
  --toolbar-bg: #404040;
  --toolbar-h: 56px;
  --nav-w: 280px;
  --toc-w: 220px;
  --accent: #0065b3;
  --accent2: #00c8ff;
  --text: #333;
  --muted: #595959;
  --bg: #fff;
  --nav-bg: #f0f0f0;
  --border: #ddd;
  --code-bg: #f4f4f5;
  --adm-note: #0065b3;
  --adm-tip: #1a7042;
  --adm-warn: #8b5c00;
  --adm-important: #c0392b;
  --adm-caution: #7a5900;
}

html {
  scroll-behavior: smooth;
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 999;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
}

.skip-link:focus {
  top: 0;
  color: #fff;
}

/* ── Focus indicators ── */
*:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

/* ── Toolbar ── */
.toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--toolbar-h);
  background: var(--toolbar-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 200;
  gap: 1rem;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.home-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.06em;
}

.home-link img {
  border-radius: 3px;
}

.version-pill {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  letter-spacing: 0.05em;
  cursor: default;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-box {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
  width: 200px;
  outline: none;
}

.search-box::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.search-box:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
}

.search-results {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 400px;
  max-height: 420px;
  overflow-y: auto;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  margin-top: 4px;
}

.search-result-item {
  display: block;
  padding: 0.6rem 0.85rem;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item:focus,
.search-result-item.is-active {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.search-result-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.2rem;
}

.search-result-excerpt {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.4;
}

.search-result-excerpt mark {
  background: rgba(0, 200, 255, 0.25);
  color: #fff;
  border-radius: 2px;
  padding: 0 2px;
}

.search-result-empty {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
  cursor: default;
}

.back-link {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  white-space: nowrap;
}

.back-link:hover {
  color: #fff;
}

/* ── Body layout ── */
.body {
  display: flex;
  margin-top: var(--toolbar-h);
  min-height: calc(100vh - var(--toolbar-h));
}

/* ── Nav panel ── */
.nav-panel {
  width: var(--nav-w);
  min-width: var(--nav-w);
  background: var(--nav-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  position: sticky;
  top: var(--toolbar-h);
  height: calc(100vh - var(--toolbar-h));
  padding: 1.25rem 0 2rem;
}

.nav-component {
  padding: 0.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.nav-component-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.nav-component-version {
  font-size: 0.72rem;
  color: var(--muted);
}

.nav-list {
  list-style: none;
}

.nav-list .nav-list {
  padding-left: 1rem;
}

.nav-item {
  margin: 0;
}

.nav-link {
  display: block;
  padding: 0.3rem 1.25rem;
  font-size: 0.84rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--accent);
}

.nav-link.is-current {
  color: var(--accent);
  background: rgba(0, 101, 179, 0.07);
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-title {
  display: block;
  padding: 0.5rem 1.25rem 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: default;
}

.nav-separator {
  height: 1px;
  background: var(--border);
  margin: 0.75rem 0;
}

/* ── Main article ── */
.article {
  flex: 1;
  min-width: 0;
  padding: 2rem 3rem 4rem;
  max-width: 860px;
}

.breadcrumb {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .sep {
  color: #767676;
}

h1.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.2;
  color: #111;
}

.page-subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 2rem;
  max-width: 680px;
}

.page-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.75rem;
  padding-top: 0.5rem;
  color: #111;
  scroll-margin-top: calc(var(--toolbar-h) + 1rem);
}

h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  color: #222;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--accent);
}

code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.84em;
  background: var(--code-bg);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  color: #c7254e;
}

pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.65;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 1em;
}

.pre-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

/* ── Syntax token colours (used in pre blocks) ── */
.token-comment { color: #6c7086; }
.token-string  { color: #a6e3a1; }
.token-key     { color: #89b4fa; }
.token-value   { color: #fab387; }
.token-type    { color: #cba6f7; }
.token-scope   { color: #89dceb; }
.token-ok      { color: #a6e3a1; }
.token-err     { color: #f38ba8; }
.token-warn    { color: #f9e2af; }
.token-dim     { color: #9399b2; }
.token-prompt  { color: #89dceb; }

/* ── Admonitions ── */
.admonition {
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-left: 4px solid;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.admonition-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.admonition-content {
  flex: 1;
}

.admonition-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.admonition p {
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
}

.admonition p:last-child {
  margin-bottom: 0;
}

.admonition.note {
  background: #eef4fb;
  border-color: var(--adm-note);
}

.admonition.note .admonition-title {
  color: var(--adm-note);
}

.admonition.tip {
  background: #eef7f0;
  border-color: var(--adm-tip);
}

.admonition.tip .admonition-title {
  color: var(--adm-tip);
}

.admonition.warning {
  background: #fef8ee;
  border-color: var(--adm-warn);
}

.admonition.warning .admonition-title {
  color: var(--adm-warn);
}

.admonition.important {
  background: #fef0ef;
  border-color: var(--adm-important);
}

.admonition.important .admonition-title {
  color: var(--adm-important);
}

.admonition.caution {
  background: #fffbee;
  border-color: var(--adm-caution);
}

.admonition.caution .admonition-title {
  color: var(--adm-caution);
}

/* ── Table ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.88rem;
}

th {
  background: var(--nav-bg);
  text-align: left;
  padding: 0.6rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}

td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #fafafa;
}

td code {
  font-size: 0.82em;
}

/* ── Numbered step lists ── */
ol.steps {
  list-style: none;
  counter-reset: step-counter;
  margin: 1.25rem 0;
  padding: 0;
}

ol.steps > li {
  counter-increment: step-counter;
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

ol.steps > li::before {
  content: counter(step-counter);
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
}

ol.steps > li > div {
  flex: 1;
  min-width: 0;
}

ol.steps > li > div > p:first-child {
  margin-top: 0;
}

/* ── Prerequisites list ── */
ul.prereqs {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 1.25rem;
}

ul.prereqs li {
  padding: 0.2rem 0 0.2rem 1.4rem;
  font-size: 0.9rem;
  position: relative;
}

ul.prereqs li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--adm-tip);
  font-weight: 700;
}

/* ── Section goal callout ── */
.section-goal {
  font-size: 0.88rem;
  color: var(--muted);
  border-left: 3px solid var(--accent2);
  padding: 0.5rem 1rem;
  background: #f8fcff;
  margin-bottom: 1.5rem;
  border-radius: 0 4px 4px 0;
}

.section-goal strong {
  color: var(--text);
}

/* ── Capability section ── */
.capability {
  margin: 3rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.capability:first-of-type {
  border-top: none;
}

.capability-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.capability-icon {
  font-size: 1.4rem;
}

.capability-header h2 {
  margin: 0;
  padding: 0;
}

.capability-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  background: #eef4fb;
  color: var(--accent);
  border: 1px solid rgba(0, 101, 179, 0.2);
  flex-shrink: 0;
}

.capability-badge.badge-expected {
  background: #eef4fb;
  color: #2b5a8a;
  border: 1px solid rgba(43, 90, 138, 0.3);
}

.capability-badge.badge-encouraged {
  background: #e8f5ee;
  color: #1a6b3c;
  border: 1px solid rgba(26, 107, 60, 0.3);
}

.capability-badge.badge-non-negotiable {
  background: #fffbee;
  color: #8a6508;
  border: 1px solid rgba(138, 101, 8, 0.3);
}

/* ── Decision matrix "maps to" row ── */
.maps-to th {
  color: #999;
  font-weight: 400;
  font-style: italic;
}

.maps-to td {
  color: #999;
  font-style: italic;
}

/* ── SVG Diagrams ── */
.diagram-wrap {
  margin: 1.5rem 0;
  overflow-x: auto;
}

.diagram-caption {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

/* ── TOC sidebar ── */
.toc-sidebar {
  width: var(--toc-w);
  min-width: var(--toc-w);
  padding: 2rem 1rem 2rem 1.25rem;
  position: sticky;
  top: var(--toolbar-h);
  height: calc(100vh - var(--toolbar-h));
  overflow-y: auto;
  border-left: 1px solid var(--border);
}

.toc-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.toc-list {
  list-style: none;
}

.toc-list li {
  margin: 0;
}

.toc-link {
  display: block;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.4;
}

.toc-link:hover {
  color: var(--accent);
}

.toc-link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ── Footer ── */
.doc-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 3rem;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: calc(var(--nav-w) + 860px + var(--toc-w));
  margin: 0 auto;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .toc-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .nav-panel {
    display: none;
    position: fixed;
    top: var(--toolbar-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    width: 100%;
    min-width: 100%;
    background: var(--nav-bg);
  }

  .nav-panel.is-open {
    display: block;
  }

  .article {
    padding: 1.5rem;
  }

  .nav-toggle {
    display: flex;
  }

  .search-box {
    display: none;
  }
}

/* ── Homepage doc-card grid ── */
.doc-section-intro {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  max-width: 640px;
}

.doc-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.5rem;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 1.1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  position: relative;
}

.doc-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 101, 179, 0.08);
  background: #f8fbff;
  color: var(--text);
  text-decoration: none;
}

.doc-card-icon {
  font-size: 1.25rem;
  line-height: 1;
  margin-bottom: 0.15rem;
}

.doc-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.3;
}

.doc-card-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.doc-card-arrow {
  margin-top: auto;
  padding-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
}

.doc-card:hover .doc-card-arrow {
  opacity: 1;
}

@media (max-width: 768px) {
  .doc-card-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Mobile menu toggle ── */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  color: #fff;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-open {
  display: none;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-close {
  display: inline;
}

.nav-toggle[aria-expanded="false"] .nav-toggle-close {
  display: none;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .doc-card,
  .nav-link,
  .toc-link {
    transition: none;
  }
}
