/* ============================
   Onshape-style accordions
   ============================ */

:root {
  --hs-surface: hsl(var(--card));
  --hs-surface-muted: hsl(var(--muted));
  --hs-border: hsl(var(--border));
  --hs-text: hsl(var(--foreground));
  --hs-text-muted: hsl(var(--muted-foreground));
  --hs-link: hsl(var(--primary));
  --hs-hover: hsl(var(--accent));
}

/* Ensure body copy always follows active theme tokens */
.md-content__inner,
.md-typeset,
.md-typeset p,
.md-typeset li,
.md-typeset .hs-acc-body,
.md-typeset .hs-acc-body *:not(img):not(svg):not(path) {
  color: var(--hs-text);
}

.md-typeset a,
.md-typeset .hs-acc-body a {
  color: var(--hs-link);
}

.md-typeset details.hs-acc {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  margin: 0.35rem 0 !important;
  padding: 0 !important;
}

/* Make the summary look like a blue section link with left caret */
.md-typeset details.hs-acc > summary {
  list-style: none;
  cursor: pointer;

  /* layout */
  display: flex;
  align-items: center;
  gap: 0.5rem;

  /* spacing */
  padding: 0.35rem 0.25rem;

  /* typography */
  color: var(--hs-link);
  font-weight: 600;
}

/* Remove Material/browser default marker */
.md-typeset details.hs-acc > summary::-webkit-details-marker {
  display: none;
}
.md-typeset details.hs-acc > summary::marker {
  content: "";
}

/* LEFT caret (triangle) */
.md-typeset details.hs-acc > summary::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 8px;             /* right-pointing triangle */
  border-color: transparent transparent transparent var(--hs-text-muted);
  transform: rotate(0deg);
  transition: transform 120ms ease;
}

/* Rotate caret when open (down) */
.md-typeset details.hs-acc[open] > summary::before {
  transform: rotate(90deg);
}

/* Hover: subtle underline like a link */
.md-typeset details.hs-acc > summary:hover {
  text-decoration: underline;
}

/* Keep neutral background on focus states */
.md-typeset details.hs-acc > summary:focus,
.md-typeset details.hs-acc > summary:focus-visible,
.md-typeset details.hs-acc > summary:hover {
  background: var(--hs-surface-muted) !important;
  outline: none !important;
}

/* Content indentation so it lines up under the title (past caret) */
.md-typeset details.hs-acc > .hs-acc-body {
  margin-left: 1.05rem;        /* aligns content with text after caret */
  padding: 1.0rem 0 0.75rem 0;
}
/* Light grey background on the accordion row */
.md-typeset details.hs-acc > summary {
  background: var(--hs-surface-muted) !important;
  border-radius: 6px;
  padding: 0.5rem 0.6rem;            /* a bit more “pill” spacing */
}

/* Keep grey on hover (optional: slightly darker) */
.md-typeset details.hs-acc > summary:hover {
  background: var(--hs-hover) !important;
  text-decoration: none;             /* optional: remove underline on hover */
}

/* When open, keep the same grey (or make it slightly different if you want) */
.md-typeset details.hs-acc[open] > summary {
  background: var(--hs-surface-muted) !important;
}


/* Accordion title text color (make it black) */
.md-typeset details.hs-acc > summary {
  color: var(--hs-text) !important;
}

/* Kill any icon/marker on the accordion summary (pencil, triangle, etc.) */
.md-typeset details.hs-acc > summary::before,
.md-typeset details.hs-acc > summary::-webkit-details-marker,
.md-typeset details.hs-acc > summary::marker {
  content: none !important;
  display: none !important;
}

/* Style directory hyperlinks */
.md-typeset .hs-dir {
  font-size: 0.9em;
  display: block;
  margin: 0 0 0.75rem 0;
}

/* Accordion typography: match default paragraph size */
.md-typeset details.hs-acc {
  font-size: 1em;
}

.md-typeset details.hs-acc > summary {
  font-size: 1em;
  font-weight: 550; /* keep if you want; remove if you want identical weight */
}

.md-typeset details.hs-acc .hs-acc-body {
  font-size: 1em;
}

/* Add space above the first line of page content */
.md-content__inner {
  padding-top: 1rem;
}

