
/* =========================================================
   Deep Kondah — GitBook-style Reader
   Primary: #2563EB
   Accent:  #FFCCCC
   ========================================================= */

.dk-book-actions {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.dk-book-actions .dk-start-reading {
  margin-top: 0;
}

.dk-pdf-link {
  color: #475569 !important;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none !important;
}

.dk-pdf-link:hover {
  color: #2563EB !important;
  text-decoration: underline !important;
  text-decoration-color: #F0B7BA !important;
}

.dk-book-author {
  margin-top: 1.25rem !important;
  color: #475569;
  font-size: 1rem;
  font-weight: 600;
}

.dk-book-author::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 3px;
  margin-right: 10px;
  border-radius: 999px;
  background: #F0B7BA;
  vertical-align: middle;
}

:root {
  --dk-blue: #2563EB;
  --dk-blue-dark: #1D4ED8;
  --dk-blue-soft: #EFF6FF;
  --dk-pink: #FFCCCC;
  --dk-pink-soft: #FFF5F5;

  --dk-text: #1F2937;
  --dk-title: #111827;
  --dk-muted: #6B7280;
  --dk-border: #E5E7EB;
  --dk-bg: #FFFFFF;
  --dk-sidebar-bg: #F8FAFC;
  --dk-code-bg: #FFF7F7;

  --dk-sidebar-width: 300px;
  --dk-header-height: 64px;
  --dk-content-width: 820px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--dk-bg);
}

body {
  margin: 0 !important;
  max-width: none !important;
  padding: 0 !important;
  background: var(--dk-bg) !important;
  color: var(--dk-text) !important;
  color-scheme: light !important;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  font-size: 16.5px;
  line-height: 1.75;
}

/* ---------- App shell injected by deep-kondah-book.js ---------- */

.dk-app {
  min-height: 100vh;
}

