/* Pikkola Contrast: a neutral chrome that keeps out of the colour judgement.
   The page itself is held to the same rule it measures, so the ink, the lines and
   the two signal colours are the only colour in the shell. The swatches carry
   everything else. Weights stay at 400 to 700. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/tools/contrast/fonts/inter.woff2) format("woff2-variations");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/tools/contrast/fonts/jetbrains-mono.woff2) format("woff2");
}

:root {
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1180px;
  --r: 14px;
  --r-sm: 8px;
  --r-xs: 6px;
}
html[lang="ko"] {
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  word-break: keep-all;
}
html[lang="ja"] {
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  word-break: normal;
}
html[lang="ja"] h1,
html[lang="ja"] h2,
html[lang="ja"] h3,
html[lang="ja"] p,
html[lang="ja"] li,
html[lang="ja"] summary { line-break: strict; overflow-wrap: break-word; word-break: auto-phrase; }
html[lang="ja"] .hero h1 { max-width: 17ch; font-size: clamp(1.9rem, 3.7vw, 2.95rem); }

html[data-theme="light"] {
  --bg: #f6f4ee;
  --bg-2: #ece9e0;
  --surface: #fffdf8;
  --surface-2: #f8f6ef;
  --ink: #14171a;
  --ink-2: #3f464a;
  --ink-3: #61686b;
  --line: #ddd8cb;
  --line-2: #c3bdae;
  --line-strong: #8a8577;
  --accent: #2f4a5a;
  --accent-ink: #f7fbfd;
  --accent-soft: #e3ecf1;
  --hot: #a3331f;
  --hot-soft: #f8e3dd;
  --ok: #22604a;
  --ok-soft: #e1efe8;
  --warn: #86590f;
  --warn-soft: #f7ecda;
  --paper: #ffffff;
  --shadow: 0 24px 60px -34px rgba(20, 23, 26, 0.34);
  --shadow-sm: 0 10px 24px -18px rgba(20, 23, 26, 0.4);
  --header: rgba(246, 244, 238, 0.86);
}
html[data-theme="dark"] {
  --bg: #0f1213;
  --bg-2: #161a1b;
  --surface: #191e1f;
  --surface-2: #1f2526;
  --ink: #eef0ec;
  --ink-2: #bcc4c1;
  --ink-3: #8a9391;
  --line: #2a3132;
  --line-2: #3c4546;
  --line-strong: #746f63;
  --accent: #9dbccd;
  --accent-ink: #0d1a21;
  --accent-soft: #1d2a31;
  --hot: #e5836c;
  --hot-soft: #38221c;
  --ok: #86cfae;
  --ok-soft: #1a2e26;
  --warn: #e0b06a;
  --warn-soft: #322818;
  --paper: #ffffff;
  --shadow: 0 28px 70px -32px rgba(0, 0, 0, 0.8);
  --shadow-sm: 0 12px 28px -18px rgba(0, 0, 0, 0.8);
  --header: rgba(15, 18, 19, 0.86);
}
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(760px 460px at 92% -10%, rgba(47, 74, 90, 0.10), transparent 70%),
    radial-gradient(520px 360px at 0% 4%, rgba(47, 74, 90, 0.05), transparent 72%);
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { display: block; }
code { font-family: var(--mono); font-size: 0.92em; }

main { flex: 1 0 auto; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 28px; position: relative; z-index: 1; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 40;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: var(--r-sm); text-decoration: none; font-size: 14px;
}
.skip-link:focus { top: 14px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.eyebrow {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 12px;
}
.note { color: var(--ink-2); font-size: 13.5px; line-height: 1.6; }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--header);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 26px; height: 66px; }
.brand { display: inline-flex; align-items: baseline; gap: 7px; text-decoration: none; font-weight: 600; letter-spacing: -0.02em; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); align-self: center; }
.brand-name { font-size: 17px; }
.brand-tool {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); border-left: 1px solid var(--line-2); padding-left: 8px;
}
.site-nav { display: flex; gap: 20px; margin-left: auto; font-size: 14px; }
.site-nav a { text-decoration: none; color: var(--ink-2); padding: 4px 0; border-bottom: 1px solid transparent; }
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--ink-3); }
.header-tools { display: flex; align-items: center; gap: 10px; }
.lang-field { position: relative; display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); }
.lang-globe { width: 16px; height: 16px; margin-left: 6px; pointer-events: none; position: absolute; left: 0; }
.lang-field select {
  appearance: none; background: transparent; border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--ink-2); font-size: 12.5px; padding: 6px 10px 6px 26px; cursor: pointer;
}
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn svg { width: 17px; height: 17px; }
html[data-theme="light"] .ico-sun { display: none; }
html[data-theme="dark"] .ico-moon { display: none; }

/* ---------- hero ---------- */