/* Change h3 header margins inside of accordion */
.md-typeset details.hs-acc .hs-acc-h {
  margin: 0 !important;          /* kill default h3 margins */
  padding: 0 !important;
  font-size: 1.25em;          /* optional, keeps it close to paragraph size */
  font-weight: 600;        /* optional */
  line-height: 1;       /* optional */
}

.md-typeset details.hs-acc .hs-acc-comp {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 1.02em;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.4rem !important;
}

.md-typeset details.hs-acc .hs-acc-key {
  margin: 0 0 0.8rem 0 !important;
  padding: 0 !important;
  font-size: 1.32em;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: underline;
}

.md-typeset details.hs-acc .hs-prop-line {
  margin-bottom: 0.4rem;
}

/* Prev/Next buttons row near top of page */
.hs-dir-nav {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.75rem 0;
}

.hs-nav-btn {
  width: 220px;
  height: 46px;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  background: var(--hs-surface);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0 0.55rem;
  color: var(--hs-text);
  text-decoration: none;
}

.hs-nav-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
  line-height: 1.1;
}

.hs-nav-arrow {
  flex: 0 0 auto;
  font-size: 0.95rem;
  line-height: 1;
}

.hs-nav-btn:hover {
  background: var(--hs-surface-muted);
}

.hs-nav-btn.is-disabled {
  opacity: 0.35;
}

/* Keep as a small horizontal group */
.hs-nav-slot {
  display: flex;
  gap: 0.1rem;
}

/* Place buttons inline with the directory row when .hs-dir exists */
.md-typeset .hs-dir.has-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.md-typeset .hs-dir.has-nav .hs-dir-nav {
  margin: 0 0 0 auto;
}

/* Copy-link icon buttons, isolated styles */
.hs-copy-link {
  margin-left: 0.4rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--hs-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 0;
  vertical-align: middle;
}

.hs-copy-link svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.hs-copy-link:hover {
  color: var(--hs-text);
}

.hs-copy-link.is-copied {
  color: #059669;
}

.md-typeset h1 .hs-copy-link {
  margin-left: 0.5rem;
}

/* Last updated label format */
.md-source-file__fact .git-revision-date-localized-plugin-date::before {
  content: "Last Updated: ";
}

/* Ensure metadata/footer text also follows theme tokens */
.md-source-file,
.md-source-file__fact,
.md-source-file__fact *,
.md-source-file__fact a {
  color: var(--hs-text-muted) !important;
}

.md-grid {
  width: 1200px;
  min-width: 1200px;
  max-width: 1200px;
  margin-left: 0;
  margin-right: auto;
}

.md-header__inner.md-grid {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  margin: 0;
}

@media (max-width: 1216px) {
  .md-grid {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
}

.md-sidebar--secondary {
  display: none !important;
}

.md-content {
  max-width: none;
  margin-right: 0;
}

.md-content__inner {
  max-width: none;
  margin-right: 0;
}

.md-sidebar--primary .md-sidebar__inner {
  padding-left: 0.6rem;
}

.md-main__inner {
  position: relative;
  min-height: 100vh;
}

.md-main__inner::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--md-sidebar-width, 12.1rem);
  width: 1px;
  background: var(--hs-border);
  pointer-events: none;
}

.md-nav--primary > .md-nav__title {
  display: none;
}

.hs-mobile-nav-wrap {
  display: none;
  margin: 0 0 0.7rem 0;
}

.hs-mobile-nav {
  width: 100%;
  height: 34px;
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  background: var(--hs-surface);
  color: var(--hs-text);
  padding: 0 0.55rem;
  font-size: 0.95rem;
}

@media (max-width: 1216px) {
  .hs-mobile-nav-wrap {
    display: block;
  }

  .md-main__inner::before {
    display: none;
  }
}

/* Welcome dashboard */
.hs-dash-page-title {
  text-align: center;
  margin-bottom: 0.6rem !important;
}

.hs-dash-lead {
  max-width: 980px;
  margin: 0 auto 0.85rem auto;
  text-align: center;
  font-size: var(--md-typeset-font-size);
  line-height: var(--md-typeset-line-height);
}

.hs-dash {
  background: var(--hs-surface-muted);
  border: 1px solid var(--hs-border);
  border-radius: 10px;
  padding: 0.8rem;
}

.hs-dash-heading {
  margin: 0 0 0.65rem 0 !important;
  text-align: center;
  font-size: 1.35rem;
}

