*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-width: 248px;
  --content-max: 740px;
  --bg: #ffffff;
  --text: #1c1c1e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --blue: #1a56db;
  --blue-light: #eff6ff;
  --callout-bg: #f9fafb;
  --sidebar-bg: #ffffff;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 20px 0 40px;
  position: fixed;
  top: 0; left: 0;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px 20px;
  font-weight: 700;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-logo a,
.mobile-logo a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.sidebar-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.nav-link {
  padding: 6px 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  line-height: 1.5;
}

.nav-link:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  color: var(--blue);
  border-left-color: var(--blue);
  font-weight: 500;
}

/* ── CONTENT ─────────────────────────────── */
.content {
  margin-left: var(--sidebar-width);
  padding: 48px 56px 80px;
  width: 100%;
  max-width: calc(var(--sidebar-width) + var(--content-max) + 112px);
}

section { margin-bottom: 8px; }

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

h1 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 24px;
  color: var(--text);
}

h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 10px;
  color: var(--text);
}

p { margin-bottom: 14px; }

ul, ol {
  padding-left: 24px;
  margin-bottom: 14px;
}

li { margin-bottom: 5px; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* ── CALLOUT ─────────────────────────────── */
.callout {
  position: relative;
  background: var(--callout-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px 12px 36px;
  margin: 16px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.callout::before {
  content: 'ⓘ';
  position: absolute;
  left: 12px;
  top: 13px;
  font-size: 0.9rem;
  color: #6b7280;
}

/* ── FLYWHEEL ────────────────────────────── */
.flywheel {
  background: var(--blue-light);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 0.9rem;
  color: #1e40af;
  font-style: normal;
}

/* ── SCREENSHOTS ─────────────────────────── */
.screenshot-row {
  margin: 24px 0 6px;
}

.screenshot-row img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

.caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 20px;
}

/* ── TABLES ──────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

th {
  text-align: left;
  padding: 10px 14px;
  background: var(--callout-bg);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* ── PAGE NAV ────────────────────────────── */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
}

.page-nav-prev,
.page-nav-next {
  display: flex;
  flex-direction: column;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  min-width: 180px;
  transition: border-color 0.15s, background 0.15s;
}

.page-nav-prev { align-items: flex-start; }
.page-nav-next { align-items: flex-end; margin-left: auto; }

.page-nav-prev:hover,
.page-nav-next:hover {
  border-color: #9ca3af;
  background: var(--callout-bg);
  text-decoration: none;
}

.page-nav-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.page-nav-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* ── FOOTER ──────────────────────────────── */
/* ── PARTNERS ────────────────────────────── */
.partner-list {
  margin: 8px 0 24px;
}

.partner {
  padding: 16px 0;
}

.partner h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.partner h3 a {
  color: var(--blue);
  text-decoration: none;
}

.partner h3 a:hover {
  text-decoration: underline;
}

.partner p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ── PAGE FOOTER ─────────────────────────── */
.page-footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* ── MOBILE HEADER ───────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  align-items: center;
  justify-content: space-between;
}

.mobile-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.mobile-logo img {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: cover;
}

.mobile-menu-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px 8px;
  line-height: 1;
}

.mobile-nav {
  display: none;
  position: fixed;
  top: 56px; left: 0; right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 199;
  padding: 8px 0 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.mobile-nav.open { display: block; }

.mobile-nav a {
  display: block;
  padding: 11px 24px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}

.mobile-nav a:active { color: var(--blue); }

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; max-width: 100vw; }

  .sidebar { display: none; }
  .mobile-header { display: flex; }

  section { scroll-margin-top: 56px; }

  .content {
    margin-left: 0;
    padding: 72px 20px 60px;
    min-width: 0;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.05rem; margin-top: 24px; }

  p, li { font-size: 0.9rem; }

  /* Tables: contained horizontal scroll */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    max-width: 100%;
  }

  td, th { white-space: nowrap; font-size: 0.875rem; }

  /* Flywheel wraps instead of overflowing */
  .flywheel { font-size: 0.8rem; word-break: break-word; white-space: normal; }

  /* Screenshot fits width */
  .screenshot-row img { max-width: 100%; }

  /* Page nav: side by side, compact */
  .page-nav { flex-direction: row; gap: 10px; }
  .page-nav-prev, .page-nav-next { min-width: unset; width: auto; flex: 1; padding: 10px 14px; }
  .page-nav-next { margin-left: 0; }
  .page-nav-title { font-size: 0.8rem; }

  /* Callout text wraps */
  .callout { font-size: 0.82rem; }
}
