:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
    'Liberation Mono', monospace;

  --brand-50: #eef7ff;
  --brand-100: #d8ecff;
  --brand-500: #2563eb;
  --brand-600: #1d4ed8;
  --brand-700: #1e40af;

  --ink-900: #0b1220;
  --ink-800: #111827;
  --ink-700: #1f2937;
  --ink-500: #4b5563;
  --ink-400: #6b7280;
  --ink-200: #e5e7eb;
  --ink-100: #f3f4f6;
  --ink-50: #fafafa;

  --ok: #047857;
  --err: #b91c1c;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  background: var(--ink-50);
  color: var(--ink-900);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--brand-600);
}
a:hover {
  color: var(--brand-700);
}

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

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 640px) {
  .container { padding: 0 1.5rem; }
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--ink-200);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--ink-900);
  text-decoration: none;
}
.brand .mark {
  display: inline-flex;
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--brand-600);
  color: #fff;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.site-nav a {
  color: var(--ink-700);
  text-decoration: none;
}
.site-nav a:hover {
  color: var(--brand-600);
}

main { flex: 1; }

.site-footer {
  margin-top: 4rem;
  background: #fff;
  border-top: 1px solid var(--ink-200);
}
.site-footer .container {
  padding-top: 2rem;
  padding-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}
.site-footer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-500);
}

.hero {
  background: #fff;
  border-bottom: 1px solid var(--ink-200);
}
.hero .container {
  padding-top: 4rem;
  padding-bottom: 4rem;
}
.hero .kicker {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--brand-600);
}
.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero p {
  margin: 1rem 0 0;
  max-width: 36rem;
  color: var(--ink-500);
  font-size: 1.05rem;
}

.section {
  padding: 3rem 0;
}

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

.tool-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tool-card:hover {
  border-color: var(--brand-500);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.tool-card h3 {
  margin: 0 0 0.4rem;
  color: var(--ink-900);
  font-size: 1.1rem;
}
.tool-card p {
  margin: 0;
  color: var(--ink-500);
  font-size: 0.9rem;
  line-height: 1.5;
}
.tool-card .arrow {
  margin-top: 1rem;
  color: var(--brand-600);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Tool page common */
.tool-head {
  padding-top: 2.5rem;
  padding-bottom: 1.5rem;
}
.breadcrumbs {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-500);
}
.breadcrumbs a { text-decoration: none; }
.tool-head h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.01em;
}
.tool-head p {
  margin: 0.5rem 0 0;
  color: var(--ink-500);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 0.4rem;
  border: 1px solid var(--ink-200);
  background: #fff;
  color: var(--ink-900);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: var(--ink-500); }
.btn-primary {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-700);
  border-color: var(--brand-700);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 0.5rem 0.5rem 0 0;
  border-bottom: none;
}
.toolbar .spacer { flex: 1; }

.status {
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.status.muted { color: var(--ink-400); }

.editor-pair {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .editor-pair { grid-template-columns: 1fr 1fr; }
}

.editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.editor label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-700);
  margin-bottom: 0.4rem;
}
.editor textarea,
.editor pre {
  width: 100%;
  min-height: 420px;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-900);
  resize: vertical;
  overflow: auto;
  tab-size: 2;
  margin: 0;
  white-space: pre;
}
.editor textarea:focus-visible,
.editor pre:focus-visible {
  outline-color: var(--brand-500);
}

.panel-note {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  color: var(--ink-500);
}
.panel-note strong { color: var(--ink-900); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
