/* Color Detector — clinical white design system
   Fraunces (display) + Work Sans (body)
   #ffffff bg / #2563eb accent / #0f172a text
   Editorial center. Square-ish 4px radius, flat fills, no shadows. */

:root {
  --bg: #ffffff;
  --panel: #f8fafc;
  --panel-2: #f1f5f9;
  --line: #0f172a;
  --line-soft: #e2e8f0;
  --line-mid: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --faint: #94a3b8;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --ok: #16a34a;
  --bad: #dc2626;
  --radius: 4px;
  --display: "Fraunces", Georgia, serif;
  --body: "Work Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display { font-family: var(--display); font-weight: 600; line-height: 1.12; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration: none; }
.num, .mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
code { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 0.05em 0.4em; font-size: 0.9em; }

/* ---------- top navigation ---------- */

.topnav {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 18px;
  border-bottom: 1.5px solid var(--line);
  background: var(--bg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.topnav .brand { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; flex: 0 0 auto; }
.brand-name { font-family: var(--display); font-size: 1.12rem; font-weight: 600; }
.brand-name em { color: var(--accent); font-style: italic; }
.topnav .links { display: flex; gap: 2px; margin-left: auto; flex: 0 0 auto; }
.topnav .links a {
  color: var(--muted); font-size: 0.84rem; font-weight: 500;
  padding: 6px 11px; border-radius: var(--radius);
  text-decoration: none; white-space: nowrap;
}
.topnav .links a:hover { color: var(--accent); background: var(--panel-2); }
.topnav .links a.here { background: var(--accent); color: #fff; font-weight: 600; }

/* ---------- layout ---------- */

.wrap { max-width: 780px; margin: 0 auto; padding: 0 18px 64px; }
.masthead { text-align: center; padding: 14px 0 14px; border-bottom: 1.5px solid var(--line); }
@media (min-width: 560px) { .masthead { padding: 28px 0 22px; } }
.kicker {
  display: inline-block;
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 3px 10px; margin-bottom: 10px;
  background: var(--accent-soft);
}
.masthead h1 { font-size: 2.1rem; margin: 0; }
.masthead .dek { color: var(--muted); max-width: 40em; margin: 8px auto 0; font-size: 0.93rem; }
@media (min-width: 560px) {
  .masthead h1 { font-size: 3.1rem; }
  .masthead .dek { font-size: 1.02rem; margin-top: 12px; }
}

.instrument {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  margin: 22px 0 12px;
}
.figcap {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 14px;
  font-size: 0.68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--muted);
  border-bottom: 1.5px solid var(--line-soft);
  background: var(--panel);
}
.instrument-body { padding: 16px 14px 20px; }
@media (min-width: 560px) { .instrument-body { padding: 24px 26px 28px; } }

/* ---------- the picker surface ---------- */

.mode-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.mode-tab {
  flex: 1; background: var(--panel);
  border: 1.5px solid var(--line-mid); border-radius: var(--radius);
  color: var(--muted); font-family: var(--body);
  font-size: 0.86rem; font-weight: 600;
  padding: 9px 6px; cursor: pointer;
}
.mode-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.view-wrap {
  position: relative;
  border: 1.5px solid var(--line-mid);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow: hidden;
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
}
.view-wrap video, .view-wrap canvas.surface { width: 100%; display: block; }
.cam-pill {
  position: absolute; left: 50%; top: calc(50% + 26px);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px;
  background: rgba(15, 23, 42, 0.82); color: #fff;
  padding: 6px 12px; border-radius: 999px;
  font-size: 0.84rem; font-weight: 500;
  max-width: 92%; white-space: nowrap;
  pointer-events: none;
}
.cam-pill .dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #fff; flex: 0 0 auto;
}
.cam-pill .pill-hex { opacity: 0.75; font-size: 0.78rem; }
.cam-pill span { overflow: hidden; text-overflow: ellipsis; }
.view-wrap .reticle {
  position: absolute; left: 50%; top: 50%;
  width: 36px; height: 36px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.view-hint {
  color: var(--faint); font-size: 0.88rem; text-align: center; padding: 40px 16px;
}

/* readout */
.readout {
  display: grid; grid-template-columns: 92px 1fr; gap: 14px;
  align-items: center; margin-top: 14px;
}
.swatch {
  width: 92px; height: 92px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}
.color-name {
  font-family: var(--display); font-size: 1.55rem;
  line-height: 2rem; height: 2rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.color-name.long { font-size: 1.18rem; }
.color-name.longer { font-size: 1rem; }
.color-sub {
  color: var(--muted); font-size: 0.8rem; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  height: 1.25rem;
}
.code-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.code-chip {
  background: var(--panel); border: 1.5px solid var(--line-mid);
  border-radius: var(--radius); font-size: 0.78rem;
  padding: 5px 9px; cursor: pointer; color: var(--text);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.code-chip:hover { border-color: var(--accent); color: var(--accent); }

/* controls */
.btn {
  display: inline-block;
  background: var(--accent); color: #fff;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--body); font-weight: 600; font-size: 0.98rem;
  padding: 12px 22px; cursor: pointer;
}
.btn:hover { background: #1d4ed8; }
.btn.full { display: block; width: 100%; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-ghost {
  background: var(--bg); border: 1.5px solid var(--line-mid);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--body); font-size: 0.84rem; font-weight: 600;
  padding: 9px 14px; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost:disabled { opacity: 0.4; cursor: default; }
.btn-ghost[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.ink { background: var(--line); border-color: var(--line); }
.btn.ink:hover { background: #1e293b; }

.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.hint { font-size: 0.78rem; color: var(--muted); margin: 10px 0 0; }
.err {
  background: #fef2f2; border: 1.5px solid var(--bad);
  border-radius: var(--radius); color: var(--bad);
  font-size: 0.85rem; padding: 10px 13px; margin-top: 12px; display: none;
}
.err.show { display: block; }
.section-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--faint); margin: 18px 0 8px;
}

/* history strip */
.history { display: flex; flex-wrap: wrap; gap: 6px; }
.history button {
  width: 34px; height: 34px;
  border: 1.5px solid var(--line-mid); border-radius: var(--radius);
  cursor: pointer; padding: 0;
}
.history button:hover { border-color: var(--line); }

.honesty {
  border: 1.5px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 13px 15px;
  font-size: 0.87rem;
  color: var(--muted);
  margin-top: 18px;
}
.honesty b { color: var(--text); }

/* ---------- content ---------- */

.content h2 { font-size: 1.65rem; margin: 42px 0 12px; text-align: center; }
.content > p, .content section > p { color: var(--muted); }

.spec-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; padding: 0; list-style: none; justify-content: center; }
.spec-strip li {
  background: var(--panel); border: 1.5px solid var(--line-soft);
  border-radius: var(--radius); font-size: 0.78rem; color: var(--muted);
  padding: 5px 11px;
}
.spec-strip b { color: var(--accent); font-weight: 700; }

.feature-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
@media (min-width: 640px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
.feature {
  background: var(--panel); border: 1.5px solid var(--line-soft);
  border-radius: var(--radius); padding: 15px 15px 13px;
}
.feature h3 { font-size: 1.15rem; margin: 0 0 5px; }
.feature p { font-size: 0.85rem; color: var(--muted); margin: 0; }

ol.steps { counter-reset: s; list-style: none; margin: 14px 0 0; padding: 0; }
ol.steps li {
  counter-increment: s; display: flex; gap: 13px;
  padding: 12px 0; border-top: 1.5px solid var(--line-soft);
  color: var(--muted); font-size: 0.95rem;
}
ol.steps li::before {
  content: counter(s);
  font-family: var(--display); color: var(--accent);
  font-size: 1.35rem; min-width: 20px;
}
ol.steps b { color: var(--text); }

.faq details { border: 1.5px solid var(--line-soft); border-radius: var(--radius); background: var(--bg); margin-top: 8px; }
.faq summary {
  cursor: pointer; padding: 12px 15px; font-weight: 600; font-size: 0.95rem;
  list-style: none; display: flex; justify-content: space-between; gap: 10px;
}
.faq summary::after { content: "+"; color: var(--accent); flex: 0 0 auto; }
.faq details[open] summary::after { content: "–"; }
.faq .a { padding: 0 15px 12px; color: var(--muted); font-size: 0.9rem; }
.faq .a p { margin: 0 0 8px; }

.card-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
@media (min-width: 640px) { .card-grid { grid-template-columns: 1fr 1fr; } }
a.card {
  display: block; background: var(--bg);
  border: 1.5px solid var(--line-mid); border-radius: var(--radius);
  padding: 15px; color: var(--text); text-decoration: none;
}
a.card:hover { border-color: var(--accent); }
a.card:hover h3 { color: var(--accent); }
a.card h3 { font-size: 1.15rem; margin: 3px 0 5px; }
a.card p { font-size: 0.83rem; color: var(--muted); margin: 0; }
a.card .tag { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); }

.site-footer {
  border-top: 1.5px solid var(--line-soft);
  margin-top: 52px; padding-top: 16px;
  font-size: 0.8rem; color: var(--faint);
}
.site-footer p { margin: 0 0 6px; }
.site-footer a { color: var(--muted); }

/* ---------- sub pages ---------- */

.page-wrap { max-width: 740px; margin: 0 auto; padding: 24px 18px 60px; }
.page-wrap h1 { font-size: 2.15rem; margin: 0 0 8px; }
.page-meta { color: var(--faint); font-size: 0.8rem; margin-bottom: 20px; }
.blog-wrap h2 { font-size: 1.45rem; margin: 34px 0 10px; }
.blog-wrap p { color: var(--muted); }
.blog-wrap p b { color: var(--text); }
.blog-illo { border: 1.5px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); padding: 13px; margin: 22px 0; }
.blog-illo svg { width: 100%; height: auto; display: block; }
.blog-cta {
  border: 1.5px solid var(--accent); border-left-width: 5px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  padding: 14px 16px; margin: 28px 0; font-size: 0.93rem;
}
