/* ============================================================
   Isomer Docs — Style Foundation
   Refined authority: Stripe precision + Isomer purple warmth
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fustat:wght@200..800&family=Inter:wght@100..900&display=swap');

/* --- Design Tokens --- */
:root {
  /* Brand palette */
  --blue: #000441;
  --blue-70: #4D507A;
  --blue-60: #66688D;
  --blue-50: #8082A0;
  --blue-40: #999BB3;
  --purple: #776DEB;
  --purple-light: #9188F5;
  --purple-60: #ADA7F3;
  --purple-45: #C2BDF6;
  --orange: #FFA574;
  --light-grey: #F8F6FF;

  /* Semantic tokens — light mode */
  --bg: #ffffff;
  --bg-subtle: #fafafe;
  --fg: #000441;
  --fg-muted: #5e617e;
  --fg-faint: #8082A0;
  --card-bg: #ffffff;
  --card-border: #e2e0f0;
  --card-hover-border: #776DEB;
  --sidebar-bg: #f8f6ff;
  --sidebar-border: #e2e0f0;
  --sidebar-active-bg: #ede9fe;
  --sidebar-active-fg: #000441;
  --nav-bg: #ffffff;
  --nav-border: #e8e6f2;
  --callout-bg: #f8f6ff;
  --callout-border: #776DEB;
  --callout-warn-bg: #fff9f5;
  --callout-warn-border: #FFA574;
  --code-bg: #f4f3fa;
  --code-fg: #4D507A;
  --link: #776DEB;
  --link-hover: #5a52be;
  --search-bg: #f4f3fa;
  --search-fg: #8082A0;
  --divider: #e8e6f2;
  --shadow-sm: 0 1px 2px rgba(0, 4, 65, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 4, 65, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 4, 65, 0.08);
}

.dark {
  --bg: #14141c;
  --bg-subtle: #1a1a24;
  --fg: #f8f6ff;
  --fg-muted: #8082a0;
  --fg-faint: #5e617e;
  --card-bg: #1e1e28;
  --card-border: rgba(119, 109, 235, 0.2);
  --card-hover-border: #776DEB;
  --sidebar-bg: #0a0a12;
  --sidebar-border: rgba(119, 109, 235, 0.12);
  --sidebar-active-bg: #1c1c25;
  --sidebar-active-fg: #f8f6ff;
  --nav-bg: #14141c;
  --nav-border: rgba(119, 109, 235, 0.15);
  --callout-bg: rgba(119, 109, 235, 0.06);
  --callout-border: #776DEB;
  --callout-warn-bg: rgba(255, 165, 116, 0.06);
  --callout-warn-border: #FFA574;
  --code-bg: #1e1e28;
  --code-fg: #C2BDF6;
  --link: #9188F5;
  --link-hover: #ADA7F3;
  --search-bg: rgba(255, 255, 255, 0.05);
  --search-fg: #5e617e;
  --divider: rgba(119, 109, 235, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  transition: background 0.25s ease, color 0.25s ease;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--link-hover);
}

