/* ── Tech/Utility Design System ── */
:root {
  /* Surface layers — light tech palette */
  --bg:        oklch(97.5% 0.004 250);
  --surface:   oklch(99.5% 0.001 250);
  --panel:     oklch(100% 0 0);
  --sidebar:   oklch(96.5% 0.003 250);

  /* Foreground */
  --fg:        oklch(20% 0.018 250);
  --muted:     oklch(48% 0.015 250);
  --border:    oklch(88% 0.006 250);

  /* Primary accent — green (Datadog-inspired) */
  --accent:          oklch(58% 0.16 150);
  --accent-deep:     oklch(48% 0.14 150);
  --accent-soft:     oklch(93% 0.03 150);
  --accent-muted:    oklch(82% 0.06 150);

  /* Status colors */
  --success: oklch(58% 0.16 150);
  --warn:    oklch(62% 0.14 70);
  --danger:  oklch(48% 0.18 20);
  --info:    oklch(55% 0.10 245);

  --radius: 6px;
  color-scheme: light;

  /* Typography — system sans + JetBrains mono */
  --font-display: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'IBM Plex Mono', 'Cascadia Code', ui-monospace, Menlo, monospace;
}

/* ── Base ── */
* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 1200px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { border: 0; cursor: pointer; }

/* Mono utility */
.mono, .stat-num, .pill, code, pre, .resource-url, kbd {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 32px 10px 28px;
  z-index: 10;
  overflow-y: auto;
  transition: width 0.22s ease, padding 0.22s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 28px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  background: var(--accent);
  opacity: 0.9;
}

.brand h1 {
  margin: 0 0 3px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
}

.brand p {
  margin: 0;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--muted);
}

/* ── Category nav ── */
.category-list {
  display: grid;
  gap: 2px;
}

.category {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border-radius: var(--radius);
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}

.category svg { width: 20px; height: 20px; stroke-width: 1.8; }

.category:hover {
  background: oklch(92% 0.01 250);
  color: var(--fg);
}

.category.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
}

/* ── Official toolbox link ── */
.official-toolbox-link {
  position: absolute;
  right: 12px;
  bottom: 20px;
  left: 12px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px 12px;
  color: var(--fg);
  transition: border-color 0.12s;
}

.official-toolbox-link:hover {
  border-color: var(--accent-muted);
  background: oklch(98% 0.008 150);
}

.official-toolbox-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
}

.official-toolbox-icon svg { width: 18px; height: 18px; }

.official-toolbox-link strong,
.official-toolbox-link em { display: block; }

.official-toolbox-link strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.official-toolbox-link em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

/* ── Workspace ── */
.workspace {
  margin-left: 260px;
  padding: 28px 64px 56px;
  max-width: 1440px;
  transition: margin-left 0.22s ease;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 24px;
}

.detail-topbar { justify-content: space-between; }

.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(760px, calc(100vw - 600px));
  min-width: 480px;
  height: 48px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 0 18px;
  transition: border-color 0.15s;
}

.search-box:focus-within { border-color: var(--accent-muted); }

.search-box svg { width: 20px; height: 20px; stroke-width: 2; color: var(--muted); }

.search-box input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--fg); font-size: 16px;
}

.search-box input::placeholder { color: var(--muted); }

/* ── Buttons & actions ── */
.top-actions { display: flex; align-items: center; gap: 10px; }

.icon-button,
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius);
  background: transparent; color: var(--muted);
  transition: background 0.12s, color 0.12s;
}

.icon-button:hover, .avatar:hover { background: var(--border); color: var(--fg); }

.icon-button svg, .avatar svg { width: 19px; height: 19px; }

.icon-button.small { width: 30px; height: 30px; }

.benefit-button,
.secondary-button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; border-radius: var(--radius);
  padding: 0 16px; white-space: nowrap; font-size: 14px; font-weight: 600;
  transition: background 0.12s, color 0.12s;
}

