/* Starlight custom styles - ReadAny Support Center */

/* ── Global Theme Application ─────────────────────────────────────────── */
html,
body {
  background-color: var(--sl-color-bg) !important;
  color: var(--sl-color-text) !important;
}

body {
  font-family: var(--sl-font);
}

main {
  background-color: var(--sl-color-bg) !important;
}

article {
  background-color: var(--sl-color-bg) !important;
  color: var(--sl-color-text) !important;
}

/* ── Base Theme Variables ─────────────────────────────────────────── */
:root {
  --sl-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;

  --sl-color-white: #3d2b1f;
  --sl-color-gray-1: #4a3728;
  --sl-color-gray-2: #5c4a3a;
  --sl-color-gray-3: #78716c;
  --sl-color-gray-4: #a8a29e;
  --sl-color-gray-5: #d6d3d1;
  --sl-color-gray-6: #e6d9c3;
  --sl-color-black: #f0e6d2;

  --sl-color-accent-low: oklch(0.35 0.08 60);
  --sl-color-accent: oklch(0.45 0.12 60);
  --sl-color-accent-high: oklch(0.75 0.08 60);

  --sl-color-bg: #f0e6d2;
  --sl-color-bg-sidebar: #f5ebd7;
  --sl-color-bg-nav: #f5ebd7;
  --sl-color-bg-inline-code: #e6d9c3;

  --sl-color-text: #3d2b1f;
  --sl-color-text-accent: #6b4c2a;
  --sl-color-heading: #3d2b1f;
  --sl-color-heading-accent: #6b4c2a;

  --sl-color-border: #d4c4a8;
  --sl-color-border-accent: #6b4c2a;

  --sl-shadow-sm: 0 1px 2px rgba(61, 43, 31, 0.05);
  --sl-shadow-md: 0 4px 6px rgba(61, 43, 31, 0.07), 0 2px 4px rgba(61, 43, 31, 0.05);
  --sl-shadow-lg: 0 10px 15px rgba(61, 43, 31, 0.1), 0 4px 6px rgba(61, 43, 31, 0.05);

  --sl-radius-sm: 0.375rem;
  --sl-radius-md: 0.5rem;
  --sl-radius-lg: 0.75rem;
  --sl-radius-xl: 1rem;
}

/* ── Light Theme ─────────────────────────────────────────── */
[data-theme="light"] {
  --sl-color-white: #0f172a;
  --sl-color-gray-1: #1e293b;
  --sl-color-gray-2: #334155;
  --sl-color-gray-3: #475569;
  --sl-color-gray-4: #64748b;
  --sl-color-gray-5: #94a3b8;
  --sl-color-gray-6: #cbd5e1;
  --sl-color-black: #ffffff;

  --sl-color-accent-low: oklch(0.3 0.01 285.93);
  --sl-color-accent: oklch(0.21 0.01 285.93);
  --sl-color-accent-high: oklch(0.5 0.01 285.93);

  --sl-color-bg: #ffffff;
  --sl-color-bg-sidebar: #f8fafc;
  --sl-color-bg-nav: #f8fafc;
  --sl-color-bg-inline-code: #f1f5f9;

  --sl-color-text: #0f172a;
  --sl-color-text-accent: oklch(0.21 0.01 285.93);
  --sl-color-heading: #0f172a;
  --sl-color-heading-accent: oklch(0.21 0.01 285.93);

  --sl-color-border: #e2e8f0;
  --sl-color-border-accent: oklch(0.21 0.01 285.93);

  --sl-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --sl-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05);
  --sl-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* ── Dark Theme ─────────────────────────────────────────── */
[data-theme="dark"] {
  --sl-color-white: #e8e8ed;
  --sl-color-gray-1: #d4d4d8;
  --sl-color-gray-2: #a1a1aa;
  --sl-color-gray-3: #71717a;
  --sl-color-gray-4: #52525b;
  --sl-color-gray-5: #3f3f46;
  --sl-color-gray-6: #27272a;
  --sl-color-black: #0f0f11;

  --sl-color-accent-low: #7c7c82;
  --sl-color-accent: #e0e0e6;
  --sl-color-accent-high: #ffffff;

  --sl-color-bg: #0f0f11;
  --sl-color-bg-sidebar: #18181b;
  --sl-color-bg-nav: #18181b;
  --sl-color-bg-inline-code: #27272a;

  --sl-color-text: #e8e8ed;
  --sl-color-text-accent: #e0e0e6;
  --sl-color-heading: #e8e8ed;
  --sl-color-heading-accent: #e0e0e6;

  --sl-color-border: #3d3d40;
  --sl-color-border-accent: #e0e0e6;

  --sl-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --sl-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
  --sl-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5), 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* ── Additional Global Styles ─────────────────────────────────────────── */
