/* -------------------------------------------------
   RevFramework – Site-wide polish layer
   Windmill-style layout + Material refinements
   ------------------------------------------------- */

/* =================================================
   1️⃣ Layout – Windmill-style width
   ================================================= */

.md-grid {
  max-width: 100% !important;
  margin: 0 !important;
}

.md-main__inner {
  max-width: 100% !important;
  margin: 0 !important;
}

.md-content {
  padding-left: 2rem;
  padding-right: 2rem;
}

.md-content__inner {
  max-width: 1050px;
  margin: 0; /* left aligned */
}


/* =================================================
   2️⃣ Structural Background Split
   ================================================= */

/* ---------- Light Mode ---------- */

[data-md-color-scheme="default"] .md-container {
  background: #f6f7fb; /* left rail */
}

[data-md-color-scheme="default"] .md-main {
  background: #ffffff; /* reading surface */
}

/* ---------- Dark Mode ---------- */

[data-md-color-scheme="slate"] .md-container {
  background: #161a22; /* left rail */
}

[data-md-color-scheme="slate"] .md-main {
  background: #1e222a; /* reading surface */
}


/* =================================================
   3️⃣ Sidebar Styling
   ================================================= */

.md-sidebar--primary {
  width: 16.5rem;
  border-right: 1px solid rgba(0,0,0,0.08);
}

[data-md-color-scheme="slate"] .md-sidebar--primary {
  border-right: 1px solid rgba(255,255,255,0.12);
}

/* Force distinct sidebar background */
[data-md-color-scheme="default"] .md-sidebar--primary,
[data-md-color-scheme="default"] .md-sidebar--primary .md-sidebar__scrollwrap,
[data-md-color-scheme="default"] .md-sidebar--primary .md-sidebar__inner {
  background: #f6f7fb !important;
}

[data-md-color-scheme="slate"] .md-sidebar--primary,
[data-md-color-scheme="slate"] .md-sidebar--primary .md-sidebar__scrollwrap,
[data-md-color-scheme="slate"] .md-sidebar--primary .md-sidebar__inner {
  background: #161a22 !important;
}

/* Internal spacing */
.md-sidebar--primary .md-sidebar__scrollwrap {
  padding-right: 0.75rem;
}

.md-sidebar--secondary {
  width: 14rem;
}

/* Nav density */
.md-nav__item {
  margin: 0.05rem 0;
}

.md-nav__link {
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
}


/* =================================================
   4️⃣ Header & Tabs (Swish Top Rail)
   ================================================= */

/* Light mode header */
[data-md-color-scheme="default"] .md-header,
[data-md-color-scheme="default"] .md-tabs {
  background: #f6f7fb;
  color: #111;
  box-shadow: 0 1px 0 rgba(0,0,0,0.08);
}

[data-md-color-scheme="default"] .md-header__button,
[data-md-color-scheme="default"] .md-header__title,
[data-md-color-scheme="default"] .md-tabs__link {
  color: #111;
}

/* Dark mode header */
[data-md-color-scheme="slate"] .md-header,
[data-md-color-scheme="slate"] .md-tabs {
  background: #161a22;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}


/* =================================================
   5️⃣ Remove Ugly Active Tab Block
   ================================================= */

[data-md-color-scheme="default"] .md-tabs__link--active,
[data-md-color-scheme="slate"] .md-tabs__link--active {
  background: transparent !important;
  box-shadow: none !important;
}


/* Replace with subtle underline */

.md-tabs__link--active {
  position: relative;
  font-weight: 600;
}

.md-tabs__link--active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.4rem;
  height: 2px;
  background: currentColor;
  opacity: 0.6;
}


/* =================================================
   6️⃣ Typography & Component Polish
   ================================================= */

.md-typeset h1 {
  letter-spacing: -0.02em;
}

.md-typeset h2 {
  margin-top: 2.2rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(125, 125, 125, 0.18);
}

.md-typeset h3 {
  margin-top: 1.6rem;
}

.md-typeset pre > code {
  border-radius: 0.85rem;
}

.md-typeset code {
  border-radius: 0.35rem;
  padding: 0.08em 0.32em;
}

.md-typeset table:not([class]) {
  border-radius: 0.85rem;
  overflow: hidden;
}

