/* BITS Pay — shared stylesheet (public/ common.css).
   Dipakai halaman statis: docs, guides, privacy, terms, status.
   Token + navbar + footer SAMA dengan landing src/style.css (disalin manual —
   halaman statis tidak lewat Vite). Dark/light via [data-theme] di <html>. */

/* ── Tokens (salinan src/style.css) ─────────────────────── */
:root,
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f2f2f3;
  --border: #e3e4e7;
  --border-strong: #c9cbd0;
  --text: #17181c;
  --muted: #555a63;
  --faint: #878c96;
  --accent: #e0272f;
  --accent-strong: #ba1e25;
  --accent-soft: rgba(224, 39, 47, 0.08);
  --on-accent: #ffffff;
  --success: #157a3e;
  --warning: #b45309;
  --error: #b91c1c;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.05), 0 6px 20px rgba(20, 22, 26, 0.06);
  --shadow-lg: 0 2px 6px rgba(20, 22, 26, 0.07), 0 18px 44px rgba(20, 22, 26, 0.1);
  --radius: 8px;
  --radius-lg: 10px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0e0f12;
  --surface: #16181d;
  --surface-2: #1d2026;
  --border: #262932;
  --border-strong: #3b3f49;
  --text: #ecedef;
  --muted: #a3a8b1;
  --faint: #6e737d;
  --accent: #e0272f;
  --accent-strong: #f03a42;
  --accent-soft: rgba(224, 39, 47, 0.14);
  --on-accent: #ffffff;
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.45), 0 18px 44px rgba(0, 0, 0, 0.5);
}

/* Terminal/pre: selalu gelap di kedua tema. */
:root {
  --term-bg: #101216;
  --term-border: #272a33;
  --term-text: #d7d9df;
  --term-muted: #878c98;
  --term-faint: #5c616c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

/* Scrollbar kustom — tipis, mengikuti token tema terang/gelap (sama seperti landing). */
:root {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
  border: 2px solid var(--bg);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--faint);
  background-clip: padding-box;
}

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.25s,
    color 0.25s;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-strong);
}
img {
  max-width: 100%;
}
code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05em 0.35em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
}
.btn-primary:hover {
  background: var(--accent-strong);
  color: var(--on-accent);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--faint);
}

/* ── Navbar: floating pill (salinan src/style.css) ──────── */
.navbar {
  position: sticky;
  top: 0.75rem;
  z-index: 100;
}
.nav-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: calc(100% - 2rem);
  padding: 0.4rem 0.5rem 0.4rem 1.15rem;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.navbar.scrolled .nav-container {
  border-color: var(--border-strong);
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.09);
}
.nav-logo {
  font-family: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  letter-spacing: -0.02em;
  flex: none;
}
.brand-mark {
  width: 1.35rem;
  height: 1.35rem;
  flex: none;
}
.nav-menu {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0 auto;
}
.nav-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  transition:
    color 0.15s,
    background 0.15s;
}
.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav-link.active {
  color: var(--text);
  background: var(--surface-2);
}
.nav-end {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: none;
  margin-left: auto;
}
.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex: none;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.nav-toggle:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.nav-toggle span {
  display: block;
  width: 1rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: 0.25s;
}
.nav-toggle[aria-expanded='true'] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded='true'] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded='true'] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Theme switcher */
.theme-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.theme-switch:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.theme-switch svg {
  width: 1.05rem;
  height: 1.05rem;
}
.theme-switch .icon-moon {
  display: none;
}
:root[data-theme='dark'] .theme-switch .icon-sun {
  display: none;
}
:root[data-theme='dark'] .theme-switch .icon-moon {
  display: block;
}

@media (max-width: 768px) {
  .navbar {
    top: 0.5rem;
  }
  .nav-toggle {
    display: flex;
  }
  .nav-menu {
    display: none;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 1rem;
    right: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
    gap: 0.15rem;
    box-shadow: var(--shadow-lg);
  }
  .nav-menu.open {
    display: flex;
  }
  .nav-links {
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    gap: 0.1rem;
  }
  .nav-links .nav-link {
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius);
  }
}

