/* MORFE.jl docs shell — Documenter.jl-style, but with personality */

.docs-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 240px;
  gap: 0;
  align-items: start;
  position: relative;
  z-index: 1;
}

/* ===== Static package identity artwork =====
   API-kind colours remain Julia blue/green/purple/red. Amber is reserved for the
   package-level companion cue, while the mesh nodes reuse the Julia palette. */
.core-manifold,
.companion-mesh {
  position: fixed;
  z-index: 0;
  top: 53px;
  right: 0;
  width: min(42vw, 680px);
  height: calc(100vh - 53px);
  pointer-events: none;
  mask-image: linear-gradient(to left, rgba(0,0,0,.78), transparent 88%);
  -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,.78), transparent 88%);
}
.core-manifold {
  /* Fine tuning: +x moves right, +y moves down, and size controls height. */
  --manifold-x: 70px;
  --manifold-y: 30px;
  --manifold-size: 120%;
  width: min(46vw, 760px);
  background-image: url("manifold-accent.svg");
  background-repeat: no-repeat;
  background-size: auto var(--manifold-size);
  background-position:
    calc(100% + var(--manifold-x))
    calc(50% + var(--manifold-y));
  opacity: 0.64;
  mask-image: linear-gradient(to left, rgba(0,0,0,.82), transparent 74%);
  -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,.82), transparent 74%);
}
.companion-mesh {
  background: url("fem-mesh-accent.svg") top right / cover no-repeat;
  opacity: 0.62;
}
.companion-button {
  position: fixed;
  z-index: 35;
  top: calc(var(--nav-h, 60px) + 92px);
  /* Sit comfortably inside the right documentation column without hugging
     the viewport edge or intruding into the API content. */
  right: 155px;
  transform: translateX(50%);
  padding: 11px 16px;
  border: 1px solid #d4a056;
  border-radius: 4px;
  background: #d4a056;
  box-shadow: 0 8px 28px rgba(0,0,0,.3);
  color: #17120b;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  transition: border-color .15s, background .15s, transform .15s;
}
.companion-button:hover {
  color: #07070b;
  border-color: #e2b86f;
  background: #e2b86f;
  transform: translateX(50%) translateY(-1px);
}
.companion-button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.package-switch .package-mark {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.package-switch .core-mark { background: var(--jl-purple); }
.package-switch .companion-mark { background: #d4a056; }

/* ===== Sidebar ===== */
.docs-side {
  position: sticky;
  top: 53px; /* match nav height */
  align-self: start;
  height: calc(100vh - 53px);
  overflow-y: auto;
  border-right: 1px solid var(--hair);
  padding: 28px 22px 80px;
  background: rgba(7,7,11,0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.docs-side .ver {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hair);
}
.docs-side .ver select {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--hair-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 3px;
}
.docs-side .search {
  position: relative;
  margin-bottom: 22px;
}
.docs-side .search input {
  width: 100%;
  background: #07070b;
  border: 1px solid var(--hair-2);
  border-radius: 4px;
  padding: 8px 12px 8px 32px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
}
.docs-side .search input::placeholder { color: var(--ink-3); }
.docs-side .search .ic {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
}
.docs-side .search .kbd {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  border: 1px solid var(--hair-2);
  border-radius: 3px;
  padding: 1px 5px;
}

.docs-side h4 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 26px 0 10px;
  font-weight: 500;
}
.docs-side ul {
  list-style: none;
  padding: 0;
  margin: 0 0 4px 0;
}
.docs-side li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 12px;
  font-size: 13.5px;
  color: var(--ink-2);
  border-radius: 4px;
  position: relative;
  font-family: var(--sans);
}
.docs-side li a:hover { background: rgba(255,255,255,0.04); color: #fff; }
.docs-side li a.active {
  background: rgba(149,88,178,0.12);
  color: #fff;
}
.docs-side li a.active::before {
  content: "";
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--jl-purple);
  border-radius: 2px;
}
.docs-side li.sub a { padding-left: 28px; font-size: 13px; color: var(--ink-3); }
.docs-side li.sub a.active { color: #fff; }
.docs-side.tutorial-side .ver {
  margin: 0 0 10px;
  padding-bottom: 0;
  border-bottom: 0;
}
.docs-side.tutorial-side .docs-install-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--jl-purple);
  border-radius: 4px;
  background: var(--jl-purple);
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: background .15s, border-color .15s;
}
.docs-side.tutorial-side .docs-install-btn:hover { background: #a566c2; border-color: #a566c2; color: #fff; }
.docs-side.tutorial-side .docs-install-btn.active { box-shadow: inset 3px 0 0 rgba(255,255,255,0.72); }
.docs-side.tutorial-side > .docs-install-btn { margin-bottom: 12px; }
.docs-side.tutorial-side .tutorial-utility-links { margin-bottom: 28px; }
.docs-side.tutorial-side .tutorial-nav-heading { margin-bottom: 10px; }
.docs-side.tutorial-side .tutorial-list { margin-bottom: 0; }

/* ===== Main content ===== */
.docs-main {
  padding: 48px 56px 120px;
  min-width: 0;
}
.docs-main .crumbs {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 18px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.docs-main .crumbs span.sep { color: var(--hair-2); }
.docs-main h1 {
  font-size: clamp(34px, 4.2vw, 52px);
  margin-bottom: 12px;
  font-weight: 400;
}
.docs-main h2 {
  font-size: 28px;
  margin: 56px 0 16px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
}
.docs-main h2:first-of-type { border-top: 0; padding-top: 0; }
.docs-main h3 { font-size: 19px; margin: 32px 0 12px; }
.docs-main p { color: var(--ink); font-size: 16px; line-height: 1.65; max-width: 70ch; }
.docs-main ul, .docs-main ol { color: var(--ink); font-size: 16px; line-height: 1.7; max-width: 70ch; }
.docs-main ul li, .docs-main ol li { margin-bottom: 6px; }
.docs-main strong { color: #fff; }
.docs-main a.inline { color: var(--jl-purple); border-bottom: 1px solid rgba(149,88,178,0.4); }
.docs-main a.inline:hover { color: #fff; border-bottom-color: #fff; }
/* API names linked into documentation.html by website/link_tutorials.jl.  The colour is
   inherited so the <code> styling underneath is untouched; only the dashed underline says
   "this is a link", the same signal the documentation page gives its signature links. */
.docs-main a.doc-link { color: inherit; text-decoration: none;
  border-bottom: 1px dashed rgba(149,88,178,0.55); transition: border-color .15s; }
.docs-main a.doc-link:hover { border-bottom-color: var(--jl-purple); }

.docs-main .lede {
  font-size: 19px;
  color: var(--ink-2);
  max-width: 60ch;
  margin: 8px 0 28px;
}
.doc-search-status {
  margin: -12px 0 20px;
  font-family: var(--mono);
  font-size: 11px !important;
  letter-spacing: .06em;
  color: var(--ink-3) !important;
}
.doc-search-results[hidden], .doc-search-status[hidden] { display: none; }
.doc-search-results { min-width: 0; }
.doc-search-results .doc:first-child { margin-top: 0; }
.doc-search-results .doc.search-exact {
  box-shadow: 0 0 0 1px rgba(212,160,86,.72), 0 10px 30px rgba(0,0,0,.18);
}
.doc-search-results .doc::after {
  content: attr(data-doc-module);
  position: absolute;
  right: 18px;
  bottom: 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--ink-3);
  opacity: .72;
  pointer-events: none;
}
.doc-search-results .doc .doc-body { padding-bottom: 30px; }

/* Code blocks within docs */
.docs-main pre.code {
  margin: 18px 0 22px;
  max-width: 100%;
}
.docs-main pre.code .out {
  display: block;
  color: #98c379;
  margin-top: 6px;
}
.docs-main p code, .docs-main li code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: #07070b;
  border: 1px solid var(--hair);
  padding: 1px 6px;
  border-radius: 3px;
  color: #d6d6df;
}

/* Admonition blocks */
.adm {
  margin: 24px 0;
  border: 1px solid var(--hair);
  border-radius: 6px;
  background: rgba(10,10,15,0.55);
  overflow: hidden;
}
.adm .adm-head {
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}
.adm .adm-head::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--jl-purple);
}
.adm .adm-body { padding: 14px 16px 16px; font-size: 14.5px; color: var(--ink-2); }
.adm.note .adm-head { color: var(--jl-blue); border-bottom: 1px solid rgba(64,99,216,0.25); background: rgba(64,99,216,0.05); }
.adm.note .adm-head::before { background: var(--jl-blue); }
.adm.tip .adm-head { color: var(--jl-green); border-bottom: 1px solid rgba(56,152,38,0.25); background: rgba(56,152,38,0.05); }
.adm.tip .adm-head::before { background: var(--jl-green); }
.adm.warn .adm-head { color: #d4a056; border-bottom: 1px solid rgba(212,160,86,0.25); background: rgba(212,160,86,0.05); }
.adm.warn .adm-head::before { background: #d4a056; }
.adm.danger .adm-head { color: var(--jl-red); border-bottom: 1px solid rgba(203,60,51,0.25); background: rgba(203,60,51,0.05); }
.adm.danger .adm-head::before { background: var(--jl-red); }
.adm .adm-body p:last-child { margin: 0; }

/* documentation entry */
.doc {
  margin: 22px 0;
  border: 1px solid var(--hair);
  border-radius: 6px;
  background: rgba(7,7,11,0.6);
  overflow: hidden;
}
.doc .doc-sig {
  padding: 14px 18px;
  font-family: var(--mono);
  font-size: 14px;
  border-bottom: 1px solid var(--hair);
  background: #07070b;
  color: #d6d6df;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  gap: 10px;
}
.doc .doc-sig code {
  display: block;
  width: 100%;
  text-align: left;
}
.doc .doc-sig .badge {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(149,88,178,0.15);
  color: var(--jl-purple);
  border: 1px solid rgba(149,88,178,0.3);
}
.doc .doc-sig .badge.t { background: rgba(56,152,38,0.12); color: var(--jl-green); border-color: rgba(56,152,38,0.3); }
.doc .doc-body { padding: 16px 18px 18px; font-size: 14.5px; color: var(--ink-2); }
.doc .doc-body p { margin: 0 0 10px; font-size: 14.5px; }
.doc .doc-body table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.doc .doc-body th, .doc .doc-body td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--hair); }
.doc .doc-body th { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.doc .doc-body td.arg { font-family: var(--mono); color: var(--ink); white-space: nowrap; }
.doc .doc-body td.typ { font-family: var(--mono); color: var(--jl-purple); white-space: nowrap; }
.doc-module-desc a.doc-ref,
.doc-body a.doc-ref {
  color: inherit;
  border-bottom: 1px dashed rgba(149,88,178,.58);
  transition: color .15s, border-color .15s;
}
.doc-module-desc a.doc-ref:hover,
.doc-body a.doc-ref:hover {
  color: #fff;
  border-bottom-color: var(--jl-purple);
}

/* On this page */
.docs-toc {
  position: sticky;
  top: 53px;
  align-self: start;
  height: calc(100vh - 53px);
  padding: 48px 28px;
  font-size: 13px;
  border-left: 1px solid var(--hair);
  overflow-y: auto;
}
.docs-toc h5 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 14px;
  font-weight: 500;
}
.docs-toc ul { list-style: none; padding: 0; margin: 0; }
.docs-toc li a {
  display: block;
  padding: 4px 0 4px 12px;
  border-left: 1px solid var(--hair);
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 13px;
}
.docs-toc li a:hover { color: var(--ink); border-left-color: var(--ink-3); }
.docs-toc li a.active { color: #fff; border-left-color: var(--jl-purple); }
.docs-toc li.h3 a { padding-left: 22px; font-size: 12.5px; }

/* Step blocks for the tutorial */
.step {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 20px;
  margin: 36px 0;
}
.step > .num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--jl-purple);
  letter-spacing: 0.06em;
  border-top: 1px solid var(--jl-purple);
  padding-top: 8px;
}
.step .body h3 { margin-top: 4px; }

