:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #6b665e;
  --line: #e4e0d8;
  --accent: #0b6b78;
  --accent-ink: #ffffff;
  --pill: #f1eee8;
  --pill-on: #1f1d1a;
  --pill-on-ink: #ffffff;
  /* Form field borders and the lightfastness stars need at least 3:1 and 4.5:1 against the page (WCAG 1.4.11 / 1.4.3). */
  --field-line: #8a847a;
  --star: #8f6400;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161513;
    --surface: #201e1b;
    --text: #ece8e1;
    --muted: #a39d93;
    --line: #36332e;
    --accent: #4fb3c4;
    --accent-ink: #161513;
    --pill: #2a2824;
    --pill-on: #ece8e1;
    --pill-on-ink: #161513;
    --field-line: #77716a;
    --star: #c28a00;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161513; --surface: #201e1b; --text: #ece8e1; --muted: #a39d93; --line: #36332e;
  --accent: #4fb3c4; --accent-ink: #161513; --pill: #2a2824; --pill-on: #ece8e1; --pill-on-ink: #161513;
  --field-line: #77716a; --star: #c28a00;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
/* Keep focused elements and link targets below the sticky header (WCAG 2.4.11). In rem so it grows with the text. */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
}
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
/* One focus ring everywhere, instead of the browser's, which follows the OS accent color. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); line-height: 1.2; margin: .2em 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 1.8em 0 .6em; }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 46em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header / footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.logo { font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.logo-mark { width: 18px; height: 18px; border-radius: 4px; background: repeating-linear-gradient(90deg, #0b6b78 0 4px, #e8a33d 4px 7px, #2f6db3 7px 11px, #6aa84f 11px 14px); }
.nav { display: flex; gap: 4px 16px; flex-wrap: wrap; font-size: .95rem; }
.nav a { text-decoration: none; padding: 6px 0; }
.tray-count[hidden], .f-active[hidden] { display: none; }
.tray-count { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; text-align: center; }
.nav-compare .tray-count { margin-left: 4px; }
.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 24px 0 40px; font-size: .875rem; color: var(--muted); }

/* intro */
.intro { padding: 28px 0 8px; }

