/* EE-Hammer home menu — EE-Hammer visual language
   Tokens mirror ee-hammer.com and the other tools (impedance solver, filter calculator, Smith chart tool). */

:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f6f8fa;
  --border: #d5dbe3;
  --text: #17202a;
  --muted: #586574;
  --accent: #0b5cad;
  --accent-ink: #ffffff;
  --accent-soft: #e4effb;
  --ok: #12805c;
  --ok-soft: #e3f5ee;
  --warn: #b5651d;
  --warn-soft: #fbf0e4;
  --input: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 6px rgba(16, 24, 40, .05);
  --shadow-hover: 0 2px 4px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .10);
  --btn2: #dde3ea;
  --btn2-border: #c3ccd7;
  --btn2-hover: #d2d9e2;
  --art-bg: #0a1628;
  --hot: #d9480f;
  --hot-ink: #ffffff;
  --hot-soft: #fff1e6;
  --hot-ring: rgba(217, 72, 15, .14);
  --radius: 8px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f141a;
  --panel: #171e26;
  --panel-2: #1c242e;
  --border: #2c3744;
  --text: #e3e9ef;
  --muted: #95a3b2;
  --accent: #4d9be8;
  --accent-ink: #0b1420;
  --accent-soft: #1b2e44;
  --ok: #4cc79a;
  --ok-soft: #133229;
  --warn: #e0a060;
  --warn-soft: #34261a;
  --input: #10161d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 1px 6px rgba(0, 0, 0, .25);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .45);
  --btn2: #26313d;
  --btn2-border: #34414f;
  --btn2-hover: #2e3a48;
  --hot: #ff8a3d;
  --hot-ink: #1a0d04;
  --hot-soft: #3a2112;
  --hot-ring: rgba(255, 138, 61, .16);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

/* ------------------------------------------------------------- header */
.top {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-icon {
  width: 30px; height: 30px; border-radius: 7px; flex: none;
  background: var(--accent); display: grid; place-items: center;
}
.brand-icon svg { width: 20px; height: 20px; }
.brand-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.pill:hover { background: var(--panel-2); }
.pill.muted { color: var(--muted); cursor: default; }
.langs { display: flex; align-items: center; gap: 6px; }
.flag {
  display: block; width: 30px; height: 20px; padding: 0; line-height: 0; overflow: hidden; cursor: pointer;
  background: none; border: 1px solid var(--border); border-radius: 3px; opacity: .5;
}
.flag svg { display: block; width: 100%; height: 100%; }
.flag:hover { opacity: .85; }
.flag.on { opacity: 1; outline: 2px solid var(--accent); outline-offset: 1px; }

/* --------------------------------------------------------------- page */
main { max-width: 1180px; margin: 0 auto; padding: 20px 24px 8px; }
h1 { font-size: 20px; margin: 4px 0 4px; }
.lead { color: var(--muted); font-size: 13px; margin: 0 0 14px; max-width: 760px; }
.title-row { display: flex; align-items: flex-start; gap: 16px; }
.title-row > div:first-child { flex: 1; min-width: 0; }
.title-row .support { margin-top: 4px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 13px; text-decoration: none;
  border-radius: 6px; padding: 7px 14px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--btn2); border-color: var(--btn2-border); color: var(--text); }
.btn.secondary:hover { background: var(--btn2-hover); filter: none; }
.btn.support { padding: 4px 9px; }
.cup-ol { stroke: #5a3d12; }
:root[data-theme="dark"] .cup-ol { stroke: #f2d27a; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ toolbar */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--panel); }
.seg button {
  font: inherit; font-size: 12.5px; padding: 6px 13px; border: 0; cursor: pointer;
  background: var(--panel); color: var(--muted); white-space: nowrap;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--panel-2); color: var(--text); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.search {
  display: flex; align-items: center; gap: 8px; flex: 0 1 300px; min-width: 0;
  background: var(--input); border: 1px solid var(--border); border-radius: 6px; padding: 0 8px; color: var(--muted);
}
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; padding: 6px 0;
}
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search kbd {
  font: 11px/1 ui-monospace, Consolas, monospace; color: var(--muted);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px;
}
.search:focus-within kbd { display: none; }
.count { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------- tool cards */
.apps { display: flex; flex-direction: column; gap: 14px; }
.app {
  display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 22px; align-items: start;
  padding: 14px; transition: border-color .2s, box-shadow .2s;
}
.app:hover, .app:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow-hover); }

