
.api-key-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.api-key-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.api-key-card-sub {
  font-size: 13px;
  color: var(--text-muted);
}
.api-key-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.api-key-badge--active { background: rgba(34,197,94,0.12); color: #22c55e; }
.api-key-badge--none   { background: var(--bg-elevated); color: var(--text-muted); }

.api-key-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 4px 4px 12px;
  margin-bottom: 16px;
}
.api-key-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: monospace;
  font-size: 13px;
  color: var(--text);
  letter-spacing: 0.5px;
  min-width: 0;
}
.api-key-toggle,
.api-key-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.api-key-toggle:hover,
.api-key-copy:hover { background: var(--bg-card); color: var(--text); }
.api-key-copy {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.api-key-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.api-key-revoke-btn {
  font-size: 13px;
  padding: 8px 16px;
  border-color: rgba(239,68,68,0.35);
  color: #fca5a5;
}
.api-key-revoke-btn:hover { border-color: #ef4444; color: #ef4444; }

/* ── Docs section ── */
.api-docs { max-width: 680px; }
.api-docs-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
}
.api-docs-sub {
  font-size: 14px;
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--text);
}
.api-endpoint-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.api-endpoint-row:first-of-type { border-top: 1px solid var(--border); }
.api-method {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-family: monospace;
  flex-shrink: 0;
}
.api-method--get { background: #22c55e; }
.api-path {
  font-family: monospace;
  font-size: 13px;
  color: var(--text);
  flex-shrink: 0;
}
.api-endpoint-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.api-table-wrap { overflow-x: auto; margin-bottom: 8px; }
.api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.api-table th, .api-table td {
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.api-table th { background: var(--bg-elevated); font-weight: 600; color: var(--text); }
.api-table td code { background: var(--bg-elevated); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* ── Code tabs ── */
.api-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}
.api-tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.api-tab.active { background: var(--bg-card); color: var(--text); border-bottom: 1px solid var(--bg-card); }

.api-code-block { display: none; }
.api-code-block.active { display: block; }
.api-code-block pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 6px 6px 6px;
  padding: 20px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.65;
  margin: 0 0 24px;
}
.api-code-block code { font-family: monospace; color: var(--text); }
.api-code-block .c { color: var(--text-muted); }

/* ── Slug grid ── */
.api-slug-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.api-slug-grid code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: monospace;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   FORMAT SELECTOR HERO  (CloudConvert-style)
   ═══════════════════════════════════════════════════════════════════ */

.fmx-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding: 36px 0 32px;
  flex-wrap: wrap;
}

