/* ScraperAPI test site — one stylesheet for the whole app. */
:root {
  --bg: #ffffff;
  --fg: #0f172a;
  --muted-bg: #f4f6fb;
  --muted-fg: #64748b;
  --border: #e2e8f0;
  --card: #ffffff;
  --primary: #1d4ed8;        /* ScraperAPI royal blue */
  --primary-hover: #1e40af;
  --primary-fg: #ffffff;
  --primary-tint: #eff4ff;
  --code-bg: #0f172a;
  --code-fg: #e2e8f0;
  --success: #047857;
  --success-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --refunded: #475569;
  --refunded-bg: #f1f5f9;
  --radius: 10px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { letter-spacing: -0.01em; line-height: 1.2; margin: 0; }
p { margin: 0; }
code, pre { font-family: var(--font-mono); }
code.inline {
  background: var(--muted-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}
pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 16px 18px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}

/* Layout helpers */
.container { max-width: 1152px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 768px; margin: 0 auto; padding: 0 24px; }
.container-wide  { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 32px; }
.section { padding: 64px 0; }
.section-sm { padding: 40px 0; }
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--primary);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  color: var(--fg);
}
.brand .logo-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.brand .brand-accent { color: var(--primary); }
.nav-main { display: flex; gap: 28px; align-items: center; }
.nav-main a, .nav-main .dropdown-btn {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-fg);
  background: none;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  position: relative;
}
.nav-main a:hover, .nav-main .dropdown-btn:hover { color: var(--fg); text-decoration: none; }
.nav-main a.active, .nav-main .dropdown.active > .dropdown-btn { color: var(--fg); }
.nav-main a.active::after,
.nav-main .dropdown.active > .dropdown-btn::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
}
.dropdown { position: relative; }
/* Extend hover target below the button so the mouse can bridge into the panel. */
.dropdown::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 12px;
}
.dropdown-panel {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 10px;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  padding: 6px;
  display: none;
  z-index: 50;
}
.dropdown:hover .dropdown-panel,
.dropdown:focus-within .dropdown-panel,
.dropdown.open .dropdown-panel { display: block; }
.dropdown-panel a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  color: var(--muted-fg);
  border-radius: 6px;
}
.dropdown-panel a:hover { background: var(--muted-bg); color: var(--fg); text-decoration: none; }
.dropdown-panel a.active { background: var(--muted-bg); color: var(--fg); font-weight: 600; }
.header-actions { display: flex; gap: 10px; align-items: center; }

/* Hamburger toggle (mobile only) */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; }
.btn-outline { border-color: var(--fg); color: var(--fg); background: transparent; }
.btn-outline:hover { background: var(--fg); color: #fff; text-decoration: none; }
.btn-ghost { background: var(--muted-bg); color: var(--fg); }
.btn-ghost:hover { background: #e5eaf3; text-decoration: none; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 13px; }

/* Cards / grid */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.card:hover { border-color: rgba(29, 78, 216, 0.35); box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .site-header .row { height: 60px; }
}

/* Mobile navigation */
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .site-header .row { flex-wrap: wrap; }
  .header-actions { display: none; }
  .nav-main {
    display: none;
    order: 10;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0 16px;
    border-top: 1px solid var(--border);
  }
  .site-header.nav-open .nav-main { display: flex; }
  .site-header.nav-open .header-actions {
    display: flex;
    order: 11;
    flex-basis: 100%;
    padding-bottom: 16px;
  }
  .nav-main > a,
  .nav-main .dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
  }
  .nav-main a.active::after,
  .nav-main .dropdown.active > .dropdown-btn::after { display: none; }
  .dropdown { width: 100%; }
  .dropdown::after { display: none; }
  .dropdown-caret { transition: transform 0.15s; }
  .dropdown.open .dropdown-caret { transform: rotate(180deg); }
  .dropdown-panel {
    position: static;
    transform: none;
    margin: 0;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    padding: 4px 0 8px 12px;
    min-width: 0;
    background: transparent;
  }
  .dropdown:hover .dropdown-panel,
  .dropdown:focus-within .dropdown-panel { display: none; }
  .dropdown.open .dropdown-panel { display: block; }
  .dropdown-panel a { padding: 10px 8px; }
}

