/* comparescan: dark canvas, light content boxes. */
:root {
  --bg: #0b0e13;
  --bg-2: #121722;
  --fg: #e8edf3;
  --fg-muted: #9aa7b6;
  --line: #222c39;
  --panel: #f6f8fb;
  --panel-fg: #131820;
  --panel-muted: #5f6b7a;
  --panel-line: #e1e6ec;
  --panel-link: #0b5cad;
  --accent: #3ad0c1;
  --accent-fg: #06201d;
  --link: #9cd3ff;
  --grade-a: #1f9d55;
  --grade-b: #7cb518;
  --grade-c: #d98c1f;
  --grade-d: #d0453b;
  --grade-none: #8b95a3;
  --radius: 12px;
  --radius-sm: 6px;
  --wrap: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 20% -10%, #17324a 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #1d2b3f 0%, transparent 55%);
  background-repeat: no-repeat;
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.55;
  font-size: 16px;
}
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 16px; padding-bottom: 64px; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.6rem); margin: 0 0 8px; letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; margin: 0 0 6px; }
h4 { font-size: 1rem; margin: 16px 0 6px; }
h5 { font-size: 0.95rem; margin: 14px 0 6px; }
p { margin: 0 0 12px; }
small, .muted { color: var(--fg-muted); }
.lead { font-size: 1.1rem; color: var(--fg-muted); max-width: 64ch; }
section { margin: 48px 0; }
section section { margin: 24px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.center { text-align: center; }
img { max-width: 100%; height: auto; }

/* Header and footer */
.site-header { position: sticky; top: 0; z-index: 10; backdrop-filter: blur(10px); background: rgba(11, 14, 19, 0.82); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 800; text-decoration: none; color: var(--fg); font-size: 1.15rem; letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 8px; }
.brand svg { width: 26px; height: 26px; }
.site-header nav { display: flex; gap: 4px 18px; flex-wrap: wrap; align-items: center; }
.site-header nav a { text-decoration: none; color: var(--fg-muted); font-weight: 500; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--fg); }
.site-header nav a.lang { color: var(--accent); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 0.9rem; }
.site-footer { border-top: 1px solid var(--line); color: var(--fg-muted); font-size: 0.9rem; padding: 28px 0; }
.site-footer .wrap { display: grid; gap: 8px; }

/* Buttons */
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 999px; background: var(--accent); color: var(--accent-fg);
  text-decoration: none; font-weight: 700; border: 1px solid transparent; line-height: 1.2; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--fg-muted); }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn-sm { padding: 6px 12px; font-size: 0.9rem; }

/* Hero */
.hero { margin: 40px 0 56px; max-width: 760px; }
.hero .lead { font-size: 1.15rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; }
.stats { list-style: none; padding: 0; margin: 0; display: flex; gap: 24px; flex-wrap: wrap; color: var(--fg-muted); }
.stats strong { color: var(--fg); font-size: 1.3rem; margin-right: 4px; }

