/* ============================================
   RestForge Documentation Styles
   Shared across all /docs/ pages
   ============================================ */

/* Self-hosted Inter font (eliminates render-blocking Google Fonts) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: optional;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
}

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

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --secondary: #3B82F6;
  --bg: #F8FAFC;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --surface: #FFFFFF;
  --surface-hover: #F1F5F9;
  --code-bg: #F1F5F9;
  --code-border: #E2E8F0;
  --callout-tip-bg: #F0FDF4;
  --callout-tip-border: #BBF7D0;
  --callout-warn-bg: #FFFBEB;
  --callout-warn-border: #FDE68A;
  --sidebar-width: 240px;
  --nav-height: 57px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-top: var(--nav-height);
}

/* ============================================
   Navigation (shared nav partial)
   ============================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 200ms;
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-cta {
  background: var(--primary);
  color: #fff !important;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: background 200ms;
}

.nav-cta:hover {
  background: var(--primary-dark);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle svg {
  width: 24px;
  height: 24px;
  color: var(--text);
}

/* ============================================
   Footer (shared footer partial — 4-col grid)
   ============================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 24px 32px;
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 10px;
}

.footer-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 280px;
}

.footer-col-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: 12px;
}

.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 0;
  transition: color 200ms;
}

.footer-col a:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
}

.footer-social {
  display: flex;
  gap: 16px;
}

.footer-social a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 200ms;
}

.footer-social a:hover {
  color: var(--primary);
}

.footer-social svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   Hub Page (index.html only)
   ============================================ */
.docs-hub-page {
  padding-top: 0;
}

.hero {
  padding: 120px 24px 40px;
  text-align: center;
  background: linear-gradient(180deg, #EFF6FF 0%, var(--bg) 100%);
}

.hero h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.hero h1 span {
  color: var(--primary);
}

.hero p {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
}

.docs-hub {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.docs-nav-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.docs-nav-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 200ms, box-shadow 200ms;
  cursor: pointer;
}

.docs-nav-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.docs-nav-card .card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #EFF6FF;
  border-radius: 10px;
  margin-bottom: 14px;
}

.docs-nav-card .card-icon svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.docs-nav-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.docs-nav-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============================================
   Docs Layout (guide pages)
   ============================================ */
.docs-layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 64px;
  display: flex;
  gap: 40px;
}

/* Sidebar */
.docs-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--nav-height) + 24px);
  align-self: flex-start;
  max-height: calc(100vh - var(--nav-height) - 48px);
  overflow-y: auto;
}

.docs-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-sidebar a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  transition: all 200ms;
}

.docs-sidebar a:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.docs-sidebar a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: #EFF6FF;
  font-weight: 500;
}

.docs-sidebar .toc-group {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  padding: 12px 12px 4px;
  margin-top: 8px;
}

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

/* Content */
.docs-content {
  flex: 1;
  min-width: 0;
}

.docs-content h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.docs-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 48px 0 16px;
  padding-top: 24px;
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--nav-height) + 24px);
}

.docs-content h2:first-child {
  margin-top: 0;
}

.docs-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 32px 0 12px;
  scroll-margin-top: calc(var(--nav-height) + 24px);
}

.docs-content p {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.7;
}

.docs-content ul,
.docs-content ol {
  margin: 0 0 16px 24px;
  color: var(--text-muted);
  font-size: 15px;
}

.docs-content li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.docs-content a {
  color: var(--primary);
  text-decoration: none;
}

.docs-content a:hover {
  text-decoration: underline;
}

/* ============================================
   Docs Components
   ============================================ */

/* Breadcrumb */
.docs-breadcrumb {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.docs-breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.docs-breadcrumb span {
  margin: 0 6px;
  color: var(--border);
}

/* Step indicators */
.docs-step {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.docs-step-number {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.docs-step-content {
  flex: 1;
}

.docs-step-content h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.docs-step-content p {
  margin-bottom: 8px;
}

/* Inline code */
.docs-code {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 13px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Code blocks */
.docs-codeblock {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 12px 0 20px;
  overflow-x: auto;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
}

.docs-codeblock .label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* Callouts */
.docs-callout {
  border-radius: 8px;
  padding: 16px 20px;
  margin: 16px 0 20px;
  font-size: 14px;
}

.docs-callout.tip {
  background: var(--callout-tip-bg);
  border: 1px solid var(--callout-tip-border);
}

.docs-callout.warning {
  background: var(--callout-warn-bg);
  border: 1px solid var(--callout-warn-border);
}

.docs-callout strong {
  display: block;
  margin-bottom: 4px;
}

/* Tables */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 14px;
}

.docs-table th,
.docs-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.docs-table th {
  font-weight: 600;
  background: var(--surface-hover);
  font-size: 13px;
}

.docs-table td {
  color: var(--text-muted);
}

/* Next page cards */
.docs-next-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.docs-next-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 200ms;
  cursor: pointer;
}

.docs-next-card:hover {
  border-color: #CBD5E1;
}

.docs-next-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.docs-next-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* Mobile TOC */
.docs-mobile-toc {
  display: none;
  margin: 0 24px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.docs-mobile-toc summary {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.docs-mobile-toc summary::-webkit-details-marker {
  display: none;
}

.docs-mobile-toc summary::after {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 200ms;
}

.docs-mobile-toc[open] summary::after {
  transform: rotate(-135deg);
}

.docs-mobile-toc nav {
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-mobile-toc nav a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 0;
}

/* ============================================
   Focus & Accessibility
   ============================================ */
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 57px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 12px;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .docs-layout {
    flex-direction: column;
    gap: 0;
  }

  .docs-sidebar {
    display: none;
  }

  .docs-mobile-toc {
    display: block;
  }

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

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

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