.dk-header {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: var(--dk-sidebar-width);
  right: 0;
  height: var(--dk-header-height);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 2rem;
  border-bottom: 1px solid var(--dk-border);
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dk-brand {
  color: var(--dk-title);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.dk-header-spacer {
  flex: 1;
}

.dk-header-link {
  color: var(--dk-muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.dk-header-link:hover {
  color: var(--dk-blue);
}

.dk-menu-button {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--dk-border);
  border-radius: 8px;
  background: #fff;
  color: var(--dk-title);
  cursor: pointer;
  font-size: 1.15rem;
}

.dk-sidebar {
  position: fixed;
  z-index: 1100;
  inset: 0 auto 0 0;
  width: var(--dk-sidebar-width);
  height: 100vh;
  overflow-y: auto;
  padding: 1.4rem 1rem 2rem;
  border-right: 1px solid var(--dk-border);
  background: var(--dk-sidebar-bg);
}

.dk-sidebar-title {
  display: block;
  margin: 0.15rem 0 1.55rem;
  padding: 0 0.65rem;
  color: var(--dk-title);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.dk-sidebar-title::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 0.55rem;
  border-radius: 2px;
  background: var(--dk-blue);
  box-shadow: 5px 5px 0 var(--dk-pink);
  vertical-align: 2px;
}

.dk-sidebar-label {
  margin: 1.25rem 0 0.55rem;
  padding: 0 0.65rem;
  color: #94A3B8;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.dk-sidebar nav,
.dk-sidebar .tableofcontents {
  width: 100%;
}

.dk-sidebar .tableofcontents {
  margin: 0 !important;
  padding: 0 !important;
}

.dk-sidebar .partToc,
.dk-sidebar .chapterToc,
.dk-sidebar .sectionToc,
.dk-sidebar .subsectionToc,
.dk-sidebar .subsubsectionToc {
  margin: 0 !important;
  line-height: 1.35 !important;
}

.dk-sidebar .sectionToc,
.dk-sidebar .subsectionToc,
.dk-sidebar .subsubsectionToc {
  margin-left: 0 !important;
}

.dk-sidebar a {
  display: block;
  margin: 1px 0;
  padding: 0.47rem 0.65rem;
  border-radius: 7px;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}

.dk-sidebar .partToc > a,
.dk-sidebar .chapterToc > a {
  margin-top: 0.35rem;
  color: #334155;
  font-weight: 700;
}

.dk-sidebar .sectionToc > a {
  padding-left: 1.15rem;
}

.dk-sidebar .subsectionToc > a {
  padding-left: 1.85rem;
  color: #64748B;
  font-size: 0.84rem;
}

.dk-sidebar .subsubsectionToc > a {
  padding-left: 2.5rem;
  color: #64748B;
  font-size: 0.82rem;
}

.dk-sidebar a:hover {
  background: #EEF2F7;
  color: var(--dk-blue-dark);
}

.dk-sidebar a.dk-active {
  background: var(--dk-blue-soft);
  color: var(--dk-blue-dark);
  font-weight: 700;
}

.dk-sidebar a.dk-active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 1.15rem;
  border-radius: 0 3px 3px 0;
  background: var(--dk-blue);
}

/* ---------- Main reading surface ---------- */

.dk-main {
  margin-left: var(--dk-sidebar-width);
  padding-top: var(--dk-header-height);
  min-height: 100vh;
}

.dk-content {
  width: min(var(--dk-content-width), calc(100vw - var(--dk-sidebar-width) - 4rem));
  margin: 0 auto;
  padding: 3.8rem 0 6rem;
}

/* Keep title/TOC page nice but don't duplicate TOC in article body */
.dk-content > .tableofcontents.dk-sidebar-source-hidden {
  display: none !important;
}

/* ---------- Typography ---------- */

p {
  margin: 0;
}

p + p {
  margin-top: 1.1em;
}

h1, h2, h3, h4, h5,
.partHead, .likepartHead,
.chapterHead, .likechapterHead,
.sectionHead, .likesectionHead,
.subsectionHead, .likesubsectionHead,
.subsubsectionHead, .likesubsubsectionHead {
  color: var(--dk-title);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  letter-spacing: -0.025em;
  line-height: 1.2;
  scroll-margin-top: calc(var(--dk-header-height) + 1.5rem);
}

.chapterHead,
.likechapterHead {
  margin: 0 0 2rem;
  padding: 0 0 1.15rem;
  border-bottom: 1px solid var(--dk-border);
  font-size: clamp(2rem, 4vw, 2.85rem);
  font-weight: 760;
}

.chapterHead::after,
.likechapterHead::after {
  content: "";
  display: block;
  width: 54px;
  height: 4px;
  margin-top: 1rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--dk-blue) 0 55%, var(--dk-pink) 55% 100%);
}

.sectionHead,
.likesectionHead {
  margin: 3rem 0 1rem;
  font-size: 1.65rem;
  font-weight: 730;
}

.subsectionHead,
.likesubsectionHead {
  margin: 2.3rem 0 0.85rem;
  font-size: 1.3rem;
  font-weight: 700;
}

.subsubsectionHead,
.likesubsubsectionHead,
.paragraphHead,
.likeparagraphHead {
  margin: 1.8rem 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
}

/* ---------- Links ---------- */

.dk-content a {
  color: var(--dk-blue);
  text-decoration: none;
  text-underline-offset: 0.18em;
}

.dk-content a:hover {
  color: var(--dk-blue-dark);
  text-decoration: underline;
  text-decoration-color: var(--dk-pink);
}

/* ---------- Images and figures ---------- */

img {
  max-width: 100%;
  height: auto !important;
}

figure.figure,
div.figure,
div.float {
  margin: 2.3rem auto;
}

figure.figure img,
div.figure img,
div.float img {
  display: block;
  margin: 0 auto;
}

figcaption.caption,
div.caption {
  margin: 0.85rem auto 0;
  color: var(--dk-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
  text-indent: 0;
}

/* ---------- Code ---------- */

code,
code.verb,
code.lstinline {
  padding: 0.12em 0.38em;
  border: 1px solid var(--dk-pink);
  border-radius: 5px;
  background: var(--dk-pink-soft);
  color: #9F1239;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.89em;
}

pre,
pre.verbatim,
pre.listings,
pre.lstlisting,
pre.lstinputlisting,
[id^="listing-"] {
  overflow-x: auto;
  margin: 1.6rem 0;
  padding: 1.15rem 1.3rem;
  border: 1px solid var(--dk-pink) !important;
  border-left: 4px solid var(--dk-blue) !important;
  border-radius: 9px;
  background: var(--dk-code-bg) !important;
  color: #172033;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* ---------- Math ---------- */

div.par-math-display,
div.math-display,
div.eqnarray,
div.gather-star,
div.array,
div.pmatrix {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 1.55rem 0;
  padding: 0.35rem 0;
}

/* ---------- Tables ---------- */

div.tabular {
  overflow-x: auto;
  margin: 1.8rem 0;
}

table.tabular {
  max-width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--dk-border);
  background: #fff;
}

table.tabular td,
table.tabular th {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--dk-border);
}

/* ---------- Theorems / boxes ---------- */

div.newtheorem,
.fbox,
.framebox-c,
.framebox-l,
.framebox-r {
  margin: 1.7rem 0;
  padding: 1rem 1.2rem;
  border: 1px solid var(--dk-pink);
  border-left: 4px solid var(--dk-blue);
  border-radius: 9px;
  background: linear-gradient(90deg, var(--dk-pink-soft), #fff 78%);
}

div.newtheorem .head {
  color: var(--dk-blue-dark);
}

/* ---------- Proper Previous / Next navigation ---------- */

div.crosslinks {
  margin: 4rem 0 0 !important;
  padding: 1.6rem 0 0 !important;
  border: 0 !important;
  border-top: 1px solid var(--dk-border) !important;
  border-radius: 0 !important;
  background: transparent !important;
}

div.crosslinks p {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin: 0 !important;
}

div.crosslinks a {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--dk-muted) !important;
  font-size: 0.9rem !important;
  font-weight: 650 !important;
  text-decoration: none !important;
}

div.crosslinks a:first-of-type {
  justify-self: start;
}

div.crosslinks a:last-of-type {
  justify-self: end;
  color: var(--dk-blue) !important;
}

div.crosslinks a:hover {
  color: var(--dk-blue-dark) !important;
  text-decoration: none !important;
  transform: none !important;
}

div.crosslinks a:first-of-type::before {
  content: "←";
  margin-right: 0.45rem;
}

div.crosslinks a:last-of-type::after {
  content: "→";
  margin-left: 0.45rem;
}

/* middle "Contents" */
div.crosslinks a:not(:first-of-type):not(:last-of-type) {
  justify-self: center;
  color: #94A3B8 !important;
  font-size: 0.82rem !important;
}

/* Do not show duplicate top crosslinks */
body > div.crosslinks:first-of-type,
.dk-content > div.crosslinks:first-child {
  display: none !important;
}

/* ---------- Mobile ---------- */

.dk-overlay {
  display: none;
}

@media (max-width: 900px) {
  .dk-header {
    left: 0;
    padding: 0 1rem;
  }

  .dk-menu-button {
    display: inline-flex;
  }

  .dk-sidebar {
    transform: translateX(-100%);
    box-shadow: 20px 0 45px rgba(15,23,42,.12);
    transition: transform .2s ease;
  }

  .dk-sidebar.dk-open {
    transform: translateX(0);
  }

  .dk-overlay {
    position: fixed;
    z-index: 1050;
    inset: 0;
    display: none;
    background: rgba(15,23,42,.28);
  }

  .dk-overlay.dk-open {
    display: block;
  }

  .dk-main {
    margin-left: 0;
  }

  .dk-content {
    width: auto;
    margin: 0;
    padding: 2.5rem 1.35rem 4rem;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .dk-brand {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dk-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  div.crosslinks p {
    grid-template-columns: 1fr 1fr;
  }

  div.crosslinks a:not(:first-of-type):not(:last-of-type) {
    display: none;
  }
}

@media print {
  .dk-sidebar,
  .dk-header,
  .dk-overlay,
  div.crosslinks {
    display: none !important;
  }

  .dk-main {
    margin-left: 0;
    padding-top: 0;
  }

  .dk-content {
    width: 100%;
    max-width: none;
    padding: 0;
  }
}

/* =========================================================
   Deep Kondah color overrides
   ========================================================= */

:root {
  --blue: #2563EB;
  --blue-dark: #1D4ED8;
  --blue-soft: #EFF6FF;

  --pink: #F0B7BA;
  --pink-soft: #F9E4E5;
}

/* Active item: pink background + blue text */
.dk-toc-item a.dk-active {
  background: #F9E4E5 !important;
  color: #2563EB !important;
  font-weight: 700;
}

/* Pink selection indicator */
.dk-toc-item a.dk-active::before {
  background: #F0B7BA !important;
}

/* Sidebar links */
.dk-toc-item a:hover {
  background: #F9E4E5 !important;
  color: #2563EB !important;
}

/* =========================================================
   Slightly larger figures
   ========================================================= */

figure.figure,
div.figure,
div.float {
  width: min(920px, calc(100vw - var(--sidebar-width) - 60px));
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}

figure.figure img,
div.figure img,
div.float img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto !important;
  margin-left: auto;
  margin-right: auto;
}

/* Images emitted directly by TeX4ht */
.dk-content > img,
.dk-content p > img {
  width: auto;
  max-width: min(900px, 110%);
  height: auto !important;
}

/* Mobile */
@media (max-width: 900px) {
  figure.figure,
  div.figure,
  div.float {
    width: 100%;
    margin-left: 0;
    transform: none;
  }

  .dk-content > img,
  .dk-content p > img {
    max-width: 100%;
  }
}


/* =========================================================
   Deep Kondah book home
   ========================================================= */

.dk-book-home {
  max-width: 720px;
  padding-top: 5.5rem;
}

.dk-book-kicker {
  margin-bottom: 1rem;
  color: #2563EB;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dk-book-home h1 {
  max-width: 680px;
  margin: 0;
  color: #111827;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  font-weight: 780;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.dk-book-home h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 5px;
  margin-top: 1.6rem;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      #2563EB 0 60%,
      #F0B7BA 60% 100%
    );
}

.dk-book-description {
  max-width: 650px;
  margin-top: 2rem !important;
  color: #64748B;
  font-size: 1.15rem;
  line-height: 1.75;
}

.dk-start-reading {
  display: inline-flex;
  align-items: center;
  margin-top: 2rem;
  padding: 0.8rem 1.15rem;
  border-radius: 8px;
  background: #2563EB;
  color: #fff !important;
  font-weight: 700;
  text-decoration: none !important;
  transition:
    background-color 0.15s ease,
    transform 0.15s ease;
}

.dk-start-reading::after {
  content: "→";
  margin-left: 0.5rem;
}

.dk-start-reading:hover {
  background: #1D4ED8;
  transform: translateY(-1px);
}

/* =========================================================
   Deep Kondah palette override
   ========================================================= */

:root {
  --blue: #2563EB;
  --blue-dark: #1D4ED8;
  --blue-soft: #EFF6FF;

  --pink: #F0B7BA;
  --pink-soft: #F9E4E5;
}

.dk-toc-item a.dk-active {
  background: #F9E4E5 !important;
  color: #2563EB !important;
  font-weight: 700;
}

.dk-toc-item a.dk-active::before {
  background: #F0B7BA !important;
}

.dk-toc-item a:hover {
  background: #F9E4E5 !important;
  color: #2563EB !important;
}

/* =========================================================
   Slightly larger figures
   ========================================================= */

figure.figure,
div.figure,
div.float {
  width: min(
    920px,
    calc(
      100vw -
      var(--sidebar-width) -
      60px
    )
  );

  max-width: none;

  margin-left: 50%;

  transform:
    translateX(-50%);
}

figure.figure img,
div.figure img,
div.float img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto !important;
  margin-left: auto;
  margin-right: auto;
}

