/* ==========================================================================
   DeveloTools — sitewide design system
   Tokens, layout primitives and shared components live here. Page-specific
   rules stay in that page's own <style> block until a second page needs
   them (see .claude/skills/new-tool-page).
   ========================================================================== */

@import url('fonts.css');

:root {
  /* ---- Light theme (default) ---- */
  --bg: #EEF0F7;
  --surface: #FFFFFF;
  --surface-alt: #F5F6FB;
  --border: #E1E4EF;
  --text: #14162A;
  --text-muted: #666C85;
  --accent: #0B458E;
  --accent-strong: #083368;
  --accent-soft: rgba(11, 69, 142, 0.09);
  --accent-2: #059669;
  --accent-2-soft: rgba(5, 150, 105, 0.1);
  --danger: #DC2626;
  --shadow: 0 1px 2px rgba(20, 22, 42, 0.04), 0 8px 24px rgba(20, 22, 42, 0.06);
  --shadow-hover: 0 4px 10px rgba(20, 22, 42, 0.06), 0 16px 32px rgba(20, 22, 42, 0.1);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --header-h: 68px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0A0D16;
  --surface: #131826;
  --surface-alt: #1A2032;
  --border: #232A3D;
  --text: #F1F2F8;
  --text-muted: #8B93AC;
  --accent: #3D90F5;
  --accent-strong: #5AA0F6;
  --accent-soft: rgba(61, 144, 245, 0.16);
  --accent-2: #2FD9A8;
  --accent-2-soft: rgba(47, 217, 168, 0.14);
  --danger: #F87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.35), 0 20px 40px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}
h1, h2, h3, h4, p, figure { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
code, kbd, samp { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Background texture: faint dot grid, page-wide ---- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 0%, transparent 75%);
  opacity: 0.6;
}

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 130%);
  color: #fff;
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-name span { color: var(--accent); }

.nav-search {
  flex: 1;
  max-width: 420px;
  margin: 0 auto 0 8px;
}
.nav-search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.nav-search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.nav-search-field svg { flex-shrink: 0; width: 16px; height: 16px; }
.nav-search-field input {
  flex: 1;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 14px;
  min-width: 0;
}
.nav-search-field input::placeholder { color: var(--text-muted); }
.nav-search-kbd {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-alt); color: var(--text); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-github {
  display: none;
}
@media (min-width: 640px) {
  .nav-github { display: inline-flex; }
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.lang-switch a, .lang-switch span {
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
.lang-switch a {
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.lang-switch a:hover { background: var(--surface-alt); color: var(--text); }
.lang-switch .lang-current { background: var(--accent-soft); color: var(--accent); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding: 64px 0 40px;
  text-align: center;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
}
.hero-eyebrow svg { width: 13px; height: 13px; }
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  max-width: 780px;
  margin: 0 auto;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  max-width: 560px;
  margin: 18px auto 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.hero-stat strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.hero-stat span {
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   Category filter chips
   ========================================================================== */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 0 0 40px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.chip svg { width: 14px; height: 14px; }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ==========================================================================
   Tool grid + cards
   ========================================================================== */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-top: 8px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.section-heading h2 {
  font-size: 1.05rem;
  font-weight: 700;
}
.section-heading .count {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 48px;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tool-card[href]:hover,
.tool-card[href]:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.tool-card.is-disabled {
  opacity: 0.6;
  filter: grayscale(0.35);
}
.tool-card.is-disabled:hover { transform: none; box-shadow: var(--shadow); }

.tool-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.tool-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tool-tint, var(--accent-soft));
  color: var(--tool-color, var(--accent));
  flex-shrink: 0;
}
.tool-icon svg { width: 20px; height: 20px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-live { background: var(--accent-2-soft); color: var(--accent-2); }
.badge-live::before {
  content: '';
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent-2);
}
.badge-soon { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }

.tool-card h3 {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.tool-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.tool-card-tag {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

/* ==========================================================================
   Tool page shared components
   Breadcrumbs, title row, two-panel tool layout (tp-*) and the SEO/FAQ
   blocks below the tool. Used by every page under /tools/*/. Promoted here
   once the second tool page needed the same layout as json-formatter.
   ========================================================================== */
.breadcrumbs {
  padding: 18px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs span[aria-hidden] { margin: 0 6px; opacity: .6; }
.breadcrumbs .current { color: var(--text); font-weight: 600; }

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 6px;
}
.page-title-row h1 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 14.5px;
  max-width: 620px;
  margin-top: 6px;
}
.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--accent-2-soft); color: var(--accent-2);
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.live-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }

.tp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0 36px;
  align-items: start;
}
@media (max-width: 800px) { .tp-grid { grid-template-columns: 1fr; } }

.tp-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tp-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tp-panel-header h2 {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.tp-toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tp-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
  cursor: pointer;
}
.tp-btn svg { width: 14px; height: 14px; }
.tp-btn:hover { border-color: var(--accent); color: var(--accent); }
.tp-btn.tp-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tp-btn.tp-btn-primary:hover { background: var(--accent-strong); color: #fff; }
.tp-btn:disabled { opacity: .5; cursor: not-allowed; }
.tp-btn:disabled:hover { border-color: var(--border); color: var(--text); }

.tp-segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.tp-segmented button {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
}
.tp-segmented button:last-child { border-right: none; }
.tp-segmented button.is-active { background: var(--accent); color: #fff; }

.tp-textarea, .tp-output {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 14px;
  outline: none;
  tab-size: 2;
}
.tp-textarea:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.tp-output { white-space: pre; overflow: auto; margin: 0; }
.tp-textarea::placeholder { color: var(--text-muted); }

.tp-field {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.tp-field:last-child { border-bottom: none; }
.tp-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.tp-input, .tp-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color .15s ease;
}
.tp-input:focus, .tp-select:focus { border-color: var(--accent); }
.tp-select { font-family: var(--font-ui); cursor: pointer; }
.tp-row { display: flex; gap: 10px; flex-wrap: wrap; }
.tp-row > * { flex: 1; min-width: 140px; }

.tp-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.tp-kv:last-child { border-bottom: none; }
.tp-kv dt { color: var(--text-muted); font-size: 12px; }
.tp-kv dd {
  font-family: var(--font-mono);
  color: var(--text);
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.tp-error {
  display: none;
  align-items: flex-start;
  gap: 8px;
  margin: 0 14px 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.5;
}
.tp-error.is-visible { display: flex; }
.tp-error svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }

.tp-status {
  padding: 8px 14px;
  font-size: 11.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
}

.seo-block {
  max-width: 760px;
  margin: 0 auto 48px;
}
.seo-block h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 12px;
  margin-top: 36px;
}
.seo-block p { color: var(--text-muted); font-size: 14.5px; margin-bottom: 12px; }
.seo-block pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 4px 14px;
  margin-bottom: 8px;
}
.faq-item summary {
  padding: 12px 0;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.faq-item p { padding-bottom: 12px; margin: 0; }

.related-tools {
  max-width: 760px;
  margin: 0 auto 56px;
}
.related-tools h2 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }
.related-tools ul { display: flex; flex-wrap: wrap; gap: 8px; }
.related-tools li a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-muted);
}
.related-tools li a:hover { border-color: var(--accent); color: var(--accent); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0 40px;
  margin-top: 40px;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.footer-note {
  font-size: 13px;
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.footer-links a:hover { color: var(--accent); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 700px) {
  .nav-search { display: none; }
  .hero { padding: 44px 0 28px; }
  .hero-stats { gap: 22px; }
}