/* filters */
.db { margin-top: 8px; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.f-search input {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--field-line);
  background: var(--bg); color: var(--text);
}
.f-more { margin-top: 10px; }
.f-more summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.f-active { font-weight: 400; color: var(--accent); font-size: .875rem; }
fieldset { border: 0; margin: 10px 0 0; padding: 0; }
legend { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; padding: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px;
  background: var(--pill); font-size: .875rem; cursor: pointer; user-select: none; border: 1px solid transparent;
}
.pill input:checked + span { background: var(--pill-on); color: var(--pill-on-ink); }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0, 0, 0, .15); }
.fam-red { background: #c8303a; } .fam-yellow { background: #f2cf1d; } .fam-green { background: #2f8f5b; }
.fam-blue { background: #2f6db3; } .fam-violet { background: #6c3f9a; } .fam-brown { background: #8a4f2a; }
.fam-black { background: #1d1d1d; } .fam-grey { background: #8f8f8f; } .fam-white { background: #f7f7f5; }
.fam-metallic { background: linear-gradient(135deg, #d2a33b, #c0beb6); }
select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--field-line); background: var(--bg); color: var(--text); }
.f-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.count { font-weight: 600; margin-right: auto; }
.link-btn { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px; }

@media (min-width: 1000px) {
  .db { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; align-items: start; }
  .filters { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; }
  .db .grid { margin-top: 0; }
  .db .empty { grid-column: 2; }
}

/* grid */
.grid { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card[hidden] { display: none; }
.card-link { text-decoration: none; display: flex; flex-direction: column; flex: 1; }
/* The card clips its overflow, so draw the ring inside the link. */
.card-link:focus-visible { outline-offset: -3px; }
.card-link:hover .card-name { color: var(--accent); }
.chip { display: block; height: 64px; background: linear-gradient(90deg, var(--mass) 0%, var(--mass) 35%, var(--tint) 100%); border-bottom: 1px solid var(--line); }
.chip-sm { display: inline-block; width: 36px; height: 24px; border-radius: 4px; flex: none; background: linear-gradient(90deg, var(--mass), var(--tint)); border: 1px solid var(--line); }
.chip-lg { display: block; width: 100%; max-width: 320px; aspect-ratio: 2 / 1; border-radius: var(--radius); background: linear-gradient(90deg, var(--mass) 0%, var(--mass) 30%, var(--tint) 100%); border: 1px solid var(--line); }
.card-body { padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.card-code { font-size: .8rem; font-weight: 600; }
.card-name { font-weight: 650; line-height: 1.25; }
.card-ja { font-size: .82rem; color: var(--muted); }
.card-pig { font: .82rem ui-monospace, SFMono-Regular, Menlo, monospace; margin-top: 2px; }
.card-price { font-size: .88rem; font-variant-numeric: tabular-nums; }
.card-price .muted { font-size: .78rem; }
.badges { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: .78rem; color: var(--muted); margin-top: 4px; }
.b-perm { color: var(--star); letter-spacing: 1px; }
.b-gran { color: var(--text); }
.b-tox { color: var(--accent); font-weight: 600; }
.cmp-btn {
  font: inherit; font-size: .82rem; margin: 0 12px 12px; align-self: flex-start; padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer;
}
.cmp-btn[aria-pressed="true"] { background: var(--pill-on); color: var(--pill-on-ink); border-color: var(--pill-on); }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }
.note { max-width: 46em; }

/* color page */
.crumbs { font-size: .875rem; color: var(--muted); margin: 18px 0 8px; }
.color-hero { display: grid; grid-template-columns: minmax(0, 320px) 1fr; gap: 24px; align-items: center; margin: 8px 0 8px; }
.color-hero .cmp-btn { margin: 8px 0 0; }
.eyebrow { margin: 0; font-size: .85rem; color: var(--muted); }
.ja { margin: 0; color: var(--muted); font-size: 1.05rem; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.spec { width: 100%; border-collapse: collapse; font-size: .95rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.spec th, .spec td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec tr:last-child th, .spec tr:last-child td { border-bottom: 0; }
.spec th { font-weight: 600; white-space: nowrap; width: 1%; }
.spec thead th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.sizes td:nth-child(3) { font-variant-numeric: tabular-nums; }
.note-box { background: var(--pill); border-radius: 8px; padding: 8px 12px; }
.link-note { font-size: .82rem; color: var(--muted); }
.link-note::before { content: "· "; }
.contact-form { max-width: 34em; margin: 20px 0; display: grid; gap: 14px; }
.contact-form label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
.contact-form input, .contact-form textarea, .contact-form select {
  font: inherit; font-weight: 400; width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--field-line); background: var(--surface); color: var(--text);
}
.contact-form textarea { resize: vertical; }
.contact-form p { margin: 0; }
.contact-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn { font: inherit; font-weight: 600; padding: 9px 18px; border-radius: 99px; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.btn:disabled { opacity: .6; cursor: default; }
.form-status:empty { display: none; }
.tag { font-size: .75rem; padding: 1px 6px; border-radius: 99px; background: var(--pill); white-space: nowrap; }
.mini { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.mini a { display: flex; gap: 10px; align-items: center; text-decoration: none; padding: 4px 0; font-size: .92rem; }
.facts { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.facts li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; }
.fam-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* sets */
.set { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 24px; }
.set-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
.set-grid a { display: flex; gap: 8px; align-items: center; text-decoration: none; font-size: .88rem; padding: 2px 0; }

/* pigments */
.pig-table td:nth-child(4), .pig-table td:nth-child(5) { font-variant-numeric: tabular-nums; }

/* compare */
.cmp-pick { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.cmp-pick label { max-width: 100%; }
/* Fixed width: the options are added by script, and an automatic width would grow and push the page down. */
.cmp-pick select { width: 16em; max-width: 100%; }
.cmp-out { overflow-x: auto; }
.cmp-table { table-layout: fixed; border-collapse: collapse; min-width: 640px; width: 100%; background: var(--surface); border: 1px solid var(--line); }
.cmp-table th, .cmp-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: .92rem; }
.cmp-table th[scope="row"] { color: var(--muted); font-weight: 600; width: 120px; }
.cmp-table .chip { height: 56px; border-radius: 6px; border: 1px solid var(--line); }
.cmp-tools { display: flex; gap: 4px; margin-bottom: 8px; }
.cmp-tool {
  width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; flex: none;
  font: inherit; font-size: 1rem; line-height: 1; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); cursor: pointer;
}
.cmp-tool:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.cmp-tool:disabled { opacity: .35; cursor: default; }
.cmp-tool.cmp-rm { margin-left: auto; font-size: 1.15rem; }

@media (max-width: 760px) {
  .color-hero, .cols { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
  .chip { height: 48px; }
  .badges { font-size: .72rem; }
  .spec th { white-space: normal; }
}

/* lists */
.quick { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.quick a { display: inline-block; padding: 4px 12px; border-radius: 99px; background: var(--pill); text-decoration: none; font-size: .9rem; }
.quick a:hover { color: var(--accent); }
.swap { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.swap li { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.swap a { display: flex; gap: 10px; align-items: center; text-decoration: none; font-size: .92rem; }
.swap-arrow { color: var(--muted); }
@media (max-width: 640px) {
  .swap li { grid-template-columns: 1fr; }
  .swap-arrow { transform: rotate(90deg); justify-self: start; padding-left: 10px; }
}

/* home: one tile per range */
.lines { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.line-tile { display: flex; flex-direction: column; height: 100%; text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.line-tile:hover .line-name { color: var(--accent); }
.line-strip { display: block; height: 56px; border-bottom: 1px solid var(--line); }
.line-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; }
.line-name { font-size: 1.1rem; }
.sub { font-size: .95rem; margin: 1.2em 0 .5em; color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.eq-list { list-style: none; padding: 0; margin: 1rem 0; }
.eq-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: .3rem 1.2rem; padding: .8rem 0; border-top: 1px solid var(--line); scroll-margin-top: 30px; }
.eq-row:target { background: var(--pill); }
.eq-from { display: flex; flex-direction: column; gap: .15rem; }
.eq-pig { font-size: .88rem; color: var(--muted); }
.eq-match { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.eq-label { margin: 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
.eq-to { display: flex; gap: 10px; align-items: center; text-decoration: none; padding: 3px 0; font-size: .92rem; }
.eq-other { margin: .3rem 0 .8rem; padding-left: 1.2rem; }
.eq-other li { margin: .2rem 0; }
.eq-brands li { margin: .4rem 0; }
@media (max-width: 640px) { .eq-row { grid-template-columns: 1fr; } }
/* Added to the 5rem scroll padding on html: the same 110px from the top as before it existed. */
.eq-row + * [id], #no-colour-index ~ p [id] { scroll-margin-top: 30px; }
/* Phones: keep the five menu links on one line, also while the Compare count is showing. */
@media (max-width: 420px) { .nav { gap: 4px 8px; font-size: .875rem; } .nav-compare .tray-count { margin-left: 3px; } }
@media (max-width: 359px) { .nav { gap: 4px 5px; font-size: .78rem; } }

/* ---- PE line tables ---- */
.table-scroll { overflow-x: auto; margin: 12px 0 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.grid-table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: .92rem; }
.grid-table th, .grid-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid-table tr:last-child th, .grid-table tr:last-child td { border-bottom: 0; }
.grid-table thead th { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.grid-table tbody th { font-weight: 600; min-width: 7em; max-width: 14em; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-line { display: block; white-space: nowrap; font-variant-numeric: tabular-nums; }
.basis { font-size: .78rem; color: var(--muted); }
.none { color: var(--muted); }
.plist { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.plist li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.plist a { font-weight: 600; }
.sizes-nav { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.sizes-nav a { display: inline-block; min-width: 3.2em; text-align: center; padding: 6px 10px; border-radius: 999px; background: var(--pill); text-decoration: none; font-variant-numeric: tabular-nums; }
.sizes-nav a[aria-current="page"] { background: var(--pill-on); color: var(--pill-on-ink); }
/* Links inside tables are not in running text, so give each one a 24×24 px target (WCAG 2.5.8). */
.grid-table a { display: inline-block; min-width: 24px; min-height: 24px; padding: 3px 0; }
