/********************************************
 *      iPhemeris Doc Plugin CSS            *
 *          by Cliff Ribaudo                *
 ********************************************/
@font-face {
  font-family: "iPhemerisGlyphs";
  src:
    url("iphemeris.woff2") format("woff2"),
    url("iphemeris.woff") format("woff"),
    url("iphemeris.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
    --dark-blue: #312c65;
    --callout: #2891d7;
    --border: #d5d5d5;
    --text: #141414;
    --link2: #444;
}

/* Docs isolation layer: keep BE Theme from flattening styles */
html:has(.iphem-docs),
body:has(.iphem-docs) {
  overflow: visible !important;
}

/* For WP Header if shown from Meny */
.iphemeris-osx-doc { --wp-header: 80px; }

.iphem-docs {
  /* Apple-first system UI font (SF on macOS/iOS) */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  font-weight: 420;          /* subtle: improves SF readability */
  color: var(--text);

  /* Optional: makes SF look a touch nicer on macOS */
  /*-webkit-font-smoothing: antialiased;*/
  /*text-rendering: optimizeLegibility;*/
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Grid overflow fix: allow columns to shrink */
.iphem-docs .docs-layout > * {
  min-width: 0;
}

.iphem-docs .docs-content {
  max-width: 75ch;      /* reading measure */
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word; /* fallback */
}

/* Beat injected theme styles: re-assert base typography inside docs content */
.iphem-docs .docs-content {
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  color: inherit !important;
}

.iphem-docs .docs-content p,
.iphem-docs .docs-content td,
.iphem-docs .docs-content th,
.iphem-docs .docs-content blockquote {
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  color: inherit !important;
}

/* baseline: a bit more separation for all list items */
.iphem-docs .docs-content li {
  line-height: 1.48;
  margin: 0.5em 0;
}

/* Paragraphs + lists */
.iphem-docs .docs-content p {
  margin: 0.9em 0;
  line-height: 1.55em!important;
}

.iphem-docs .docs-content ul,
.iphem-docs .docs-content ol {
  margin: 0.55em 0 0.75em 1.35em;
  padding: 0;
}

/* OL: slightly more separation */
.iphem-docs .docs-content ol > li {
  margin: 0.65em 0;
}

/* Tighten bullet lists that live under numbered steps */
.iphem-docs .docs-content ol li ul > li,
.iphem-docs .docs-content ol li ol > li {
  margin: 0.45em 0;
}

/* Ensure BE theme doesn't normalize headings into the same size. Use .docs-content
   for specificity. Use !important only on font-size/line-height because BE theme
   uses inline CSS. */
.iphem-docs .docs-content h1,
.iphem-docs .docs-content h2,
.iphem-docs .docs-content h3,
.iphem-docs .docs-content h4,
.iphem-docs .docs-content h5,
.iphem-docs .docs-content h6 {
  margin: 1.2em 0 0.5em;
  padding: 0;
  letter-spacing: normal;
  text-transform: none;
  font-weight: 600;
  font-family: inherit!important;
}

/* Heading scale (tune as desired) */
.iphem-docs .docs-content h1 {
  font-size: 2.25rem !important;
  line-height: 1.2 !important;
  margin-top: 0.2em;
  padding: 15px 0;
  text-align: center;
  color: #ffffff;
  background-color: var(--dark-blue);
  border-radius: 12px;
}
.iphem-docs .docs-content h2 {
  font-size: 1.75rem !important;
  line-height: 1.25 !important;
  text-align: left;
  margin: 1.8em 0 0.6em;
  padding: 8px 12px;
  color: var(--dark-blue);
  border-bottom: 1px solid var(--border);
}
.iphem-docs .docs-content h3 {
  font-size: 1.35rem !important;
  line-height: 1.25 !important;
  margin: 1.2em 0 0.7em;
  color: var(--dark-blue);
  border-bottom: none;
  padding: 8px 12px;
  background: rgba(49,44,101,0.06);
  border-radius: 10px;
}
.iphem-docs .docs-content h4 {
  font-size: 1.10rem !important;
  line-height: 1.35 !important;
  font-weight:700;
  margin: 25px 0 15px 0;
  text-align: center;
  color: var(--callout);
}
.iphem-docs .docs-content h5 {
  font-size: 1.10rem !important;
  line-height: 1.35 !important;
  font-weight: 700;
  margin: 25px 0 6px 0;
}
.iphem-docs .docs-content h6 {
  font-size: 1.10rem !important;
  line-height: 1.35 !important;
  font-weight: 700;
  margin: 25px 0 6px 0;
  color: var(--callout);
}

/************************************************************************ 
 * List coloring always inherit base text color (beats theme injection)
 ************************************************************************/
.iphem-docs .docs-content ul,
.iphem-docs .docs-content ol,
.iphem-docs .docs-content li {
  color: inherit !important;
}

/* Bullets/numbers: inherit too */
.iphem-docs .docs-content li::marker {
  color: inherit !important;
}

.iphem-docs .docs-content li > ul > li::marker,
.iphem-docs .docs-content li > ol > li::marker {
  color: rgba(0,0,0,0.45) !important;
}

/* Deeper nesting goes back to normal (prevents wash-out) */
.iphem-docs .docs-content li > ul > li ul > li,
.iphem-docs .docs-content li > ol > li ol > li {
  color: inherit !important;
}

.iphem-docs .docs-content li > ul > li ul > li::marker,
.iphem-docs .docs-content li > ol > li ol > li::marker {
  color: inherit !important;
}

/************ Links (lock weight + color against theme + markdown quirks) */
.iphem-docs .docs-content a,
.iphem-docs .docs-content a:visited {
  font-weight: 400 !important;
  color: var(--callout);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Neutralize markdown renderer putting <strong>/<b> inside links */
.iphem-docs .docs-content a strong,
.iphem-docs .docs-content a b {
  font-weight: inherit !important;
}

/* In case <strong>/<b> wraps the <a> */
.iphem-docs .docs-content strong a,
.iphem-docs .docs-content b a {
  font-weight: 400 !important;
}

.iphem-docs .docs-content a:hover {
  text-decoration-thickness: 2px;
}

.iphem-docs .docs-content ul { list-style: disc; }
.iphem-docs .docs-content ul ul { list-style: circle; }
.iphem-docs .docs-content ul ul ul { list-style: square; }

.iphem-docs .docs-content ol { list-style: decimal; }
.iphem-docs .docs-content ol ol { list-style: lower-alpha; }
.iphem-docs .docs-content ol ol ol { list-style: lower-roman; }

.iphem-docs .iph-glyph {
  font-family: "iPhemerisGlyphs", sans-serif;
  font-size: 1.2em;
  line-height: 1;
  white-space: nowrap;
  color: #298cda;
}

/* Layout */
.iphem-docs .docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

/******************************************************
    Side-bar
 *******************************************************/
.iphem-docs .docs-sidebar {
  position: sticky;
  min-width: 0;
  top: 20px !important;
  max-height: calc(100vh - 50px) !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  align-self: start;
  padding-right: 12px;
  border-right: 1px solid rgba(0,0,0,0.1);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.35;
}

/**** Avoid WP Header when docs access from Menu */
.iphemeris-osx-doc .iphem-docs .docs-sidebar {
  top: calc(var(--wp-header) + 20px) !important;
  max-height: calc(100vh - var(--wp-header) - 50px) !important;
}

/* Sidebar nav */
.iphem-docs .docs-nav-title {
  margin-bottom: 0px;
  padding: 12px 0;
  text-align: center;
  color: #fff !important;
  background-color: var(--dark-blue);
  font-weight: 600;
  border-radius: 8px;
}

.iphem-docs .docs-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Sidebar nav: tighten vertical spacing */
.iphem-docs .docs-nav-item {
  margin: 0;                 /* kill any theme-injected li margins */
  padding: 0;
}

.iphem-docs .docs-nav-item a {
  padding: 10px 8px 2px 8px;          /* was 6px 8px */
  margin: 0;
  display: block;
  border-radius: 8px;
  text-decoration: none;
  line-height: 1.45;    /* more breathing room */
  font-weight: 500;
  color: #000 !important;
}

/* Sub-items: slightly tighter still */
.iphem-docs .docs-nav-item.sub a {
  padding-top: 2px;
  padding-bottom: 4px;
  padding-left: 20px;
  font-size: 0.95em;
  opacity: 0.9;
  line-height: 1.2em;
  font-weight: 450;
  color: var(--callout) !important;
}

.iphem-docs .docs-nav a.active {
  background: rgba(0,0,0,0.06);
  font-weight: 600;
}

/* Scroll offset for anchored headings */
.iphem-docs .docs-content h2,
.iphem-docs .docs-content h3 {
  scroll-margin-top: 100px;
}

/* Tables */
.iphem-docs .docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.95em;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  max-width: 100%;
}

.iphem-docs .docs-content th,
.iphem-docs .docs-content td {
  border: 1px solid rgba(0,0,0,0.12);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.iphem-docs .docs-content thead th {
  background: rgba(0,0,0,0.04);
  font-weight: 600;
}

/* Error box */
.iphem-docs .docs-error {
  padding: 12px;
  border: 1px solid #f3caca;
  background: #fff3f3;
  border-radius: 12px;
}

/* Images */
.iphem-docs .docs-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 14px 0;
  border-radius: 12px;
}

.iphem-docs .docs-content p > img {
  margin: 10px 0;
}

.iphem-docs .docs-content figure {
  margin: 16px 0;
}

.iphem-docs .docs-content figcaption {
  font-size: 0.9em;
  opacity: 0.8;
  margin-top: 6px;
}

/*****************************************************
 *               Floating Scroll To Top              *
 *****************************************************/
.iphem-docs .docs-to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;

  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.18);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);

  font-size: 14px;
  line-height: 1;
  font-weight: 600;

  box-shadow: 0 6px 18px rgba(0,0,0,0.12);

  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.iphem-docs .docs-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Only show this UX when layout collapses (<= 900px) */
