/* AbeBooks Developer Documentation Styles */
:root {
  /* Verso accent (brand red), reserved for callouts */
  --abe-red: #c7002c;
  --abe-red-hover: #99001f;
  --abe-callout-bg: #ffe8e7;
  /* Verso primary (aqua), interactive/selected */
  --abe-primary: #005765;
  --abe-primary-hover: #00434e;
  /* Verso ink */
  --abe-dark: #02080e;
  --abe-text: #02080e;
  --abe-text-light: #575f67;
  /* Verso surfaces & borders */
  --abe-border: #ccd5de;
  --abe-border-subdued: #e9ebef;
  --abe-bg: #fff;
  --abe-sidebar-bg: #f7f6f8;
  --abe-code-bg: #f7f6f8;
  /* Interactive links map to Verso primary */
  --abe-link: var(--abe-primary);
  --abe-link-hover: var(--abe-primary-hover);
  --font-body: 'Amazon Ember', 'Amazon Ember Arabic', Arial, sans-serif;
  --font-mono: 'Amazon Ember Monospace', ui-monospace, Menlo, monospace;
  --sidebar-width: 280px;
  --content-max-width: 900px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--abe-text);
  line-height: 1.5;
}

/* Layout */
.docs-container {
  display: flex;
  min-height: calc(100vh - 200px);
  max-width: 1400px;
  margin: 0 auto;
  border-bottom: 1px solid var(--abe-border);
}

/* Override HFS wrapper styles that break position:sticky */
#wrapper, #abe-content, .abe-content {
  overflow: visible !important;
}

/* Sidebar */
.docs-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--abe-sidebar-bg);
  border-right: 1px solid var(--abe-border);
}

.docs-sidebar-inner {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: 24px 16px;
}

.sidebar-home {
  display: block;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--abe-border);
}

a.sidebar-home:link,
a.sidebar-home:visited {
  color: var(--abe-dark);
}

a.sidebar-home:hover { color: var(--abe-primary); }

.nav-section { margin-bottom: 20px; }

.nav-heading {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--abe-text-light);
  margin-bottom: 8px;
}

.nav-section ul {
  list-style: none;
  padding: 0;
}

.nav-link {
  display: block;
  padding: 4px 12px;
  font-size: 14px;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

/* Override the AbeBooks global a:link/:visited/:hover colors on nav links. */
a.nav-link:link,
a.nav-link:visited {
  color: var(--abe-text);
}

a.nav-link:hover {
  background: var(--abe-border-subdued);
  color: var(--abe-dark);
  text-decoration: none;
}

a.nav-link.active:link,
a.nav-link.active:visited {
  background: var(--abe-primary);
  color: #fff;
  font-weight: 500;
}

/* Main content */
.docs-content {
  flex: 1;
  min-width: 0;
  max-width: var(--content-max-width);
  padding: 8px 24px;
  overflow-wrap: break-word;
}

.docs-content h1 {
  font-size: 2rem;
  color: var(--abe-dark);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--abe-border);
}

.docs-content h2 {
  font-size: 1.5rem;
  color: var(--abe-dark);
  margin: 32px 0 12px;
}

.docs-content h3 {
  font-size: 1.2rem;
  color: var(--abe-dark);
  margin: 24px 0 8px;
}

.docs-content p { margin: 12px 0; }

.docs-content a,
.docs-content a:visited {
  color: var(--abe-link);
  text-decoration: underline;
}

.docs-content a:hover {
  color: var(--abe-link-hover);
  text-decoration: underline;
}

/* Heading links don't need underline - they're clearly clickable */
.docs-content h1 a,
.docs-content h2 a,
.docs-content h3 a,
.docs-content h4 a {
  text-decoration: none;
}

.docs-content ul, .docs-content ol {
  margin: 12px 0;
  padding-left: 24px;
}

.docs-content li { margin: 4px 0; }

/* Change Log panel */
.docs-content #change-log + ul {
  background: var(--abe-sidebar-bg);
  border: 1px solid var(--abe-border);
  border-radius: 6px;
  padding: 16px 16px 16px 36px;
  margin: 12px 0 24px;
}

/* Code */
.docs-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--abe-code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--abe-border);
  overflow-wrap: anywhere;
}

.docs-content pre {
  background: var(--abe-code-bg);
  border: 1px solid var(--abe-border);
  border-radius: 4px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0;
  line-height: 1.5;
}

/* Shiki highlighted blocks provide their own background */
.docs-content pre.shiki {
  background: var(--abe-code-bg) !important;
}

.docs-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85em;
}

/* Copy button */
.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 4px;
  line-height: 0;
  font-family: inherit;
  background: var(--abe-sidebar-bg);
  border: 1px solid var(--abe-border);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

pre:hover .copy-btn { opacity: 1; }

.copy-btn:hover { background: var(--abe-border); }

/* Tables */
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.9em;
}

.docs-content th {
  background: var(--abe-sidebar-bg);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--abe-border);
  white-space: nowrap;
}

.docs-content td {
  padding: 10px 12px;
  border: 1px solid var(--abe-border);
}

.docs-content tr:hover td { background: var(--abe-sidebar-bg); }

/* Blockquotes (used for notes/warnings) */
.docs-content blockquote {
  border-left: 4px solid var(--abe-red);
  background: var(--abe-callout-bg);
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 4px 4px 0;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  width: 100%;
  padding: 12px 16px;
  background: var(--abe-sidebar-bg);
  border: 1px solid var(--abe-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--abe-dark);
  cursor: pointer;
  text-align: left;
}

.sidebar-toggle::after {
  /* U+25BE BLACK DOWN-POINTING SMALL TRIANGLE, escaped due to Latin-1 encoding forced by Apache */
  content: '\25BE';
  float: right;
}

.sidebar-toggle[aria-expanded="true"]::after {
  /* U+25B4 BLACK UP-POINTING SMALL TRIANGLE */
  content: '\25B4';
}

/* Responsive */
@media (max-width: 768px) {
  .docs-container { flex-direction: column; }

  .sidebar-toggle {
    display: block;
    margin: 12px 16px;
    width: calc(100% - 32px);
  }

  .docs-sidebar {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--abe-border);
    display: none;
  }

  .docs-sidebar.expanded {
    display: block;
  }

  .docs-sidebar-inner {
    position: static;
    max-height: none;
    overflow-y: visible;
  }

  .docs-content { padding: 8px 16px; }

  /* Let wide tables scroll horizontally instead of overflowing the viewport. */
  .docs-content table {
    display: block;
    overflow-x: auto;
  }
}