.fmx-hero-text {
  flex: 1;
  min-width: 260px;
}
.fmx-hero-text h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.15;
}
.fmx-hero-text .lead {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.65;
  max-width: 520px;
}
.fmx-experimental {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.fmx-experimental svg { color: #f59e0b; flex-shrink: 0; }
.fmx-sibling-link {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.fmx-sibling-link svg { color: var(--text-dim); flex-shrink: 0; }
.fmx-sibling-link a { color: var(--accent); font-weight: 600; text-decoration: none; }
.fmx-sibling-link a:hover { text-decoration: underline; }

/* ── Selector wrapper ─────────────────────────────────────────────── */
.fmx-selector-wrap {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-shrink: 0;
  position: relative;
}

/* ── Format box ───────────────────────────────────────────────────── */
.fmx-box {
  position: relative;
  width: 148px;
  background: #1c1c1e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  cursor: default;
  transition: border-color 0.2s;
  z-index: 10;
}
.fmx-box:hover { border-color: rgba(255,255,255,0.18); }
.fmx-box.fmx-box--open { border-color: rgba(255,255,255,0.3); z-index: 100; }

.fmx-box--to {
  border-color: rgba(229,57,53,0.35);
  background: #1e1514;
}
.fmx-box--to:hover { border-color: rgba(229,57,53,0.55); }
.fmx-box--to.fmx-box--open { border-color: rgba(229,57,53,0.75); }

.fmx-box-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 16px 14px;
  gap: 12px;
  flex: 1;
}
.fmx-box-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.fmx-box-fmt-icon {
  width: 52px;
  height: 60px;
  object-fit: contain;
  display: block;
}
.fmx-box-label {
  font-size: 15px;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.fmx-box-label--to { color: #e57373; }

/* Chevron button */
.fmx-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 0 10px;
  background: none;
  border: none;
  border-top: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border-radius: 0 0 13px 13px;
}
.fmx-chevron:hover { color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.04); }
.fmx-box--to .fmx-chevron { border-top-color: rgba(229,57,53,0.15); color: rgba(229,57,53,0.45); }
.fmx-box--to .fmx-chevron:hover { color: rgba(229,57,53,0.85); background: rgba(229,57,53,0.06); }
.fmx-chevron[aria-expanded="true"] svg { transform: rotate(180deg); }
.fmx-chevron svg { transition: transform 0.2s; }

/* ── Connector ────────────────────────────────────────────────────── */
.fmx-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  padding-bottom: 38px; /* align with box body, not chevron */
}
.fmx-connector-line {
  width: 1px;
  flex: 1;
  max-height: 22px;
  background: linear-gradient(to bottom, transparent, rgba(229,57,53,0.4), transparent);
}
.fmx-connector-icon {
  width: 38px;
  height: 38px;
  background: #1c1514;
  border: 1px solid rgba(229,57,53,0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(229,57,53,0.8);
  flex-shrink: 0;
}
.fmx-connector-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
  margin-top: 2px;
}

/* ── Dropdown panel ───────────────────────────────────────────────── */
.fmx-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 360px;
  background: #18181a;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.4);
  z-index: 200;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.fmx-dropdown.open { display: flex; }
.fmx-dropdown--right { left: auto; right: 0; }

/* Search */
.fmx-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.3);
}
.fmx-search {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.fmx-search::placeholder { color: rgba(255,255,255,0.25); }

/* Category tabs */
.fmx-dropdown-cats {
  display: flex;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  overflow-x: auto;
  scrollbar-width: none;
}
.fmx-dropdown-cats::-webkit-scrollbar { display: none; }
.fmx-cat {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: inherit;
  flex: 0 0 auto;
  line-height: 1.4;
  box-sizing: border-box;
}
.fmx-cat:hover { color: rgba(255,255,255,0.75); background: rgba(255,255,255,0.05); }
.fmx-cat.active {
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07);
}

/* Format grid */
.fmx-grid-wrap {
  position: relative;
}
.fmx-grid-wrap::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  /* Stronger fade-to-white so users clearly see "there is more below". */
  background: linear-gradient(rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 50%, var(--bg-card, #ffffff) 100%);
  pointer-events: none;
  border-radius: 0 0 11px 11px;
  opacity: 1;
  transition: opacity 0.2s;
}
.fmx-grid-wrap.fmx-grid-wrap--at-bottom::after { opacity: 0; }
.fmx-grid-wrap.fmx-grid-wrap--no-scroll::after { opacity: 0; }
.fmx-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 10px;
  /* Cap at exactly 4 rows of format icons. Each cell ~78px tall + 4px gap
     × 3 + 20px padding = 332px. Anything beyond row 4 is scrollable, with
     a clear fade at the bottom signalling there's more content. */
  max-height: 332px;
  overflow-y: scroll;            /* always-on so users always see the bar */
  scrollbar-gutter: stable;       /* reserve space; no layout shift on hover */
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.35) rgba(15, 23, 42, 0.08);
}
.fmx-grid::-webkit-scrollbar { width: 8px; }
.fmx-grid::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.05); border-radius: 99px; }
.fmx-grid::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.32); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
.fmx-grid::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.55); background-clip: padding-box; }

