/* ==========================================================================
   XdTd Documentation — Custom Styles
   Light blue + orange, clean engineering aesthetic
   ========================================================================== */

/* ---------- Brand palette ---------- */
/*
   Blue:    #71C7EC (light),  #5ABBE5 (mid),  #3AA5D9 (dark)
   Orange:  #F37021 (primary), #E5621A (dark), #F89A5B (light)
   Neutrals: white / light grey backgrounds
*/

/* ---------- Root color overrides — Light mode ---------- */
:root {
  --md-primary-fg-color: #3AA5D9;
  --md-primary-fg-color--light: #71C7EC;
  --md-primary-fg-color--dark: #2B8BBF;
  --md-accent-fg-color: #F37021;
  --md-accent-fg-color--transparent: rgba(243, 112, 33, 0.12);

  /* Gulf orange for specific highlights */
  --xdtd-orange: #F37021;
  --xdtd-orange-light: #F89A5B;
  --xdtd-orange-dark: #E5621A;
  --xdtd-blue: #71C7EC;
  --xdtd-blue-mid: #5ABBE5;
  --xdtd-blue-dark: #3AA5D9;
}

/* ---------- Dark mode ---------- */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #5ABBE5;
  --md-primary-fg-color--light: #71C7EC;
  --md-primary-fg-color--dark: #3AA5D9;
  --md-accent-fg-color: #F89A5B;
  --md-accent-fg-color--transparent: rgba(248, 154, 91, 0.15);
}

/* ---------- Header & tabs — Gulf blue ---------- */
.md-header {
  background-color: var(--md-primary-fg-color--dark);
}

.md-tabs {
  background-color: var(--md-primary-fg-color);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ---------- Typography refinements ---------- */
.md-typeset {
  font-size: 0.82rem;
  line-height: 1.7;
}

.md-typeset h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
  border-bottom: 3px solid var(--xdtd-orange);
  padding-bottom: 0.3em;
  margin-bottom: 1em;
}

.md-typeset h2 {
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 1.8em;
  color: var(--md-primary-fg-color--dark);
}

.md-typeset h3 {
  font-weight: 600;
  color: var(--xdtd-orange-dark);
}

/* Links use orange accent */
.md-typeset a {
  color: var(--xdtd-orange);
}

.md-typeset a:hover {
  color: var(--xdtd-orange-dark);
}

/* Navigation links keep default behavior */
.md-nav a {
  color: inherit;
}

/* Active nav item uses orange */
.md-nav__item--active > .md-nav__link {
  color: var(--xdtd-orange);
  font-weight: 600;
}

/* ---------- Figure / screenshot styling ---------- */
.md-typeset figure {
  margin: 1.5em 0;
  text-align: center;
}

.md-typeset figure img {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  max-width: 100%;
  transition: box-shadow 0.2s ease;
}

.md-typeset figure img:hover {
  box-shadow: 0 4px 20px rgba(58, 165, 217, 0.2);
}

.md-typeset figcaption {
  font-size: 0.78rem;
  color: var(--md-default-fg-color--light);
  font-style: italic;
  margin-top: 0.5em;
}

/* Stand-alone images also get the treatment */
.md-typeset img:not(.emojione):not(.twemoji):not(.gemoji):not([src*="logo"]) {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 4px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

/* ---------- Screenshot gallery grid ---------- */
.screenshot-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2em;
  margin: 1.5em 0;
}

.screenshot-gallery figure {
  margin: 0;
}

/* ---------- Admonitions — Gulf-themed ---------- */
/* Custom "equation" admonition for formulas */
:root {
  --md-admonition-icon--equation: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.5 21 3 9h3l2.5 7L11 9h3l-4.5 12h-2Zm9-12h4.5L18 3h-3l2.5 6Z"/></svg>');
}

.md-typeset .admonition.equation,
.md-typeset details.equation {
  border-color: var(--xdtd-blue-dark);
}

.md-typeset .equation > .admonition-title,
.md-typeset .equation > summary {
  background-color: rgba(113, 199, 236, 0.15);
  border-color: var(--xdtd-blue-dark);
}

/* Tip admonitions use orange */
.md-typeset .admonition.tip,
.md-typeset details.tip {
  border-color: var(--xdtd-orange);
}

