/* SAA — Deep Navy / Accent Blue / Red-Pink theme, Skills & Agents Architecture
   Brand foundation loaded from brand.css
   Dark theme: deliberate departure for AI/agentic systems domain */

/* ===================================================
   1. COLOR PALETTE & SEMANTIC OVERRIDES
   =================================================== */

:root {
  --saa-primary: #1a1a2e;
  --saa-secondary: #16213e;
  --saa-accent: #0f3460;
  --saa-highlight: #e94560;
  --saa-highlight-light: #ff6b6b;
  --saa-text: #eaeaea;
  --saa-text-muted: #a0a0a0;
  --saa-card-bg: #1f1f3a;
  --saa-border: #2a2a4a;

  /* Semantic overrides for dark theme */
  --page-bg: var(--saa-primary);
  --page-text: var(--saa-text);
  --page-text-light: var(--saa-text-muted);
  --link: var(--saa-highlight);
  --link-hover: var(--saa-highlight-light);
  --accent: var(--saa-highlight);
  --accent-light: var(--saa-highlight-light);
  --accent-dark: var(--saa-accent);
  --card-bg: var(--saa-card-bg);
  --card-border: var(--saa-border);
  --card-shadow: rgba(233, 69, 96, 0.15);
  --border: var(--saa-border);
  --parchment: var(--saa-border);
  --content-width: 64rem;
}

/* ===================================================
   2. BODY & BACKGROUND
   =================================================== */

body {
  background: linear-gradient(135deg, var(--saa-primary) 0%, var(--saa-secondary) 100%) !important;
  color: var(--saa-text) !important;
  min-height: 100vh;
}

/* ===================================================
   3. HEADER -- navy to accent blue with red-pink highlight
   =================================================== */

header {
  background: linear-gradient(180deg, var(--saa-accent) 0%, transparent 100%);
  border-bottom: 1px solid var(--saa-border);
  padding: 2.5rem 2rem;
}
header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--saa-highlight), var(--saa-highlight-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: var(--saa-highlight);
}
header .subtitle {
  color: var(--saa-text-muted);
  font-size: 1.1rem;
}
header nav a {
  background: rgba(255,255,255,0.08);
  color: var(--saa-text);
}
header nav a:hover {
  background: rgba(233, 69, 96, 0.2);
  color: white;
}
header nav a.active {
  background: var(--saa-highlight);
  color: white;
}

/* ===================================================
   4. TYPOGRAPHY COLOR OVERRIDES
   =================================================== */

h2 {
  color: var(--saa-text);
  border-bottom: 2px solid var(--saa-highlight);
  padding-bottom: 0.4rem;
}
h3 { color: var(--saa-text); }
h4 { color: var(--saa-text-muted); }
p { color: var(--saa-text); }

/* ===================================================
   5. THEMED COMPONENTS
   =================================================== */

blockquote {
  border-left: 3px solid var(--saa-highlight);
  background: rgba(233, 69, 96, 0.08);
  color: var(--saa-text);
  padding: 1rem 1.5rem;
  border-radius: 4px;
}

a { color: var(--saa-highlight); }
a:hover { color: var(--saa-highlight-light); }

/* Tables */
table { border-collapse: collapse; }
th {
  background: var(--saa-accent);
  color: white;
  padding: 0.6rem 0.8rem;
}
td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--saa-border);
  color: var(--saa-text);
}
tr:nth-child(even) { background: rgba(15, 52, 96, 0.15); }
tr:hover { background: rgba(15, 52, 96, 0.25); }

/* Code */
pre {
  background: #0d1117;
  color: #e0e0e0;
  border-left: 3px solid var(--saa-highlight);
  border-radius: 6px;
  padding: 1.2rem 1.5rem;
}
code {
  background: rgba(15, 52, 96, 0.4);
  color: var(--saa-highlight-light);
}
pre code { background: none; color: inherit; }