.md-typeset .admonition,
.md-typeset details {
  border-radius: 0.85rem;
}


/* Search polish */
[data-md-color-scheme="default"] .md-search__form {
  background: rgba(0,0,0,0.04);
  border-radius: 0.75rem;
}


/* =================================================
   7️⃣ Focus Mode
   ================================================= */

body.focus-mode .md-sidebar--primary,
body.focus-mode .md-sidebar--secondary {
  display: none !important;
}

body.focus-mode .md-content {
  padding-left: 3rem;
  padding-right: 3rem;
}

body.focus-mode .md-content__inner {
  max-width: 1200px;
}

/* Focus toggle active state */

.md-header__button.is-active svg {
  opacity: 1;
}

.md-header__button.is-active {
  border-bottom: 2px solid rgba(255,255,255,0.65);
}

[data-md-color-scheme="default"] .md-header__button.is-active {
  border-bottom: 2px solid rgba(0,0,0,0.35);
}

/* =================================================
   Sidebar: remove active background entirely
   ================================================= */

/* Dark mode */
[data-md-color-scheme="slate"] .md-nav__item--active > .md-nav__link,
[data-md-color-scheme="slate"] .md-nav__link--active {
  background: transparent !important;
}

/* Light mode */
[data-md-color-scheme="default"] .md-nav__item--active > .md-nav__link,
[data-md-color-scheme="default"] .md-nav__link--active {
  background: transparent !important;
}

/* =================================================
   Sidebar: nuke active glow/overlay completely
   ================================================= */

[data-md-color-scheme="slate"] .md-nav__item--active > .md-nav__link,
[data-md-color-scheme="slate"] .md-nav__link--active {
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  outline: none !important;
}

/* Some Material builds draw an overlay via pseudo elements */
[data-md-color-scheme="slate"] .md-nav__item--active > .md-nav__link::before,
[data-md-color-scheme="slate"] .md-nav__item--active > .md-nav__link::after,
[data-md-color-scheme="slate"] .md-nav__link--active::before,
[data-md-color-scheme="slate"] .md-nav__link--active::after {
  display: none !important;
  content: none !important;
}

/* =================================================
   Sidebar (LIGHT MODE): nuke active glow/overlay completely
   ================================================= */

[data-md-color-scheme="default"] .md-nav__item--active > .md-nav__link,
[data-md-color-scheme="default"] .md-nav__link--active {
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  outline: none !important;
}

/* Some Material builds draw the highlight via pseudo-elements */
[data-md-color-scheme="default"] .md-nav__item--active > .md-nav__link::before,
[data-md-color-scheme="default"] .md-nav__item--active > .md-nav__link::after,
[data-md-color-scheme="default"] .md-nav__link--active::before,
[data-md-color-scheme="default"] .md-nav__link--active::after {
  display: none !important;
  content: none !important;
}

/* And sometimes the wrapper is shaded */
[data-md-color-scheme="default"] .md-nav__item--active {
  background: transparent !important;
  box-shadow: none !important;
}

/* =================================================
   8️⃣ Sidebar Toggle Modes (matches JS classes)
   ================================================= */

/* WIDE = hide left nav, keep TOC */
body.sidebar-wide .md-sidebar--primary {
  display: none !important;
}

/* WIDE: tighten content padding a touch */
body.sidebar-wide .md-content {
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}

/* FOCUS = hide both sidebars */
body.sidebar-focus .md-sidebar--primary,
body.sidebar-focus .md-sidebar--secondary {
  display: none !important;
}

/* FOCUS: more breathing room */
body.sidebar-focus .md-content {
  padding-left: 3rem;
  padding-right: 3rem;
}

body.sidebar-focus .md-content__inner {
  max-width: 1200px;
}

/* Optional: show toggle button as "active" in wide/focus */
body.sidebar-wide  .md-header__button#rf-sidebar-toggle,
body.sidebar-focus .md-header__button#rf-sidebar-toggle {
  border-bottom: 2px solid rgba(255,255,255,0.65);
}

[data-md-color-scheme="default"] body.sidebar-wide  .md-header__button#rf-sidebar-toggle,
[data-md-color-scheme="default"] body.sidebar-focus .md-header__button#rf-sidebar-toggle {
  border-bottom: 2px solid rgba(0,0,0,0.35);
}