.hero {
  display: grid; grid-template-columns: 1.04fr 0.96fr; gap: 48px; align-items: center;
  padding-top: 62px; padding-bottom: 64px;
}
.hero h1 { font-size: clamp(2.1rem, 3.9vw, 3.25rem); max-width: 20ch; }
.hero-lede { margin-top: 20px; font-size: 17px; color: var(--ink-2); max-width: 56ch; }
.facts { display: flex; gap: 34px; margin: 30px 0 0; padding: 22px 0 0; border-top: 1px solid var(--line); }
.facts div { display: flex; flex-direction: column; }
.facts dt { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -0.03em; }
.facts dd { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.35; max-width: 15ch; }

.hero-art {
  position: relative; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow); padding: 16px;
}
.art-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.art-swatch {
  border-radius: 10px; min-height: 176px; padding: 14px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.sw-dark { background: #14171a; color: #f4f2ec; }
.sw-light { background: #f4f2ec; color: #5d6367; }
.art-letter { font-size: 66px; line-height: 1; font-weight: 600; letter-spacing: -0.04em; }
.sw-light .art-letter { color: #5d6367; }
.art-caption-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.art-num { font-size: 12.5px; }
.art-badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  padding: 3px 6px; border-radius: 4px; border: 1px solid currentColor;
}
.art-badge.is-pass { color: #86cfae; }
.art-badge.is-fail { color: #9c4a35; border-style: dashed; }
.art-scale {
  position: relative; height: 10px; margin: 14px 2px 0; border-radius: 999px;
  background: linear-gradient(90deg, #ffffff 0%, #d6d1c6 26%, #8b8f92 52%, #4b5257 74%, #101314 100%);
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.art-tick { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--ink); border-radius: 1px; }
.art-tick::after { content: ""; position: absolute; top: 18px; left: -3px; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--ink); background: var(--surface); }
.tick-a { left: 17%; }
.tick-b { left: 79%; }
.art-note { margin-top: 30px; font-size: 11px; color: var(--ink-3); letter-spacing: 0.02em; }

/* ---------- sections ---------- */

.section { padding-top: 26px; padding-bottom: 58px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin-bottom: 26px; }
.section-head h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
.section-lede { color: var(--ink-2); font-size: 15px; max-width: 46ch; }

section[id], article[id] { scroll-margin-top: 86px; }

/* ---------- the studio shell ---------- */

.tool-shell {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow-sm);
  padding: 18px;
}

.pair-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
.color-panel { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.cp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.cp-label { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.mini-btn {
  width: 26px; height: 26px; display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--ink-3);
}
.mini-btn:hover { color: var(--ink); border-color: var(--line-2); }
.mini-btn svg { width: 14px; height: 14px; }
.cp-body { display: grid; grid-template-columns: 116px 1fr; gap: 12px; padding: 12px; }
.cp-swatch {
  border-radius: 8px; border: 1px solid var(--line-2); min-height: 112px;
  display: grid; place-items: center; overflow: hidden;
}
.cp-swatch span { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; }
.cp-fields { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fmt-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.fmt-tabs button {
  background: transparent; border: 1px solid transparent; border-radius: 5px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em;
  color: var(--ink-3); padding: 4px 7px; cursor: pointer;
}
.fmt-tabs button:hover { color: var(--ink); }
.fmt-tabs button.is-on { color: var(--ink); background: var(--surface); border-color: var(--line-2); }
.value-input {
  width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 9px 10px; font-size: 13.5px; color: var(--ink);
}
.value-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cp-tools { display: flex; align-items: center; gap: 10px; }
.picker-wrap { position: relative; display: inline-flex; }
.picker-wrap input[type="color"] {
  width: 34px; height: 30px; padding: 0; border: 1px solid var(--line-strong); border-radius: 7px;
  background: transparent; cursor: pointer;
}
.picker-wrap input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.picker-wrap input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }
.cp-note { font-size: 11px; color: var(--ink-3); }

.swap-btn {
  align-self: center; display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
  background: transparent; border: 1px solid var(--line-2); border-radius: 999px;
  padding: 10px 10px 8px; cursor: pointer; color: var(--ink-2); font-size: 10.5px;
  font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
}
.swap-btn:hover { color: var(--ink); border-color: var(--ink-3); background: var(--surface-2); }
.swap-btn svg { width: 18px; height: 18px; }

.invalid-note {
  margin: 12px 2px 0; padding: 9px 12px; border-radius: 8px;
  border: 1px dashed var(--hot); background: var(--hot-soft); color: var(--hot); font-size: 13px;
}

.result-row {
  display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 18px;
  margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); align-items: stretch;
}
.result-main { display: flex; flex-direction: column; justify-content: center; }
.pv-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.ratio-line { display: flex; align-items: baseline; gap: 3px; margin-top: 6px; }
.ratio-big { font-size: clamp(2.6rem, 5vw, 3.6rem); font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.ratio-unit { font-size: 17px; color: var(--ink-3); }
.ratio-sub { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.lc-line { margin-top: 14px; }
.lc-big { font-size: 16px; font-weight: 600; }
.lc-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }

.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; justify-content: center; }
.check-list li {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.check-list li:last-child { border-bottom: 0; }
.ck-name { font-size: 14px; }
.ck-target { font-size: 11.5px; color: var(--ink-3); }
.ck-verdict {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid currentColor; min-width: 58px; text-align: center;
}
.ck-verdict.is-pass { color: var(--ok); background: var(--ok-soft); }
.ck-verdict.is-fail { color: var(--hot); background: var(--hot-soft); }

/* ---------- the specimen ---------- */

.preview-block { margin-top: 18px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pb-head { padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.specimen { padding: 26px 24px 22px; transition: background-color 120ms linear, color 120ms linear; }
.spec { margin: 0; }
.spec-head { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.spec-body { font-size: 16px; line-height: 1.65; margin-top: 12px; max-width: 60ch; }
.spec-small { font-size: 12px; line-height: 1.5; margin-top: 12px; }
.spec-line { margin-top: 14px; }
.spec-link { text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }
.spec-button {
  display: inline-flex; align-items: center; margin-top: 16px; padding: 9px 15px;
  border: 1px solid currentColor; border-radius: 999px; font-size: 14px;
}
.preview-block .note { padding: 0 24px 16px; }

/* ---------- the fix ---------- */

.fix-box {
  margin-top: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); display: grid; grid-template-columns: 1fr auto; gap: 12px 24px; align-items: center;
}
.fix-copy .note { margin-top: 6px; max-width: 60ch; }
.fix-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.fix-note { grid-column: 1 / -1; font-size: 12px; color: var(--ink-2); min-height: 18px; }
.fix-note.is-live { color: var(--ok); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px;
  padding: 9px 16px; font-size: 13.5px; cursor: pointer; color: var(--ink); text-decoration: none;
  transition: border-color 120ms, background-color 120ms;
}
.btn:hover { border-color: var(--ink-3); background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent); border-color: var(--ink); }
.btn.small { padding: 7px 13px; font-size: 12.5px; }
.btn.quiet { border-color: transparent; color: var(--ink-3); background: transparent; }
.btn.quiet:hover { color: var(--ink); border-color: var(--line-2); }
.btn[disabled] { opacity: 0.45; cursor: default; }

/* ---------- the six pairs ---------- */

.pair-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pair-card {
  display: flex; flex-direction: column; gap: 0; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  padding: 0; overflow: hidden; box-shadow: var(--shadow-sm);
  transition: border-color 140ms, transform 140ms;
}
.pair-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.pc-spec {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  padding: 18px 16px; min-height: 104px; background: var(--pc-bg); color: var(--pc-fg);
}
.p-ink { --pc-fg: #15181a; --pc-bg: #f6f4ee; }
.p-body { --pc-fg: #3a3f43; --pc-bg: #ffffff; }
.p-muted { --pc-fg: #6b7074; --pc-bg: #ffffff; }
.p-placeholder { --pc-fg: #8b8f92; --pc-bg: #ffffff; }
.p-button { --pc-fg: #ffffff; --pc-bg: #1f5f8b; }
.p-warn { --pc-fg: #8a5b10; --pc-bg: #fdf8ec; }
.pc-a { font-size: 38px; font-weight: 600; line-height: 1; letter-spacing: -0.03em; }
.pc-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pc-ratio { font-size: 12px; }
.pc-badge {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.05em; padding: 2px 5px;
  border: 1px solid currentColor; border-radius: 4px;
}
.pc-badge.is-pass { opacity: 0.9; }
.pc-badge.is-fail { border-style: dashed; opacity: 0.9; }
.pc-body { display: flex; flex-direction: column; gap: 5px; padding: 14px 16px 4px; }
.pc-body b { font-size: 14.5px; font-weight: 600; }
.pc-body span:not(b) { font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.pc-open {
  display: block; padding: 12px 16px 14px; font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
}

/* ---------- the palette ---------- */

.pal-shell { padding: 18px; }
.pal-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.sim-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg-label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.seg { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.seg button {
  background: transparent; border: 0; border-radius: 999px; padding: 5px 11px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.seg button:hover { color: var(--ink); }
.seg button.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }

.pal-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pal-row {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); padding: 8px;
}
.pal-chip { width: 46px; height: 40px; border-radius: 6px; border: 1px solid var(--line-2); position: relative; overflow: hidden; }
.pal-chip input[type="color"] {
  position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px);
  padding: 0; border: 0; cursor: pointer; opacity: 0;
}
.pal-index {
  position: absolute; left: 3px; top: 3px; font-family: var(--mono); font-size: 9px;
  line-height: 1; padding: 2px 3px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.82); color: #14171a;
}
.pal-fields { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pal-label { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.pal-input {
  width: 100%; background: transparent; border: 1px solid transparent; border-radius: 5px;
  padding: 2px 4px; font-family: var(--mono); font-size: 13px; color: var(--ink);
}
.pal-input:hover { border-color: var(--line-2); }
.pal-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; background: var(--surface); }
.pal-actions { display: flex; align-items: center; gap: 2px; }
.pal-btn {
  width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink-3);
}
.pal-btn:hover { color: var(--ink); border-color: var(--line-2); }
.pal-btn svg { width: 14px; height: 14px; }
.pal-btn[disabled] { opacity: 0.35; cursor: default; }

.matrix-block { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.matrix-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.matrix-worst { font-size: 11.5px; color: var(--ink-2); }
.matrix-scroll { overflow-x: auto; }
.matrix { border-collapse: collapse; width: 100%; min-width: 460px; table-layout: fixed; font-family: var(--mono); font-size: 11.5px; }
.matrix th:first-child { width: 96px; }
.matrix th, .matrix td { border: 1px solid var(--line); padding: 0; text-align: center; }
.matrix thead th { background: var(--surface-2); font-weight: 400; }
.mx-head { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; }
.mx-swatch { width: 22px; height: 14px; border-radius: 3px; border: 1px solid var(--line-2); }
.mx-index { font-size: 9.5px; color: var(--ink-3); }
.mx-rowlabel { display: flex; align-items: center; gap: 6px; padding: 6px 8px; justify-content: flex-start; }
.mx-cell { padding: 7px 4px; color: var(--ink-2); }
.mx-cell.is-pass { color: var(--ok); background: var(--ok-soft); }
.mx-cell.is-near { color: var(--warn); background: var(--warn-soft); }
.mx-cell.is-fail { color: var(--hot); background: var(--hot-soft); }
.mx-cell.is-self { background: var(--surface-2); color: var(--ink-3); }
.matrix-block .note { padding: 11px 14px; border-top: 1px solid var(--line); }

.vars-block { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.vars-head { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }

.code-out {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--ink-2);
  background: var(--bg-2); white-space: pre;
}

/* ---------- how to read it ---------- */

.rule-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.rule-card { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 18px; }
.rule-num { font-size: 11px; color: var(--ink-3); letter-spacing: 0.1em; }
.rule-card h3 { font-size: 15.5px; margin: 8px 0 8px; }
.rule-card p { font-size: 13.5px; color: var(--ink-2); line-height: 1.62; }

.table-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.prop-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.prop-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.prop-table caption { text-align: left; padding: 12px 14px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.prop-table th, .prop-table td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.prop-table tbody tr:last-child td { border-bottom: 0; }
.prop-table thead th { font-weight: 500; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.table-note { margin-top: 12px; }

/* ---------- faq ---------- */

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; padding: 15px 2px; font-size: 15px; font-weight: 500; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--ink-3); font-size: 16px; }
.faq details[open] summary::after { content: "-"; }
.faq details p { padding: 0 2px 18px; color: var(--ink-2); font-size: 14px; max-width: 76ch; }

/* ---------- related ---------- */

.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.rel-card {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 16px 16px 18px;
  transition: border-color 140ms, transform 140ms;
}
.rel-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.rel-kicker { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.04em; }
.rel-card h3 { font-size: 15px; }
.rel-card p { font-size: 13px; color: var(--ink-2); }
.rel-open { margin-top: auto; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--line); margin-top: 30px; background: var(--bg-2); }
.footer-inner { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 26px; padding-top: 34px; padding-bottom: 34px; align-items: start; }
.footer-brand .brand-name { font-size: 16px; font-weight: 600; }
.footer-brand .brand-tool { margin-left: 7px; }
.footer-tagline { margin-top: 10px; font-size: 13px; color: var(--ink-2); max-width: 38ch; }
.footer-note { margin-top: 6px; font-size: 11px; color: var(--ink-3); }
.footer-links { display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.footer-links a { color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.footer-legal { font-size: 12px; color: var(--ink-3); }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 60; box-shadow: var(--shadow);
}

/* ---------- plain pages ---------- */

.doc { max-width: 760px; padding-top: 46px; padding-bottom: 40px; }
.doc h1 { font-size: clamp(1.8rem, 3.2vw, 2.5rem); max-width: 26ch; }
.doc .updated { margin-top: 10px; font-size: 12px; color: var(--ink-3); font-family: var(--mono); }
.doc-lede { margin-top: 16px; font-size: 17px; color: var(--ink-2); }
.doc h2 { font-size: 1.2rem; margin: 34px 0 10px; }
.doc p { color: var(--ink-2); font-size: 15px; margin-top: 10px; }
.doc ul { margin: 12px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 15px; }
.doc li { margin-top: 8px; }
.doc a { color: var(--accent); text-underline-offset: 3px; }
.doc-foot { margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line); }
.doc-foot a { text-decoration: none; font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.doc .eyebrow { margin-top: 22px; }
.notfound { text-align: center; padding: 90px 0 80px; }
.notfound h1 { font-size: clamp(2rem, 4vw, 3rem); }
.notfound p { margin-top: 14px; color: var(--ink-2); }
.notfound a { display: inline-block; margin-top: 22px; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; gap: 34px; padding-top: 44px; padding-bottom: 44px; }
  .hero-art { max-width: 560px; }
  .pair-grid { grid-template-columns: repeat(2, 1fr); }
  .rule-cards { grid-template-columns: 1fr; }
  .table-pair { grid-template-columns: 1fr; }
  .result-row { grid-template-columns: 1fr; }
  .fix-box { grid-template-columns: 1fr; }
  .fix-actions { justify-content: flex-start; }
  .pal-list { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  section[id], article[id] { scroll-margin-top: 74px; }
  .wrap { padding: 0 18px; }
  .header-inner { gap: 12px; height: 60px; }
  .site-nav { display: none; }
  .hero h1 { font-size: clamp(1.9rem, 7vw, 2.4rem); }
  .facts { gap: 20px; flex-wrap: wrap; }
  .art-letter { font-size: 52px; }
  .art-swatch { min-height: 140px; }
  .tool-shell { padding: 12px; }
  .pair-row { grid-template-columns: 1fr; }
  .swap-btn { flex-direction: row; border-radius: 999px; padding: 7px 14px; justify-self: center; }
  .cp-body { grid-template-columns: 92px 1fr; }
  .cp-swatch { min-height: 92px; }
  .specimen { padding: 20px 16px; }
  .spec-head { font-size: 26px; }
  .preview-block .note { padding: 0 16px 14px; }
  .pair-grid { grid-template-columns: 1fr; }
  .section { padding-bottom: 40px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-lede { max-width: none; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 18px; }
  .vars-head { grid-template-columns: 1fr; }
  .check-list li { gap: 8px; }
  .ck-name { font-size: 13px; }
  .matrix { font-size: 10.5px; }
}

@media (max-width: 460px) {
  .facts dt { font-size: 20px; }
  .cp-body { grid-template-columns: 1fr; }
  .cp-swatch { min-height: 64px; }
  .cp-swatch span { font-size: 30px; }
  .ratio-big { font-size: 2.6rem; }
  .seg button { padding: 5px 9px; font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