/* ===================================================
   6. STATS -- grid with highlight color
   =================================================== */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.2rem;
  margin: 2rem 0;
  padding: 0;
  background: none;
  border: none;
}
.stat {
  background: var(--saa-card-bg);
  border: 1px solid var(--saa-border);
  border-radius: 8px;
  padding: 1.2rem;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
}
.stat:hover {
  transform: translateY(-2px);
  border-color: var(--saa-highlight);
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--saa-highlight);
  display: block;
}
.stat-label {
  color: var(--saa-text-muted);
  font-size: 0.82rem;
  margin-top: 0.3rem;
}

/* ===================================================
   7. CARDS -- dark cards with highlight hover
   =================================================== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}
.card {
  background: var(--saa-card-bg);
  border: 1px solid var(--saa-border);
  border-radius: 10px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--saa-highlight);
  box-shadow: 0 6px 24px rgba(233, 69, 96, 0.2);
  text-decoration: none;
}
.card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  color: var(--saa-text);
}
.card .meta {
  font-size: 0.82rem;
  color: var(--saa-text-muted);
  margin-bottom: 0.5rem;
}
.card p {
  font-size: 0.92rem;
  margin: 0;
  color: var(--saa-text-muted);
}

/* Section number badges */
.section-number {
  display: inline-block;
  background: var(--saa-highlight);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  text-align: center;
  line-height: 32px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
  font-family: system-ui, sans-serif;
}

/* Topic tags */
.topic-tag {
  display: inline-block;
  background: var(--saa-accent);
  color: var(--saa-text-muted);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-family: system-ui, sans-serif;
  margin-right: 0.3rem;
  margin-bottom: 0.3rem;
}

/* Category cards -- larger with icon-like header */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}
.category-card {
  background: var(--saa-card-bg);
  border: 1px solid var(--saa-border);
  border-radius: 10px;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: all 0.3s ease;
}
.category-card:hover {
  transform: translateY(-3px);
  border-color: var(--saa-highlight);
  box-shadow: 0 6px 24px rgba(233, 69, 96, 0.2);
  text-decoration: none;
}
.category-card .cat-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.category-card h3 {
  font-size: 1.2rem;
  color: var(--saa-text);
  margin: 0 0 0.3rem;
}
.category-card .cat-count {
  font-size: 0.85rem;
  color: var(--saa-highlight);
  font-weight: 600;
  font-family: system-ui, sans-serif;
}
.category-card p {
  font-size: 0.88rem;
  color: var(--saa-text-muted);
  margin: 0.5rem 0 0;
}

/* ===================================================
   8. SECTION GRID -- report sections
   =================================================== */

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}

/* ===================================================
   9. FILTER BAR
   =================================================== */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
  align-items: center;
}
.filter-bar input {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--saa-border);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  color: var(--saa-text);
  font-size: 0.88rem;
  font-family: system-ui, sans-serif;
  flex: 1;
  min-width: 200px;
  outline: none;
  transition: border-color 0.2s;
}
.filter-bar input:focus {
  border-color: var(--saa-highlight);
}
.filter-bar input::placeholder {
  color: rgba(255,255,255,0.25);
}
.filter-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--saa-border);
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  color: var(--saa-text-muted);
  font-size: 0.82rem;
  font-family: system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  border-color: var(--saa-highlight);
  color: var(--saa-text);
}
.filter-btn.active {
  background: var(--saa-highlight);
  color: white;
  border-color: var(--saa-highlight);
}

/* ===================================================
   10. FAMILY / CLUSTER LABELS
   =================================================== */

