/* Joins the handbook page to the website shell. Loaded after guide/css/styles.css.
 * The book keeps its own layout, sidebar and palette; this file gives it the shared header and footer, the site fonts,
 * the sub-navigation under the header, and a dark appearance driven by the website's switch (html[data-theme="dark"]). */
:root {
  --font-body: "Poppins", "Noto Sans Devanagari", "Noto Sans Gujarati", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Cormorant", Georgia, "Times New Roman", serif;
}
.hb-header a, .hb-drawer a, .hb-search a, .hb-btn, .hb-social a, .hb-brand { text-decoration: none; }
.hb-ftr-col a:hover { text-decoration: underline; }


/* Text colours of the book's palette, darkened so every text/background pair reaches WCAG AA (4.5:1) on the book's own backgrounds. */
:root {
  --text-faint: #6b5a45;
  --turmeric-dark: #7a4d0c;
  --amber: #7a5410;
  --ink-3: #6b5a6c;
}
.tab-btn.is-active { background: var(--turmeric-dark); color: #fff; }
.callout-caution p { color: #6b470d; }
.chapter-body a, .xref { text-decoration: underline; text-underline-offset: .18em; }
.hb-credit a, .hb-ftr-col a, .hb-social a { color: var(--plum-ink); }
.hb-ftr-col a { color: var(--ink-2); }

/* The footer sits below the book's own legal notice. */
.site-footer { margin-bottom: 0; }
.hb-footer { margin-top: 0; }

/* Dark appearance for the book. The guide's palette is variables, so redefining them restyles every part. */
html[data-theme="dark"] {
  --bg: #150e19; --bg-alt: #1b1221; --surface: #231a2b; --surface-soft: #2a1f33;
  --border: #3b2a47; --border-soft: #2f2239;
  --text: #f6ecf6; --text-soft: #cdbccf; --text-faint: #a894ab;
  --turmeric: #e8be62; --turmeric-dark: #f0cd80; --turmeric-light: #4a3a22; --turmeric-pale: #2e2619;
  --clay: #e09a6c; --clay-dark: #eeb48c; --clay-light: #4a3226;
  --lavender: #c3a9da; --lavender-light: #35273f;
  --tulsi: #a8c878; --tulsi-light: #263020;
  --amber: #e8be62; --amber-light: #3a3020;
  --rose: #ff9a8f; --rose-light: #4a2622;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4); --shadow-md: 0 6px 20px rgba(0, 0, 0, .45); --shadow-lg: 0 14px 40px rgba(0, 0, 0, .55);
}
html[data-theme="dark"] .bg-decor span { opacity: .18; }
html[data-theme="dark"] input, html[data-theme="dark"] textarea, html[data-theme="dark"] select { background: var(--surface); color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .site-footer { background: transparent; }

/* Supporting-tools cards link into the dashboard. */
a.tool-card { display: block; color: inherit; text-decoration: none; }
a.tool-card:hover { text-decoration: none; }
.tool-card .enter-btn { display: inline-block; margin-top: .6rem; }
.about-dedication img { float: right; width: 160px; height: auto; border-radius: 18px; margin: 0 0 1rem 1.2rem; box-shadow: var(--shadow-md); }
@media (max-width: 600px) { .about-dedication img { float: none; margin: 0 auto 1rem; } }
.notes-save-hint.is-warning { color: var(--rose); font-weight: 600; }
html[data-theme="dark"] .tab-btn.is-active { color: #2a1d05; }
html[data-theme="dark"] .callout-caution p { color: #f2d79a; }

/* Contents list on the guide Overview. */
.toc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1rem; }
.toc-part { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); }
.toc-part h3 { font-size: 1.05rem; margin: 0 0 .5rem; }
.toc-part ol { margin: 0; padding-left: 1.2rem; }
.toc-part li { margin: .25rem 0; font-size: .92rem; line-height: 1.4; }

/* ---------- the reader: menu on the left, one chapter at a time on the right ---------- */
main#main { max-width: 1400px; padding: 0 clamp(12px, 2.4vw, 32px) 3rem; }
.reader { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: clamp(18px, 2.4vw, 36px); align-items: start; padding-top: 18px; position: relative; }
.reader .chapter-sidebar { position: sticky; top: calc(var(--header-h) + 14px); max-height: calc(100vh - var(--header-h) - 28px); overflow-y: auto; overscroll-behavior: contain; padding: 14px 12px 16px; }
.reader-content { min-width: 0; }
.reader .sidebar-toggle { display: none; }
.reading-progress { position: fixed; left: 0; right: 0; top: var(--header-h); height: 3px; z-index: 85; background: transparent; opacity: 0; transition: opacity .2s; pointer-events: none; }
.reading-progress.is-on { opacity: 1; }
.reading-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--turmeric), var(--plum)); border-radius: 0 3px 3px 0; }
.menu-top { list-style: none; margin: 0 0 .4rem; padding: 0; display: grid; gap: 2px; }
.menu-link { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: var(--radius-sm); padding: .55rem .7rem; font: inherit; font-size: .88rem; font-weight: 600; color: var(--text-soft); cursor: pointer; }
.menu-link:hover { background: var(--turmeric-pale); color: var(--turmeric-dark); }
.menu-link.is-active { background: var(--turmeric-light); color: var(--turmeric-dark); font-weight: 700; }
.chapter-kicker { margin: 0 0 .35rem; font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.reader .view, .reader .chapter-panel { padding-top: .2rem; }
.reader .chapter-panel { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); padding: clamp(18px, 3vw, 36px); box-shadow: var(--shadow-sm); }
.chapter-body h3[id] { scroll-margin-top: calc(var(--header-h) + 24px); }
.part-hero:first-child { margin-top: 0; }

@media (max-width: 980px) {
  .reader { grid-template-columns: 1fr; padding-top: 10px; }
  .reader .sidebar-toggle { display: flex; justify-content: center; position: sticky; top: var(--header-h); z-index: 70; width: 100%; min-height: 44px; border-radius: 0 0 14px 14px; background: var(--surface); border: 1px solid var(--border-soft); border-top: 0; box-shadow: var(--shadow-md); margin: 0; }
  .reader .chapter-sidebar { display: none; position: fixed; inset: calc(var(--header-h) + 48px) 10px 10px 10px; max-height: none; z-index: 80; box-shadow: var(--shadow-lg); }
  .reader .chapter-sidebar.is-open { display: block; }
}
@media print { .reader { display: block; } .reader .chapter-sidebar, .reader .sidebar-toggle, .reading-progress { display: none !important; } .reader .chapter-panel { border: 0; box-shadow: none; padding: 0; } }
