/* -----------------------------
   DARK MODE (slate)
   ----------------------------- */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: #1d1d1d;   /* background */
  --md-default-fg-color: #c2c2c2;   /* text */
  --md-primary-fg-color: #2d2c2c;   /* header/nav */
  --md-accent-fg-color: #e0e0e0;    /* subtle link color */
}

[data-md-color-scheme="slate"] .md-header {
  color: #fff !important;
}

/* -----------------------------
   LIGHT MODE (default)
   ----------------------------- */
[data-md-color-scheme="default"] {
  --md-default-bg-color: #ffffff;   /* background */
  --md-default-fg-color: #6d6d6d;   /* text */
  --md-primary-fg-color: #2d2c2c;   /* header/nav */
  --md-accent-fg-color: #121212;    /* links */
}

[data-md-color-scheme="default"] .md-header {
  color: #fff !important;
}

/* -----------------------------
   Links
   ----------------------------- */
a,
.md-typeset a {
  color: var(--md-accent-fg-color) !important;
  text-decoration: underline;
}
a:hover {
  opacity: 0.7;
}

/* -----------------------------
   Header + Footer
   ----------------------------- */
.md-header {
  background: var(--md-primary-fg-color) !important;
  color: var(--md-default-fg-color) !important;
}

.md-footer {
  background: var(--md-primary-fg-color) !important;
  color: var(--md-default-fg-color) !important;
}

/* Hide footer completely */
.md-footer {
  display: none !important;
}

/* Logo */
.md-logo img {
  height: 40px !important;  /* adjust to fit nicely */
  width: auto !important;
}

/* Content and TOC layout */
.md-grid {
  max-width: 90rem;
}

.md-main__inner {
  display: flex;
  margin-top: 1.5rem;
}

.md-sidebar--secondary {
  order: 2;
  margin-left: 0;
  margin-right: -20rem;
  padding: 1.5rem 0;
}

.md-content {
  max-width: 100%;
}

/* Ensure code blocks have good spacing and styling */
.highlight pre {
  padding: 1em;
  margin: 0.5em 0;
  overflow: auto;
}

