/* VadPosts Beta 2. Hand-written, no framework, no build step.
   Every colour, the radius, the density and the sidebar width come from
   config/theme.json via a <style> block the server emits. Nothing visual is
   hard-coded here, so the Design screen can change the look without a deploy. */

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 15px/1.6 var(--font-stack);
  -webkit-font-smoothing: antialiased;
}

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

.skip {
  position: absolute; left: -9999px;
  background: var(--card); padding: 10px 14px; border-radius: var(--radius);
}
.skip:focus { left: 12px; top: 12px; z-index: 50; }

/* ---------- app shell ---------- */

body.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.side {
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; height: 100vh;
}

.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text);
  border-radius: 9px; font-weight: 800; font-size: 17px;
}
.logo-img { width: 32px; height: 32px; object-fit: contain; }
.logo-text { font-weight: 700; font-size: 15px; line-height: 1.2; letter-spacing: -0.2px; }
.logo-text em {
  display: block; font-style: normal; font-weight: 600;
  font-size: 10px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--ink-muted);
}

.ws-switch select {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px;
}

.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--ink-muted); font-weight: 600; font-size: 14px;
}
.sidenav a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.sidenav a.on { background: var(--accent); color: var(--accent-text); }
.sidenav svg { width: 17px; height: 17px; flex: none; }

.side-foot { margin-top: auto; font-size: 11px; color: var(--ink-muted); }

.shell { min-width: 0; display: flex; flex-direction: column; }

.pagehead {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px; border-bottom: 1px solid var(--line); background: var(--card);
}
.pagehead h1 { margin: 0; font-size: 20px; letter-spacing: -0.3px; }

main { padding: 24px 28px 64px; max-width: 1180px; }

@media (max-width: 860px) {
  body.app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidenav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { display: none; }
  main, .pagehead { padding-left: 16px; padding-right: 16px; }
}

/* ---------- surfaces ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.card h2 { margin: 0 0 8px; font-size: 17px; letter-spacing: -0.2px; }
.card h3 { margin: 0 0 10px; font-size: 14px; letter-spacing: 0.1px; }
.card h4 { margin: 0 0 6px; font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
.grid .card { margin: 0; }
.grid .span2 { grid-column: span 2; }
@media (max-width: 980px) { .grid { grid-template-columns: 1fr 1fr; } .grid .span2 { grid-column: span 2; } }
@media (max-width: 680px) { .grid { grid-template-columns: 1fr; } .grid .span2 { grid-column: span 1; } }

.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.muted { color: var(--ink-muted); }
.note { color: var(--ink-muted); font-size: 12.5px; margin: 8px 0 0; }

/* ---------- bits ---------- */

.stat-num { font-size: 34px; font-weight: 800; letter-spacing: -1px; display: block; line-height: 1.1; }
.stat h3 { margin: 2px 0 4px; }