.benefit-button {
  background: var(--accent-soft); color: var(--accent-deep);
}

.benefit-button:hover { background: var(--accent-muted); }

.secondary-button {
  background: var(--border); color: var(--fg);
}

.secondary-button:hover { background: oklch(82% 0.004 250); }

.benefit-button svg, .secondary-button svg { width: 17px; height: 17px; }

/* Capability links (detail page tabs) */
.capability-link {
  display: inline-flex; align-items: center;
  min-height: 34px; border-radius: var(--radius);
  padding: 0 14px; background: transparent;
  color: var(--muted); font-weight: 600; font-size: 14px;
  transition: background 0.12s, color 0.12s;
}

.capability-link:hover { background: var(--border); color: var(--fg); }

.capability-link.is-active {
  background: var(--accent); color: #fff;
}

/* ── Hero panel ── */
.hero-panel {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 108px; margin: 0 auto 24px;
  padding: 22px 28px; max-width: 1334px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
}

.hero-copy p { margin: 0 0 6px; font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--accent-deep); text-transform: uppercase; letter-spacing: 0.04em; }

.hero-copy h2 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }

/* ── Stats (solid, not translucent) ── */
.quick-stats {
  display: flex; gap: 1px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.quick-stats div {
  min-width: 108px; padding: 14px 18px;
  background: var(--bg);
}

.quick-stats strong,
.quick-stats span { display: block; }

.quick-stats strong {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 20px; font-weight: 700; color: var(--fg);
}

.quick-stats span {
  margin-top: 3px; color: var(--muted); font-size: 12px;
}

/* ── Tool badge (plugin icons) ── */
.tool-badge {
  position: relative; display: grid; place-items: center;
  width: 64px; height: 64px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent);
  flex-shrink: 0;
}

.tool-badge::before {
  content: ""; position: absolute; inset: 18px 14px 12px;
  border-radius: 4px; background: currentColor;
}

.tool-badge span {
  position: relative; z-index: 1;
  color: #fff; font-size: 20px; font-weight: 800;
}

.tool-badge.green {
  background: oklch(93% 0.03 150);
  color: var(--success);
}

.tool-badge.orange {
  background: oklch(93% 0.04 70);
  color: var(--warn);
}

/* ── Panel shell ── */
.ability-panel,
.catalog-panel,
.translator-shell,
.parser-shell,
.language-panel {
  max-width: 1334px; margin: 0 auto 28px;
  padding: 24px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border);
}

.panel-title,
.parser-header,
.translator-header,
.result-title,
.submit-row { display: flex; align-items: center; justify-content: space-between; }

.panel-title { margin-bottom: 20px; }

.panel-title p,
.parser-header p,
.translator-header p {
  margin: 0 0 6px; font-family: var(--font-mono); font-size: 12px;
  font-weight: 700; color: var(--accent-deep); text-transform: uppercase; letter-spacing: 0.04em;
}

.panel-title h2,
.parser-header h2,
.translator-header h2 {
  margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
}

/* ── Ability cards ── */
.ability-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px;
}

.single-ability { grid-template-columns: minmax(0, 1fr); max-width: 460px; }

.ability-card {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) 20px;
  align-items: center; gap: 16px;
  min-height: 140px; border-radius: var(--radius);
  padding: 20px; text-align: left;
  background: var(--bg); border: 1px solid var(--border);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.ability-card:hover {
  border-color: var(--accent-muted);
  box-shadow: 0 2px 12px oklch(0% 0 0 / 0.06);
  transform: translateY(-1px);
}

.ability-card h3 {
  margin: 0 0 6px; font-size: 18px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ability-card p {
  margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}

/* ── Translator / parser grids ── */
.translator-grid,
.parser-grid {
  display: grid; gap: 18px; margin-top: 20px;
}

.translator-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.parser-grid { grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr); }

.input-panel,
.result-panel {
  min-height: 460px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg);
  padding: 16px;
}