/* --- Scrollbar --- */
body {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

body:hover {
  scrollbar-color: var(--fg-faint) transparent;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
*:hover::-webkit-scrollbar-thumb { background: var(--fg-faint); }

/* --- Top Nav --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo img {
  height: 32px;
  width: auto;
}

.nav-logo .logo-dark { display: none; }
.dark .nav-logo .logo-light { display: none; }
.dark .nav-logo .logo-dark { display: block; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 32px;
}

.nav-links a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-muted);
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-links a:hover {
  color: var(--fg);
  background: var(--search-bg);
}

.nav-links a.active {
  color: var(--purple);
  font-weight: 600;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- DocSearch Theme Overrides --- */
:root {
  --docsearch-primary-color: #776DEB;
  --docsearch-text-color: #000441;
  --docsearch-secondary-text-color: #5e617e;
  --docsearch-muted-color: #5e617e;
  --docsearch-subtle-color: #e2e0f0;
  --docsearch-container-background: rgba(0, 4, 65, 0.25);
  --docsearch-modal-background: #ffffff;
  --docsearch-modal-shadow: 0 8px 24px rgba(0, 4, 65, 0.08);
  --docsearch-searchbox-background: #f4f3fa;
  --docsearch-searchbox-focus-background: #ffffff;
  --docsearch-search-button-background: #f4f3fa;
  --docsearch-search-button-text-color: #5e617e;
  --docsearch-hit-background: #ffffff;
  --docsearch-hit-color: #000441;
  --docsearch-hit-active-color: #ffffff;
  --docsearch-highlight-color: #776DEB;
  --docsearch-logo-color: #8082A0;
  --docsearch-footer-background: #fafafe;
  --docsearch-background-color: #f4f3fa;
  --docsearch-icon-color: #5e617e;
  --docsearch-key-background: #f4f3fa;
  --docsearch-key-color: #5e617e;
  --docsearch-key-gradient: linear-gradient(-26.5deg, #e2e0f0, #f8f6ff);
  --docsearch-key-shadow: inset 0 -2px 0 0 #e2e0f0, inset 0 0 1px 1px #ffffff, 0 1px 2px 1px rgba(0, 4, 65, 0.08);
}

.dark {
  --docsearch-primary-color: #9188F5;
  --docsearch-text-color: #f8f6ff;
  --docsearch-secondary-text-color: #8082a0;
  --docsearch-muted-color: #8082a0;
  --docsearch-subtle-color: #2a2a36;
  --docsearch-container-background: rgba(0, 0, 0, 0.5);
  --docsearch-modal-background: #1e1e28;
  --docsearch-modal-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --docsearch-searchbox-background: #14141c;
  --docsearch-searchbox-focus-background: #14141c;
  --docsearch-search-button-background: rgba(255, 255, 255, 0.05);
  --docsearch-search-button-text-color: #8082a0;
  --docsearch-hit-background: #14141c;
  --docsearch-hit-color: #f8f6ff;
  --docsearch-hit-active-color: #ffffff;
  --docsearch-highlight-color: #9188F5;
  --docsearch-logo-color: #5e617e;
  --docsearch-footer-background: #14141c;
  --docsearch-background-color: rgba(255, 255, 255, 0.06);
  --docsearch-icon-color: #b6b7d5;
  --docsearch-key-background: rgba(255, 255, 255, 0.06);
  --docsearch-key-color: #b6b7d5;
  --docsearch-key-gradient: none;
  --docsearch-key-shadow: none;
}

.DocSearch-Button {
  border-radius: 8px !important;
  height: 36px !important;
  font-family: 'Inter', sans-serif !important;
}

.DocSearch-Modal {
  border-radius: 14px !important;
  font-family: 'Inter', sans-serif !important;
}

.DocSearch-Logo {
  display: none !important;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 1.125rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  background: var(--search-bg);
  color: var(--fg);
}

/* --- Layout Shell --- */
.layout {
  display: flex;
  padding-top: 56px;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  padding: 24px 16px 48px;
  font-family: 'Fustat', sans-serif;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.sidebar-group {
  margin-bottom: 8px;
}

.sidebar-group:first-child .sidebar-label {
  margin-top: 0;
}

.sidebar-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  padding: 0 12px;
  margin-top: 20px;
  margin-bottom: 4px;
}

.sidebar-link {
  display: block;
  font-size: 0.875rem;
  font-weight: 450;
  color: var(--fg-muted);
  padding: 6px 12px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: all 0.12s ease;
  text-decoration: none;
  margin: 1px 0;
}

.sidebar-link:hover {
  color: var(--fg);
  background: var(--sidebar-active-bg);
}

.sidebar-link.active {
  color: var(--sidebar-active-fg);
  font-weight: 600;
  background: var(--sidebar-active-bg);
  border-left-color: var(--purple);
}

/* --- Main Content --- */
.main {
  margin-left: 260px;
  flex: 1;
  min-width: 0;
}

.content {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 48px 80px;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 0.8125rem;
  color: var(--fg-faint);
  margin-bottom: 8px;
  font-weight: 500;
}

.breadcrumb a {
  color: var(--fg-faint);
}

.breadcrumb a:hover {
  color: var(--purple);
}

.breadcrumb .sep {
  margin: 0 6px;
  opacity: 0.4;
}

/* Page header */
.page-title {
  font-family: 'Fustat', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.page-desc {
  font-size: 1.0625rem;
  color: var(--fg-muted);
  line-height: 1.65;
  margin-bottom: 32px;
  max-width: 600px;
}

/* --- Content Typography --- */
.content h2 {
  font-family: 'Fustat', sans-serif;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--fg);
  margin-top: 48px;
  scroll-margin-top: 72px;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.content h3 {
  font-family: 'Fustat', sans-serif;
  font-size: 1.125rem;
  font-weight: 650;
  color: var(--fg);
  margin-top: 32px;
  scroll-margin-top: 72px;
  margin-bottom: 8px;
}

.content p {
  margin-bottom: 16px;
  color: var(--fg-muted);
  font-size: 0.9375rem;
  line-height: 1.75;
}

.content ul, .content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.content li {
  color: var(--fg-muted);
  font-size: 0.9375rem;
  line-height: 1.75;
  margin-bottom: 4px;
}

.content strong {
  color: var(--fg);
  font-weight: 600;
}

.content code {
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
  font-size: 0.8125rem;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 2px 6px;
  border-radius: 4px;
}

/* --- Callout --- */
.callout {
  border-left: 3px solid var(--callout-border);
  background: var(--callout-bg);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  margin-bottom: 24px;
}

.callout-title {
  font-size: 0.8125rem;
  font-weight: 650;
  color: var(--purple);
  margin-bottom: 4px;
  font-family: 'Fustat', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.callout p {
  margin-bottom: 0;
  font-size: 0.875rem;
}

.callout.warn {
  border-left-color: var(--callout-warn-border);
  background: var(--callout-warn-bg);
}

.callout.warn .callout-title {
  color: var(--orange);
}

/* --- Link Cards --- */
.link-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 24px;
  margin-bottom: 32px;
}

.link-card {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 20px;
  background: var(--card-bg);
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  display: block;
}

.link-card:hover {
  border-color: var(--card-hover-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.link-card-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.link-card-title {
  font-family: 'Fustat', sans-serif;
  font-size: 0.9375rem;
  font-weight: 650;
  color: var(--fg);
  margin-bottom: 4px;
}

.link-card-desc {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.link-card-arrow {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--purple);
  font-weight: 500;
  transition: transform 0.15s ease;
}

.link-card:hover .link-card-arrow {
  transform: translateX(3px);
}

/* --- Feature List --- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 24px 0 32px;
}

.feature-item {
  padding: 4px 0;
}

.feature-icon {
  font-size: 1.25rem;
  margin-bottom: 6px;
}

.feature-title {
  font-family: 'Fustat', sans-serif;
  font-size: 0.9375rem;
  font-weight: 650;
  color: var(--fg);
  margin-bottom: 4px;
}

.feature-desc {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* --- Steps --- */
.steps {
  margin: 24px 0 32px;
  counter-reset: step;
}

.step {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--divider);
}

.step:last-child {
  border-bottom: none;
}

.step-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--callout-bg);
  border: 1.5px solid var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fustat', sans-serif;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--purple);
}

.step-content h3 {
  margin-top: 2px;
  margin-bottom: 4px;
  font-size: 1rem;
}

.step-content p {
  margin-bottom: 0;
  font-size: 0.875rem;
}

/* --- Table --- */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 0.875rem;
}

.content th {
  text-align: left;
  font-family: 'Fustat', sans-serif;
  font-weight: 650;
  color: var(--fg);
  padding: 10px 12px;
  border-bottom: 2px solid var(--divider);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.content td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--divider);
  color: var(--fg-muted);
}

/* --- Divider --- */
.content hr {
  border: none;
  border-top: 1px solid var(--divider);
  margin: 40px 0;
}

/* --- Page Footer Nav --- */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--divider);
}

.page-nav a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.875rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.page-nav a:hover {
  color: var(--purple);
}

.page-nav .label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-faint);
}

.page-nav .title {
  font-family: 'Fustat', sans-serif;
  font-weight: 600;
  color: inherit;
}

.page-nav .next {
  text-align: right;
  margin-left: auto;
}

/* --- Mobile --- */
.mobile-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font-size: 1.25rem;
  border-radius: 8px;
  margin-right: 8px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 49;
}

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

  .DocSearch-Button-Keys {
    display: none !important;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 50;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .content {
    padding: 32px 20px 64px;
  }

  .link-cards {
    grid-template-columns: 1fr;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* Heading highlight on hash navigation */
@keyframes heading-flash {
  0% { background: var(--purple-45); }
  100% { background: transparent; }
}
.heading-highlight {
  animation: heading-flash 2s ease-out;
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: -6px;
}