.dk-content > img,
.dk-content p > img {
  width: auto;
  max-width: min(900px, 110%);
  height: auto !important;
}

@media (max-width: 900px) {
  figure.figure,
  div.figure,
  div.float {
    width: 100%;
    margin-left: 0;
    transform: none;
  }

  .dk-content > img,
  .dk-content p > img {
    max-width: 100%;
  }

  .dk-book-home {
    padding-top: 2.5rem;
  }

  .dk-book-home h1 {
    font-size: clamp(
      2.2rem,
      10vw,
      3.2rem
    );
  }
}


/* =========================================================
   Collapsible TOC subsections
   ========================================================= */

.dk-toc-item.dk-subsection,
.dk-toc-item.dk-subsubsection {
  display: none;
}

/* Expanded subsections */
.dk-toc-item.dk-subsection.dk-visible,
.dk-toc-item.dk-subsubsection.dk-visible {
  display: block;
}

/* Sections that contain subsections */
.dk-toc-item.dk-section.dk-expandable > a {
  position: relative;
  padding-right: 2rem;
}

/* Chevron */
.dk-toc-item.dk-section.dk-expandable > a::after {
  content: "›";
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94A3B8;
  font-size: 1.15rem;
  transition: transform 0.15s ease;
}

/* Rotate when open */
.dk-toc-item.dk-section.dk-expandable.dk-expanded > a::after {
  transform:
    translateY(-50%)
    rotate(90deg);

  color: #2563EB;
}

