/* ============================================================
   JSON BFF — style.css
   Two-pane layout, toolbar, status bar, responsive (<768px stack).
   Zero dependencies; system font stacks only.
   ============================================================ */

/* LOCAL TESTING / pre-approval: ad slots are hidden so the layout has no
   dead space and no ad requests fire. REMOVE BOTH LINES below once AdSense
   is approved and the placeholder script is enabled (JSONBFF-PLAN.md §6). */
#ad-header, #ad-footer { display: none; }

:root {
  --bg: #f2f5fa;
  --panel: #ffffff;
  --text: #1a2233;
  --muted: #55607a;
  --border: #d4dbe8;
  --accent: #2563eb;
  --accent-strong: #1e4fd6;
  --accent-soft: #e8efff;
  --ok: #15803d;
  --error: #b91c1c;
  --warn: #92400e;
  --info: #374151;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

#main {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  flex: 1;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- accessibility ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 0 0 8px 0;
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  padding: 2px 8px;
}
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: 0.2px; }
.brand-tag { color: var(--muted); font-size: 13px; }
.site-nav a {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
}
.site-nav a:hover { background: var(--accent-soft); text-decoration: underline; }

/* ---------- ad slots ---------- */
.ad-slot {
  width: 100%;
  max-width: 970px;
  margin: 0 auto;
  padding: 10px 16px;
  text-align: center;
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.btn {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn--ghost { background: transparent; }
.btn--small { padding: 5px 10px; font-size: 14px; }

.indent-picker {
  margin-left: auto; /* pushes indent + Clear to the right end */
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}
#indent-select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

/* ---------- panes ---------- */
.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  flex: 1;
}
.pane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pane-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.output-head .pane-title { border: 0; padding: 0; margin: 0; }
.output-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.pane-body { height: clamp(340px, 56vh, 640px); }

#json-input {
  width: 100%;
  height: 100%;
  border: 0;
  resize: none;
  padding: 14px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: #fbfcfe;
  white-space: pre; /* no wrap — horizontal scroll */
  overflow: auto;
}
#json-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }

#json-output-wrap {
  margin: 0;
  height: 100%;
  overflow: auto;
  padding: 14px;
  background: #fbfcfe;
}
#json-output {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre;
}

/* ---------- status bar ---------- */
.status {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left-width: 5px;
  background: var(--panel);
  font-size: 14px;
  min-height: 42px; /* stable height — no layout shift when text changes */
}
.status--info  { border-left-color: var(--accent); color: var(--info); }
.status--ok    { border-left-color: var(--ok); color: var(--ok); }
/* .status--error gets pre-wrap + monospace because fix() failure messages
   embed a multi-line context snippet (fixer.js §8.2) whose caret line must
   render aligned; white-space: normal would collapse it to a run-on string.
   Single-line error statuses are visually unaffected by pre-wrap. */
.status--error { border-left-color: var(--error); color: var(--error); white-space: pre-wrap; word-break: break-word; font-family: var(--mono); }
.status--warn  { border-left-color: #d97706; color: var(--warn); }

/* ---------- footer ---------- */
.site-footer {
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 16px 20px 22px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.site-footer nav { margin-top: 6px; display: flex; gap: 8px; justify-content: center; }
.site-footer a { color: var(--accent-strong); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- content pages (about / privacy / 404) ---------- */
#main.content-page {
  max-width: 860px;
  padding: 28px 16px 44px;
}
.prose h1 { font-size: 30px; line-height: 1.25; margin: 0 0 10px; }
.prose .lede { color: var(--muted); font-size: 17px; }
.prose h2 {
  font-size: 21px;
  margin: 34px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.prose h3 { font-size: 16.5px; margin: 22px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin: 5px 0; }
.prose a { color: var(--accent-strong); }
.prose code {
  font-family: var(--mono);
  font-size: 13.5px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}
.prose pre {
  margin: 0 0 14px;
  padding: 14px;
  background: #101827;
  color: #e6ebf4;
  border-radius: var(--radius);
  overflow: auto;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: 13px; line-height: 1.55; }
.prose .btn { display: inline-block; }
.prose .cta-row .btn { margin: 0 4px 6px 0; }
.prose--center { text-align: center; }
.error-code {
  font-family: var(--mono);
  font-size: 64px;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 8px;
}

/* ---------- responsive (<768px): stack panes, wrap toolbar ---------- */
@media (max-width: 768px) {
  .panes { grid-template-columns: 1fr; }
  .pane-body { height: clamp(240px, 38vh, 460px); }
  .indent-picker { margin-left: 0; width: 100%; justify-content: space-between; }
  .brand-tag { display: none; }
  #main.content-page { padding: 22px 16px 32px; }
  .prose h1 { font-size: 25px; }
  .error-code { font-size: 48px; }
}
