/* Z2M Device Tracker site. Same tokens and Roboto as the sidebar, so it looks like Home Assistant. */
@font-face { font-family: "Roboto"; font-weight: 400; font-display: swap; src: url("fonts/roboto-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-display: swap; src: url("fonts/roboto-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-display: swap; src: url("fonts/roboto-latin-700-normal.woff2") format("woff2"); }

:root {
  --primary: #03a9f4;
  --primary-text: #026aa7;
  --bg: #fafafa;
  --card: #ffffff;
  --sec-bg: #f0f0f0;
  --text: #212121;
  --text-2: #727272;
  --divider: rgba(0, 0, 0, 0.12);
  --hover: rgba(0, 0, 0, 0.04);
  --success: #43a047;
  --success-text: #2e7d32;
  --success-bg: rgba(67, 160, 71, 0.12);
  --warning: #ffa600;
  --warning-text: #9b6200;
  --warning-bg: rgba(255, 166, 0, 0.14);
  --error: #db4437;
  --error-text: #c62828;
  --error-bg: rgba(219, 68, 55, 0.11);
  --chip-on: rgba(3, 169, 244, 0.14);
  --code-bg: #f3f3f3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary-text: #4fc3f7; --bg: #111111; --card: #1c1c1c; --sec-bg: #282828; --text: #e1e1e1; --text-2: #9b9b9b;
    --divider: rgba(225, 225, 225, 0.12); --hover: rgba(255, 255, 255, 0.05); --success-text: #81c784; --success-bg: rgba(67, 160, 71, 0.2);
    --warning-text: #ffc163; --warning-bg: rgba(255, 166, 0, 0.16); --error-text: #f28b82; --error-bg: rgba(219, 68, 55, 0.2);
    --chip-on: rgba(3, 169, 244, 0.22); --code-bg: #242424; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary-text: #4fc3f7; --bg: #111111; --card: #1c1c1c; --sec-bg: #282828; --text: #e1e1e1; --text-2: #9b9b9b;
  --divider: rgba(225, 225, 225, 0.12); --hover: rgba(255, 255, 255, 0.05); --success-text: #81c784; --success-bg: rgba(67, 160, 71, 0.2);
  --warning-text: #ffc163; --warning-bg: rgba(255, 166, 0, 0.16); --error-text: #f28b82; --error-bg: rgba(219, 68, 55, 0.2);
  --chip-on: rgba(3, 169, 244, 0.22); --code-bg: #242424; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.6 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--primary-text); }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.875em; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
pre { background: var(--code-bg); border: 1px solid var(--divider); border-radius: 8px; padding: 12px 16px; overflow-x: auto; line-height: 1.45; }
pre code { background: none; padding: 0; overflow-wrap: normal; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--divider); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 500; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand img { border-radius: 6px; }
.top-links { margin-left: auto; display: flex; gap: 4px; }
.top-links a { padding: 8px 12px; border-radius: 18px; white-space: nowrap; color: var(--text); text-decoration: none; font-weight: 500; font-size: 15px; }
.top-links a:hover { background: var(--hover); }
.top-links a[aria-current="page"] { background: var(--chip-on); color: var(--primary-text); }
.menu { display: none; width: 40px; height: 40px; margin-left: -8px; border: 0; border-radius: 50%; background: none; color: var(--text); cursor: pointer; }
.menu svg { width: 24px; height: 24px; fill: currentColor; }
.menu:hover { background: var(--hover); }

/* Layout */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr) 216px; gap: 32px; max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.side, .toc { position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow-y: auto; padding: 20px 0 32px; font-size: 14px; }
.side ul, .toc ul { list-style: none; margin: 0 0 12px; padding: 0; }
.side a, .toc a { display: block; padding: 5px 12px; border-radius: 8px; color: var(--text); text-decoration: none; line-height: 1.4; }
.side a:hover, .toc a:hover { background: var(--hover); }
.side a[aria-current="page"] { background: var(--chip-on); color: var(--primary-text); font-weight: 500; }
.nav-group { margin: 12px 12px 4px; font-size: 12px; font-weight: 500; color: var(--text-2); letter-spacing: 0.02em; }
.toc a { color: var(--text-2); }
.content { min-width: 0; padding: 24px 0 48px; max-width: 800px; }
.layout:not(:has(.toc)) { grid-template-columns: 248px minmax(0, 1fr); }
.layout:not(:has(.toc)) .content { max-width: 1040px; }

/* Content */
h1 { font-size: 32px; line-height: 1.2; font-weight: 400; margin: 8px 0 16px; }
h2 { font-size: 22px; line-height: 1.3; font-weight: 500; margin: 40px 0 12px; padding-top: 8px; border-top: 1px solid var(--divider); }
h3 { font-size: 18px; font-weight: 500; margin: 28px 0 8px; }
h4 { font-size: 16px; font-weight: 500; margin: 24px 0 8px; }
h2 .anchor, h3 .anchor, h4 .anchor { color: inherit; text-decoration: none; }
h2 .anchor:hover::after, h3 .anchor:hover::after { content: " #"; color: var(--text-2); }
.content img { display: block; margin: 16px auto; border: 1px solid var(--divider); border-radius: 12px; }
.content p[align="center"] img { display: inline-block; }
blockquote { margin: 16px 0; padding: 12px 16px; background: var(--chip-on); border-left: 4px solid var(--primary); border-radius: 0 8px 8px 0; }
blockquote p { margin: 0; }
.table { overflow-x: auto; margin: 16px 0; border: 1px solid var(--divider); border-radius: 12px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--divider); }
th { font-weight: 500; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
li { margin: 4px 0; }
hr { border: 0; border-top: 1px solid var(--divider); margin: 32px 0; }
.foot { padding: 24px 16px 40px; border-top: 1px solid var(--divider); text-align: center; font-size: 14px; color: var(--text-2); }
.foot a { color: var(--text-2); }

/* Ratings */
.lede { font-size: 18px; color: var(--text-2); margin-top: 0; }
.cta { margin: 20px 0 8px; padding: 14px 18px; background: var(--card); border: 1px solid var(--divider); border-left: 4px solid var(--primary); border-radius: 12px; }
.cta p { margin: 0; }
.filters { position: sticky; top: 56px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; padding: 12px 0; background: var(--bg); }
.filters[hidden] { display: none; }
.filters .search { flex: 1 1 240px; }
.filters input, .filters select { width: 100%; height: 44px; padding: 0 16px; border: 1px solid var(--divider); border-radius: 22px; background: var(--card); color: var(--text); font: inherit; font-size: 16px; }
.filters select { width: auto; padding-right: 12px; cursor: pointer; }
.filters input:focus, .filters select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.group .count { display: inline-block; min-width: 24px; margin-left: 8px; padding: 0 8px; border-radius: 12px; background: var(--sec-bg); color: var(--text-2); font-size: 14px; font-weight: 500; text-align: center; vertical-align: 3px; line-height: 24px; }
.group > p { color: var(--text-2); margin-top: 0; }
.group > p.empty { padding: 16px; border: 1px dashed var(--divider); border-radius: 12px; text-align: center; }
.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.model { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--card); border: 1px solid var(--divider); border-radius: 12px; min-width: 0; }
.model[hidden] { display: none; }
.model:target { outline: 2px solid var(--primary); }
.model > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.model .vendor { margin: 0; font-size: 13px; color: var(--text-2); }
.model h3 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.model h3 a { color: var(--primary-text); text-decoration: none; }
.model h3 a:hover { text-decoration: underline; }
.model h3 .ext { width: 14px; height: 14px; margin-left: 4px; fill: currentColor; vertical-align: 0; opacity: 0.7; }
.badge { flex: none; padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 500; line-height: 20px; }
.badge.recommended { background: var(--success-bg); color: var(--success-text); }
.badge.avoid { background: var(--error-bg); color: var(--error-text); }
.badge.mixed { background: var(--warning-bg); color: var(--warning-text); }
.badge.early { background: var(--sec-bg); color: var(--text-2); }
.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--sec-bg); }
.seg.recommend { background: var(--success); }
.seg.ok { background: var(--warning); }
.seg.avoid { background: var(--error); }
.votes { margin: -4px 0 0; font-size: 14px; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 2px 10px; border: 1px solid var(--divider); border-radius: 8px; font-size: 13px; line-height: 20px; }
.chip b { font-weight: 500; color: var(--text-2); }
.chip.good { border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.chip.bad { border-color: color-mix(in srgb, var(--error) 45%, transparent); color: var(--error-text); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 0; padding: 10px 0 0; border-top: 1px solid var(--divider); }
.facts dt { font-size: 12px; color: var(--text-2); }
.facts dd { margin: 0; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.facts-note { margin: -4px 0 0; font-size: 12px; color: var(--text-2); }
.muted { color: var(--text-2); }
details summary { cursor: pointer; font-size: 14px; font-weight: 500; color: var(--primary-text); }
.quote { margin: 8px 0 0; padding: 8px 12px; font-size: 14px; background: var(--sec-bg); border-left-color: var(--divider); }
.quote.recommend { border-left-color: var(--success); }
.quote.avoid { border-left-color: var(--error); }
.quote.ok { border-left-color: var(--warning); }
.quote p { white-space: pre-line; overflow-wrap: anywhere; }
.quote footer { margin-top: 4px; font-size: 12px; color: var(--text-2); }
.no-match { color: var(--text-2); }

/* Narrow screens: one column, guide menu behind the button */
@media (max-width: 1100px) {
  .layout, .layout:not(:has(.toc)) { grid-template-columns: 220px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 800px) {
  .menu { display: inline-flex; align-items: center; justify-content: center; }
  .brand { font-size: 16px; }
  .brand img { display: none; }
  .top-links a { padding: 8px 10px; font-size: 14px; }
  .top-links .github { display: none; }
  .layout, .layout:not(:has(.toc)) { display: block; padding: 0 16px; }
  .side { display: none; position: fixed; inset: 56px 0 0 0; z-index: 15; max-height: none; padding: 8px 16px 32px; background: var(--card); }
  .side.open { display: block; }
  h1 { font-size: 26px; }
  .facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