.md-typeset .tip > .admonition-title,
.md-typeset .tip > summary {
  background-color: var(--md-accent-fg-color--transparent);
  border-color: var(--xdtd-orange);
}

/* ---------- Tables — Gulf blue headers ---------- */
.md-typeset table:not([class]) {
  font-size: 0.78rem;
  border-collapse: collapse;
}

.md-typeset table:not([class]) th {
  background-color: var(--md-primary-fg-color--dark);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.md-typeset table:not([class]) tr:nth-child(even) {
  background-color: var(--md-code-bg-color);
}

/* ---------- Code blocks ---------- */
.md-typeset code {
  font-size: 0.82em;
}

.md-typeset pre > code {
  font-size: 0.78em;
}

/* Inline code with subtle orange tint */
.md-typeset code:not(pre code) {
  border: 1px solid var(--md-accent-fg-color--transparent);
}

/* ---------- Footer — Gulf dark blue ---------- */
.md-footer {
  font-size: 0.72rem;
}

/* ---------- Content width for image-heavy pages ---------- */
@media screen and (min-width: 76.25em) {
  .md-grid {
    max-width: 1440px;
  }
}

/* ---------- Hero section for landing page ---------- */
.hero {
  padding: 2em 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.2rem;
  border-bottom: none;
  margin-bottom: 0.3em;
  color: var(--md-primary-fg-color--dark);
}

.hero p {
  font-size: 1.1rem;
  color: var(--md-default-fg-color--light);
  max-width: 700px;
  margin: 0 auto 1.5em;
}

/* ---------- Feature cards — blue border, orange hover ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2em;
  margin: 2em 0;
}

.feature-card {
  padding: 1.5em;
  border: 1px solid var(--xdtd-blue);
  border-left: 4px solid var(--xdtd-orange);
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  border-color: var(--xdtd-orange);
  box-shadow: 0 2px 12px rgba(243, 112, 33, 0.12);
}

.feature-card h3 {
  margin-top: 0;
  font-size: 0.92rem;
  color: var(--xdtd-orange-dark);
  border-bottom: none;
}

.feature-card p {
  font-size: 0.8rem;
  margin-bottom: 0;
}

/* ---------- Responsive video embed ---------- */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  margin: 20px 0;
  border-radius: 6px;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 6px;
}

/* ---------- Buttons — orange CTA ---------- */
.md-typeset .md-button {
  border-color: var(--xdtd-orange);
  color: var(--xdtd-orange);
}

.md-typeset .md-button:hover {
  background-color: var(--xdtd-orange);
  color: white;
  border-color: var(--xdtd-orange);
}

.md-typeset .md-button--primary {
  background-color: var(--xdtd-orange);
  color: white;
  border-color: var(--xdtd-orange);
}

.md-typeset .md-button--primary:hover {
  background-color: var(--xdtd-orange-dark);
  border-color: var(--xdtd-orange-dark);
}

/* ---------- Search highlight uses orange ---------- */
.md-search-result mark {
  background-color: var(--md-accent-fg-color--transparent);
  color: var(--xdtd-orange-dark);
}

/* ---------- Scrollbar accent (Webkit) ---------- */
::-webkit-scrollbar-thumb {
  background-color: var(--xdtd-blue-mid);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--xdtd-orange);
}

/* ---------- Slide Carousel for Benchmarks ---------- */
.slide-carousel {
  position: relative;
  max-width: 960px;
  margin: 1.5em auto;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 8px;
  overflow: hidden;
  background: var(--md-code-bg-color);
}

/* Hide raw <img> tags before JS builds the carousel — prevents the
   flash of all images stacking vertically during page load. */
.slide-carousel > img,
.slide-carousel > a > img {
  display: none;
}

.carousel-wrapper {
  position: relative;
  width: 100%;
  display: flex;
}

.carousel-slide {
  display: none;
  text-align: center;
  padding: 1em 1em 0.5em;
  width: 100%;
}

.carousel-slide.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
}

/* Fixed-height image area so the carousel never changes size. */
.carousel-slide img {
  max-width: 100%;
  max-height: 560px;
  width: auto;
  height: auto;
  object-fit: contain;
  border: none !important;
  box-shadow: none !important;
  border-radius: 4px;
}