.page {
  background-color: var(--sl-color-bg) !important;
}

.content-panel {
  background-color: var(--sl-color-bg) !important;
}

.sl-flex {
  background-color: var(--sl-color-bg) !important;
}

/* ── Layout Enhancements ─────────────────────────────────────────── */

/* Remove PageFrame's default padding/height on the header wrapper —
   let the inner .sl-header control its own dimensions.
   overflow: visible lets dropdowns (theme, language) extend below the header. */
.page > .header {
  padding: 0;
  height: auto;
  overflow: visible;
}
.sl-container {
  max-width: 80rem;
  margin: 0 auto;
}

.main-pane {
  max-width: 100%;
}

/* ── Sidebar Styling ─────────────────────────────────────────── */
.sidebar {
  border-right: 1px solid var(--sl-color-border);
  background: var(--sl-color-bg-sidebar);
}

.sidebar-content {
  padding: 1.5rem 1rem;
}

.sidebar-nav-group {
  margin-bottom: 1.5rem;
}

.sidebar-nav-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sl-color-gray-3);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
}

.sidebar-nav-item {
  margin: 0.125rem 0;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: var(--sl-radius-md);
  color: var(--sl-color-text);
  font-size: 0.875rem;
  line-height: 1.4;
  transition: background-color 0.15s, color 0.15s;
}

.sidebar-nav-link:hover {
  background: var(--sl-color-bg-inline-code);
  color: var(--sl-color-text-accent);
}

.sidebar-nav-link[aria-current="page"] {
  background: var(--sl-color-accent);
  color: var(--sl-color-bg);
  font-weight: 500;
}

.sidebar a[aria-current="page"] {
  background: var(--sl-color-accent) !important;
  color: var(--sl-color-bg) !important;
  font-weight: 500 !important;
  border-radius: var(--sl-radius-md) !important;
}

.sidebar a[aria-current="page"] span {
  color: var(--sl-color-bg) !important;
}

/* ── Right Sidebar (Table of Contents) ─────────────────────────────────────────── */
.right-sidebar {
  border-left: 1px solid var(--sl-color-border);
  background: var(--sl-color-bg-sidebar);
  display: block !important;
  visibility: visible !important;
}

.right-sidebar-panel {
  padding: 1.5rem;
  position: sticky;
  top: 3.5rem;
}

.right-sidebar-panel .sl-container {
  margin: 0;
  max-width: 100%;
}

.right-sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sl-color-gray-3);
  margin-bottom: 0.75rem;
}

.right-sidebar-panel ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.right-sidebar-panel li {
  margin: 0.375rem 0;
}

.right-sidebar-panel a {
  display: block;
  padding: 0.25rem 0;
  color: var(--sl-color-gray-2);
  font-size: 0.8125rem;
  line-height: 1.5;
  text-decoration: none;
  transition: color 0.15s;
}

.right-sidebar-panel a:hover {
  color: var(--sl-color-text-accent);
}

.right-sidebar-panel a[aria-current="true"] {
  color: var(--sl-color-text-accent);
  font-weight: 500;
}

/* ── Main Content Styling ─────────────────────────────────────────── */
.sl-markdown-content {
  max-width: 100%;
  line-height: 1.7;
}

.sl-markdown-content > *:first-child {
  margin-top: 0;
}

.sl-markdown-content h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
  color: var(--sl-color-heading);
}

.sl-markdown-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--sl-color-border);
  color: var(--sl-color-heading);
}

.sl-markdown-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--sl-color-heading);
}

.sl-markdown-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--sl-color-heading);
}

.sl-markdown-content h1 a,
.sl-markdown-content h2 a,
.sl-markdown-content h3 a,
.sl-markdown-content h4 a {
  display: none;
}

.sl-markdown-content h1:hover a,
.sl-markdown-content h2:hover a,
.sl-markdown-content h3:hover a,
.sl-markdown-content h4:hover a {
  display: inline-block;
  margin-left: 0.5rem;
  opacity: 0.5;
  color: var(--sl-color-text-accent);
  border-bottom: none;
}