.family-label {
  display: inline-block;
  font-size: 0.72rem;
  font-family: system-ui, sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-right: 0.3rem;
}
.family-devops { background: rgba(15, 52, 96, 0.5); color: #64B5F6; }
.family-gsd { background: rgba(233, 69, 96, 0.2); color: var(--saa-highlight); }
.cluster-dev { background: rgba(76, 175, 80, 0.2); color: #81C784; }
.cluster-devops { background: rgba(15, 52, 96, 0.5); color: #64B5F6; }
.cluster-ops { background: rgba(255, 152, 0, 0.2); color: #FFB74D; }
.cluster-gov { background: rgba(156, 39, 176, 0.2); color: #CE93D8; }
.cluster-gsd { background: rgba(233, 69, 96, 0.2); color: var(--saa-highlight); }

/* ===================================================
   11. BACK LINK & BREADCRUMBS
   =================================================== */

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
  color: var(--saa-text-muted);
}
.back-link:hover { color: var(--saa-highlight); }

.breadcrumb {
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  color: var(--saa-text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--saa-text-muted); }
.breadcrumb a:hover { color: var(--saa-highlight); }
.breadcrumb .sep { margin: 0 0.4rem; opacity: 0.4; }

/* ===================================================
   12. SUMMARY CARD
   =================================================== */

.summary {
  background: var(--saa-card-bg);
  border: 1px solid var(--saa-border);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
}
.summary h2 {
  color: var(--saa-highlight);
  margin-bottom: 1rem;
  font-size: 1.4rem;
  border: none;
  padding: 0;
}
.summary p {
  color: var(--saa-text);
  font-size: 1rem;
}

/* ===================================================
   13. FOOTER
   =================================================== */

footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--saa-border);
  margin-top: 3rem;
  color: var(--saa-text-muted);
  font-size: 0.82rem;
}
footer a { color: var(--saa-highlight); }
footer a:hover { color: var(--saa-highlight-light); text-decoration: underline; }

/* ===================================================
   14. PAGE.HTML -- markdown viewer specifics
   =================================================== */

.loading { text-align: center; padding: 4rem; color: var(--saa-text-muted); }

.md-content img { max-width: 100%; border-radius: 4px; }
.md-content hr { border: none; border-top: 2px solid var(--saa-border); margin: 2rem 0; }

.toc {
  background: var(--saa-card-bg);
  border: 1px solid var(--saa-border);
  border-radius: 6px;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
}
.toc h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--saa-highlight); }
.toc ul { list-style: none; padding-left: 0; margin: 0; }
.toc li { margin: 0.2rem 0; font-size: 0.88rem; font-family: system-ui, sans-serif; }
.toc li a {
  color: var(--saa-text-muted);
  text-decoration: none;
  display: block;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  transition: background 0.2s, color 0.2s;
}
.toc li a:hover { color: var(--saa-highlight); background: rgba(233, 69, 96, 0.08); text-decoration: none; }
.toc li a.active { color: var(--saa-highlight); background: rgba(233, 69, 96, 0.15); font-weight: 600; }
.toc .depth-3 { padding-left: 1.2rem; }
.toc .depth-4 { padding-left: 2.4rem; font-size: 0.82rem; }

.toc-search {
  width: 100%;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--saa-border);
  border-radius: 4px;
  font-size: 0.82rem;
  font-family: system-ui, sans-serif;
  outline: none;
  background: rgba(255,255,255,0.04);
  color: var(--saa-text);
}
.toc-search:focus { border-color: var(--saa-highlight); }
.toc-search::placeholder { color: rgba(255,255,255,0.2); }

h2:hover .anchor, h3:hover .anchor { opacity: 1; }
.anchor {
  opacity: 0;
  margin-left: 0.3em;
  text-decoration: none;
  color: var(--saa-text-muted);
  transition: opacity 0.2s;
  font-weight: 400;
  font-size: 0.85em;
}
.anchor:hover { color: var(--saa-highlight); text-decoration: none; }

@media (min-width: 1024px) {
  .page-grid { display: grid; grid-template-columns: 240px 1fr; gap: 2rem; align-items: start; }
  .page-grid .toc { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; margin: 0; scrollbar-width: thin; }
  .page-grid .toc::-webkit-scrollbar { width: 4px; }
  .page-grid .toc::-webkit-scrollbar-thumb { background: var(--saa-border); border-radius: 2px; }
  .page-grid .md-body { min-width: 0; scroll-behavior: smooth; }
}

/* ===================================================
   15. RESPONSIVE
   =================================================== */

@media (max-width: 768px) {
  header h1 { font-size: 1.6rem; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .card-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .section-grid { grid-template-columns: 1fr; }
  header { padding: 1.5rem 1rem; }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