/* Math blocks */
.docs-main .math-block {
  margin: 18px 0;
  padding: 16px 20px;
  background: rgba(7,7,11,0.6);
  border-left: 2px solid var(--jl-purple);
  border-radius: 0 4px 4px 0;
  overflow-x: auto;
}

/* Inline plot */
.fig {
  margin: 22px 0 30px;
  border: 1px solid var(--hair);
  border-radius: 6px;
  background: #07070b;
  overflow: hidden;
}
.fig .fig-cap {
  padding: 10px 16px;
  border-top: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}
.fig .fig-cap .lab { color: var(--jl-purple); margin-right: 10px; }

/* Tutorial card grid (index) */
.tut-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 28px;
}
.tut-card {
  border: 1px solid var(--hair);
  border-radius: 6px;
  padding: 26px 28px;
  background: rgba(10,10,15,0.55);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .2s, transform .2s;
}
.tut-card:hover { border-color: var(--hair-2); transform: translateY(-2px); }
.tut-card .row { display: flex; align-items: center; justify-content: space-between; }
.tut-card .lvl { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.tut-card .lvl.intro { color: var(--jl-green); }
.tut-card .lvl.mid { color: #d4a056; }
.tut-card .lvl.adv { color: var(--jl-red); }
.tut-card h3 { font-size: 19px; font-weight: 500; margin: 4px 0 4px; }
.tut-card p { font-size: 14px; color: var(--ink-2); margin: 0; }
.tut-card .meta { font-family: var(--mono); font-size: 11px; color: var(--ink-3); display: flex; gap: 14px; margin-top: 6px; }

@media (max-width: 1240px) {
  .docs-shell { grid-template-columns: 260px minmax(0, 1fr); }
  .docs-toc { display: none; }
  .companion-button { top: auto; bottom: 18px; right: 18px; transform: none; padding: 9px 13px; }
  .companion-button:hover { transform: translateY(-1px); }
  .core-manifold { display: none; }
  .companion-mesh { width: 52vw; opacity: .3; }
}
@media (max-width: 900px) {
  .docs-shell { grid-template-columns: 1fr; }
  .docs-side { display: none; }
  .docs-main { padding: 32px 24px 80px; }
  .tut-grid { grid-template-columns: 1fr; }
  .companion-button { bottom: 12px; right: 12px; }
  .companion-mesh { width: 76vw; opacity: .24; }
}
