/* ═══════════════════════════════════════════════════════════
   EasyIK Documentation — "Blueprint" theme
   Palette drawn from the addon's own gizmo: cyan bones (#38bdf8),
   amber targets (#fbbf24), green joints (#34d399), on blue-slate.
   Structure/DOM shared with the DocShell engine; style is original.
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Cyan primary (bones / links / structure) */
  --primary:         #38bdf8;
  --primary-dark:    #0ea5e9;
  --primary-light:   #7dd3fc;
  --primary-xlight:  #bae6fd;
  --primary-glow:    rgba(56, 189, 248, 0.18);
  --primary-glow-lg: rgba(56, 189, 248, 0.32);

  /* Amber accent (targets / highlights) */
  --accent:          #fbbf24;
  --accent-dark:     #f59e0b;
  --accent-glow:     rgba(251, 191, 36, 0.16);

  /* Green (joints / success) */
  --joint:           #34d399;

  /* Blue-slate backgrounds */
  --bg:              #080b11;
  --surface:        #0c1119;
  --surface-2:      #10161f;
  --surface-3:      #151d29;
  --surface-4:      #1b2431;
  --surface-hover:  #1f2a3a;

  /* Borders */
  --border:          #182130;
  --border-light:    #22303f;
  --border-focus:    rgba(56, 189, 248, 0.55);

  /* Text hierarchy */
  --text:            #dce6f2;
  --text-soft:       #a9bacb;
  --text-muted:      #647688;
  --text-dim:        #3a4759;

  --code-bg:         #070a0f;
  --mark-bg:         rgba(251, 191, 36, 0.24);

  --green:           #34d399;
  --green-bg:        rgba(52, 211, 153, 0.10);
  --yellow:          #fbbf24;
  --yellow-bg:       rgba(251, 191, 36, 0.10);
  --red:             #fb7185;
  --red-bg:          rgba(251, 113, 133, 0.10);
  --blue:            #38bdf8;
  --blue-bg:         rgba(56, 189, 248, 0.10);

  --sidebar-w:       302px;
  --header-h:        64px;
  --radius:          8px;
  --radius-lg:       13px;
  --radius-xl:       18px;
  --transition:      0.18s ease;
  --font-mono:       'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --font-sans:       'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display:    'Space Grotesk', 'Inter', system-ui, sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Blueprint line grid — technical, "rigging" feel (distinct from a dot grid) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 35%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 35%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}

/* Twin glows — cyan top-left, amber top-right */
body::after {
  content: '';
  position: fixed;
  top: -180px; left: -140px; right: -140px;
  height: 620px;
  background:
    radial-gradient(520px 420px at 12% 0%, rgba(56, 189, 248, 0.10) 0%, transparent 60%),
    radial-gradient(460px 380px at 92% 4%, rgba(251, 191, 36, 0.055) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

::selection { background: rgba(56, 189, 248, 0.32); color: #fff; }

/* ── Scrollbars ─────────────────────────────────────────────── */
::-webkit-scrollbar          { width: 6px; height: 6px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: var(--border-light); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }
* { scrollbar-width: thin; scrollbar-color: var(--border-light) transparent; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }

/* ══════════════════════════════════════════════════════════════
   SITE HEADER
   ══════════════════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(8, 11, 17, 0.86);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--border);
}

/* Gradient hairline (cyan → amber) at header bottom */
.site-header::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary) 22%, var(--accent) 78%, transparent);
  opacity: 0.5;
}

.site-header__inner {
  max-width: 1720px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 0 24px;
  position: relative;
  z-index: 1;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
  user-select: none;
  transition: opacity var(--transition);
}
.site-logo:hover { opacity: 0.9; }

.site-logo__mark {
  height: 38px;
  width: 38px;
  filter: drop-shadow(0 0 9px rgba(56, 189, 248, 0.45));
  transition: filter var(--transition), transform var(--transition);
}
.site-logo:hover .site-logo__mark {
  filter: drop-shadow(0 0 13px rgba(56, 189, 248, 0.7)) drop-shadow(0 0 20px rgba(251, 191, 36, 0.28));
  transform: rotate(-4deg);
}

.site-logo__text { display: flex; flex-direction: column; line-height: 1.05; }

.site-logo__name {
  font-family: var(--font-display);
  font-size: 1.34rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #eaf6ff 0%, #7dd3fc 45%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-logo__sub {
  font-size: 0.64rem;
  color: var(--text-dim);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  -webkit-text-fill-color: var(--text-dim);
}

/* Header doc chrome (search + lang) */
.site-header__doc-chrome {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0 0 0 18px;
  justify-content: flex-start;
}
.site-header__doc-chrome .ds-lang-switcher {
  flex-shrink: 0; margin-left: auto; border-bottom: none; margin-bottom: 0; padding: 0; gap: 4px;
}
.site-header__doc-chrome .ds-lang-btn { padding: 6px 13px; min-width: 46px; }
.site-header__doc-chrome .ds-search-slot { flex: 1; min-width: 0; max-width: 100%; padding: 0; }

