/* ========================================================= 
Agile AI Specification — UI Refinement Layer
Version: 6.2 (Micro UX Authority Layer — FINAL)
SAFE: Additive Only · Zero Structural Impact
========================================================= */


/* =========================================================
INSTITUTIONAL HEADER (STABLE — NON-INTRUSIVE)
========================================================= */

.spec-institutional-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;

  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-md-color-scheme="slate"] .spec-institutional-header {
  background: rgba(15, 23, 42, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.spec-header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 24px;

  display: flex;
  align-items: center;
  justify-content: space-between;
}


/* =========================================================
LEFT SIDE (BRAND CONTEXT)
========================================================= */

.spec-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.spec-brand {
  font-weight: 600;
  text-decoration: none;
  color: #111827;
}

[data-md-color-scheme="slate"] .spec-brand {
  color: #e2e8f0;
}

.spec-divider {
  opacity: 0.4;
}

.spec-surface {
  color: #64748b;
}

[data-md-color-scheme="slate"] .spec-surface {
  color: #94a3b8;
}


/* =========================================================
RIGHT NAVIGATION (CALM + CONTROLLED)
========================================================= */

.spec-header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
}

.spec-header-nav a {
  text-decoration: none;
  color: #334155;
}

[data-md-color-scheme="slate"] .spec-header-nav a {
  color: #cbd5f5;
}

.spec-header-nav a:hover {
  color: #0f172a;
}

[data-md-color-scheme="slate"] .spec-header-nav a:hover {
  color: #ffffff;
}


/* =========================================================
ORIENTATION STRIP
========================================================= */

.spec-orientation-strip {
  font-size: 12px;
  padding: 6px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: #64748b;
  background: #f8fafc;
}

[data-md-color-scheme="slate"] .spec-orientation-strip {
  background: #0f172a;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.spec-orientation-strip strong {
  color: #334155;
  font-weight: 600;
}

[data-md-color-scheme="slate"] .spec-orientation-strip strong {
  color: #e2e8f0;
}


/* =========================================================
CONTEXT BAR
========================================================= */