/* ── Footer (salinan src/style.css) ─────────────────────── */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-top: 1.75rem;
  margin-top: 4rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-bottom: 1.4rem;
}
.footer-brand strong {
  font-family: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.footer-brand p {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.3rem;
}
.footer-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
}
.footer-nav a {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  transition:
    color 0.15s,
    background 0.15s;
}
.footer-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px dashed var(--border);
  padding-top: 1rem;
  padding-bottom: 1.1rem;
}
.footer-copyright {
  font-size: 0.74rem;
  color: var(--faint);
  font-family: 'IBM Plex Mono', monospace;
  text-align: center;
}
.footer-copyright .heart {
  color: var(--accent);
}
.footer-co {
  color: var(--muted);
  font-weight: 600;
}
.footer-co:hover {
  color: var(--text);
}

@media (max-width: 900px) {
  .footer-inner {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
  }
  .footer-brand strong {
    justify-content: center;
  }
  .footer-nav {
    justify-content: center;
  }
}

/* ── Layout konten / prose ──────────────────────────────── */
.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}
.page.wide {
  max-width: 1160px;
}

/* Kicker pill dengan // merah (salinan .section-kicker landing). */
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.34rem 0.85rem;
  margin-bottom: 0.9rem;
}
.section-kicker::before,
.section-kicker::after {
  content: '//';
  color: var(--accent);
  font-weight: 600;
}

.page h1 {
  font-family: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 0.6rem;
}
.lead {
  color: var(--muted);
  font-size: 1.02rem;
  margin-top: 0;
}
.updated {
  color: var(--faint);
  font-size: 0.85rem;
  margin-top: 0;
}
.page h2 {
  font-family: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 2.5rem 0 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.page h2:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 2rem;
}
.page h3 {
  font-family: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}
.page p {
  margin: 0.75rem 0;
}
.page ul,
.page ol {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
}
.page li {
  margin: 0.35rem 0;
}
.page li::marker {
  color: var(--faint);
}

/* Breadcrumb kembali ke /docs/ */
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.crumb:hover {
  color: var(--accent);
}

/* ── Komponen docs ──────────────────────────────────────── */
pre {
  background: var(--term-bg);
  color: var(--term-text);
  border: 1px solid var(--term-border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  font-size: 0.83rem;
  line-height: 1.6;
  margin: 1rem 0;
}
pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.88rem;
}
th,
td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
th {
  background: var(--surface-2);
  font-weight: 600;
}
td {
  background: var(--surface);
}
.callout {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-left-width: 3px;
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  font-size: 0.92rem;
}
.callout.warn {
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
  border-left-width: 3px;
}
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.step h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.step .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--on-accent);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  flex: none;
}
.step p {
  margin: 0;
}

/* ── Pager prev/next antar halaman docs ─────────────────── */
.doc-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-top: 2.5rem;
}
.pager-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
a.pager-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.06);
  color: var(--text);
}
.pager-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.pager-title {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.pager-card.next {
  text-align: right;
  align-items: flex-end;
}
.pager-card.next .pager-title {
  flex-direction: row-reverse;
}
.pager-arrow {
  color: var(--accent);
  flex: none;
}
@media (max-width: 520px) {
  .doc-pager {
    grid-template-columns: 1fr;
  }
}

/* ── Status page ────────────────────────────────────────── */
.status-wrap {
  min-height: 60vh;
  display: grid;
  place-items: center;
  padding: 3rem 1.5rem;
}
.status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  text-align: center;
  min-width: min(320px, 100%);
}
.status-card h1 {
  font-family: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}
.status-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid transparent;
}
.status-badge .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge.ok {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-color: color-mix(in srgb, var(--success) 32%, transparent);
}
.status-badge.bad {
  color: var(--error);
  background: color-mix(in srgb, var(--error) 12%, transparent);
  border-color: color-mix(in srgb, var(--error) 32%, transparent);
}
.status-badge.checking {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border-color: color-mix(in srgb, var(--warning) 32%, transparent);
}
.status-badge.checking .dot {
  animation: status-pulse 1.6s ease-in-out infinite;
}
@keyframes status-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--warning) 45%, transparent);
  }
  50% {
    box-shadow: 0 0 0 6px transparent;
  }
}
.status-hint {
  margin-top: 1.25rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--faint);
}

/* ── Aksesibilitas & reduced motion ─────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
}
