/* Styling tuned to the reference data_engineering_book reading experience. */
:root {
  --book-red: #d32f2f;
  --book-line: #e5e7eb;
  --book-muted: #64748b;
}

/* Keep the wide, calm Material book layout used by the reference site. */
.md-grid { max-width: 64rem; }
.md-content { max-width: none; }
.md-content__inner { padding-bottom: 3rem; }
.md-typeset { font-size: .78rem; line-height: 1.78; }
.md-typeset h1 { font-size: 1.85rem; line-height: 1.25; letter-spacing: -.015em; margin-bottom: 1.35rem; }
.md-typeset h2 { font-size: 1.35rem; line-height: 1.35; margin-top: 2.2rem; padding-bottom: .3rem; border-bottom: 1px solid var(--book-line); }
.md-typeset h3 { font-size: 1.05rem; margin-top: 1.8rem; }
.md-typeset h1, .md-typeset h2, .md-typeset h3 { font-weight: 700; }
.md-typeset a { color: var(--book-red); }
.md-typeset blockquote { border-left-color: var(--book-red); background: #fff8f8; color: #4b5563; }
.md-typeset table:not(.highlight) { display: table; width: 100%; font-size: .72rem; border: 1px solid var(--book-line); }
.md-typeset table:not(.highlight) th { background: #fafafa; font-weight: 700; }
.md-typeset table:not(.highlight) td, .md-typeset table:not(.highlight) th { border-bottom: 1px solid var(--book-line); }
.md-typeset pre > code { border-radius: .2rem; }
.md-typeset .admonition, .md-typeset details { box-shadow: none; border-radius: .2rem; }

/* The reference uses a clean white header and a red active state. */
.md-header { box-shadow: 0 1px 0 rgba(0, 0, 0, .08); }
.md-tabs { background: #fff; border-bottom: 1px solid var(--book-line); color: #374151; }
.md-tabs__link { opacity: .78; }
.md-tabs__link--active, .md-tabs__link:hover { opacity: 1; color: var(--book-red); }
.md-nav__item .md-nav__link--active { color: var(--book-red); font-weight: 700; }
.md-footer { margin-top: 2rem; }

@media (max-width: 60em) {
  .md-typeset { font-size: .76rem; }
  .md-typeset h1 { font-size: 1.6rem; }
}

/* Sidebar: a clearer book table-of-contents hierarchy. */
.md-sidebar--primary .md-sidebar__scrollwrap { padding: .35rem .45rem .9rem .25rem; }
.md-sidebar--primary .md-nav__list { margin: 0; }
.md-sidebar--primary > .md-sidebar__scrollwrap > .md-sidebar__inner > .md-nav > .md-nav__list > .md-nav__item > .md-nav__link {
  margin: .15rem 0 .35rem;
  padding: .5rem .7rem;
  border-radius: .3rem;
  color: #475569;
  font-size: .76rem;
  font-weight: 600;
}
.md-sidebar--primary .md-nav__item--section > .md-nav__container > .md-nav__link {
  margin-top: .85rem;
  padding: .5rem .7rem;
  border-left: .2rem solid #cbd5e1;
  border-radius: 0 .25rem .25rem 0;
  background: #f8fafc;
  color: #334155;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .01em;
}
.md-sidebar--primary .md-nav__item--section > .md-nav__container > .md-nav__link:hover {
  border-left-color: var(--book-red);
  background: #fff8f8;
  color: var(--book-red);
}
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list {
  padding: .18rem 0 .35rem .35rem;
  border-left: 1px solid #eef0f2;
}
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item > .md-nav__link {
  position: relative;
  margin: .08rem 0;
  padding: .28rem .55rem .28rem .8rem;
  border-radius: .22rem;
  color: #64748b;
  font-size: .72rem;
  line-height: 1.35;
}
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item > .md-nav__link:hover {
  background: #f8fafc;
  color: var(--book-red);
}
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item--active > .md-nav__link {
  margin-left: -.05rem;
  border-left: .2rem solid var(--book-red);
  border-radius: 0 .25rem .25rem 0;
  background: #fff1f2;
  color: #b91c1c;
  font-weight: 700;
}
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item--active > .md-nav__link::before {
  content: "";
  display: inline-block;
  width: .3rem;
}
.md-sidebar--primary .md-nav__title { color: #475569; font-weight: 700; }

/* Separate the book title from the book-level overview entry. The overview
 * is the navigation equivalent of a front-matter section heading. */
.md-sidebar--primary > .md-sidebar__scrollwrap > .md-sidebar__inner > .md-nav > .md-nav__title {
  margin-bottom: .55rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid #eef0f2;
  line-height: 1.35;
}
.md-sidebar--primary > .md-sidebar__scrollwrap > .md-sidebar__inner > .md-nav > .md-nav__list > .md-nav__item:first-child > a.md-nav__link {
  margin: .4rem 0 .72rem;
  padding: .38rem .55rem;
  border-left: .2rem solid #cbd5e1;
  border-radius: 0 .25rem .25rem 0;
  background: #f8fafc;
  color: #334155;
  font-size: .70rem;
  font-weight: 700;
}
.md-sidebar--primary > .md-sidebar__scrollwrap > .md-sidebar__inner > .md-nav > .md-nav__list > .md-nav__item:first-child > a.md-nav__link:hover,
.md-sidebar--primary > .md-sidebar__scrollwrap > .md-sidebar__inner > .md-nav > .md-nav__list > .md-nav__item:first-child > a.md-nav__link.md-nav__link--active {
  border-left-color: var(--book-red);
  background: #fff1f2;
  color: var(--book-red);
}

/* Compact table of contents: reduce vertical rhythm without flattening hierarchy. */
.md-sidebar--primary .md-nav__item--section > .md-nav__container > .md-nav__link {
  margin-top: .42rem;
  margin-bottom: .12rem;
  margin-left: -.55rem;
  padding: .32rem .45rem;
}
/* Material offsets a nested section's child navigation by -.6rem. That
 * default is useful for a generic site tree, but it reverses the hierarchy
 * in a book TOC: the chapter labels can end up left of their part label.
 * Reset the offset and give the chapter list one deliberate indent. */
.md-sidebar--primary .md-nav__item--section > .md-nav {
  margin-left: 0;
}
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list {
  padding: .05rem 0 .18rem .72rem;
}
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item > .md-nav__link {
  margin: .02rem 0;
  padding: .18rem .45rem .18rem .45rem;
  line-height: 1.24;
}
.md-sidebar--primary > .md-sidebar__scrollwrap > .md-sidebar__inner > .md-nav > .md-nav__list > .md-nav__item > .md-nav__link {
  margin: .02rem 0 .18rem;
  padding: .34rem .55rem;
}
.md-sidebar--primary .md-nav__item--section > .md-nav__title {
  padding-top: .15rem;
  padding-bottom: .15rem;
}

/* Fine tune the compact book table of contents. Keep the wider rail on
 * desktop only; Material switches to an overlay drawer below this breakpoint. */
@media screen and (min-width: 76.25em) {
  .md-sidebar--primary { width: 17rem; }
}
.md-sidebar--primary .md-sidebar__scrollwrap { padding-left: .15rem; padding-right: .15rem; }
.md-sidebar--primary .md-nav__link { font-size: .68rem; }
.md-sidebar--primary .md-nav__item--section > .md-nav__container > .md-nav__link { font-size: .70rem; }
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item > .md-nav__link { font-size: .66rem; }
/* The active chapter has both a collapsible label and an anchor. Apply the
 * same box model to both so the red marker never pushes the title inward. */
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item--active > .md-nav__link,
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item--active > .md-nav__link--active {
  margin-left: 0;
  padding-left: .48rem;
  box-sizing: border-box;
}
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item--active > .md-nav__link::before,
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item--active > .md-nav__link--active::before { display: none; }

/* Status badges (for example the scaffold “!” marker) are editorial
 * metadata and should not appear in the reader-facing navigation. */
.md-sidebar--primary .md-status { display: none !important; }

/* The active item should not shift when its red marker appears. */
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item--active > .md-nav__link,
.md-sidebar--primary .md-nav__item--section > .md-nav > .md-nav__list > .md-nav__item > .md-nav__link { box-sizing: border-box; }

/* Front matter links stay compact and aligned with chapter links. */
.md-sidebar--primary > .md-sidebar__scrollwrap > .md-sidebar__inner > .md-nav > .md-nav__list > .md-nav__item > .md-nav__link {
  margin: .02rem 0 .08rem;
  padding: .24rem .55rem;
  font-size: .68rem;
  line-height: 1.22;
}

/* Front matter pages are reference material rather than a chapter sequence.
 * Hide Material's automatic previous/next band there, while retaining it for
 * part and chapter pages where sequential reading is useful. */
html:has(link[rel="canonical"][href$="/reader_guide/"]) .md-footer__inner,
html:has(link[rel="canonical"][href$="/abbreviations/"]) .md-footer__inner,
html:has(link[rel="canonical"][href$="/authors/"]) .md-footer__inner,
html:has(link[rel="canonical"][href$="/figures_tables/"]) .md-footer__inner,
html:has(link[rel="canonical"][href$="/asset_contract/"]) .md-footer__inner,
html:has(link[rel="canonical"][href$="/preface/"]) .md-footer__inner,
html:has(link[rel="canonical"][href$="/acknowledgements/"]) .md-footer__inner {
  display: none;
}