.sl-markdown-content h1:hover a:hover,
.sl-markdown-content h2:hover a:hover,
.sl-markdown-content h3:hover a:hover,
.sl-markdown-content h4:hover a:hover {
  opacity: 1;
}

.sl-markdown-content h1 a svg,
.sl-markdown-content h2 a svg,
.sl-markdown-content h3 a svg,
.sl-markdown-content h4 a svg {
  display: none;
}

/* Hide anchor link icons */
.sl-anchor-link {
  display: none !important;
}

.sl-markdown-content p {
  margin: 1rem 0;
  color: var(--sl-color-text);
}

.sl-markdown-content a {
  color: var(--sl-color-text-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.sl-markdown-content a:hover {
  border-bottom-color: var(--sl-color-text-accent);
}

.sl-markdown-content ul,
.sl-markdown-content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.sl-markdown-content li {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.sl-markdown-content li::marker {
  color: var(--sl-color-text-accent);
}

/* ── Code Blocks ─────────────────────────────────────────── */
.sl-markdown-content code {
  background: var(--sl-color-bg-inline-code);
  border-radius: var(--sl-radius-sm);
  padding: 0.125rem 0.375rem;
  font-size: 0.875em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.sl-markdown-content pre {
  background: var(--sl-color-bg-sidebar);
  border: 1px solid var(--sl-color-border);
  border-radius: var(--sl-radius-lg);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.sl-markdown-content pre code {
  background: transparent;
  padding: 0;
}

/* ── Blockquotes ─────────────────────────────────────────── */
.sl-markdown-content blockquote {
  border-left: 4px solid var(--sl-color-border-accent);
  background: var(--sl-color-bg-sidebar);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--sl-radius-md) var(--sl-radius-md) 0;
}

.sl-markdown-content blockquote p {
  margin: 0;
}

/* ── Tables ─────────────────────────────────────────── */
.sl-markdown-content table {
  width: auto;
  min-width: 50%;
  max-width: 100%;
  border-collapse: collapse;
  border-radius: var(--sl-radius-lg);
  overflow: hidden;
  border: 1px solid var(--sl-color-border);
  margin: 1.5rem 0;
  display: table;
}

.sl-markdown-content th {
  background: var(--sl-color-bg-sidebar);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--sl-color-border);
}

.sl-markdown-content td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--sl-color-border);
}

.sl-markdown-content tr:last-child td {
  border-bottom: none;
}

/* ── Card Components ─────────────────────────────────────────── */
.sl-markdown-content .card {
  border-radius: var(--sl-radius-lg);
  border: 1px solid var(--sl-color-border);
  background: var(--sl-color-bg-sidebar);
  padding: 1.5rem;
  transition: all 0.2s ease;
}

.sl-markdown-content .card:hover {
  border-color: var(--sl-color-border-accent);
  box-shadow: var(--sl-shadow-md);
  transform: translateY(-2px);
}

.sl-markdown-content .card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.sl-markdown-content .card a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-weight: 500;
}

/* ── Hero Section ─────────────────────────────────────────── */
.sl-markdown-content > h1:first-of-type {
  text-align: center;
  margin-bottom: 0.5rem;
}

/* ── Footer ─────────────────────────────────────────── */
.sl-footer {
  border-top: 1px solid var(--sl-color-border);
  background: var(--sl-color-bg-sidebar);
  padding: 1.5rem;
  margin-top: 3rem;
}

.sl-footer-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 80rem;
  margin: 0 auto;
}

/* ── Pagination ─────────────────────────────────────────── */
.sl-pagination {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.sl-pagination-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--sl-color-border);
  border-radius: var(--sl-radius-md);
  color: var(--sl-color-text);
  font-size: 0.875rem;
  transition: all 0.15s;
}

.sl-pagination-link:hover {
  border-color: var(--sl-color-border-accent);
  background: var(--sl-color-bg-sidebar);
}

/* ── Search (Pagefind) Modal Styling ─────────────────────────────────────────── */
.pagefind-ui {
  --pagefind-ui-primary: var(--sl-color-accent);
  --pagefind-ui-text: var(--sl-color-text);
  --pagefind-ui-background: var(--background);
  --pagefind-ui-border: var(--sl-color-border);
  --pagefind-ui-font: var(--sl-font);
}

