:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2b303b;
  --text: #d7dae0;
  --muted: #8a909c;
  --accent: #6cb6ff;
  --error: #ff6b6b;
  --error-bg: rgba(255, 107, 107, 0.35);
  --expanded-bg: rgba(108, 182, 255, 0.10);
  --code-bg: #12151b;
  --accent-soft: rgba(108, 182, 255, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
  --j-key: #6cb6ff;
  --j-string: #a5d6a7;
  --j-number: #f0b86e;
  --j-bool: #d19bf2;
  --j-null: #d19bf2;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --border: #d5d9e0;
  --text: #1d2129;
  --muted: #646b78;
  --accent: #0b63c4;
  --error: #c62828;
  --error-bg: rgba(198, 40, 40, 0.25);
  --expanded-bg: rgba(11, 99, 196, 0.08);
  --code-bg: #fbfcfe;
  --accent-soft: rgba(11, 99, 196, 0.10);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 10px 30px rgba(16, 24, 40, 0.08);
  --j-key: #0b63c4;
  --j-string: #2e7d32;
  --j-number: #b35c00;
  --j-bool: #8e24aa;
  --j-null: #8e24aa;
}

* { box-sizing: border-box; }


body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root { --header-h: 52px; }
:root { --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }

a { color: var(--accent); }

button, select {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}
button:hover, select:hover { border-color: var(--accent); }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Header */

#site-header {
  flex: none;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font: 700 16px var(--mono); color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 7px;
}
.brand-accent { color: var(--accent); }
.site-nav { display: flex; gap: 16px; flex: 1; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }
.theme-toggle { font-size: 16px; padding: 2px 8px; }

/* Home */

.home { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px 48px; }

.hero {
  position: relative;
  padding: 72px 0 10px;
  text-align: center;
}
.hero::before {
  /* Soft accent glow behind the headline. */
  content: "";
  position: absolute;
  inset: 0 10% auto;
  height: 320px;
  background: radial-gradient(ellipse at 50% 0%, var(--accent-soft), transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.eyebrow {
  display: inline-block;
  margin: 0 0 18px;
  padding: 4px 12px;
  font: 600 12px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  background: var(--accent-soft);
}
.hero h1 {
  max-width: 860px;
  margin: 0 auto 18px;
  font: 700 clamp(28px, 4.6vw, 48px) / 1.15 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
}
.hero .accent {
  background: linear-gradient(90deg, var(--accent), var(--j-bool));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead { max-width: 640px; margin: 0 auto 28px; font-size: 17px; line-height: 1.6; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 28px; }
.cta, .cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s, filter 0.15s, border-color 0.15s;
}
.cta { background: var(--accent); color: var(--bg); box-shadow: 0 6px 20px var(--accent-soft); }
.cta:hover { filter: brightness(1.1); transform: translateY(-1px); }
.cta-secondary { color: var(--text); border: 1px solid var(--border); background: var(--surface); }
.cta-secondary:hover { border-color: var(--accent); }
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pills li {
  padding: 4px 12px;
  font: 12px var(--mono);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.pills li::before { content: "✓ "; color: var(--j-string); }

.home-section { padding: 40px 0 8px; }
.home-section h2 { margin: 0 0 6px; font: 700 24px ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: -0.01em; }
.section-lead { margin: 0 0 20px; color: var(--muted); }

#tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
a.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.tool-card.featured { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: linear-gradient(160deg, var(--accent-soft), transparent 60%), var(--surface); }
.tool-card.soon { border-style: dashed; color: var(--muted); }
.tool-card h2, .tool-card h3 { margin: 0; font: 600 17px var(--mono); }
.tool-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.tool-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font: 700 16px var(--mono);
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 10px;
}
.tool-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.tool-tags li { padding: 2px 8px; font: 11px var(--mono); color: var(--muted); background: var(--surface-2); border-radius: 4px; }
.tool-open { margin-top: auto; padding-top: 6px; font-weight: 600; color: var(--accent); }

.why { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); }
.why h2 { margin: 0 0 10px; font: 600 12px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.why ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 24px; margin: 0; padding: 0; list-style: none; }
.why li { font-size: 13px; line-height: 1.5; color: var(--muted); }
.why strong { color: var(--text); font-weight: 600; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 20px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.site-footer nav { display: flex; gap: 16px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* Tool layout */

.tool {
  /* The tool fills the first screen; the about content scrolls below it. */
  height: calc(100dvh - var(--header-h));
  min-height: 560px;
  display: flex;
  flex-direction: column;
  padding: 12px 20px 16px;
  gap: 10px;
}
.tool-intro { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.tool-intro h1 { margin: 0; font: 600 18px var(--mono); }
.tool-intro p { margin: 0; font-size: 13px; color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }

.segmented { display: inline-flex; }
.segmented button { border-radius: 0; }
.segmented button:first-child { border-radius: 6px 0 0 6px; }
.segmented button:last-child { border-radius: 0 6px 6px 0; border-left: 0; }
.segmented button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }


/* Cards */

.card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 6px 10px 6px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 11px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.card-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.card-meta { font-size: 12px; color: var(--muted); }

.input-card { flex: none; }
.input-body { position: relative; height: 130px; min-height: 60px; max-height: 70vh; resize: vertical; overflow: hidden; }

.output-card {
  flex: 1;
  min-height: 160px;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow);
}
.output-card .card-head {
  background: linear-gradient(180deg, var(--accent-soft), transparent), var(--surface-2);
  border-top: 2px solid var(--accent);
}
.output-card .card-title { color: var(--text); }
.output-card .card-title::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

button.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }

/* Search */

.search {
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--accent); }
.search.invalid { border-color: var(--error); }
.search input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  font: 13px var(--mono);
  color: var(--text);
  background: none;
  border: 0;
  outline: none;
}
.search kbd {
  font: 11px var(--mono);
  padding: 0 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--muted);
}
.search:focus-within kbd,
.search:has(input:not(:placeholder-shown)) kbd { visibility: hidden; }