.spec-context-bar {
  background: #f8fafc;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

[data-md-color-scheme="slate"] .spec-context-bar {
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.spec-context-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 24px;

  font-size: 12px;
  display: flex;
  gap: 6px;
}

.spec-context-label {
  color: #94a3b8;
}

[data-md-color-scheme="slate"] .spec-context-label {
  color: #64748b;
}

.spec-context-value {
  font-weight: 600;
  color: #334155;
}

[data-md-color-scheme="slate"] .spec-context-value {
  color: #e2e8f0;
}


/* =========================================================
GLOBAL SPEC BANNER (DOCUMENT STYLE)
========================================================= */

.spec-global-banner {
  background: #f1f5f9;
  border: 1px solid rgba(100, 116, 139, 0.2);
  color: #0f172a;

  padding: 14px 18px;
  margin-bottom: 16px;
  border-radius: 6px;

  display: flex;
  flex-direction: column;
  gap: 6px;
}

[data-md-color-scheme="slate"] .spec-global-banner {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.spec-title {
  font-size: 15.5px;
  font-weight: 600;
}

.spec-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12.5px;
  opacity: 0.9;
}


/* =========================================================
NAVIGATION STATE
========================================================= */

.md-tabs__link--active {
  font-weight: 600;
  color: #0f172a !important;
  border-bottom: 2px solid rgba(100, 116, 139, 0.6);
}

[data-md-color-scheme="slate"] .md-tabs__link--active {
  color: #ffffff !important;
  border-bottom: 2px solid rgba(148, 163, 184, 0.6);
}

.md-nav__link--active {
  font-weight: 600;
  color: #0f172a !important;
}

[data-md-color-scheme="slate"] .md-nav__link--active {
  color: #ffffff !important;
}


/* =========================================================
MATERIAL HEADER ALIGNMENT
========================================================= */

.md-header__option {
  display: flex;
  align-items: center;
}


/* =========================================================
READING EXPERIENCE
========================================================= */

.md-content__inner {
  max-width: 820px;
}

.md-typeset {
  font-size: 15.5px;
  line-height: 1.7;
}

[data-md-color-scheme="slate"] .md-typeset {
  color: #e2e8f0;
}

.md-typeset p {
  margin-bottom: 1.1em;
}

.md-typeset h1 {
  font-size: 28px;
  font-weight: 600;
}

.md-typeset h2 {
  font-size: 22px;
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-md-color-scheme="slate"] .md-typeset h2 {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.md-typeset h3 {
  font-size: 18px;
  font-weight: 600;
}


/* =========================================================
MICRO UX AUTHORITY LAYER (NEW)
========================================================= */

/* Links */

.md-typeset a {
  color: #334155;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.md-typeset a:hover {
  color: #0f172a;
}

[data-md-color-scheme="slate"] .md-typeset a {
  color: #cbd5f5;
}

[data-md-color-scheme="slate"] .md-typeset a:hover {
  color: #ffffff;
}


/* TOC */

.md-nav--secondary .md-nav__link {
  color: #64748b;
  font-size: 13px;
}

.md-nav--secondary .md-nav__link--active {
  color: #0f172a;
  font-weight: 600;
}

[data-md-color-scheme="slate"] .md-nav--secondary .md-nav__link--active {
  color: #ffffff;
}


/* Smooth perception */

* {
  transition: color 0.15s ease;
}

/* =========================================================
NAVIGATION INTELLIGENCE LAYER — STEP 1
Active Navigation Authority (Safe + Additive)
========================================================= */

/* Active item — strong visual anchor */
.md-nav__link--active {
  color: var(--md-primary-fg-color);
  font-weight: 600;
  position: relative;
}

/* Left border indicator for active item */
.md-nav__link--active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 2px;
  background-color: var(--md-primary-fg-color);
  opacity: 0.9;
}

/* Slight background for active item */
.md-nav__item .md-nav__link--active {
  background: rgba(255, 255, 255, 0.04);
  padding-left: 6px;
  border-radius: 4px;
}

/* Section parent emphasis (open section) */
.md-nav__item--active > .md-nav__link {
  font-weight: 600;
  opacity: 1;
}

/* Improve non-active readability */
.md-nav__link {
  transition: all 0.2s ease;
}

.md-nav__link:hover {
  opacity: 1;
}

/* =========================================================
STEP-2: NAVIGATION INTELLIGENCE — CONTENT AWARENESS (TOC)
Safe, Additive, Non-Breaking
========================================================= */

/* TOC Container */
.md-sidebar--secondary {
  border-left: 1px solid rgba(0, 0, 0, 0.06);
  padding-left: 12px;
}

/* TOC Title */
.md-sidebar--secondary .md-nav__title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 8px;
}

/* TOC Links (default) */
.md-sidebar--secondary .md-nav__link {
  font-size: 0.82rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  opacity: 0.75;
}

/* Hover State */
.md-sidebar--secondary .md-nav__link:hover {
  background: rgba(0, 0, 0, 0.04);
  opacity: 1;
}

/* ACTIVE SECTION — KEY INTELLIGENCE LAYER */
.md-sidebar--secondary .md-nav__link--active {
  background: rgba(63, 81, 181, 0.08);
  color: #3f51b5;
  font-weight: 600;
  opacity: 1;
  position: relative;
}

/* Active Indicator Bar */
.md-sidebar--secondary .md-nav__link--active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: #3f51b5;
}

/* Nested Items (slight hierarchy clarity) */
.md-sidebar--secondary .md-nav__item .md-nav__link {
  padding-left: 12px;
  font-size: 0.78rem;
  opacity: 0.7;
}

/* Active nested boost */
.md-sidebar--secondary .md-nav__item .md-nav__link--active {
  opacity: 1;
}

/* Dark Mode Support */
[data-md-color-scheme="slate"] .md-sidebar--secondary {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

[data-md-color-scheme="slate"] .md-sidebar--secondary .md-nav__link:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-md-color-scheme="slate"] .md-sidebar--secondary .md-nav__link--active {
  background: rgba(140, 158, 255, 0.12);
  color: #8c9eff;
}

[data-md-color-scheme="slate"] .md-sidebar--secondary .md-nav__link--active::before {
  background: #8c9eff;
}

/* =========================================================
STEP-3: SCROLL INTELLIGENCE — PROGRESS BAR
Safe, Additive, Non-Breaking
========================================================= */

#scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 9999;
  background: linear-gradient(90deg, #3f51b5, #5c6bc0);
  transition: width 0.1s ease-out;
}

/* Dark Mode */
[data-md-color-scheme="slate"] #scroll-progress-bar {
  background: linear-gradient(90deg, #8c9eff, #aab6fe);
}