/* Obsidian Publish Custom CSS */

/* Heading font: Skia */
h1, h2, h3, h4, h5, h6 {
  font-family: Skia, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

/* Heading sizes */
h1 {
  font-size: 2em !important;
}

h2 {
  font-size: 1.7em !important;
}

h3 {
  font-size: 1.3em !important;
}

h4 {
  font-size: 1.2em !important;
}

/* Note titles */
.inline-title {
  font-family: Skia, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 2em !important;
}

/* Body text font: Source Sans Pro */
body,
.markdown-preview-view,
.markdown-rendered {
  font-family: "Source Sans Pro", "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

/* Sidebar/navigation font: Source Sans Pro */
.tree-item-inner,
.nav-file-title,
.site-body-left-column {
  font-family: "Source Sans Pro", "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

/* ============================================================
   Sidebar toggle  (pairs with publish.js)
   ============================================================ */

/* The state class lives on <html> rather than <body> or .published-container,
   because Obsidian rewrites the class lists on those two itself. */

html.ti-nav-hidden .site-body-left-column {
  display: none !important;
}

/* Obsidian shows this compact header (logo + site name) on sites that have no
   navigation, so reuse it here — the branding survives when the nav is gone. */
html.ti-nav-hidden .site-header {
  display: flex !important;
}

/* ...but not the mobile hamburger or its backdrop, which would reopen the
   drawer we just hid. */
html.ti-nav-hidden .site-header .clickable-icon,
html.ti-nav-hidden .nav-backdrop {
  display: none !important;
}

/* Optional second column — set alsoHideOutline in publish.js to turn off. */
html.ti-nav-hidden.ti-hide-outline .site-body-right-column {
  display: none !important;
}

/* Obsidian only re-centres the text column on sites that have no navigation at
   all, so do it ourselves once the sidebar is hidden — otherwise the column
   stays pinned to the left edge with dead space beside it. */
html.ti-nav-hidden .published-container.is-readable-line-width
  .publish-renderer > .markdown-preview-view > .markdown-preview-sizer {
  margin-left: auto !important;
  margin-right: auto !important;
}

/* When the outline column is still on screen, centre within the space beside it
   instead — the same sum Obsidian uses for its own no-navigation layout. */
html.ti-nav-hidden:not(.ti-hide-outline)
  .published-container.is-readable-line-width.has-outline
  .publish-renderer > .markdown-preview-view > .markdown-preview-sizer,
html.ti-nav-hidden:not(.ti-hide-outline)
  .published-container.is-readable-line-width.has-graph
  .publish-renderer > .markdown-preview-view > .markdown-preview-sizer {
  margin-right: calc((100vw - var(--page-width) + var(--sidebar-right-width)) / 2) !important;
}

/* The floating button */
#ti-sidebar-toggle {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--background-modifier-border);
  border-radius: 8px;
  background-color: var(--background-primary);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.65;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition: opacity 120ms ease, color 120ms ease, background-color 120ms ease;
}

#ti-sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

#ti-sidebar-toggle:hover {
  opacity: 1;
  color: var(--text-normal);
  background-color: var(--background-secondary);
}

#ti-sidebar-toggle:focus-visible {
  opacity: 1;
  outline: 2px solid var(--interactive-accent);
  outline-offset: 2px;
}

/* Fade the divider bar in the icon when the sidebar is hidden, so the button
   reads as a state and not just a decoration. */
html.ti-nav-hidden #ti-sidebar-toggle svg path {
  opacity: 0.35;
}

@media print {
  #ti-sidebar-toggle {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #ti-sidebar-toggle {
    transition: none;
  }
}

/* Sidebar logo. Publish caps it at 200px tall by default, which the logo hits
   exactly — this just lowers the cap. Width follows automatically. */
.published-container {
  --logo-max-height: 90px;
}

/* Centre the site name under the logo. The padding-right override matters:
   Publish ships 32px there, which would pull the centred text off-axis. */
.site-body-left-column-site-name {
  text-align: center;
  padding-right: 0;
}