/* Better readability for inline code */
code {
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

.md-sidebar--secondary {
  order: 2;
  margin-left: 2rem;      /* Add some left margin */
  margin-right: 0;        /* Remove negative right margin */
  padding: 1.5rem 0;
}

/* -----------------------------
   Code block UX (filename header, copy button)
   Works with Material for MkDocs when a code fence has a title, e.g.:
   ```python title="src/OpAgentsOlympus/tracing/processors.py" linenums="1"
   ``` 
   ----------------------------- */
.md-typeset .highlight {
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.md-typeset .highlight .highlight-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .8rem;
  line-height: 1.2;
  color: var(--md-default-fg-color);
  background: color-mix(in srgb, var(--md-primary-fg-color) 6%, transparent);
  border-bottom: 1px solid rgba(0,0,0,.06);
}

/* Tighten spacing so the header hugs the code block */
.md-typeset .highlight pre,
.md-typeset .highlight .codehilite {
  margin: 0;
  border-radius: 0;
}

/* Improve line number contrast */
.md-typeset .highlight .linenodiv,
.md-typeset .highlight .hljs-ln-numbers {
  opacity: .6;
}

/* Position the copy button inside the header area */
.md-typeset .highlight .md-clipboard {
  top: .4rem;
  right: .4rem;
}

/* Subtle background for code blocks in light/dark */
[data-md-color-scheme="default"] .md-typeset .highlight pre {
  background: #f7f7f9;
}
[data-md-color-scheme="slate"] .md-typeset .highlight pre {
  background: #2b2b2b;
}

/* Ensure the outer container and inline code match in dark mode */
[data-md-color-scheme="slate"] .md-typeset .highlight {
  background: #2b2b2b;
}
[data-md-color-scheme="slate"] .md-typeset code {
  background: #2b2b2b;
}

.md-typeset .highlight {
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.highlight span.filename {
  display: none;
}

.highlight pre {
  padding: 0;
}

a, .md-typeset a {
  text-decoration: none;
}

.md-typeset .note>.admonition-title, .md-typeset .note>summary {
  background-color: #ffce441a;
}

[data-md-color-scheme="slate"] .md-typeset .admonition.note, .md-typeset details.note {
  border-color: #ffd544;
}

.md-typeset .note>.admonition-title:before, .md-typeset .note>summary:before {
  background-color: #ffb844;
  -webkit-mask-image: var(--md-admonition-icon--note);
  mask-image: var(--md-admonition-icon--note);
}

.md-typeset .headerlink:focus, .md-typeset .headerlink:hover, .md-typeset :target>.headerlink {
  color: var(--md-accent-fg-color);
  display: none;
}

[data-md-color-scheme="default"] .md-top:focus, .md-top:hover {
  background-color: #383838 !important;
  color: white !important;
}

.md-source__repository {
  color: white;
}

.md-source__icon {
  color: white;
}

[dir=ltr] .md-typeset .headerlink {
    display: none;
}

[data-md-color-scheme="slate"] .highlighttable .linenos {
    background-color: hsl(0deg 0% 16.86%);
}

.md-typeset .note>.admonition-title:after, .md-typeset .note>summary:after {
    color: #ffc244;
}

[data-md-color-scheme="default"] .md-typeset .admonition.note, .md-typeset details.note {
    border-color: #f0c94354;
}

/* -----------------------------
   RESPONSIVE DESIGN
   ----------------------------- */

/* Large Desktop (1200px and up) */
@media (min-width: 1200px) {
  .md-grid {
    max-width: 90rem;
  }
}

/* Desktop/Laptop (992px to 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
  .md-grid {
    max-width: 75rem;
  }
  
  .md-content {
    margin-right: 0rem;
  }
  
  .md-sidebar--secondary {
    margin-left: 1.5rem;
  }

  .md-typeset {
    font-size: 0.7rem;
  }
  
  .md-typeset h1 {
    font-size: 1.6rem;
  }
  
  .md-typeset h2 {
    font-size: 1.3rem;
  }
}

/* Tablet (768px to 991px) */
@media (max-width: 991px) and (min-width: 768px) {
  .md-grid {
    max-width: 95%;
    margin: 0 auto;
  }
  
  .md-main__inner {
    flex-direction: column;
    margin-top: 1rem;
  }
  
  .md-content {
    max-width: 100%;
    margin-right: 0;
    order: 1;
  }
  
  .md-sidebar--secondary {
    order: 2;
    margin-left: 0;
    margin-right: 0;
    margin-top: 1rem;
    padding: 1rem 0;
    width: 100%;
  }
  
  .md-logo img {
    height: 36px !important;
  }
  
  .md-typeset {
    font-size: 0.7rem;
  }
  
  .md-typeset h1 {
    font-size: 1.5rem;
  }
  
  .md-typeset h2 {
    font-size: 1.2rem;
  }
  
  .md-typeset .highlight .highlight-title {
    font-size: .75rem;
    padding: .4rem .6rem;
  }
  
  .highlight pre {
    padding: 0.8em;
    font-size: 0.75rem;
  }
}

/* Mobile Large (481px to 767px) */
@media (max-width: 767px) and (min-width: 481px) {
  .md-grid {
    max-width: 95%;
    margin: 0 auto;
    padding: 0 1rem;
  }
  
  .md-main__inner {
    flex-direction: column;
    margin-top: 0.5rem;
  }
  
  .md-content {
    max-width: 100%;
    margin-right: 0;
    order: 1;
    padding: 0 0.5rem;
  }
  
  .md-sidebar--secondary {
    order: 2;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0.8rem;
    padding: 0.8rem 0;
    width: 100%;
  }
  
  .md-logo img {
    height: 32px !important;
  }
  
  .md-typeset {
    font-size: 0.7rem;
  }
  
  .md-typeset h1 {
    font-size: 1.4rem;
  }
  
  .md-typeset h2 {
    font-size: 1.1rem;
  }
  
  .md-typeset .highlight .highlight-title {
    font-size: .7rem;
    padding: .35rem .5rem;
    flex-wrap: wrap;
  }
  
  .highlight pre {
    padding: 0.6em;
    font-size: 0.75rem;
  }
  
  code {
    padding: 0.15em 0.3em;
    font-size: 0.75rem;
  }
  
  .md-typeset .highlight .md-clipboard {
    top: .3rem;
    right: .3rem;
  }

  .md-nav {
    font-size: 0.7rem;
  }
}

/* Mobile Small (480px and below) */
@media (max-width: 480px) {
  .md-grid {
    max-width: 100%;
    margin: 0;
    padding: 0 0.5rem;
  }
  
  .md-typeset .note>.admonition-title:before, .md-typeset .note>summary:before {
    display: none;
  }

  .md-main__inner {
    flex-direction: column;
    margin-top: 0.25rem;
  }
  
  .md-content {
    max-width: 100%;
    margin-right: 0;
    order: 1;
    padding: 0 0.25rem;
  }
  
  .md-sidebar--secondary {
    order: 2;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    width: 100%;
  }
  
  .md-logo img {
    height: 28px !important;
  }
  
  .md-typeset {
    font-size: 0.7rem;
  }
  
  .md-typeset h1 {
    font-size: 1.3rem;
  }
  
  .md-typeset h2 {
    font-size: 1.1rem;
  }
  
  .md-typeset .highlight {
    border-radius: 8px;
    margin: 0.25em 0;
  }
  
  .md-typeset .highlight .highlight-title {
    font-size: .65rem;
    padding: .3rem .4rem;
    flex-wrap: wrap;
    gap: .3rem;
  }
  
  .highlight pre {
    padding: 0.5em;
    font-size: 0.75rem;
    overflow-x: auto;
  }
  
  code {
    padding: 0.1em 0.25em;
    font-size: 0.75rem;
  }

  .md-nav {
    font-size: 0.7rem;
  }  .md-typeset .highlight .md-clipboard {
    top: .25rem;
    right: .25rem;
    transform: scale(0.9);
  }
  
  /* Better mobile scrolling for code blocks */
  .md-typeset .highlight pre {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Adjust admonition spacing for mobile */
  .md-typeset .admonition,
  .md-typeset details {
    margin: 0.8em 0;
  }
  
  .md-typeset .note>.admonition-title,
  .md-typeset .note>summary {
    padding: 0.4rem 0.6rem;
    font-size: 0.9em;
  }
}

/* Extra Small Mobile (320px and below) */
@media (max-width: 320px) {
  .md-grid {
    padding: 0 0.25rem;
  }
  
  .md-content {
    padding: 0;
  }
  
  .md-logo img {
    height: 24px !important;
  }
  
  .md-typeset .highlight .highlight-title {
    font-size: .6rem;
    padding: .25rem .35rem;
  }
  
  .highlight pre {
    padding: 0.4em;
    font-size: 0.8em;
  }
  
  code {
    font-size: 0.8em;
  }
  
  .md-typeset .highlight .md-clipboard {
    transform: scale(0.8);
  }
}