/* Mobile chrome */
.ds-mobile-chrome { display: none; }
.ds-mobile-chrome .ds-lang-switcher { padding: 0; margin: 0; border-bottom: none; gap: 8px; }
.ds-mobile-chrome .ds-lang-btn { flex: 1; padding: 10px 12px; min-height: 44px; }
.ds-mobile-chrome .ds-search-slot { padding: 0; }

/* GitHub button */
.site-github {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 10px;
  color: var(--text-soft);
  border: 1px solid var(--border-light);
  background: var(--surface-2);
  transition: all var(--transition);
}
.site-github:hover {
  color: #fff;
  border-color: var(--border-focus);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px; height: 42px;
  padding: 0 9px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  flex-shrink: 0;
}
.menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-soft);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.menu-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.menu-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--header-h);
  background: rgba(4, 6, 10, 0.68);
  z-index: 49;
  backdrop-filter: blur(3px);
}
.sidebar-overlay.active { display: block; }

/* ══════════════════════════════════════════════════════════════
   DOCSHELL ROOT LAYOUT
   ══════════════════════════════════════════════════════════════ */
.ds-root {
  display: flex;
  min-height: calc(100vh - var(--header-h));
  position: relative;
  z-index: 1;
}

/* ── Sidebar ── */
.ds-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 0 56px;
  flex-shrink: 0;
}
.ds-sidebar::after {
  content: '';
  position: sticky;
  bottom: 0; left: 0; right: 0;
  height: 44px;
  background: linear-gradient(to top, var(--bg), transparent);
  pointer-events: none;
  display: block;
  margin-top: -44px;
}

/* ── Language Switcher ── */
.ds-lang-switcher {
  display: flex;
  gap: 6px;
  padding: 0 16px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.ds-lang-btn {
  flex: 1;
  padding: 7px 0;
  border: 1px solid var(--border-light);
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all var(--transition);
}
.ds-lang-btn:hover { color: var(--text); border-color: var(--border-focus); background: var(--surface-3); }
.ds-lang-btn--active {
  color: #04121c;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  border-color: transparent;
  box-shadow: 0 4px 14px -4px var(--primary-glow-lg);
}

/* ── Search ── */
.ds-search-slot { padding: 0 16px 14px; }
.ds-search-wrapper { position: relative; }
.ds-search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  transition: all var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23647688' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
}
.ds-search-input::placeholder { color: var(--text-muted); }
.ds-search-input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--surface-3);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.ds-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  max-height: 62vh;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 44px -12px rgba(0, 0, 0, 0.7);
  z-index: 60;
  padding: 6px;
}
.ds-search-no-results { padding: 16px; text-align: center; color: var(--text-muted); font-size: 0.86rem; }
.ds-search-item {
  padding: 9px 11px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}
.ds-search-item:hover, .ds-search-item--focused { background: var(--surface-3); border-color: var(--border-light); }
.ds-search-item-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; flex-wrap: wrap; }
.ds-search-item-page { font-size: 0.72rem; font-weight: 700; color: var(--primary-light); font-family: var(--font-display); }
.ds-search-item-section { font-size: 0.7rem; color: var(--text-muted); }
.ds-search-item-section::before { content: '›'; margin-right: 6px; color: var(--text-dim); }
.ds-search-item-type {
  margin-left: auto;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 8px;
}
.ds-search-item-snippet { font-size: 0.8rem; color: var(--text-soft); line-height: 1.5; }
.ds-search-mark { background: var(--mark-bg); color: var(--accent); border-radius: 3px; padding: 0 2px; font-weight: 600; }

/* ── Nav ── */
.ds-nav { padding: 0 12px; }
.ds-nav-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.ds-nav-link {
  display: block;
  position: relative;
  padding: 9px 14px 9px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.ds-nav-link::before {
  content: '';
  position: absolute;
  left: 4px; top: 50%;
  width: 3px; height: 0;
  border-radius: 3px;
  background: linear-gradient(var(--primary), var(--accent));
  transform: translateY(-50%);
  transition: height var(--transition);
}
.ds-nav-link:hover { color: var(--text); background: var(--surface-2); }
.ds-nav-link--active {
  color: var(--primary-light);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.12), rgba(56, 189, 248, 0.02));
  font-weight: 600;
}
.ds-nav-link--active::before { height: 60%; }

