/* Hex From Image: styles
   Neutral UI on purpose: the user's image supplies the color. One accent (vermilion) for marks + focus. */

/* Self-hosted fonts (latin subset) */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 600 800;
  font-stretch: 100%;
  font-display: swap;
  src: url(/assets/fonts/bricolage-grotesque-600-800.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/fonts/jetbrains-mono-500.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/jetbrains-mono-600.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #f3f1ec;
  --surface: #fffefb;
  --ink: #17161a;
  --muted: #615e58;
  --line: #dcd8cf;
  --soft: #ebe8e1;
  --accent: #f0461a;
  --danger: #b42318;
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #111110;
  --surface: #1a1a18;
  --ink: #f2efe8;
  --muted: #a39f96;
  --line: #2f2e2b;
  --soft: #222220;
  --accent: #ff5a2b;
  --danger: #ff8a7a;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 3px; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 50; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
code { font-family: var(--font-mono); font-size: .9em; background: var(--soft); padding: 1px 6px; border-radius: 5px; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand {
  display: inline-flex; align-items: baseline; gap: 1px; margin: 0;
  font: 800 23px/1 var(--font-display); letter-spacing: -.03em; text-decoration: none;
}
.brand-hash { font-family: var(--font-mono); font-weight: 600; color: var(--accent); margin-right: 1px; }
.brand-sm { font-size: 18px; }
.brand-from { color: var(--muted); font-weight: 700; }
.nav { display: flex; align-items: center; gap: 22px; font-size: 15px; }
.nav > a { color: var(--ink); opacity: .78; text-decoration: none; font-weight: 500; }
.nav > a:hover { opacity: 1; }
.nav a:hover { color: var(--ink); }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: block; }
[data-theme="dark"] .i-moon { display: none; }
@media (max-width: 760px) { .nav > a { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  font: 600 15px/1 var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { opacity: .88; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); opacity: 1; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.link-btn {
  border: 0; padding: 0; background: none; color: var(--ink); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; font-weight: 600;
}

/* ---------- Ad slots ----------
   Fixed min-heights reserve space so ads never push content around (good for Core Web Vitals / SEO). */
.ad-slot {
  position: relative; display: grid; place-items: start center; padding-top: 10px; border-radius: 6px;
  background: var(--soft); color: color-mix(in oklab, var(--muted) 70%, transparent);
  font: 500 10.5px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase;
}
.ad-incontent { min-height: 280px; margin: 48px 0 0; }
.ad-mid { min-height: 250px; margin: 40px 0; }
.ad-end { min-height: 250px; margin: 0 0 56px; }
.ad-rail { width: 300px; min-height: 600px; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; }
.rail { display: none; }
@media (min-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .rail { display: block; padding-top: 40px; }
  .rail .ad-slot { position: sticky; top: 24px; }
}

/* ---------- Tool ---------- */
.tool { padding: 40px 0 0; }
.intro { max-width: 820px; margin-bottom: 24px; }
h1 {
  margin: 0 0 12px; font: 800 clamp(36px, 5.4vw, 60px)/1 var(--font-display);
  letter-spacing: -.032em; text-wrap: balance;
}
.lede { margin: 0; max-width: 56ch; text-wrap: balance; font-size: 18px; color: var(--muted); text-wrap: pretty; }

.dropzone {
  display: grid; justify-items: center; align-content: center; gap: 14px; text-align: center;
  min-height: 260px; padding: 40px 24px; border: 1.5px solid var(--line); border-radius: 18px;
  background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 1px 0 rgb(0 0 0 / .03), 0 12px 32px -18px rgb(0 0 0 / .25);
}
.dropzone:hover, .is-dragging .dropzone {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 16%, transparent), 0 12px 32px -18px rgb(0 0 0 / .25);
}
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.dz-swatches { display: flex; }
.dz-swatches { margin-bottom: 4px; }
.dz-swatches i { width: 30px; height: 30px; border-radius: 50%; margin-left: -8px; box-shadow: 0 0 0 3px var(--surface), inset 0 0 0 1px rgb(255 255 255 / .14); }
.dz-swatches i:nth-child(1) { background: #1f1a33; margin-left: 0; }
.dz-swatches i:nth-child(2) { background: #6b3a6e; }
.dz-swatches i:nth-child(3) { background: #d9577a; }
.dz-swatches i:nth-child(4) { background: #f28a5b; }
.dz-swatches i:nth-child(5) { background: #ffd07a; }
.dz-title { font: 700 clamp(24px, 3vw, 32px)/1.1 var(--font-display); letter-spacing: -.025em; }
.dz-meta { font-size: 14px; color: var(--muted); text-wrap: balance; }
.coarse-ptr { display: none; }
@media (pointer: coarse) { .fine-ptr { display: none; } .coarse-ptr { display: inline; } }
.below-dz { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin: 14px 4px 0; font-size: 14.5px; color: var(--muted); }
.below-dz p { margin: 0; display: inline-flex; align-items: center; gap: 7px; }
.privacy { color: var(--ink); font-weight: 600; }
.privacy svg { color: var(--accent); }
.error {
  margin: 12px 0 0; padding: 11px 14px; border-radius: 10px; font-size: 15px;
  color: var(--danger); background: color-mix(in oklab, var(--danger) 10%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--danger) 30%, transparent);
}

/* Workspace (after an image is loaded) */
.workspace { display: grid; gap: 20px; }
@media (min-width: 920px) {
  .workspace { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); align-items: start; }
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }

.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.file-name { margin: 0; min-width: 0; font: 600 13.5px/1.3 var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-dims { color: var(--muted); font-weight: 500; }
.stage {
  display: grid; place-items: center; min-height: 240px; padding: 12px; border-radius: 12px;
  background-color: var(--soft);
}
.stage.has-alpha {
  background-image: conic-gradient(var(--line) 25%, transparent 0 50%, var(--line) 0 75%, transparent 0);
  background-size: 18px 18px;
}
.frame { position: relative; display: inline-block; max-width: 100%; line-height: 0; cursor: crosshair; touch-action: manipulation; }
.frame img { display: block; max-width: 100%; max-height: min(62vh, 560px); width: auto; height: auto; border-radius: 4px; user-select: none; -webkit-user-drag: none; }
.markers { position: absolute; inset: 0; pointer-events: none; }
.marker {
  position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%;
  display: grid; place-items: center; font: 700 11px/1 var(--font-mono); color: #fff;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .45), 0 2px 8px rgb(0 0 0 / .35);
}
.chip {
  --tx: 16px; --ty: 16px;
  position: absolute; z-index: 2; pointer-events: none; display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font: 600 13px/1 var(--font-mono); white-space: nowrap; transform: translate(var(--tx), var(--ty));
  box-shadow: 0 8px 24px rgb(0 0 0 / .28);
}
.chip.flip-x { --tx: calc(-100% - 16px); }
.chip.flip-y { --ty: calc(-100% - 16px); }
.chip-sw { width: 20px; height: 20px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg); }
.hint { margin: 10px 2px 0; font-size: 14px; color: var(--muted); }

.picked { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.h-small { margin: 0 0 10px; font: 700 16px/1.2 var(--font-display); letter-spacing: -.01em; }
.picked ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pk { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.pk:hover { border-color: var(--ink); }
.pk-main {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 4px 4px 5px;
  border: 0; background: none; color: var(--ink); font: 600 13px/1 var(--font-mono); cursor: pointer;
}
.pk-chip { position: relative; width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(128 128 128 / .3); display: grid; place-items: center; font-size: 10px; color: #fff; text-shadow: 0 0 3px rgb(0 0 0 / .8); }
.pk-x { width: 34px; height: 40px; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; border-radius: 0 999px 999px 0; }
.pk-x:hover { color: var(--ink); }

/* Results */
.results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.results h2 { margin: 0; font: 700 22px/1.2 var(--font-display); letter-spacing: -.02em; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.seg button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 600 12.5px/1 var(--font-mono); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.count { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.count input { width: 110px; accent-color: var(--ink); }
.count output { min-width: 2ch; font: 600 14px var(--font-mono); color: var(--ink); }

.strip { display: flex; gap: 2px; height: 64px; margin-bottom: 10px; }
.strip-seg:first-child { border-radius: 10px 0 0 10px; }
.strip-seg:last-child { border-radius: 0 10px 10px 0; }
.strip-seg { flex-basis: 0; min-width: 14px; padding: 0; border: 0; cursor: pointer; transition: flex-grow .25s ease; }
.strip-seg:hover { filter: brightness(1.1); }
.summary { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); }

.swatches { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sw {
  width: 100%; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 7px 14px 7px 7px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); text-align: left; cursor: pointer;
}
.sw:hover { border-color: var(--ink); }
.sw-chip { width: 48px; height: 48px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgb(128 128 128 / .28); }
.sw-body { display: grid; gap: 3px; min-width: 0; }
.sw-code { font: 600 17px/1.2 var(--font-mono); letter-spacing: .01em; }
.sw-meta { font-size: 13px; line-height: 1.3; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-side { display: grid; justify-items: end; gap: 3px; }
.sw-pct { font: 600 14px/1.2 var(--font-mono); }
.sw-copy { font-size: 12.5px; font-weight: 600; line-height: 1.2; color: var(--ink); opacity: .7; }
.sw:hover .sw-copy { opacity: 1; text-decoration: underline; }
.export { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- SEO content ---------- */
.content { max-width: 760px; padding-bottom: 56px; }
.content h2 { margin: 52px 0 14px; font: 700 clamp(25px, 3vw, 34px)/1.12 var(--font-display); letter-spacing: -.03em; text-wrap: balance; }
.content p, .content li { color: color-mix(in oklab, var(--ink) 86%, var(--bg)); text-wrap: pretty; }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 16px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; gap: 14px; }
.steps li::before {
  content: counter(step); width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  display: grid; place-items: center; font: 600 14px/1 var(--font-mono); color: var(--ink);
}
.table-wrap { overflow-x: auto; }
.compare { width: 100%; border-collapse: collapse; font-size: 15px; }
.compare th, .compare td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare th { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.compare td:first-child { font-weight: 600; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; justify-content: space-between; gap: 16px; padding: 15px 0; cursor: pointer;
  list-style: none; font-weight: 600; font-size: 17px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 600 18px/1.4 var(--font-mono); color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 16px; }

/* Content pages */
.doc { padding: 48px 0 72px; }
.doc h1 { margin-bottom: 14px; }
.doc .lede { margin-bottom: 28px; }
.doc h2 { margin-top: 40px; font-size: clamp(22px, 2.4vw, 28px); }
.doc ul { padding-left: 22px; }
.doc li + li { margin-top: 8px; }
.updated { font: 500 13px/1 var(--font-mono); color: var(--muted); margin: 0 0 24px; }

/* ---------- Tools menu ---------- */
.menu { position: relative; }
.menu summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 2px; font-weight: 600; color: var(--ink);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .15s;
}
.menu[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.menu-list {
  position: absolute; right: -8px; top: calc(100% + 8px); z-index: 30; width: min(300px, calc(100vw - 32px));
  margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 18px 48px -16px rgb(0 0 0 / .32);
}
.menu-list a { display: grid; gap: 2px; padding: 9px 12px; border-radius: 9px; text-decoration: none; color: var(--ink); }
.menu-list a:hover, .menu-list a:focus-visible { background: var(--soft); }
.menu-list a[aria-current="page"] { background: var(--soft); }
.menu-list strong { font-size: 15px; }
.menu-list span { font-size: 13px; color: var(--muted); }

/* ---------- Tool pages ---------- */
.crumbs { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.field-label { display: block; margin: 0 0 8px; font-weight: 700; font-size: 15px; }
.field-help { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.field-help.is-error { color: var(--danger); }
.text-in {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: 500 16px/1 var(--font-body);
}
.text-in:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.mono { font-family: var(--font-mono); font-weight: 600; letter-spacing: .02em; }
input[type="color"] {
  flex: none; width: 58px; height: 58px; padding: 4px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); cursor: pointer;
}
.conv { display: grid; gap: 22px; padding: 20px; }
@media (min-width: 860px) { .conv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; padding: 24px; } }
.hex-field { display: flex; gap: 10px; }
.hex-field .text-in { font-size: 22px; min-height: 58px; }
.conv-swatch { height: 132px; margin-top: 18px; border-radius: 12px; box-shadow: inset 0 0 0 1px rgb(128 128 128 / .25); }
.conv-out { display: grid; gap: 6px; }
.out-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 5px 5px 5px 14px; border: 1px solid var(--line); border-radius: 10px;
}
.out-label { font: 600 12px/1 var(--font-mono); letter-spacing: .06em; color: var(--muted); }
.out-code { padding: 0; background: none; font-size: 15.5px; overflow-wrap: anywhere; }
.channels { display: grid; gap: 12px; margin: 0; padding: 0; border: 0; }
.ch { display: grid; grid-template-columns: 20px minmax(0, 1fr) 84px; align-items: center; gap: 12px; }
.ch label { font: 700 14px/1 var(--font-mono); }
.ch input[type="range"] { width: 100%; accent-color: var(--ink); }
.ch .text-in { min-height: 44px; padding: 0 6px; text-align: center; }
.paste-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; }

.picker { display: grid; gap: 22px; padding: 18px; }
@media (min-width: 860px) {
  .picker { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); padding: 22px; }
  .pk-shades { grid-column: 1 / -1; }
}
.sv {
  position: relative; aspect-ratio: 4 / 3; border-radius: 12px; cursor: crosshair; touch-action: none;
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), var(--hue-color, #f00);
}
.sv:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sv-handle {
  position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .45), 0 2px 6px rgb(0 0 0 / .3); pointer-events: none;
}
.hue {
  -webkit-appearance: none; appearance: none; width: 100%; height: 18px; margin: 16px 0 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}
.hue::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--hue-color, #f00);
  border: 3px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .45);
}
.hue::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--hue-color, #f00);
  border: 3px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .45);
}
.pk-side { display: grid; gap: 14px; align-content: start; }
.pk-top { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; align-items: end; }
.pk-top .conv-swatch { height: 92px; margin: 0; }
.pk-top .text-in { font-size: 20px; min-height: 54px; }
.shades { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; }
.shade {
  width: 100%; aspect-ratio: 1 / 1.25; display: flex; align-items: flex-end; justify-content: center; padding: 0 0 7px;
  border: 0; border-radius: 8px; cursor: pointer; font: 600 10.5px/1 var(--font-mono);
  box-shadow: inset 0 0 0 1px rgb(128 128 128 / .2);
}
.shade.is-base { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (max-width: 640px) { .shades { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.codes-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 22px; }
.codes-bar .text-in { max-width: 420px; }
.code-group + .code-group { margin-top: 30px; }
.code-group h2 span { color: var(--muted); font-weight: 600; }
.code-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); gap: 8px; }
.code-card {
  width: 100%; display: grid; grid-template-rows: 60px auto; padding: 0; overflow: hidden; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer;
}
.code-card:hover { border-color: var(--ink); }
.cc-sw { display: block; border-bottom: 1px solid var(--line); }
.cc-body { display: grid; gap: 3px; padding: 9px 12px 11px; }
.cc-name { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.cc-hex { font: 600 13px/1.3 var(--font-mono); }
.cc-rgb { font-size: 12px; color: var(--muted); }
.no-results { color: var(--muted); }

.related { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.related a { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.related strong { font-weight: 700; }
.related span { color: var(--muted); font-size: 14.5px; }
.related a:hover strong { text-decoration: underline; }

/* Color detail pages */
a.code-card { text-decoration: none; }
.color-hero { display: grid; gap: 18px; padding: 18px; }
@media (min-width: 860px) { .color-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 22px; } }
.hero-swatch {
  min-height: 250px; display: flex; flex-direction: column; justify-content: flex-end; padding: 22px;
  border-radius: 14px; box-shadow: inset 0 0 0 1px rgb(128 128 128 / .25);
}
.hs-hex { font: 700 clamp(32px, 4vw, 46px)/1 var(--font-mono); letter-spacing: .01em; }
.hs-name { margin-top: 8px; font-weight: 600; opacity: .85; }
.harmony + .harmony { margin-top: 22px; }
.content .harmony h3, .content section > h3 { margin: 0 0 4px; }
.harmony .field-help { margin: 0 0 10px; }
.content .code-grid { margin-top: 10px; }
.content .code-grid li + li { margin-top: 0; }
.contrast-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.cp { padding: 20px; border-radius: 12px; box-shadow: inset 0 0 0 1px rgb(128 128 128 / .25); }
.content .cp p { color: inherit; margin: 0; }
.cp-big { font: 700 22px/1.2 var(--font-display); }
.content .cp .cp-meta { margin-top: 6px; font: 600 13px/1.4 var(--font-mono); }
.codeblock { margin: 0; padding: 16px 18px; border-radius: 12px; background: var(--soft); overflow-x: auto; }
.codeblock code { padding: 0; background: none; font-size: 14px; line-height: 1.7; }

/* Contrast checker */
.contrast { display: grid; gap: 22px; padding: 20px; }
@media (min-width: 860px) { .contrast { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 24px; } }
.ct-inputs { display: grid; gap: 12px; align-content: start; }
.swap { justify-self: start; }
.ct-ratio { margin: 0; font: 800 clamp(52px, 7vw, 76px)/1 var(--font-display); letter-spacing: -.035em; }
.ct-ratio small { font-size: .45em; color: var(--muted); letter-spacing: 0; }
.ct-word { margin: 8px 0 16px; font-weight: 600; }
.ct-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ct-checks li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14.5px; }
.ct-checks .req { color: var(--muted); font-family: var(--font-mono); font-size: 13px; }
.badge { flex: none; padding: 5px 9px; border-radius: 6px; font: 700 12px/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; }
.badge.pass { background: color-mix(in oklab, #16a34a 16%, var(--surface)); color: #166534; }
.badge.fail { background: color-mix(in oklab, var(--danger) 14%, var(--surface)); color: var(--danger); }
[data-theme="dark"] .badge.pass { color: #4ade80; }
.ct-preview { grid-column: 1 / -1; padding: 26px; border-radius: 14px; box-shadow: inset 0 0 0 1px rgb(128 128 128 / .25); }
.ct-large { margin: 0 0 10px; font: 700 28px/1.15 var(--font-display); letter-spacing: -.02em; }
.ct-preview p { max-width: 62ch; margin: 0 0 16px; font-size: 16px; }
.ct-ui { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 2px solid currentColor; border-radius: 999px; font-weight: 600; }
.ct-fix { grid-column: 1 / -1; }
.ct-fix p { margin: 0 0 8px; }
.fix-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; }
.fix-row .grow { flex: 1; min-width: 160px; font-size: 14.5px; }
.fix-sw { width: 26px; height: 26px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgb(128 128 128 / .3); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; }
.footer-grid { display: grid; gap: 28px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; } }
.footer-about .fine { margin-top: 10px; max-width: 34ch; }
.foot-h { margin: 0 0 12px; font: 600 11.5px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 14.5px; }
.site-footer ul a { color: var(--ink); opacity: .8; text-decoration: none; }
.site-footer ul a:hover { opacity: 1; text-decoration: underline; }
.footer-copy { margin-top: 28px; }
.fine { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Feedback ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 40; pointer-events: none;
  padding: 11px 18px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font: 600 14px/1 var(--font-mono); box-shadow: 0 10px 30px rgb(0 0 0 / .25);
  opacity: 0; transform: translate(-50%, 16px); transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.is-dragging::after {
  content: "Drop your image to find its colors";
  position: fixed; inset: 12px; z-index: 45; pointer-events: none;
  display: grid; place-items: center; border: 3px dashed var(--accent); border-radius: 22px;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  font: 700 clamp(22px, 3vw, 32px)/1.1 var(--font-display); letter-spacing: -.02em;
}
.is-busy .dropzone { opacity: .6; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
