/* styles.css — custom scrollbars, editor tweaks and ad-slot styling for Scrubtly.
   Layout/utility styling lives in Tailwind classes; this file covers what Tailwind can't. */

:root {
  --bg: #0b0f19;
  --panel: #111827;
  --border: #1f2937;
  --accent: #10b981;
  --muted: #9ca3af; /* gray-400: passes WCAG AA (4.5:1) on the dark panels */
  --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[x-cloak] { display: none !important; }

html { color-scheme: dark; }
body { background: var(--bg); -webkit-font-smoothing: antialiased; }

::selection { background: rgba(16, 185, 129, 0.35); color: #fff; }

/* ---------- Scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: #374151 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 9999px;
  border: 2px solid var(--panel);
}
*::-webkit-scrollbar-thumb:hover { background: #4b5563; }
*::-webkit-scrollbar-corner { background: transparent; }

/* ---------- Code editors ---------- */
.editor {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  resize: none;
  caret-color: var(--accent);
  font-variant-ligatures: none;
}
.editor::placeholder { color: #8b95a5; white-space: pre-wrap; }
.editor:focus { outline: none; }

/* Drag & drop overlay */
.drop-zone {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(16, 185, 129, 0.06) 0 12px,
    transparent 12px 24px
  );
}

/* ---------- Ad slots (placeholders — no ad scripts loaded yet) ---------- */
.ad-sponsor {
  max-width: 330px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.ad-banner {
  width: 100%;
  max-width: 728px;
  min-height: 90px;          /* reserve space to avoid layout shift (CLS) */
  border: 1px dashed var(--border);
  background: rgba(17, 24, 39, 0.6);
}
@media (max-width: 767px) {
  .ad-banner { min-height: 100px; } /* responsive 320x100 mobile banner */
}
.ad-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Long-form content (SEO sections, legal pages) ---------- */
.prose-scrub { color: #9ca3af; font-size: 15px; line-height: 1.75; }
.prose-scrub > * + * { margin-top: 1em; }
.prose-scrub h2 { color: #fff; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; margin-top: 2.25em; }
.prose-scrub h3 { color: #e5e7eb; font-size: 1.125rem; font-weight: 600; margin-top: 1.75em; }
/* Grid containers space their items with `gap`; the flow margin above would push the
   second column (e.g. "After") down and misalign it with the first. */
.prose-scrub.grid > * + * { margin-top: 0; }
.prose-scrub h2:first-child, .prose-scrub h3:first-child { margin-top: 0; }
.prose-scrub strong { color: #e5e7eb; font-weight: 600; }
.prose-scrub a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(16, 185, 129, 0.4); }
.prose-scrub a:hover { text-decoration-color: var(--accent); }
.prose-scrub ul, .prose-scrub ol { padding-left: 1.25em; }
.prose-scrub ul { list-style: disc; }
.prose-scrub ol { list-style: decimal; }
.prose-scrub li + li { margin-top: 0.4em; }
.prose-scrub li::marker { color: #4b5563; }
.prose-scrub code {
  font-family: var(--mono); font-size: 0.85em; color: #a7f3d0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 0.1em 0.35em;
}
.prose-scrub pre {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: #d1d5db;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem 1.1rem; overflow-x: auto; white-space: pre;
}
.prose-scrub pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose-scrub table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose-scrub th, .prose-scrub td { border-bottom: 1px solid var(--border); padding: 0.55em 0.75em 0.55em 0; text-align: left; vertical-align: top; }
.prose-scrub th { color: #e5e7eb; font-weight: 600; }
.prose-scrub details { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); padding: 0.75rem 1rem; }
.prose-scrub details + details { margin-top: 0.6rem; }
.prose-scrub summary { color: #e5e7eb; font-weight: 600; cursor: pointer; }
.prose-scrub details[open] summary { margin-bottom: 0.5rem; }
.code-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; margin-bottom: 0.4rem; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Callout blocks inside long-form content opt out of prose link styling */
.prose-scrub .not-prose a { text-decoration: none; }

/* Grid items default to min-width:auto, so a wide <pre> would stretch the page on mobile.
   Let them shrink so the <pre> scrolls horizontally inside its own box instead. */
.grid > * { min-width: 0; }

/* Mobile sub-header nav: stays scrollable on ultra-narrow viewports without showing a bulky bar. */
.mobile-nav { scrollbar-width: none; }
.mobile-nav::-webkit-scrollbar { display: none; }