.model-shell .input-panel,
.model-shell .result-panel { min-height: 540px; }

.input-panel.is-disabled { opacity: 0.6; pointer-events: none; }

/* ── Mode tabs ── */
.mode-tabs {
  display: flex; gap: 2px; padding: 3px;
  border-radius: var(--radius); background: var(--bg);
  border: 1px solid var(--border);
}

.mode-tabs button {
  min-width: 88px; height: 34px; border-radius: 4px;
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 600;
  transition: background 0.12s, color 0.12s;
}

.mode-tabs button.is-active {
  background: var(--panel); color: var(--fg);
  box-shadow: 0 1px 4px oklch(0% 0 0 / 0.08);
}

/* ── Form fields ── */
.link-field,
.field-row label,
.direction-row label,
.model-options label,
.options-row label {
  display: grid; gap: 6px;
  color: var(--muted); font-size: 12px; font-weight: 600;
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.03em;
}

select, input[type="text"] {
  width: 100%; height: 40px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--panel);
  color: var(--fg); outline: 0; padding: 0 10px;
  transition: border-color 0.12s;
}

select:focus, input[type="text"]:focus { border-color: var(--accent-muted); }

textarea {
  width: 100%; resize: vertical; border: 1px solid var(--border); outline: 0;
  border-radius: var(--radius); background: var(--panel);
  padding: 12px; color: var(--fg); line-height: 1.6;
  font-family: var(--font-mono);
  transition: border-color 0.12s;
}

textarea:focus { border-color: var(--accent-muted); }

.field-row,
.direction-row,
.model-options {
  display: grid; gap: 12px; align-items: end;
}

.field-row { grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); }

.direction-row { grid-template-columns: minmax(0, 1fr); }

.model-options { grid-template-columns: 140px minmax(0, 1fr); margin-top: 12px; }

.model-options.always-visible { display: grid; }

.options-row { grid-template-columns: 150px minmax(0, 1fr); margin-top: 12px; display: grid; }

.swap-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius);
  background: var(--bg); color: var(--muted); border: 1px solid var(--border);
  transition: background 0.12s, color 0.12s;
}

.swap-button:hover { background: var(--border); color: var(--fg); }

.swap-button svg { width: 18px; height: 18px; }

.link-field textarea { min-height: 240px; }

.translator-grid textarea,
.model-shell textarea,
.link-field textarea { margin-top: 0; }

.translator-grid textarea { min-height: 320px; }

.model-shell textarea { min-height: 310px; }

/* ── Submit row ── */
.submit-row { margin-top: 12px; }

.submit-row span,
.status-text { color: var(--muted); font-size: 13px; font-family: var(--font-mono); }

.primary-button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; border-radius: var(--radius);
  padding: 0 18px; background: var(--accent);
  color: #fff; font-size: 14px; font-weight: 700;
  transition: background 0.12s, opacity 0.12s;
}

.primary-button:hover { background: var(--accent-deep); }

.primary-button:disabled { opacity: 0.6; cursor: wait; }

.primary-button svg { width: 17px; height: 17px; }

/* ── Result panel ── */
.result-title { height: 32px; color: var(--muted); font-weight: 700; font-size: 14px; }

.result-output { display: grid; gap: 12px; margin-top: 10px; }

output {
  display: block; min-height: 380px; margin-top: 10px;
  border-radius: var(--radius); background: var(--panel);
  border: 1px solid var(--border); padding: 14px;
  color: var(--fg); white-space: pre-wrap; line-height: 1.65;
  font-family: var(--font-mono); font-size: 14px;
}

.model-shell output { min-height: 420px; }

.empty-result,
.error-result {
  min-height: 380px; display: grid; place-items: center;
  border-radius: var(--radius); background: var(--bg);
  border: 1px dashed var(--border); color: var(--muted);
  text-align: center; font-family: var(--font-mono);
}

.error-result { color: var(--danger); border-color: var(--danger); }