.app-art {
  display: block; position: relative; overflow: hidden; border-radius: 6px;
  width: 100%; aspect-ratio: 4 / 3; background: var(--art-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.app-art img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform .45s cubic-bezier(.2, .7, .2, 1);
}
.app:hover .app-art img { transform: scale(1.03); }
.app-art::after { /* soft inner edge so the art sits in the card */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25), inset 0 -40px 60px -40px rgba(0, 0, 0, .35);
}

.app-info { display: flex; flex-direction: column; align-self: stretch; min-width: 0; padding: 4px 6px 2px 0; }
.app-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.num { font: 600 11px/1 ui-monospace, Consolas, monospace; color: var(--muted); letter-spacing: .04em; margin-right: 2px; }
.tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.tag.badge { background: var(--accent); color: var(--accent-ink); }
.tag.badge.beta { background: var(--warn-soft); color: var(--warn); }
.tag.badge.updated { background: var(--ok-soft); color: var(--ok); }
.app h2 { font-size: 19px; line-height: 1.25; margin: 0 0 3px; }
.app h2 a { color: var(--text); text-decoration: none; }
.app h2 a:hover { color: var(--accent); }
.app-tagline { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
/* "NEW Feature!" callout (apps.js `highlight`) */
.app-new {
  display: flex; gap: 12px; align-items: flex-start; margin: 0 0 14px; padding: 11px 14px;
  border: 1px solid var(--hot); border-radius: var(--radius); color: var(--text); text-decoration: none;
  background: linear-gradient(120deg, var(--hot-soft), var(--panel) 90%);
  box-shadow: 0 0 0 3px var(--hot-ring); max-width: 68ch;
  transition: box-shadow .2s, transform .2s;
}
.app-new:hover { box-shadow: 0 0 0 5px var(--hot-ring); transform: translateY(-1px); }
.app-new:focus-visible { outline: 2px solid var(--hot); outline-offset: 3px; }
.app-new-icon {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; margin-top: 2px;
  border-radius: 50%; background: var(--hot); color: var(--hot-ink); animation: hot-pulse 2.4s ease-in-out infinite;
}
.app-new-icon svg { width: 17px; height: 17px; }
.app-new-body { display: flex; flex-direction: column; min-width: 0; }
.app-new-label { font-size: 11px; font-weight: 800; letter-spacing: .05em; color: var(--hot); }
.app-new-title { font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.app-new:hover .app-new-title { color: var(--hot); }
.app-new-text { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
@keyframes hot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--hot-ring); }
  50% { box-shadow: 0 0 0 6px var(--hot-ring); }
}
.app-desc { margin: 0 0 12px; font-size: 13.5px; max-width: 68ch; }
.app-features {
  list-style: none; margin: 0 0 16px; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 20px; font-size: 12.5px;
}
.app-features li { display: flex; gap: 8px; align-items: flex-start; color: var(--text); }
.app-features svg { flex: none; width: 15px; height: 15px; margin-top: 1px; color: var(--accent); }
.app-actions { margin-top: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.app-actions .btn svg { width: 15px; height: 15px; transition: transform .2s; }
.app-actions .btn:hover svg { transform: translateX(2px); }

.empty { padding: 28px 20px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 12px; }

/* -------------------------------------------------------------- footer */
footer { max-width: 1180px; margin: 0 auto; padding: 18px 24px 28px; font-size: 11.5px; color: var(--muted); }
footer p { margin: 2px 0; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .app-art img, .app-actions .btn svg, .app-new { transition: none; }
  .app-new-icon { animation: none; }
  .app-new:hover { transform: none; }
  .app:hover .app-art img { transform: none; }
}

/* ----------------------------------------------------------- responsive */
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 18px; }
  .app-features { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; gap: 14px; padding: 12px; }
  .app-info { padding: 0 2px; }
  .title-row { gap: 10px; }
}
@media (max-width: 560px) {
  .top { padding: 8px 16px; flex-wrap: wrap; row-gap: 8px; }
  .flag { width: 27px; height: 18px; }
  main { padding: 14px 16px 6px; }
  footer { padding: 12px 16px 24px; }
  .brand-sub, #liveBadge { display: none; }
  .toolbar { gap: 10px; }
  /* categories become wrapping chips */
  .seg { flex-wrap: wrap; gap: 6px; border: 0; background: none; overflow: visible; }
  .seg button, .seg button + button { border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; }
  .seg button.on { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
  .search { flex: 1 1 100%; order: 3; }
  .search kbd { display: none; }
  .count { margin-left: 0; order: 4; }
}