/* ══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════════ */
.ds-main { flex: 1; min-width: 0; }
.ds-page-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 52px 48px 110px;
  animation: ds-fade 0.4s ease;
}
@keyframes ds-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Headings ── */
.ds-h1, .ds-h2, .ds-h3, .ds-h4, .ds-h5, .ds-h6 {
  font-family: var(--font-display);
  scroll-margin-top: calc(var(--header-h) + 20px);
  line-height: 1.25;
  font-weight: 700;
}
.ds-h1 {
  font-size: 2.35rem;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  background: linear-gradient(120deg, #f2f9ff 0%, #a9d9f5 60%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ds-page-inner > .ds-h1:first-child { margin-top: 0; }
/* accent underline under the page title */
.ds-page-inner > .ds-h1:first-child::after {
  content: '';
  display: block;
  width: 64px; height: 3px;
  margin-top: 18px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.ds-h2 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin: 52px 0 16px;
  padding-top: 14px;
  color: var(--text);
  border-top: 1px solid var(--border);
  position: relative;
}
.ds-h2::before {
  content: '';
  position: absolute;
  top: -1px; left: 0;
  width: 44px; height: 2px;
  background: var(--primary);
}
.ds-h3 { font-size: 1.18rem; margin: 34px 0 12px; color: var(--text); }
.ds-h3::before { content: '// '; color: var(--primary); font-weight: 600; opacity: 0.7; }
.ds-h4 { font-size: 1.02rem; margin: 26px 0 10px; color: var(--text-soft); }
.ds-h5, .ds-h6 { font-size: 0.92rem; margin: 20px 0 8px; color: var(--text-soft); }

/* ── Text ── */
.ds-p { margin: 0 0 16px; color: var(--text-soft); }
.ds-strong { color: var(--text); font-weight: 700; }
.ds-em { color: var(--primary-xlight); font-style: italic; }
.ds-del { color: var(--text-muted); }
.ds-a {
  color: var(--primary-light);
  text-decoration: none;
  border-bottom: 1px solid rgba(56, 189, 248, 0.32);
  transition: all var(--transition);
}
.ds-a:hover { color: #fff; border-bottom-color: var(--primary); }

/* ── Lists ── */
.ds-ul, .ds-ol { margin: 0 0 16px; padding-left: 22px; color: var(--text-soft); }
.ds-li { margin-bottom: 7px; }
.ds-li::marker { color: var(--primary); }
.ds-ul .ds-ul, .ds-ol .ds-ol, .ds-ul .ds-ol, .ds-ol .ds-ul { margin: 7px 0; }

/* ── Blockquote / callout ── */
.ds-blockquote {
  margin: 18px 0;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--primary);
  color: var(--text-soft);
}
.ds-blockquote .ds-p:last-child { margin-bottom: 0; }
.ds-blockquote .ds-strong { color: var(--primary-light); }

/* ── HR ── */
.ds-hr { border: none; height: 1px; background: var(--border); margin: 40px 0; }

/* ── Images ── */
.ds-img {
  max-width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  display: block;
  margin: 20px auto;
}

/* ── Tables ── */
.ds-table-wrapper {
  margin: 20px 0;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.ds-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ds-thead { background: var(--surface-3); }
.ds-th {
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--primary-light);
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}
.ds-td { padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--text-soft); vertical-align: top; }
.ds-tbody .ds-tr:last-child .ds-td { border-bottom: none; }
.ds-tbody .ds-tr:hover { background: rgba(56, 189, 248, 0.035); }
.ds-td .ds-code-inline, .ds-th .ds-code-inline { white-space: nowrap; }

/* ── Inline code ── */
.ds-code-inline {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-3);
  color: var(--primary-xlight);
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
}

/* ── Code blocks ── */
.ds-code-block-wrapper {
  margin: 20px 0;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.55);
}
.ds-code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.ds-code-lang {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ds-code-lang::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.ds-code-copy-btn {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.ds-code-copy-btn:hover { color: var(--text); border-color: var(--border-focus); background: var(--surface-4); }
.ds-code-copy-btn--copied { color: var(--joint); border-color: var(--joint); }
.ds-pre { margin: 0; padding: 16px 18px; overflow-x: auto; }
.ds-code-block {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.65;
  background: transparent !important;
  color: #c8d3e0;
  padding: 0 !important;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1080px) {
  .ds-page-inner { padding: 44px 40px 96px; }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }

  .site-header__doc-chrome:empty {
    display: none; flex: 0 0 0; min-width: 0; max-width: 0; margin: 0; padding: 0;
    overflow: hidden; pointer-events: none;
  }
  .site-header__doc-chrome:empty ~ .site-github { margin-left: auto; }

  .ds-root { position: relative; }

  .ds-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    height: calc(100vh - var(--header-h));
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 34px rgba(0, 0, 0, 0.62);
    padding-top: 10px;
  }
  .ds-root.sidebar-open .ds-sidebar { transform: translateX(0); }

  .ds-mobile-chrome:not(:empty) {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .ds-page-inner { padding: 32px 22px 80px; }
  .ds-h1 { font-size: 1.8rem; }
  .ds-h2 { font-size: 1.28rem; }
  .ds-h3 { font-size: 1.06rem; }
}

@media (max-width: 480px) {
  .ds-page-inner { padding: 24px 16px 64px; }
  .ds-h1 { font-size: 1.55rem; }
  .site-logo__sub { display: none; }
  .ds-code-block-wrapper, .ds-table-wrapper { border-radius: var(--radius); }
}