.status-text { min-height: 20px; margin: 10px 0 0; }

/* ── Summary & media cards ── */
.summary-card,
.media-card {
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--panel); padding: 14px;
}

.summary-card h3,
.media-card h3 { margin: 0; color: var(--fg); font-size: 16px; line-height: 1.3; }

.summary-meta,
.media-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.summary-meta span,
.media-meta span,
.format-quality {
  border-radius: 999px; background: var(--accent-soft);
  padding: 4px 10px; color: var(--accent-deep);
  font-size: 12px; font-weight: 700; font-family: var(--font-mono);
}

.media-card-header { display: flex; align-items: center; gap: 10px; }

.media-actions { display: flex; flex-shrink: 0; gap: 6px; }

.small-link,
.copy-link {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 30px; border-radius: var(--radius);
  padding: 0 10px; background: var(--bg);
  color: var(--muted); font-size: 12px; font-weight: 600;
  transition: background 0.12s, color 0.12s;
}

.small-link:hover, .copy-link:hover { background: var(--border); color: var(--fg); }

.small-link svg, .copy-link svg { width: 14px; height: 14px; }

.resource-url {
  display: block; margin-top: 10px; border-radius: var(--radius);
  background: var(--bg); padding: 10px 12px;
  color: var(--fg); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere;
}

/* ── Format list ── */
.format-list { display: grid; gap: 6px; margin-top: 10px; }

.format-row {
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--radius); background: var(--bg);
  padding: 8px 12px; border: 1px solid var(--border);
}

.format-row a { color: var(--accent); font-size: 12px; font-weight: 700; font-family: var(--font-mono); }

/* ── Language groups ── */
.language-groups { display: grid; gap: 20px; margin-top: 16px; }

.language-group {
  border-radius: var(--radius); background: var(--panel);
  border: 1px solid var(--border); padding: 18px;
}

.language-group-title {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}

.language-group-title h3 { margin: 0; font-size: 18px; font-weight: 700; }

.language-group-title span { color: var(--muted); font-family: var(--font-mono); font-size: 13px; }

.language-list {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
}

.language-card-item {
  border-radius: var(--radius); background: var(--bg);
  padding: 10px 12px; border: 1px solid var(--border);
}

.language-card-item strong,
.language-card-item span { display: block; }

.language-card-item strong { color: var(--fg); font-size: 14px; }

.language-card-item span { margin-top: 3px; color: var(--muted); font-size: 12px; }

/* ── Float actions ── */
.float-actions {
  position: fixed; right: 18px; bottom: 22px; display: grid; gap: 8px;
}

.float-actions button {
  width: 44px; height: 44px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--panel);
  color: var(--muted); font-size: 13px; font-weight: 600;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.float-actions button:hover { border-color: var(--accent-muted); color: var(--fg); }

.float-actions button svg { width: 18px; height: 18px; }

/* ── Responsive ── */
@media (max-width: 1380px) {
  body { min-width: 980px; }
  .workspace { padding-right: 32px; padding-left: 32px; }
}

@media (max-width: 980px) {
  body { min-width: 0; }

  .sidebar { position: static; width: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--border); }

  .official-toolbox-link { position: static; margin-top: 12px; }

  .category-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .workspace { margin-left: 0; padding: 16px; }

  .topbar, .hero-panel { align-items: stretch; flex-direction: column; }

  .search-box { width: 100%; min-width: 0; }

  .translator-grid, .parser-grid, .options-row { grid-template-columns: 1fr; }

  .field-row { grid-template-columns: 1fr; }

  .swap-button { display: none; }

  .model-options { grid-template-columns: 1fr; }

  .ability-grid, .language-list { grid-template-columns: 1fr; }

  .translator-header, .media-card-header, .format-row {
    align-items: stretch; flex-direction: column;
  }

  .media-actions { justify-content: flex-start; }

  .float-actions { display: none; }
}