.hs-dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.hs-dash-card {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0.45rem;
  align-items: start;
  background: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: 6px;
  padding: 0.58rem 0.62rem;
  text-decoration: none !important;
  color: inherit;
  box-shadow: 0 1px 2px hsl(var(--foreground) / 0.08);
  min-height: 0;
}

.hs-dash:not(.hs-dash--welcome) .hs-dash-card {
  grid-template-columns: 1fr;
  gap: 0;
}

.hs-dash-card--hero {
  grid-column: 1 / -1;
}

.hs-dash-card:hover {
  border-color: hsl(var(--foreground) / 0.28);
  box-shadow: 0 4px 14px hsl(var(--foreground) / 0.14);
}

.hs-dash-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--hs-text-muted);
}

.hs-dash-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.hs-dash-title {
  display: block;
  color: var(--md-typeset-a-color);
  text-decoration: underline;
  font-size: 0.9rem;
  line-height: 1.25;
  margin-bottom: 0.18rem;
}

.hs-dash-desc {
  display: block;
  font-size: 0.7rem;
  line-height: 1.2;
  color: var(--hs-text-muted);
}

@media (max-width: 1080px) {
  .hs-dash-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .hs-dash-grid {
    grid-template-columns: 1fr;
  }

  .hs-dash-card {
    min-height: 0;
    grid-template-columns: 24px 1fr;
  }

  .hs-dash:not(.hs-dash--welcome) .hs-dash-card {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .hs-dash-icon,
  .hs-dash-icon svg {
    width: 22px;
    height: 22px;
  }

  .hs-dash-heading {
    font-size: 1.25rem;
  }

  .hs-dash-card--hero {
    grid-column: auto;
  }

  .hs-dash-lead {
    font-size: 1rem;
  }
}

.hs-dash:not(.hs-dash--welcome) .hs-dash-icon {
  display: none;
}

/* Getting Started dashboard cards: increase card target height */
.hs-dash--getting-started .hs-dash-card {
  min-height: 135px;
}

/* ============================================
   Dark-mode hard override for markdown table cards
   ============================================ */
[data-theme="dark"] .md-typeset__scrollwrap,
[data-theme="dark"] .md-typeset__table,
html.dark .md-typeset__scrollwrap,
html.dark .md-typeset__table {
  background: hsl(var(--card)) !important;
}

[data-theme="dark"] .md-typeset__table > table,
[data-theme="dark"] .md-typeset__table > table thead,
[data-theme="dark"] .md-typeset__table > table tbody,
[data-theme="dark"] .md-typeset__table > table tr,
[data-theme="dark"] .md-typeset__table > table th,
[data-theme="dark"] .md-typeset__table > table td,
html.dark .md-typeset__table > table,
html.dark .md-typeset__table > table thead,
html.dark .md-typeset__table > table tbody,
html.dark .md-typeset__table > table tr,
html.dark .md-typeset__table > table th,
html.dark .md-typeset__table > table td {
  color: hsl(var(--foreground)) !important;
  border-color: hsl(var(--border)) !important;
}

[data-theme="dark"] .md-typeset__table > table thead th,
html.dark .md-typeset__table > table thead th {
  background: hsl(var(--muted)) !important;
}

[data-theme="dark"] .md-typeset__table > table tbody td,
html.dark .md-typeset__table > table tbody td {
  background: hsl(var(--card)) !important;
}

[data-theme="dark"] .md-typeset__table > table tbody tr:nth-child(even) td,
html.dark .md-typeset__table > table tbody tr:nth-child(even) td {
  background: hsl(var(--muted) / 0.35) !important;
}

/* Matches your exact structure: div[overflow-x:auto] > .md-typeset__scrollwrap > .md-typeset__table > table */
[data-theme="dark"] .hs-acc-body div[style*="overflow-x:auto"] > .md-typeset__scrollwrap > .md-typeset__table,
[data-theme="dark"] .hs-acc-body div[style*="overflow-x:auto"] > .md-typeset__scrollwrap > .md-typeset__table > table,
html.dark .hs-acc-body div[style*="overflow-x:auto"] > .md-typeset__scrollwrap > .md-typeset__table,
html.dark .hs-acc-body div[style*="overflow-x:auto"] > .md-typeset__scrollwrap > .md-typeset__table > table {
  background: hsl(var(--card)) !important;
}