.fmx-fmt-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 7px;
  color: rgba(255,255,255,0.6);
  font-size: 10px;
  font-weight: 600;
  padding: 7px 4px 5px;
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.04em;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  font-family: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.fmx-fmt-btn img { width: 22px; height: 25px; object-fit: contain; flex-shrink: 0; display: block; }
.fmx-fmt-btn:hover {
  background: rgba(255,255,255,0.09);
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
}
.fmx-fmt-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.fmx-fmt-btn--active:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.fmx-no-results {
  grid-column: 1 / -1;
  text-align: center;
  color: rgba(255,255,255,0.25);
  font-size: 13px;
  padding: 20px 0;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .fmx-hero { flex-direction: column; align-items: flex-start; }
  .fmx-selector-wrap { align-self: center; }
}
@media (max-width: 640px) {
  /* Tighten hero vertical space */
  .fmx-hero { padding: 14px 0 10px; gap: 10px; }
  .fmx-hero-text h1 { font-size: 1.35rem; margin-bottom: 4px; }
  .fmx-hero-text .lead { font-size: 13px; line-height: 1.5; }

  /* Half-size cards */
  .fmx-box { width: 80px; border-radius: 10px; }
  .fmx-box-inner { padding: 8px 8px 6px; gap: 4px; }
  .fmx-box-fmt-icon { width: 22px; height: 26px; }
  .fmx-box-label { font-size: 11px; letter-spacing: 0.03em; }
  .fmx-chevron { padding: 4px 0 5px; }
  .fmx-chevron svg { width: 11px; height: 11px; }

  /* Horizontal connector */
  .fmx-connector {
    flex-direction: row;
    align-items: center;
    padding-bottom: 18px;
    gap: 0;
  }
  .fmx-connector-line {
    width: 12px;
    max-height: none;
    height: 1px;
    flex: none;
    background: linear-gradient(to right, transparent, rgba(229,57,53,0.45), transparent);
  }
  .fmx-connector-icon { width: 26px; height: 26px; }
  .fmx-connector-icon svg { width: 12px; height: 12px; }
  .fmx-connector-label { display: none; }

  .fmx-dropdown, .fmx-dropdown--right { width: calc(100vw - 32px); left: 0; right: auto; }
}

/* ── Guide & Tips sections ──────────────────────────────────────────────── */
.guide-body {
  max-width: 720px;
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.8;
}
.guide-body p { margin-bottom: 14px; }
.guide-body p:last-child { margin-bottom: 0; }
.guide-body strong { color: var(--text); }

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 720px;
}
.tips-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}
.tips-list li::before {
  content: "";
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-top: 7px;
}

/* ── Formats Involved cards (CloudConvert-style) ────────────────────────── */
.fi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) { .fi-grid { grid-template-columns: 1fr; } }

.fi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s;
}
.fi-card:hover { border-color: var(--border-subtle); }

.fi-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.fi-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fi-icon--from {
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
}
.fi-icon--to {
  background: var(--accent-dim);
  color: var(--accent);
}

.fi-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.fi-fullname {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.fi-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.7;
  flex: 1;
}

.fi-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  margin-top: 4px;
}
.fi-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* ════════════════════════════════════════════════════════════════════════════
   LIGHT-THEME OVERRIDES
   All component-specific dark hardcodes overridden here for light mode.
   ════════════════════════════════════════════════════════════════════════════ */

/* body & page */
body { background: var(--bg); color: var(--text); }

/* drawer */
.drawer { background: var(--bg-elevated); border-right-color: var(--border); }
.drawer-nav a { color: var(--text-muted); }
.drawer-nav a:hover { color: var(--text); }