/* Light panels */
.panel { background: var(--panel); color: var(--panel-fg); border-radius: var(--radius); }
.panel a { color: var(--panel-link); }
.panel .muted, .panel small, .panel-muted { color: var(--panel-muted); }
.panel .btn { color: var(--accent-fg); }
.card { padding: 16px; display: block; text-decoration: none; }
a.card:hover { outline: 2px solid var(--accent); text-decoration: none; }
.card h3 { margin: 8px 0 4px; }
.card .photo { margin: -16px -16px 12px; border-radius: var(--radius) var(--radius) 0 0; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.chip { display: inline-block; font-size: 0.8rem; padding: 2px 10px; border-radius: 999px; background: #e7ecf2; color: var(--panel-muted); }
.notice { background: var(--panel); color: var(--panel-fg); border-left: 5px solid var(--accent); padding: 12px 16px; border-radius: var(--radius-sm); margin: 16px 0; }
.notice a { color: var(--panel-link); }

/* Photos */
.photo { aspect-ratio: 1 / 1; background: #e6ebf1; overflow: hidden; display: block; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.placeholder img { object-fit: contain; padding: 18%; opacity: 0.7; }
.thumb { aspect-ratio: 16 / 9; background: #e6ebf1; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; margin: -16px -16px 12px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Comparison table: feature rows, one light box per scanner column */
.compare-scroll { overflow-x: auto; margin: 0 -16px; padding: 4px 16px 12px; }
table.compare { border-collapse: separate; border-spacing: 14px 0; margin: 0 -14px; font-size: 0.95rem; }
table.compare th, table.compare td { text-align: left; vertical-align: middle; }
table.compare thead th { background: transparent; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; padding: 0 14px 8px; }
table.compare tbody th { background: transparent; color: var(--fg-muted); font-weight: 500; padding: 10px 0; white-space: nowrap; min-width: 140px; position: sticky; left: 0; z-index: 1; }
table.compare tbody th small { display: block; font-weight: 400; color: var(--fg-muted); opacity: 0.8; }
table.compare td { background: var(--panel); color: var(--panel-fg); padding: 10px 14px; border-bottom: 1px solid var(--panel-line); min-width: 220px; max-width: 320px; }
table.compare td a { color: var(--panel-link); }
table.compare td .muted { color: var(--panel-muted); }
table.compare tr.row-photo td { padding: 0; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
table.compare tr.row-photo .photo { border-radius: var(--radius) var(--radius) 0 0; }
table.compare tr.row-name td { font-weight: 700; font-size: 1.05rem; }
table.compare tr.row-cta td { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 14px; }
table.compare tr.row-verdict td { font-size: 0.92rem; vertical-align: top; }
table.compare .raw { color: var(--panel-muted); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 8px 0 16px; font-size: 0.9rem; color: var(--fg-muted); }

/* Plain data tables inside light panels */
.table-scroll { overflow-x: auto; background: var(--panel); color: var(--panel-fg); border-radius: var(--radius); padding: 4px 14px; }
.table-scroll a { color: var(--panel-link); }
.table-scroll .muted, .table-scroll small { color: var(--panel-muted); }
table.results, .table-scroll table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.table-scroll th, .table-scroll td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--panel-line); vertical-align: top; }
.table-scroll thead th { font-weight: 600; white-space: nowrap; color: var(--panel-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table-scroll tbody tr:last-child td, .table-scroll tbody tr:last-child th { border-bottom: 0; }
.table-scroll tbody th { font-weight: 600; white-space: nowrap; }
.raw { font-variant-numeric: tabular-nums; }

/* Scores 1-5 */
.score { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #d3d9e0; display: inline-block; }
.dots i.on { background: var(--accent); }
.score-num { color: var(--panel-muted); font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.tag { display: inline-block; font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--fg-muted); margin-left: 6px; vertical-align: middle; }
.tag-draft { background: #d98c1f; color: #fff; }
/* Scan mode: infrared, visible blue light, laser. Always readable on dark and on panels. */
.tag-mode { font-weight: 700; letter-spacing: 0.01em; color: #fff; }
.tag-mode-ir { background: #7a4bd0; }
.tag-mode-blue { background: #1f6fd0; }
.tag-mode-laser { background: #c0392b; }
.tag-mode-unknown { background: var(--grade-none); }
.modes { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.modes .tag { margin-left: 0; }

/* Galleries and lightbox */
.gallery { display: grid; gap: 8px; margin: 12px 0; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.gallery-md { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.gallery-lg { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.gallery-item { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.gallery-item:hover img { transform: scale(1.03); }
dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; display: none; }
dialog.lightbox[open] { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; }
dialog.lightbox::backdrop { background: rgba(5, 8, 12, 0.92); }
dialog.lightbox figure { margin: 0; text-align: center; }
dialog.lightbox img { max-width: calc(100vw - 112px); max-height: 88vh; object-fit: contain; border-radius: var(--radius-sm); }
dialog.lightbox figcaption { color: var(--fg-muted); margin-top: 8px; font-size: 0.9rem; }
.lb-btn { background: transparent; border: 0; color: var(--fg); font-size: 2.4rem; cursor: pointer; line-height: 1; padding: 8px; }
.lb-btn:hover { color: var(--accent); }
.lb-close { position: fixed; top: 8px; right: 12px; }
.lb-prev { justify-self: center; }
.lb-next { justify-self: center; }

/* Mesh viewer */
.scan-viewer { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0 20px; overflow: hidden; }
.scan-viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.scan-viewer-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.scan-viewer-actions .btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.scan-viewer-canvas { min-height: 220px; display: grid; place-items: center; padding: 12px; }
.scan-viewer-canvas p { max-width: 48ch; text-align: center; }
.scan-viewer-canvas canvas { display: block; width: 100% !important; height: auto !important; border-radius: 0; }
.scan-viewer-status { padding: 6px 14px; margin: 0; font-size: 0.85rem; }

/* Definition lists */
dl.specs { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; background: var(--panel); color: var(--panel-fg); border-radius: var(--radius); padding: 16px 20px; }
dl.specs dt { color: var(--panel-muted); }
dl.specs dd { margin: 0; }
dl.specs a { color: var(--panel-link); }

/* Offers */
ul.offers { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 10px; }
ul.offers li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Media */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 12px; }
.gallery img { width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.video { aspect-ratio: 16 / 9; width: 100%; max-width: 820px; border: 0; border-radius: var(--radius); background: #000; }

/* Prose (markdown) */
.prose { max-width: 72ch; font-size: 1.05rem; }
.prose h2 { margin-top: 32px; }
.prose li { margin-bottom: 4px; }
.prose blockquote { border-left: 4px solid var(--accent); margin: 16px 0; padding: 4px 16px; color: var(--fg-muted); }
.prose code { background: var(--bg-2); padding: 1px 5px; border-radius: 4px; font-size: 0.95em; }
.post-meta { color: var(--fg-muted); margin-bottom: 20px; }

/* Comments: light panels on the dark canvas, same as the rest of the content */
.comments { margin-top: 56px; }
.comments-status { margin: 8px 0 16px; }
.comment-list, .comment-replies { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.comment-list { margin-bottom: 16px; }
.comment-replies { margin: 12px 0 0 20px; padding-left: 14px; border-left: 2px solid var(--line); }
.comment { padding: 14px 16px; }
.comment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.comment-head time { color: var(--panel-muted); font-size: 0.85rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; color: #fff; background: hsl(var(--h, 200) 42% 42%); }
.comment-body { font-size: 0.97rem; overflow-wrap: anywhere; }
.comment-body p { margin: 0 0 8px; }
.comment-body p:last-child { margin-bottom: 0; }
.comment-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.chip-admin { background: var(--accent); color: var(--accent-fg); font-weight: 700; }
button.linkish { background: none; border: 0; padding: 0; font: inherit; font-size: 0.85rem; color: var(--panel-link); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
button.linkish:hover { color: var(--panel-fg); }
.comment-form, .comment-login { padding: 14px 16px; display: grid; gap: 10px; max-width: 72ch; }
.comment-form textarea { width: 100%; font: inherit; font-size: 0.97rem; color: var(--panel-fg); background: #fff; border: 1px solid var(--panel-line); border-radius: var(--radius-sm); padding: 10px 12px; resize: vertical; min-height: 88px; }
.comment-form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.comment-form-bar { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.comment-form-bar .comment-counter { margin-left: auto; font-variant-numeric: tabular-nums; }
.comment-error { margin: 0; font-size: 0.9rem; color: var(--grade-d); font-weight: 600; }
.comment-login p { margin: 0; font-weight: 600; }
.comment-login-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.comment-login .btn { display: inline-flex; align-items: center; gap: 8px; }
.comment-login .btn-google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.comment-login .btn-facebook { background: #1877f2; color: #fff; }
.comment-note { margin: 10px 0 0; font-size: 0.9rem; }

@media (max-width: 640px) {
  .hero { margin: 24px 0 40px; }
  dl.specs { grid-template-columns: 1fr; }
  dl.specs dt { margin-top: 8px; }
  table.compare td { min-width: 180px; }
  table.compare tbody th { min-width: 110px; font-size: 0.85rem; }
}

@media (max-width: 520px) {
  .comment-replies { margin-left: 8px; padding-left: 10px; }
  .comment-form-bar .comment-counter { margin-left: 0; }
}

/* Editor bar: shown only to a signed-in admin */
.admin-bar { background: #3ad0c1; color: #06201d; font-size: 0.85rem; font-weight: 600; }
.admin-bar .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.admin-bar a { color: #06201d; margin-left: 14px; }
