/* RewardMate Knowledge Base */
:root {
  --primary: #0F766E;
  --primary-dark: #0B5F58;
  --primary-light: #14B8A6;
  --header-start: #0B3A42;
  --gold: #C9A227;
  --success: #059669;
  --danger: #DC2626;
  --bg: #FFFFFF;
  --bg-soft: #F4F7F8;
  --bg-muted: #E8EEF0;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --sidebar-w: 280px;
  --top-h: 64px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --grad-header: linear-gradient(135deg, #0B3A42 0%, #0F766E 48%, #C9A227 100%);
  --grad-primary: linear-gradient(180deg, #14968B 0%, #0F766E 100%);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
code, kbd, pre { font-family: var(--mono); font-size: 0.875em; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Top bar */
.docs-top {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--top-h);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.docs-top__inner {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo__mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--grad-header);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px rgba(15,118,110,0.25);
}
.logo__mark svg { width: 16px; height: 16px; }
.logo__badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: #F0FDFA;
  color: var(--primary);
  border: 1px solid #99F6E4;
}
.search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
  margin: 0 auto;
}
.search-wrap input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 0.55rem 0.9rem 0.55rem 2.4rem;
  background: var(--bg-soft);
  font-size: 0.9rem;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.search-wrap input:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,118,110,0.12);
}
.search-wrap__icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  max-height: 360px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}
.search-results.open { display: block; }
.search-results__item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s;
}
.search-results__item:last-child { border-bottom: none; }
.search-results__item:hover,
.search-results__item.active { background: #F0FDFA; text-decoration: none; }
.search-results__item strong { display: block; font-size: 0.9rem; margin-bottom: 0.15rem; }
.search-results__item span { font-size: 0.78rem; color: var(--text-muted); }
.search-results__empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.docs-top__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 12px;
  padding: 0.5rem 0.95rem;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  text-decoration: none !important;
  white-space: nowrap;
}
.btn--primary {
  background: var(--grad-primary);
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(15,118,110,0.28);
}
.btn--primary:hover { transform: translateY(-1px); }
.btn--ghost {
  color: var(--text-secondary) !important;
  background: transparent;
}
.btn--ghost:hover { background: var(--bg-soft); color: var(--text) !important; }
.nav-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* Layout */
.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1440px;
  margin: 0 auto;
  min-height: calc(100vh - var(--top-h));
}
.docs-sidebar {
  position: sticky;
  top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: #FAFCFC;
  padding: 1.25rem 0.85rem 2.5rem;
}
.docs-sidebar__label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.85rem 0.75rem 0.4rem;
}
.docs-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.docs-nav a:hover { background: #fff; color: var(--text); text-decoration: none; }
.docs-nav a.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.docs-nav a .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
}
.docs-nav a.active .dot { background: var(--primary); }

.docs-main {
  min-width: 0;
  padding: 2rem 2.5rem 4rem;
}
.docs-content { max-width: 760px; }

/* Home hub */
.hub-hero {
  background: linear-gradient(145deg, #F0FDFA 0%, #fff 45%, #FEF9E7 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 2rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}
.hub-hero h1 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.65rem;
}
.hub-hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 540px;
  margin-bottom: 1.25rem;
}
.hub-search-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.hub-search-hint kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  font-size: 0.75rem;
  margin: 0 0.15rem;
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 2.5rem;
}
.cat-card {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.2rem;
  text-decoration: none !important;
  color: inherit;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
}
.cat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #99F6E4;
}
.cat-card__icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F0FDFA;
  color: var(--primary);
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}
.cat-card h3 {
  font-size: 1rem;
  letter-spacing: -0.015em;
  margin-bottom: 0.3rem;
}
.cat-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.cat-card__count {
  display: inline-block;
  margin-top: 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
}

