/* ═══════════════════════════════════════════════════════════════
   Motor Toolkit — shared theme
   Single source of truth for colors, fonts, header, and common
   components. Every tool page loads this BEFORE its own styles.css.
   Theme switching: [data-theme="dark"] on <html>, managed by shell.js.
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables (light) ── */
:root {
  --bg:        #f1f5f9;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --text2:     #64748b;
  --text3:     #94a3b8;
  --header:    #ffffff;
  --header-t:  #1e293b;
  --input-bg:  #f8fafc;
  --hint-bg:   #f8fafc;
  --hover-bg:  #eff6ff;
  --accent:    #2563eb;
  --accent-d:  #1d4ed8;
  --accent-l:  #dbeafe;
  --red:       #dc2626;
  --green:     #059669;
  --amber:     #f59e0b;
  --metric-bg: #f8fafc;
  --bar-bg:    #e2e8f0;
  --track:     #dde1e9;
  --grid-c:    #f1f5f9;
  --tooltip-bg:#1e293b;
  --tooltip-t: #ffffff;
  --shadow:    0 1px 3px rgba(0,0,0,.06);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}
[data-theme="dark"] {
  --bg:        #0f172a;
  --surface:   #1e293b;
  --border:    #334155;
  --text:      #f1f5f9;
  --text2:     #94a3b8;
  --text3:     #64748b;
  --header:    #0f172a;
  --header-t:  #f1f5f9;
  --input-bg:  #1e293b;
  --hint-bg:   #0f172a;
  --hover-bg:  #1e3a5f;
  --accent:    #3b82f6;
  --accent-d:  #60a5fa;
  --accent-l:  #1e3a5f;
  --red:       #f87171;
  --green:     #34d399;
  --amber:     #fbbf24;
  --metric-bg: #0f172a;
  --bar-bg:    #334155;
  --track:     #334155;
  --grid-c:    #1e293b;
  --tooltip-bg:#f8fafc;
  --tooltip-t: #1e293b;
  --shadow:    0 1px 3px rgba(0,0,0,.35);
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .2s, color .2s;
}

/* ── Site header (injected by shell.js) ── */
.mt-header {
  background: var(--header);
  color: var(--header-t);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}
.mt-header-left { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.mt-site-name {
  font-size: 13px; font-weight: 600; color: var(--text2);
  text-decoration: none; white-space: nowrap; letter-spacing: .4px;
}
.mt-site-name:hover { color: var(--accent); }
.mt-page-title { font-size: 17px; font-weight: 600; }
.mt-page-sub { font-size: 12px; color: var(--text3); }
.mt-header-right { display: flex; align-items: center; gap: 8px; }

/* tools dropdown */
.mt-nav { position: relative; }
.mt-nav-btn {
  background: none; border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.mt-nav-btn:hover { background: var(--hover-bg); }
.mt-nav-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 1000;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15);
  min-width: 230px; padding: 6px; display: none;
}
.mt-nav-menu.open { display: block; }
.mt-nav-menu a {
  display: block; padding: 8px 10px; border-radius: 7px;
  color: var(--text); text-decoration: none; font-size: 13px;
}
.mt-nav-menu a:hover { background: var(--hover-bg); }
.mt-nav-menu a .mt-nav-desc { display: block; font-size: 11px; color: var(--text3); margin-top: 1px; }

/* icon button (theme toggle etc.) */
.mt-icon-btn {
  background: none; border: 1px solid var(--border); color: var(--text);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.mt-icon-btn:hover { background: var(--hover-bg); }

/* ── Common components ── */
.mt-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
}
.mt-btn {
  background: var(--accent); color: #fff; border: none;
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600;
}
.mt-btn:hover { background: var(--accent-d); }
.mt-btn-ghost {
  background: none; color: var(--text); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.mt-btn-ghost:hover { background: var(--hover-bg); }
.mt-input, .mt-select, .mt-textarea {
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; font-family: inherit;
}
.mt-textarea { font-family: var(--mono); font-size: 12px; }
.mt-input:focus, .mt-select:focus, .mt-textarea:focus {
  outline: none; border-color: var(--accent);
}
.mt-label { font-size: 12px; color: var(--text2); font-weight: 600; }

/* ── Homepage tool cards ── */
.mt-home {
  max-width: 1000px; margin: 0 auto; padding: 40px 24px 80px;
}
.mt-home-intro { margin: 8px 0 28px; color: var(--text2); font-size: 14px; }
.mt-home h1 { font-size: 26px; }
.mt-tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.mt-tool-card {
  display: block; padding: 20px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.mt-tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.mt-tool-card .mt-tool-icon { font-size: 26px; }
.mt-tool-card h2 { font-size: 16px; margin: 10px 0 6px; }
.mt-tool-card p { font-size: 13px; color: var(--text2); line-height: 1.55; }

/* ── Footer ── */
.mt-footer {
  text-align: center; padding: 28px 16px; font-size: 12px; color: var(--text3);
}