/* Hero */
.hero {
  padding: 96px 0 72px;
  text-align: center;
  background:
    radial-gradient(50% 40% at 50% 0%, rgba(29, 78, 216, 0.18), transparent 70%),
    linear-gradient(180deg, var(--muted-bg), transparent 60%);
  border-bottom: 1px solid var(--border);
}
.hero .pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--muted-fg);
}
.hero .pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.hero h1 { font-size: clamp(32px, 5vw, 56px); margin-top: 20px; font-weight: 600; }
.hero h1 .accent { color: var(--primary); }
.hero p.lead {
  max-width: 640px;
  margin: 20px auto 0;
  color: var(--muted-fg);
  font-size: 18px;
}
.hero .cta { margin-top: 32px; display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Sandbox tag & headings for interior pages */
.page-head { padding: 48px 0 12px; }
.page-head h1 { font-size: clamp(28px, 3.5vw, 40px); font-weight: 600; margin-top: 8px; }
.page-head p.lead { color: var(--muted-fg); margin-top: 12px; max-width: 640px; }

/* Product grid */
.product-list { list-style: none; padding: 0; margin: 32px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1100px) { .product-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px)  { .product-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 500px)  { .product-list { grid-template-columns: 1fr; } }
.product-card { border: 1px solid var(--border); border-radius: 12px; background: #fff; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow 0.15s; }
.product-card:hover { box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08); }
.product-card .thumb { position: relative; aspect-ratio: 1 / 1; background: var(--muted-bg); overflow: hidden; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .discount-badge { position: absolute; top: 10px; left: 10px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 4px; }
.product-card .body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .brand-line { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-fg); }
.product-card h2 { font-size: 14px; font-weight: 500; line-height: 1.35; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .rating { display: flex; gap: 4px; align-items: center; font-size: 12px; }
.product-card .stars { color: #f59e0b; letter-spacing: 1px; }
.product-card .reviews { color: var(--muted-fg); }
.product-card .price-row { display: flex; gap: 8px; align-items: baseline; margin-top: 4px; }
.product-card .price { font-size: 18px; font-weight: 600; }
.product-card .original-price { color: var(--muted-fg); text-decoration: line-through; font-size: 12px; }
.product-card .stock { margin-left: auto; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.product-card .stock.in { color: var(--success); }
.product-card .stock.out { color: var(--muted-fg); }
.product-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.product-card .tag { font-size: 11px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted-fg); }
.product-card .tag.prime { border-color: transparent; background: var(--primary-tint); color: var(--primary); font-weight: 600; }
.product-card dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; font-size: 11px; color: var(--muted-fg); margin: 4px 0 0; }
.product-card dd { margin: 0; font-family: var(--font-mono); color: #334155; }

/* Pagination */
.pagination { display: flex; gap: 8px; justify-content: center; margin: 40px 0; }
.pagination a, .pagination span {
  display: inline-flex;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--fg);
  background: #fff;
  text-decoration: none;
}
.pagination a:hover { background: var(--muted-bg); text-decoration: none; }
.pagination .active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled { color: var(--muted-fg); background: var(--muted-bg); }

/* Table */
.data-table { width: 100%; border-collapse: collapse; margin-top: 24px; background: #fff; border: 1px solid var(--border); }
.data-table caption { text-align: left; padding: 0 0 8px; font-size: 12px; color: var(--muted-fg); caption-side: top; }
.data-table th, .data-table td { border: 1px solid var(--border); padding: 10px 12px; font-size: 14px; text-align: left; }
.data-table thead th { background: var(--muted-bg); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; color: var(--muted-fg); font-weight: 600; }
.data-table tbody tr:nth-child(even) { background: #fbfcfe; }
.data-table tbody tr:hover { background: #eef4ff; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.data-table th[scope="row"] { font-family: var(--font-mono); font-weight: 400; }
.data-table tfoot td { background: #f4f6fb; font-weight: 600; }
.status { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.status.paid { color: var(--success); background: var(--success-bg); border-color: rgba(4, 120, 87, 0.2); }
.status.pending { color: var(--warn); background: var(--warn-bg); border-color: rgba(180, 83, 9, 0.2); }
.status.refunded { color: var(--refunded); background: var(--refunded-bg); border-color: var(--border); }
.status.failed { color: var(--danger); background: var(--danger-bg); border-color: rgba(185, 28, 28, 0.2); }
.table-scroll { overflow-x: auto; }

/* JS-rendered blocks */
.js-block { border: 1px solid var(--border); border-radius: 12px; padding: 20px; background: #fff; }
.js-block .heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.js-block h2 { font-size: 15px; font-weight: 600; }
.js-block .selector { font-family: var(--font-mono); font-size: 11px; color: var(--muted-fg); background: var(--muted-bg); padding: 3px 8px; border-radius: 4px; }
.js-block .body { margin-top: 14px; }
.muted { color: var(--muted-fg); }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Lessons */
.lesson { max-width: 800px; margin: 0 auto; padding: 48px 24px 96px; }
.lesson h1 { font-size: clamp(28px, 3.5vw, 40px); font-weight: 600; margin: 8px 0 12px; }
.lesson .intro { color: var(--muted-fg); font-size: 18px; margin-bottom: 32px; }
.lesson section { margin-top: 40px; }
.lesson section h2 { font-size: 22px; font-weight: 600; margin-bottom: 12px; }
.lesson p { margin-top: 12px; color: #334155; }
.lesson ul { padding-left: 22px; }
.lesson ul li { margin-top: 6px; }
.param-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.param-table th, .param-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
.param-table th { font-weight: 600; background: var(--muted-bg); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-fg); }
.param-table td:first-child { font-family: var(--font-mono); font-size: 13px; }
.callout { margin-top: 32px; border: 1px solid rgba(29, 78, 216, 0.25); background: var(--primary-tint); padding: 16px 18px; border-radius: 10px; }
.callout .callout-title { font-weight: 600; color: var(--primary); margin-bottom: 4px; }

/* Language tabs */
.tabs { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tabs .tablist { display: flex; flex-wrap: wrap; gap: 0; background: var(--muted-bg); border-bottom: 1px solid var(--border); }
.tabs .tab {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--muted-fg);
  font-family: inherit;
  border-right: 1px solid var(--border);
}
.tabs .tab.active { background: #fff; color: var(--fg); }
.tabs .tab:hover { color: var(--fg); }
.tabs .panel { padding: 0; display: none; }
.tabs .panel.active { display: block; }
.tabs .panel pre { border-radius: 0; }

.next-prev { display: flex; justify-content: space-between; gap: 12px; margin-top: 56px; }
.next-prev a { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); font-weight: 500; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--muted-bg); margin-top: 64px; }
.site-footer .row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; padding: 48px 0; }
@media (max-width: 700px) { .site-footer .row { grid-template-columns: 1fr; } }
.site-footer h4 { font-size: 13px; margin-bottom: 12px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-top: 6px; font-size: 14px; }
.site-footer li a { color: var(--muted-fg); }
.site-footer li a:hover { color: var(--fg); }
.site-footer .brand-blurb { color: var(--muted-fg); max-width: 380px; font-size: 14px; margin-top: 8px; }
.site-footer .fine { border-top: 1px solid var(--border); padding: 16px 0; font-size: 12px; color: var(--muted-fg); }

/* Home playground cards */
.playground-card { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.playground-card .icon-badge { width: 40px; height: 40px; border-radius: 8px; background: var(--primary-tint); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.playground-card h3 { font-size: 18px; font-weight: 600; }
.playground-card p { color: var(--muted-fg); font-size: 14px; margin: 0; }

/* Forms */
input[type="text"], textarea, select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  background: #fff;
}
textarea { height: auto; padding: 10px 12px; min-height: 100px; }
input[type="text"]:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

/* Utility */
.small { font-size: 12px; }
.center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