@media (min-width: 901px) {
  .iphem-docs .docs-to-top { display: none; }
}


/*****************************************************
 *                 Responsive                        *
 *****************************************************/
@media (max-width: 600px) {
  .iphem-docs {
    font-size: 16.5px;   /* mobile comfort sweet spot */
    line-height: 1.62;
  }
  .iphem-docs .docs-layout {
    padding: 16px 12px; /* slightly smaller side padding */
    gap: 16px;
  }
  .iphemeris-osx-doc { --wp-header: 64px; }
}
@media (max-width: 900px) {
  .iphem-docs .docs-layout {
    grid-template-columns: 1fr;
  }

  .iphem-docs .docs-sidebar {
    position: relative;
    top: auto;
    border-right: none;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 12px;
    margin-bottom: 12px;

    overflow: visible !important;
    max-height: none !important;
    overscroll-behavior: auto !important;
    -webkit-overflow-scrolling: auto !important;
  }
  /* To help menu to avoid header if on WP Menu */
  .iphemeris-osx-doc { --wp-header: 72px; }
  @media (max-width: 900px) {
  /* Ensure we truly stack sidebar over content on WP pages */
  .iphemeris-osx-doc .iphem-docs .docs-layout {
    display: flex;              /* override any theme grid weirdness */
    flex-direction: column;
  }

  .iphemeris-osx-doc .iphem-docs .docs-sidebar {
    position: relative !important;
    top: auto !important;
    max-height: none !important;
    overflow: visible !important;

    /* make sure it occupies full width and participates in layout */
    width: 100%;
    flex: 0 0 auto;
  }

  .iphemeris-osx-doc .iphem-docs .docs-content {
    width: 100%;
    flex: 1 1 auto;
  }
}
}
