/* ==========================================================================
   DevKit — design system
   ========================================================================== */

:root {
  color-scheme: light;

  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-sunken: #f1f3f6;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --overlay: #ffffff;

  --border: #e4e7ec;
  --border-strong: #d4d8e0;

  --text: #101828;
  --text-muted: #667085;
  --text-faint: #98a2b3;

  --accent: #5b5bd6;
  --accent-hover: #4a4ac4;
  --accent-soft: #eeeefc;
  --accent-contrast: #ffffff;

  --success: #12805c;
  --success-soft: #e6f6f0;
  --danger: #c8322e;
  --danger-soft: #fdeceb;
  --warn: #a35a00;
  --warn-soft: #fdf3e5;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 16px 40px -8px rgba(16, 24, 40, .16), 0 4px 8px -4px rgba(16, 24, 40, .06);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --nav-h: 60px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0d0e12;
  --bg-soft: #131419;
  --bg-sunken: #0a0b0e;
  --surface: #16171d;
  --surface-2: #1b1d24;
  --overlay: #1b1d24;

  --border: #26282f;
  --border-strong: #363943;

  --text: #eceef2;
  --text-muted: #949aa8;
  --text-faint: #6c7280;

  --accent: #8b8bf5;
  --accent-hover: #a0a0f8;
  --accent-soft: #1e1f38;
  --accent-contrast: #0d0e12;

  --success: #3dd9a0;
  --success-soft: #0f2820;
  --danger: #ff6b66;
  --danger-soft: #2c1414;
  --warn: #e5a04a;
  --warn-soft: #2a1f0e;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, .5);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }

::selection { background: var(--accent-soft); color: var(--text); }

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

/* --- Navbar --------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -.02em;
  color: var(--text);
  flex: 0 0 auto;
}
.nav__brand:hover { text-decoration: none; }

.nav__mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}

.nav__center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.nav__end { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }

.nav__links {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav__links::-webkit-scrollbar { display: none; }

.nav__link {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color .12s, background .12s;
}
.nav__link:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav__link[aria-current="page"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 5px 12px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; }

/* --- Layout --------------------------------------------------------------- */

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}
.page--wide { max-width: 1600px; }

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 6px 0 0; color: var(--text-muted); font-size: 13.5px; max-width: 70ch; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card__title { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.card__body { padding: 16px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
/* Let wide children (tables, long field names) scroll rather than stretch the
   column past the viewport. */
.grid-2 > * { min-width: 0; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }

/* --- Controls ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
.btn:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn svg { width: 14px; height: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .01em;
}
.hint { font-size: 12px; color: var(--text-faint); }

.input, .select, .textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }

.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23667085' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px;
  cursor: pointer;
}

.textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  tab-size: 2;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  color: var(--text-muted);
}
.check input,
.ms__opt input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-content: center;
  flex: 0 0 auto;
  transition: background .12s, border-color .12s;
}
.check input::after,
.ms__opt input[type="checkbox"]::after {
  content: "";
  width: 9px;
  height: 9px;
  transform: scale(0);
  transition: transform .1s ease-out;
  background: var(--accent-contrast);
  clip-path: polygon(14% 44%, 0 65%, 40% 100%, 100% 16%, 82% 0%, 37% 62%);
}
.check input:checked,
.ms__opt input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after,
.ms__opt input[type="checkbox"]:checked::after { transform: scale(1); }
.check:hover { color: var(--text); }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}
.seg button {
  padding: 4px 11px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}
.seg button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* --- Multi-select --------------------------------------------------------- */

.ms { position: relative; }

.ms__control {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.ms__control:hover { border-color: var(--border-strong); }
.ms__control[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ms__value { flex: 1 1 auto; min-width: 0; color: var(--text-muted); }
.ms__value--filled { color: var(--text); font-weight: 500; }
.ms__count {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
}
.ms__chev { flex: 0 0 auto; width: 14px; height: 14px; color: var(--text-faint); }

.ms__panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
}
.ms__panel--open { display: block; }

.ms__search {
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.ms__search:focus { outline: none; }

.ms__actions {
  display: flex;
  gap: 6px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.ms__actions button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.ms__actions button:hover { background: var(--accent-soft); }

.ms__list { max-height: 280px; overflow-y: auto; padding: 5px; }

.ms__opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.ms__opt:hover, .ms__opt[data-active="true"] { background: var(--bg-soft); }
.ms__opt input { pointer-events: none; }
.ms__opt-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms__opt-meta {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-faint);
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-sunken);
}
.ms__empty { padding: 18px; text-align: center; color: var(--text-faint); font-size: 12.5px; }

/* --- Table ---------------------------------------------------------------- */

.table-wrap {
  overflow: auto;
  max-width: 100%;
  max-height: 62vh;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
table.data th, table.data td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
}
table.data th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-soft);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
}
table.data td { color: var(--text); max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
table.data tbody tr:hover td { background: var(--bg-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num { font-family: var(--mono); color: var(--accent); }
table.data td.null { color: var(--text-faint); font-style: italic; }
table.data td.idx {
  font-family: var(--mono);
  color: var(--text-faint);
  background: var(--bg-soft);
  position: sticky;
  left: 0;
  z-index: 1;
}
table.data th.idx-head { left: 0; z-index: 3; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-sunken);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge--red { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge--amber { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge--green { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge--accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* --- Messages ------------------------------------------------------------- */

.alert {
  display: flex;
  gap: 9px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  border: 1px solid transparent;
}
.alert--error { background: var(--danger-soft); color: var(--danger); }
.alert--ok { background: var(--success-soft); color: var(--success); }
.alert--info { background: var(--bg-soft); color: var(--text-muted); border-color: var(--border); }
.alert[hidden] { display: none; }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}
.empty strong { display: block; color: var(--text-muted); font-weight: 600; margin-bottom: 3px; }

.toast-host {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 12.5px;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --- Home ----------------------------------------------------------------- */

/* Split layout: text left (with room to grow — buttons/links land here later),
   a small framed video right. Bounding the video to a fixed aspect-ratio box
   (rather than letting it size the section, as a full-bleed background would)
   is what keeps it from ever dominating the page at any viewport width. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 5vw, 56px);
  margin: 8px 0 44px;
  padding: clamp(28px, 5vw, 48px) 4px;
}

.hero__content { min-width: 0; }

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.hero__eyebrow .badge { font-size: 10px; }
.hero h1 {
  font-size: clamp(28px, 3.6vw, 42px);
  letter-spacing: -.035em;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--accent), #a855f7 60%, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  margin: 16px 0 0;
  max-width: 48ch;
  color: var(--text-muted);
  font-size: 15px;
}

.hero__media {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin-left: auto;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-soft);
  box-shadow: var(--shadow-md);
}

.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (prefers-reduced-motion: reduce) {
  .hero__video { display: none; }
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 28px 4px 8px;
  }
  .hero h1 { max-width: none; }
  .hero p { margin-inline: auto; }
  .hero__media {
    max-width: 420px;
    margin: 4px auto 0;
    aspect-ratio: 16 / 10;
    order: 2;
  }
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(266px, 1fr));
  gap: 14px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tool-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.tool-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.tool-card__icon svg { width: 18px; height: 18px; }
.tool-card h3 { font-size: 14.5px; }
.tool-card p { margin: 0; font-size: 12.5px; color: var(--text-muted); flex: 1 1 auto; }
.tool-card__go { font-size: 12px; font-weight: 600; color: var(--accent); }

.section-label {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.foot {
  border-top: 1px solid var(--border);
  padding: 22px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

/* --- Utilities ------------------------------------------------------------
   The site runs under `style-src 'self'` with no 'unsafe-inline', which means
   inline style="" attributes are blocked outright. Every one-off spacing tweak
   has to live here as a class.
   -------------------------------------------------------------------------- */

.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 14px; }
.mb-4 { margin-bottom: 16px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 14px; }
.nowrap { flex-wrap: nowrap; }

.textarea--tall { min-height: 200px; }
.textarea--json { min-height: 180px; }

.input--search { width: 180px; height: 28px; }

.offscreen { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }

.mono { font-family: var(--mono); }
.muted { color: var(--text-muted); }
.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;
}
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