.carousel-caption {
  font-size: 0.78rem;
  color: var(--md-default-fg-color--light);
  font-style: italic;
  margin-top: 0.4em;
  padding-bottom: 0.2em;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2em;
  padding: 0.5em 0 0.8em;
}

.carousel-btn {
  background: var(--md-primary-fg-color--dark);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  line-height: 1;
}

.carousel-btn:hover {
  background: var(--xdtd-orange);
}

.carousel-counter {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--md-default-fg-color--light);
  min-width: 50px;
  text-align: center;
}

/* ---------- Download / Contact Form ---------- */
.xdtd-form {
  max-width: 520px;
  margin: 0 auto 30px;
}

.xdtd-form-field {
  margin-bottom: 14px;
}

.xdtd-form-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.xdtd-form-field .optional {
  font-weight: 400;
  color: var(--md-default-fg-color--light);
}

.xdtd-form-field input,
.xdtd-form-field select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 4px;
  font-size: 0.95em;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  transition: border-color 0.2s ease;
}

.xdtd-form-field input:focus,
.xdtd-form-field select:focus {
  border-color: var(--md-primary-fg-color);
  outline: none;
}

.xdtd-form-field input:disabled {
  background: var(--md-default-fg-color--lightest);
  color: var(--md-default-fg-color--light);
  cursor: not-allowed;
}

.xdtd-form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-weight: 400;
  font-size: 0.9em;
  color: var(--md-default-fg-color--light);
  cursor: pointer;
}

.xdtd-form-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
}

.xdtd-form-submit {
  text-align: center;
  margin-top: 20px;
}

.xdtd-form-submit button {
  background: var(--md-primary-fg-color--dark);
  color: white;
  border: none;
  padding: 12px 36px;
  border-radius: 4px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.xdtd-form-submit button:hover {
  background: var(--xdtd-orange);
}

/* ==========================================================================
   Edge trim — thin orange stripes always visible at viewport top and bottom
   ========================================================================== */

body::before,
body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  height: 4px;
  background-color: var(--xdtd-orange);
  z-index: 1000;
  pointer-events: none;
}

body::before { top: 0; }
body::after  { bottom: 0; }

/* ==========================================================================
   Homepage hero block
   ========================================================================== */

.md-typeset .xdtd-hero {
  margin: -1.5em 0 2.5em;
  padding: 3em 2em 2.5em;
  background-image: linear-gradient(180deg,
    var(--md-primary-fg-color) 0%,
    var(--md-primary-fg-color--dark) 100%);
  border-radius: 8px;
  border-bottom: 4px solid var(--xdtd-orange);
  text-align: center;
  color: white;
}

.md-typeset .xdtd-hero h1 {
  font-size: 4em;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: white;
  border: none;
  margin: 0;
  padding: 0;
}

.md-typeset .xdtd-hero-fullname {
  font-size: 0.95em;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  margin: 0.5em 0 1.6em;
}

.md-typeset .xdtd-hero-tagline {
  font-size: 1.4em;
  font-weight: 600;
  margin: 0 0 0.8em;
  color: white;
}

.md-typeset .xdtd-hero-motto {
  font-size: 1.05em;
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 1em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.md-typeset .xdtd-hero-motto::before,
.md-typeset .xdtd-hero-motto::after {
  content: "";
  display: inline-block;
  width: 36px;
  height: 2px;
  background-color: var(--xdtd-orange);
}

.md-typeset .xdtd-hero-meta {
  font-size: 0.82em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 1.8em;
}

.md-typeset .xdtd-hero-buttons {
  margin: 0;
}

.md-typeset .xdtd-hero .md-button {
  margin: 0 0.3em;
  background-color: transparent;
  border-color: white;
  color: white;
  font-weight: 600;
}

.md-typeset .xdtd-hero .md-button:hover {
  background-color: white;
  color: var(--md-primary-fg-color--dark);
  border-color: white;
}

.md-typeset .xdtd-hero .md-button--primary {
  background-color: var(--xdtd-orange);
  border-color: var(--xdtd-orange);
  color: white;
}

.md-typeset .xdtd-hero .md-button--primary:hover {
  background-color: var(--xdtd-orange-dark);
  border-color: var(--xdtd-orange-dark);
  color: white;
}