.article-list { margin-top: 0.5rem; }
.article-list h2 {
  font-size: 1.15rem;
  margin-bottom: 0.85rem;
  letter-spacing: -0.02em;
}
.article-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
.article-list a:hover { color: var(--primary); }
.article-list a span {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Article */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb__sep { opacity: 0.5; }

.article-header { margin-bottom: 1.75rem; }
.article-header .pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #F0FDFA;
  color: var(--primary);
  border: 1px solid #99F6E4;
  margin-bottom: 0.75rem;
}
.article-header h1 {
  font-size: clamp(1.65rem, 3vw, 2.1rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.65rem;
}
.article-header .lead {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.prose h2 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin: 2rem 0 0.75rem;
  padding-top: 0.5rem;
  scroll-margin-top: calc(var(--top-h) + 16px);
}
.prose h3 {
  font-size: 1.1rem;
  letter-spacing: -0.015em;
  margin: 1.5rem 0 0.55rem;
  scroll-margin-top: calc(var(--top-h) + 16px);
}
.prose p { margin-bottom: 1rem; color: var(--text-secondary); }
.prose ul, .prose ol {
  margin: 0 0 1.15rem 1.25rem;
  color: var(--text-secondary);
}
.prose li { margin-bottom: 0.4rem; }
.prose li::marker { color: var(--primary); }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { font-weight: 500; }
.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.callout {
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.callout--tip {
  background: #F0FDFA;
  border-color: #99F6E4;
}
.callout--warn {
  background: #FFFBEB;
  border-color: #FDE68A;
}
.callout--pro {
  background: linear-gradient(135deg, #FEF9E7, #F0FDFA);
  border-color: #F5E6B8;
}
.callout__title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  color: var(--text);
}
.callout p:last-child { margin-bottom: 0; }

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}
.steps li {
  position: relative;
  padding: 0 0 1.25rem 2.75rem;
  border-left: 2px solid #CCFBF1;
  margin-left: 0.85rem;
}
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -0.95rem;
  top: 0;
  width: 1.75rem; height: 1.75rem;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(15,118,110,0.3);
}
.steps strong { display: block; color: var(--text); margin-bottom: 0.2rem; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1.25rem 0 1.5rem;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
th {
  background: var(--bg-soft);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}
tr:last-child td { border-bottom: none; }
td strong { color: var(--text); }

pre {
  background: #0F172A;
  color: #E2E8F0;
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  margin: 1rem 0 1.35rem;
  font-size: 0.82rem;
  line-height: 1.55;
}
pre .c { color: #94A3B8; }
pre .s { color: #6EE7B7; }
pre .k { color: #93C5FD; }
code:not(pre code) {
  background: #F0FDFA;
  color: var(--primary-dark);
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  border: 1px solid #CCFBF1;
  font-size: 0.85em;
}

.tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}
.tag--pro {
  background: #FEF9E7;
  color: #A67C00;
  border-color: #F5E6B8;
}
.tag--free {
  background: #EFF6FF;
  color: #1D4ED8;
  border-color: #BFDBFE;
}

.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.article-nav a {
  display: block;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  text-decoration: none !important;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.article-nav a:hover {
  border-color: #99F6E4;
  box-shadow: var(--shadow-sm);
}
.article-nav a span {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.article-nav a strong { font-size: 0.9rem; }
.article-nav a.next { text-align: right; }

.toc {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1.75rem;
}
.toc__title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
}
.toc ol {
  margin: 0;
  padding-left: 1.15rem;
}
.toc li { margin-bottom: 0.3rem; font-size: 0.875rem; }
.toc a { color: var(--text-secondary); }
.toc a:hover { color: var(--primary); }

.feedback {
  margin-top: 2rem;
  padding: 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(145deg, #F8FAFB, #fff);
  text-align: center;
}
.feedback p {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}
.feedback__btns { display: flex; justify-content: center; gap: 0.5rem; }
.feedback__btns button {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.feedback__btns button:hover { border-color: var(--primary); background: #F0FDFA; }

/* On-this-page (desktop right rail optional - keep simple) */
.docs-aside {
  display: none;
}

/* Footer mini */
.docs-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Hidden pages until routed */
.page { display: none; }
.page.active { display: block; animation: fade 0.25s var(--ease); }
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.35);
  z-index: 90;
}
.sidebar-overlay.open { display: block; }

@media (max-width: 960px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar {
    position: fixed;
    left: 0; top: var(--top-h);
    width: min(300px, 88vw);
    z-index: 95;
    transform: translateX(-105%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-md);
  }
  .docs-sidebar.open { transform: translateX(0); }
  .nav-toggle { display: flex; }
  .docs-main { padding: 1.5rem 1.15rem 3rem; }
  .cat-grid { grid-template-columns: 1fr; }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav a.next { text-align: left; }
  .docs-top__actions .btn--ghost { display: none; }
  .search-wrap { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