.chip {
  font: 600 11px var(--mono);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}
.chip.none { background: var(--surface); color: var(--muted); }
.chip.invalid { background: var(--error-bg); color: var(--error); }
.chip[hidden] { display: none; }

/* Input editor: a transparent textarea over a backdrop that marks errors. */

.editor-text,
.backdrop-content {
  margin: 0;
  padding: 10px 14px;
  font: 13px/20px var(--mono);
  white-space: pre;
  tab-size: 2;
  letter-spacing: normal;
}
.backdrop { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.backdrop-content { color: transparent; }
.backdrop-content mark { background: var(--error-bg); color: transparent; border-radius: 2px; }
.editor-text {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  overflow: auto;
}
.editor-text::placeholder { color: var(--muted); }

/* Output */

.output { flex: 1; min-height: 0; overflow: auto; background: var(--code-bg); outline: none; }
.output.stale { opacity: 0.45; }
.output pre {
  margin: 0;
  padding: 12px 16px;
  font: 13px/20px var(--mono);
  tab-size: 2;
  white-space: pre;
}
.empty {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 120px;
  color: var(--muted);
  font-size: 13px;
}
.empty code { font-family: var(--mono); color: var(--text); }

.j-k { color: var(--j-key); }
.j-s { color: var(--j-string); }
.j-n { color: var(--j-number); }
.j-b { color: var(--j-bool); }
.j-z { color: var(--j-null); font-style: italic; }
.j-x { background: var(--expanded-bg); border-radius: 3px; }

/* Path search results: one card per match */

.matches { display: flex; flex-direction: column; gap: 12px; padding: 12px; }
.match { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.match pre { background: var(--code-bg); }
.match-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 8px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.crumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  padding: 7px 12px;
  font: 12px var(--mono);
  text-align: left;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 0;
}
.crumbs:hover { background: var(--accent-soft); }
.copy-match { flex: none; padding: 2px 12px; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.copy-match:hover { border-color: var(--accent); }
.crumbs .sep { opacity: 0.5; }
.crumbs .last { color: var(--accent); font-weight: 600; }
.crumbs .record { padding: 0 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
.crumbs .hint { margin-left: auto; opacity: 0; font-size: 11px; }
.crumbs:hover .hint { opacity: 1; }

.statusbar { display: flex; gap: 16px; align-items: baseline; min-height: 21px; font: 12px var(--mono); color: var(--muted); }
.statusbar .status { flex: 1; }
.error { color: var(--error); background: none; border: 0; padding: 0; font: inherit; text-align: left; }
.error:hover { text-decoration: underline; }
.error[hidden] { display: none; }
.privacy { color: var(--muted); }

/* About / SEO content below the tool */

.about {
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 64px;
  border-top: 1px solid var(--border);
  line-height: 1.65;
}
.about h2 { font: 600 18px var(--mono); margin: 36px 0 12px; }
.about h2:first-child { margin-top: 8px; }
.about p, .about li { color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.about ul, .about ol { padding-left: 22px; }
.about li { margin: 6px 0; }
.about li strong, .about p strong { color: var(--text); }
.about code {
  font: 0.9em var(--mono);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--j-key);
}
.about kbd {
  font: 12px var(--mono);
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
}
.about table { width: 100%; border-collapse: collapse; font-size: 14px; }
.about th, .about td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.about th { color: var(--muted); font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.about details {
  margin: 8px 0;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.about summary { padding: 10px 0; font-weight: 600; cursor: pointer; }
.about details[open] summary { border-bottom: 1px solid var(--border); }
.about details p { margin: 10px 0 12px; }

.noscript { margin: 20px; padding: 12px 16px; border: 1px solid var(--error); border-radius: 8px; color: var(--error); }