.pagefind-ui__modal-content {
  border-radius: 20px !important;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 20px 50px -10px rgba(0, 0, 0, 0.3) !important;
  border: 1px solid var(--sl-color-border) !important;
  background-color: var(--background) !important;
  backdrop-filter: blur(10px) !important;
  overflow: hidden !important;
  padding: 0 !important;
  max-width: 640px !important;
  margin-top: 10vh !important;
}

.pagefind-ui__search-input {
  background-color: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--sl-color-border) !important;
  border-radius: 0 !important;
  padding: 1.75rem 1.5rem 1.75rem 3.5rem !important;
  font-size: 1.25rem !important;
  font-weight: 500 !important;
  color: var(--foreground) !important;
}

.pagefind-ui__search-input:focus {
  outline: none !important;
  background-color: color-mix(in srgb, var(--primary) 3%, transparent) !important;
}

.pagefind-ui__results-area {
  padding: 0.5rem !important;
  max-height: 50vh !important;
}

.pagefind-ui__result {
  border: none !important;
  padding: 1rem 1.5rem !important;
  border-radius: 12px !important;
  transition: all 0.2s ease !important;
  margin: 0.25rem 0.5rem !important;
}

.pagefind-ui__result:hover,
.pagefind-ui__result:focus-within {
  background-color: var(--muted) !important;
  transform: translateX(4px);
}

.pagefind-ui__result-link {
  color: var(--foreground) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
}

.pagefind-ui__result-excerpt {
  color: var(--muted-foreground) !important;
  font-size: 0.875rem !important;
  margin-top: 0.4rem !important;
  line-height: 1.5 !important;
}

.pagefind-ui__result-excerpt mark {
  background-color: var(--primary) !important;
  color: var(--primary-foreground) !important;
  border-radius: 4px !important;
  padding: 0 4px !important;
  font-weight: 500 !important;
}

/* ── Layout Overrides ─────────────────────────────────────────── */
/* Reduce right sidebar to same width as left sidebar */
@media (min-width: 72rem) {
  .main-pane {
    max-width: 100%;
  }

  .right-sidebar-container {
    width: var(--sl-sidebar-width) !important;
  }

  [data-has-sidebar][data-has-toc] .main-pane {
    width: calc(100% - var(--sl-sidebar-width)) !important;
  }
}

/* ── Mobile Responsive ─────────────────────────────────────────── */

@media (max-width: 50rem) {
  .sl-markdown-content h1 {
    font-size: 1.75rem;
  }

  .sl-markdown-content h2 {
    font-size: 1.25rem;
  }

  .sl-markdown-content .card-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Pagination (Prev/Next) ─────────────────────────────────────────── */
.pagination-links {
  gap: 0.75rem !important;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--sl-color-border);
}

.pagination-links a {
  border: 1px solid var(--sl-color-border) !important;
  border-radius: 0.5rem !important;
  padding: 0.75rem 1rem !important;
  box-shadow: none !important;
  font-size: var(--sl-text-sm) !important;
  color: var(--sl-color-gray-2) !important;
  transition: border-color 0.15s, color 0.15s;
}

.pagination-links a:hover {
  border-color: var(--sl-color-text-accent) !important;
  color: var(--sl-color-text-accent) !important;
}

.pagination-links .link-title {
  font-size: var(--sl-text-sm) !important;
  font-weight: 500;
  color: var(--sl-color-text) !important;
}

.pagination-links a:hover .link-title {
  color: var(--sl-color-text-accent) !important;
}

.pagination-links svg {
  width: 1rem !important;
  height: 1rem !important;
}

/* ── Print Styles ─────────────────────────────────────────── */
@media print {
  .sidebar,
  .right-sidebar,
  .sl-header,
  .sl-footer {
    display: none;
  }

  .main-pane {
    max-width: 100%;
  }
}

/* ── Scrollbar Styles ─────────────────────────────────────────── */
/* Light theme scrollbar */
[data-theme="light"] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

[data-theme="light"] ::-webkit-scrollbar-track {
  background: #f1f5f9;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 5px;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Dark theme scrollbar */
[data-theme="dark"] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #27272a;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #52525b;
  border-radius: 5px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #71717a;
}

/* Sepia theme scrollbar */
[data-theme="sepia"] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

[data-theme="sepia"] ::-webkit-scrollbar-track {
  background: #e6d9c3;
}

[data-theme="sepia"] ::-webkit-scrollbar-thumb {
  background: #c4b5a0;
  border-radius: 5px;
}

[data-theme="sepia"] ::-webkit-scrollbar-thumb:hover {
  background: #a89a82;
}