.meter { height: 6px; background: var(--surface); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.meter span { display: block; height: 100%; background: var(--accent); }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.2px;
  border: 1px solid var(--line); color: var(--ink-muted); background: var(--surface);
}
.pill.ok   { color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pill.bad  { color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.pill.info { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

.tagchip {
  display: inline-block; padding: 3px 9px; margin: 0 5px 5px 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 99px; font-size: 12.5px;
}
.tags { margin-bottom: 14px; }

code {
  font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px;
}

.btn, button.primary, .btn.primary {
  display: inline-block; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: 13.5px; font-weight: 650; cursor: pointer;
}
.btn:hover { text-decoration: none; background: var(--surface); }
.primary, .btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.primary:hover { filter: brightness(1.07); }

.banner { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.banner.ok  { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.banner.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.warn-card { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }

/* ---------- tables and lists ---------- */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: var(--cell-pad); border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--ink-muted); }
tbody tr:last-child td { border-bottom: 0; }

ul.plain { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }
ul.plain li.bad { color: var(--bad); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--ink-muted); }
.facts dd { margin: 0; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a {
  padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 650;
  color: var(--ink-muted); border: 1px solid transparent;
}
.tabs a:hover { background: var(--card); text-decoration: none; }
.tabs a.on { background: var(--accent); color: var(--accent-text); }

.postlist { list-style: none; margin: 0; padding: 0; }
.postrow { margin-bottom: 10px; }
.postrow a {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; color: var(--ink);
}
.postrow a:hover { text-decoration: none; border-color: var(--accent); }
.postrow .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 7px; }
.postrow p { margin: 0; color: var(--ink-muted); font-size: 13.5px; }
.chips code { margin-right: 4px; }
.when { font-size: 12px; color: var(--ink-muted); }

ul.cards { list-style: none; margin: 0; padding: 0; }
ul.cards li {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
ul.cards li.off { opacity: 0.62; }
ul.cards h4 { margin: 6px 0 4px; font-size: 14.5px; }
ul.cards p { margin: 0; font-size: 13.5px; }

/* ---------- forms ---------- */

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.6px; }
.field .val { margin: 0; }

input[type=text], input[type=url], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px;
}
textarea.caption { font-size: 15px; line-height: 1.65; resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* Inputs inside a settings table need room; without this the label column
   collapses to a single character. Caught by looking at the rendered page. */
td input[type=text] { min-width: 9rem; padding: 6px 9px; font-size: 13px; }
td input[type=number] { width: 5rem; padding: 6px 9px; font-size: 13px; }
table th:last-child, table td:last-child { width: 1%; white-space: nowrap; }

.urlform { display: flex; gap: 8px; flex-wrap: wrap; }
.urlform input { flex: 1 1 260px; }

.formbar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; font-size: 13px;
}

/* auto-fit rather than a fixed pair: inside the narrow settings column the two
   columns squeezed the hex field down to "#1f". Caught by looking at it. */
.colorgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px; }
.colorfield { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.colorfield label { grid-column: 1 / -1; font-size: 11.5px; font-weight: 700; color: var(--ink-muted); text-transform: capitalize; }
.colorfield input[type=color] { grid-column: 2; width: 38px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.colorfield input[type=text] { grid-column: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- checks, palettes, media ---------- */

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .checks { grid-template-columns: 1fr; } }
.checkcol ul { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.checkcol li { padding: 3px 0; }
.checkcol li.pass { color: var(--ok); }
.checkcol li.fail { color: var(--bad); }

.palette { margin-bottom: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  width: 86px; height: 52px; border-radius: 8px; border: 1px solid var(--line);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px;
}
.swatch code { font-size: 10.5px; background: rgba(255,255,255,.88); color: #111; border: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.tile { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tile .thumb { aspect-ratio: 4 / 5; }
.tile figcaption { padding: 9px 11px; font-size: 12.5px; }
.tile figcaption span { display: block; color: var(--ink-muted); font-size: 11.5px; margin-top: 2px; }

.placeholder {
  display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 9px,
              color-mix(in srgb, var(--line) 55%, transparent) 9px,
              color-mix(in srgb, var(--line) 55%, transparent) 18px);
  color: var(--ink-muted); font-size: 11.5px; min-height: 100px;
}

.dot {
  display: inline-block; width: 13px; height: 13px; border-radius: 4px;
  border: 1px solid var(--line); margin-right: 6px; vertical-align: -2px;
}

.findings td:first-child { width: 1%; }
.findings td { font-size: 13px; }

ul.quotes { list-style: none; margin: 0 0 4px; padding: 0; }
ul.quotes li {
  border-left: 3px solid var(--accent); padding: 4px 0 4px 11px;
  margin-bottom: 7px; font-size: 13.5px; color: var(--ink-muted);
}

.empty { text-align: center; padding: 40px 20px; }
.empty .placeholder, .empty img {
  width: 100%; max-width: 420px; aspect-ratio: 16 / 9;
  margin: 0 auto 18px; border-radius: var(--radius); object-fit: cover;
}
.empty h3 { margin: 0 0 6px; font-size: 17px; }
.empty p { margin: 0 auto 14px; color: var(--ink-muted); max-width: 46ch; }