/* sections */
.section-label { color: var(--text-dim); }
.section-label svg { stroke: var(--text-dim); }
.step-card { background: var(--bg-card); border-color: var(--border); }
.step-num { background: var(--accent); color: #fff; }
.faq-item { border-color: var(--border); }
.faq-question { color: var(--text); }
.faq-answer { color: var(--text-muted); }
.chip { background: var(--bg-card); border-color: var(--border); color: var(--text-muted); }
.chip:hover { background: var(--bg-card-hover); color: var(--text); border-color: #ccc; }
.tool-card { background: var(--bg-card); border-color: var(--border); }
.tool-card:hover { border-color: var(--accent); }
.tool-fmt { color: var(--text-dim); }
.tool-name { color: var(--text-muted); }
.format-reference { background: var(--bg-card); border-color: var(--border); }
.format-ref-content p { color: var(--text-muted); }

/* converter workspace */
.cv-workspace { background: var(--bg-card); border-color: var(--border); box-shadow: var(--shadow); }
.cv-dropzone { border-color: var(--border); background: #f7f8fb; }
.cv-dropzone:hover, .cv-dropzone.drag-over { border-color: var(--accent); background: rgba(229,57,53,0.03); }
.cv-drop-title { color: var(--text); }
.cv-drop-sub { color: var(--text-muted); }
.cv-file-row { border-color: var(--border); background: var(--bg); }
.cv-file-meta .cv-file-name { color: var(--text); }
.cv-file-meta .cv-file-info { color: var(--text-muted); }
.cv-file-fmt { color: var(--text-muted); }
.cv-fmt-from-badge, .cv-fmt-to-badge { background: var(--bg-card-hover); color: var(--text); border-color: var(--border); }
.cv-row-remove { color: var(--text-dim); }
.cv-row-remove:hover { color: var(--text); background: var(--bg-card-hover); }
.cv-row-progress { background: var(--border); }
.cv-options-row { background: var(--bg); border-top-color: var(--border); }
.cv-opt-label { color: var(--text-muted); }
.cv-select { background: var(--bg-card); border-color: var(--border); color: var(--text); }
.cv-select:focus { border-color: var(--accent); }
.cv-input-num { background: var(--bg-card); border-color: var(--border); color: var(--text); }
.cv-download-row { background: var(--bg); border-top-color: var(--border); }
.cv-dl-name { color: var(--text); }
.cv-dl-size { color: var(--text-muted); }
.cv-action-bar { background: var(--bg-card); border-top-color: var(--border); box-shadow: 0 -2px 12px rgba(0,0,0,0.15); }
.cv-action-info { color: var(--text-muted); }
.cv-quota-bar { background: var(--border); }
#cv-quota-text { color: var(--text-dim); }
.cv-trust { color: var(--accent); }
.cv-trust svg { stroke: var(--accent); }

/* fmx hero - format selector boxes */
.fmx-hero-text h1 { color: var(--text); }
.fmx-hero-text .lead { color: var(--text-muted); }

.fmx-box {
  background: var(--bg-card);
  border-color: var(--border);
}
.fmx-box:hover { border-color: #bbb; }
.fmx-box.fmx-box--open { border-color: #999; }

.fmx-box--to {
  background: rgba(229,57,53,0.04);
  border-color: rgba(229,57,53,0.3);
}
.fmx-box--to:hover { border-color: rgba(229,57,53,0.5); }
.fmx-box--to.fmx-box--open { border-color: rgba(229,57,53,0.7); }

.fmx-box-label { color: var(--text); }
.fmx-box-label--to { color: var(--accent); }

.fmx-chevron {
  border-top-color: var(--border);
  color: var(--text-dim);
}
.fmx-chevron:hover { color: var(--text); background: var(--bg-card-hover); }
.fmx-box--to .fmx-chevron { border-top-color: rgba(229,57,53,0.12); color: rgba(229,57,53,0.5); }
.fmx-box--to .fmx-chevron:hover { color: var(--accent); background: rgba(229,57,53,0.06); }

.fmx-connector-line { background: linear-gradient(to bottom, transparent, rgba(229,57,53,0.3), transparent); }
.fmx-connector-icon {
  background: rgba(229,57,53,0.06);
  border-color: rgba(229,57,53,0.3);
  color: var(--accent);
}
.fmx-connector-label { color: var(--text-dim); }

/* fmx dropdown panel */
.fmx-dropdown {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: 0 8px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
}
.fmx-search-wrap {
  border-bottom-color: var(--border);
  color: var(--text-dim);
}
.fmx-search { background: transparent; color: var(--text); }
.fmx-search::placeholder { color: var(--text-dim); }
.fmx-search:focus { outline: none; }
.fmx-dropdown-cats { border-bottom-color: var(--border); }
.fmx-cat { color: var(--text-muted); border-color: transparent; background: transparent; }
.fmx-cat:hover { color: var(--text); background: var(--bg-card-hover); }
.fmx-cat.active { color: var(--text); border-color: var(--border); background: var(--bg-card-hover); }
.fmx-grid-wrap::after { background: linear-gradient(transparent, var(--bg-elevated)); }
.fmx-grid { scrollbar-color: #c0c0cc rgba(0,0,0,0.04); }
.fmx-grid::-webkit-scrollbar-track { background: rgba(0,0,0,0.04); }
.fmx-grid::-webkit-scrollbar-thumb { background: #c0c0cc; }
.fmx-no-results { color: var(--text-dim); }
.fmx-fmt-btn {
  background: var(--bg-card-hover);
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 10px;
}
.fmx-fmt-btn:hover { background: var(--bg-card); color: var(--text); border-color: #bbb; }
.fmx-fmt-btn--active { background: var(--accent); border-color: var(--accent); color: #fff; }
.fmx-fmt-btn--active:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* fmx breadcrumb */
.breadcrumb a, .breadcrumb .sep { color: var(--text-dim); }
.breadcrumb .current { color: var(--text-muted); }

/* fi-cards (Formats Involved) */
.fi-card { background: var(--bg-card); border-color: var(--border); }
.fi-icon--from { background: rgba(0,0,0,0.05); color: var(--text-muted); }
.fi-icon--to { background: var(--accent-dim); color: var(--accent); }
.fi-name { color: var(--text); }
.fi-fullname { color: var(--text-dim); }
.fi-desc { color: var(--text-muted); }

/* guide & tips */
.guide-body { color: var(--text-muted); }
.guide-body p { color: var(--text-muted); }

/* footer */
.site-footer { background: var(--bg-elevated); border-top: 1px solid var(--border); }
.site-footer h3 { color: var(--text); }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }
.footer-bottom p { color: var(--text-dim); }

/* flash */
.flash-success { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.flash-danger  { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.flash-warning { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.flash-info    { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }

/* ── Blog post layout ─────────────────────────────────────────────────────── */
.bp-outer { max-width: 1200px; }   /* match .main-content default */

.bp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;  /* let article grow into available space */
  gap: 64px;
  align-items: start;
  margin-top: 32px;
}

/* Constrain the prose itself for readability while the column may be wider */
.bp-article .bp-body {
  max-width: 760px;
}

/* Featured image generated by gen_blog_image.py — sits above the body
   prose so it reads as a hero (same URL is also the og:image) */
.bp-featured {
  margin: 24px 0 28px;
  max-width: 760px;
}
.bp-featured img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* ── Mobile-only featured-image polish ───────────────────────────────────
   On phones the 1200×630 hero looked oversized + cropped. Switch to a
   smaller inline image, rounded only on the right + bottom-right, with a
   light fade on the LEFT edge so it bleeds into the page background. */
@media (max-width: 640px) {
  .bp-featured {
    margin: 18px 0 22px;
    max-width: 100%;
    /* Pull the figure right to the edge so the rounded-right looks intentional */
    margin-right: 0;
  }
  .bp-featured img {
    /* Show the image at its natural aspect ratio — no forced crop. */
    height: auto;
    object-fit: contain;
    /* Rounded ONLY on the right side, square on the left */
    border-radius: 0 14px 14px 0;
    /* Remove the all-around border that was clipping the rounded look */
    border: none;
    /* Light fade on the LEFT edge — image fades to transparent over ~28px */
    -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,0) 0, rgba(0,0,0,1) 28px);
            mask-image: linear-gradient(to right, rgba(0,0,0,0) 0, rgba(0,0,0,1) 28px);
  }
}

@media (max-width: 960px) {
  .bp-layout { grid-template-columns: 1fr; gap: 32px; }
}

/* Article column */
.bp-article { min-width: 0; }

.bp-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 10px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.bp-meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 36px;
}

.bp-back {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.bp-back a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}
.bp-back a:hover { color: var(--accent); }

/* Article body typography */
.bp-body { line-height: 1.8; }

.bp-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 40px 0 12px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.bp-body h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 28px 0 10px;
  color: var(--text);
}

.bp-body h4 {
  font-size: .95rem;
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--text);
}

.bp-body p {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.8;
}

.bp-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.bp-body a:hover { opacity: .8; }

.bp-body ul,
.bp-body ol {
  font-size: 15px;
  color: var(--text-muted);
  padding-left: 22px;
  margin-bottom: 20px;
  line-height: 1.8;
}

.bp-body li { margin-bottom: 6px; }

.bp-body strong { color: var(--text); font-weight: 600; }

.bp-body em { font-style: italic; color: var(--text-muted); }

.bp-body hr { display: none; }

/* Tables */
.bp-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 24px 0 32px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.bp-body th {
  background: var(--bg-inset);
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.bp-body td {
  padding: 10px 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle, var(--border));
  vertical-align: top;
}

.bp-body tr:last-child td { border-bottom: none; }
.bp-body tr:nth-child(even) td { background: var(--bg-inset); }

/* Code */
.bp-body code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 13px;
  background: var(--bg-inset);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.bp-body pre {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 20px 0;
}

.bp-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--text);
}

/* Blockquote / key point */
.bp-body blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-dim, rgba(59,130,246,.06));
  margin: 24px 0;
  padding: 14px 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
  color: var(--text-muted);
}

.bp-body blockquote p { margin-bottom: 0; }

/* Sidebar */
.bp-sidebar { position: sticky; top: 88px; }

.bp-sidebar-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.bp-sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.bp-sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.bp-sidebar-links li { margin-bottom: 2px; }

.bp-sidebar-links a {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 0;
  border-bottom: 1px solid transparent;
  transition: color .15s;
}

.bp-sidebar-links a:hover { color: var(--accent); }

.bp-sidebar-all-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.bp-sidebar-all-link:hover { opacity: .8; }

.bp-sidebar-cta {
  background: var(--accent-dim, rgba(59,130,246,.08));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 20px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 860px) {
  .bp-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .bp-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .bp-sidebar-cta { grid-column: 1 / -1; }
  .bp-title { font-size: 1.5rem; }
}

@media (max-width: 500px) {
  .bp-sidebar { grid-template-columns: 1fr; }
}

/* blog/pages */
.prose { color: var(--text); }
.prose h2, .prose h3 { color: var(--text); }
.prose p, .prose li { color: var(--text-muted); }
.prose code { background: var(--bg-card-hover); color: var(--text); }
.prose blockquote { border-left-color: var(--border); color: var(--text-muted); }

/* ── Fix guide/tips full width ── */
.guide-body { max-width: 100%; }
.tips-list   { max-width: 100%; }

/* ── Nav tools dropdown ── */
.nav-tools-wrap { position: relative; }

/* Legacy single-button (still used for any nav item that hasn't been
   converted to the split-button pattern) */
.nav-tools-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,0.65);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}
.nav-tools-btn:hover,
.nav-tools-btn.open { color: #ffffff; background: rgba(255,255,255,0.09); }
.nav-tools-btn svg { transition: transform 0.18s; }
.nav-tools-btn.open svg { transform: rotate(180deg); }

/* ── NEW: split-button pattern ──
   Clicking the text goes to the destination page.
   Clicking the chevron toggles the dropdown.
   Visually still one pill, with a 1px divider between the two halves. */
.nav-tools-wrap--split {
  display: inline-flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.nav-tools-wrap--split:hover,
/* Highlight the WHOLE pill (link + chevron) when either the page is active
   or the dropdown is open. Previously the active-page bg only applied to the
   <a> half, leaving the chevron unstyled — looked like a broken half-pill. */
.nav-tools-wrap--split:has(.open),
.nav-tools-wrap--split:has(.nav-tools-link.active),
.nav-tools-wrap--split:has(.nav-tools-chevron.active) {
  background: rgba(255,255,255,0.09);
  border-radius: var(--radius-sm);
}
.nav-tools-wrap--split:has(.nav-tools-link.active) .nav-tools-link,
.nav-tools-wrap--split:has(.open) .nav-tools-link {
  background: transparent !important;
}
.nav-tools-link {
  display: inline-flex;
  align-items: center;
  color: rgba(255,255,255,0.65);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px 6px 12px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-tools-link:hover,
.nav-tools-link.active { color: #ffffff; }
.nav-tools-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  padding: 6px 4px 6px 4px;
  border: none;
  border-left: 1px solid rgba(255,255,255,0.10);
  background: transparent;
  color: rgba(255,255,255,0.55);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-tools-chevron:hover,
.nav-tools-chevron.open,
.nav-tools-chevron.active { color: #ffffff; }
.nav-tools-chevron svg { transition: transform 0.18s; }
.nav-tools-chevron.open svg { transform: rotate(180deg); }

/* Links inside the dropdown sit on white, so override the nav's white-text rule */
.nav-desktop .nav-tools-dropdown a { color: var(--text-muted); padding: 0; background: none; }
.nav-desktop .nav-tools-dropdown a:hover { color: var(--text); background: none; }
.nav-desktop .ntd-all { color: var(--accent); }
.nav-desktop .ntd-all:hover { color: var(--accent-hover); }

.nav-tools-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  /* Anchor right-side so the wide dropdown doesn't overflow viewport. */
  right: 0;
  left: auto;
  width: 880px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  z-index: 500;
  padding: 14px 16px;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
  max-height: 480px;
  overflow: hidden;
}
.nav-tools-dropdown.open { display: grid; }
.ntd-col {
  display: block;        /* allow CSS columns to split the link list */
  column-count: 2;
  column-gap: 14px;
  max-height: 420px;
  padding-right: 4px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.ntd-col .ntd-heading { column-span: all; }
.ntd-col .ntd-link    { break-inside: avoid; }
.ntd-heading {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.ntd-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12.5px;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.ntd-link:hover { background: var(--bg-card-hover); color: var(--text); }
.ntd-icon {
  width: 22px;
  height: 25px;
  flex-shrink: 0;
  object-fit: contain;
}
.ntd-link-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
}
.ntd-fmt-from {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.ntd-arrow {
  color: var(--text-dim);
  font-size: 11px;
}
.ntd-fmt-to {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.ntd-link:hover .ntd-fmt-from { color: var(--text); }
.ntd-link:hover .ntd-arrow { color: var(--text-muted); }
.ntd-all {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.ntd-all:hover { text-decoration: underline; }
.ntd-pillar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  grid-column: 1 / -1;
}
.ntd-pillar-link {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-dim);
  white-space: nowrap;
}
.ntd-pillar-link:hover { background: var(--accent); color: #fff; }

/* ── Related Tools section ── */
.related-tools-section {
  margin-top: 56px;
  padding-top: 0;
}
.related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.related-tool-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.14s, background 0.14s, transform 0.12s;
}
.related-tool-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.related-tool-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.related-tool-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.related-tool-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.related-tool-desc {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.35;
}

/* ── AI Tools nav dropdown ── */
.ai-tools-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
  z-index: 600;
  padding: 12px;
}
.ai-tools-dropdown.open { display: block; }
.ai-tools-heading {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.ai-tools-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-desktop .ai-tools-dropdown a { padding: 0; background: none; color: inherit; }
.nav-desktop .ai-tools-dropdown a:hover { background: none; }
.ai-tool-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.14s, border-color 0.14s;
  cursor: pointer;
  width: 100%;
}