/* ncolor converter */
:root {
  --nc-ink: #1F1626;
  --nc-muted: #6A6072;
  --nc-soft: #F3F0F5;
  --nc-line: #E6E1EA;
  --nc-neutral: #E9E5EC;
  --nc-accent: #703081;
  --nc-accent-dark: #4A1F57;
  --nc-fs-s: 13px;
  --nc-fs-m: 14px;
  --nc-fs-l: 16px;
  --nc-font: Helvetica, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  font-size: var(--nc-fs-m);
  font-weight: 400;
  margin: 0;
  background: #FFFFFF;
  color: var(--nc-ink);
  font-family: var(--nc-font);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--nc-accent); }
a:hover { color: var(--nc-accent-dark); }
button, input { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--nc-accent); outline-offset: 2px; }

/* ---------- page grid: left half follows the source color, right half the result ---------- */
.nc-page {
  --src-ground: var(--nc-neutral);
  --dst-ground: var(--nc-neutral);
  /* colors on the grounds (logo, header); set by js/ncolor-app.js from the current colors */
  --src-fg: #1F1626;
  --dst-fg: #1F1626;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.nc-src-ground { background: var(--src-ground); }
/* card colors follow the color of their half (set by js/ncolor-app.js) */
.nc-panel.nc-src-ground { --nc-ink: var(--src-t-ink, #1F1626); --nc-muted: var(--src-t-muted, #6A6072); --nc-soft: var(--src-t-soft, #F3F0F5); --nc-line: var(--src-t-line, #E6E1EA); --nc-accent: var(--src-t-accent, #703081); color: var(--nc-ink); }
.nc-panel.nc-dst-ground { --nc-ink: var(--dst-t-ink, #1F1626); --nc-muted: var(--dst-t-muted, #6A6072); --nc-soft: var(--dst-t-soft, #F3F0F5); --nc-line: var(--dst-t-line, #E6E1EA); --nc-accent: var(--dst-t-accent, #703081); color: var(--nc-ink); }
.nc-dst-ground { background: var(--dst-ground); }

.nc-main, .nc-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.nc-main { grid-auto-rows: 1fr; flex: 1; position: relative; }

.nc-bar-cell { display: flex; align-items: center; min-height: 64px; padding: 0 clamp(16px, 3vw, 40px); }
.nc-bar-end { justify-content: flex-end; }
/* Google ad at the right end of the header: a fixed size per width (the unit keeps the size it
   loads with). Phones: its own row under the logo, on the source color. */
.nc-ad-cell { padding-top: 12px; padding-bottom: 12px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }

.nc-adslot { display: inline-block; width: 320px; height: 50px; }
@media (min-width: 1100px) { .nc-adslot { width: 468px; height: 60px; } }
@media (min-width: 1560px) { .nc-adslot { width: 728px; height: 90px; } }
.nc-ad-dummy { display: inline-flex; align-items: center; justify-content: center; background: repeating-linear-gradient(45deg, #D9D9D9 0 8px, #CFCFCF 8px 16px); color: #6A6A6A; font-size: var(--nc-fs-s); }
.nc-ad-dummy span { padding: 2px 8px; background: #FFFFFF; border-radius: 4px; }
.nc-ad-dummy::after { content: ' 320×50'; margin-left: 6px; }
@media (min-width: 1100px) { .nc-ad-dummy::after { content: ' 468×60'; } }
@media (min-width: 1560px) { .nc-ad-dummy::after { content: ' 728×90'; } }
.nc-logo { display: flex; align-items: center; min-height: 44px; }
/* the logo file is used as a mask so it can take the theme color */
.nc-logo-mark {
  display: block;
  width: 113px;
  height: 28px;
  background: var(--src-fg);
  transition: background-color 0.25s;
  -webkit-mask: url("../images/logo_nclor.svg") no-repeat left center / contain;
  mask: url("../images/logo_nclor.svg") no-repeat left center / contain;
}
.nc-brand { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding-top: 12px; padding-bottom: 12px; }
.nc-tagline { margin: 0; font-size: var(--nc-fs-s); font-weight: 400; color: var(--src-fg); opacity: 0.55; transition: color 0.25s; }
.nc-coffee {
  margin-top: 6px;
  padding: 4px 10px 4px 12px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: var(--src-fg);
  font-family: var(--nc-font);
  font-size: 12px;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s, color 0.25s;
}
.nc-coffee:hover { opacity: 1; }
.nc-coffee-price { margin-left: 4px; font-weight: 700; }

/* coffee modal */
.nc-modal { width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 16px; background: #FFFFFF; color: #1F1626; box-shadow: 0 8px 40px rgba(31, 22, 38, 0.3); overflow: hidden; }
.nc-modal[open] { display: flex; flex-direction: column; }
.nc-modal::backdrop { background: rgba(31, 22, 38, 0.45); }
.nc-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 20px; }
.nc-modal-title { margin: 0; font-size: var(--nc-fs-l); font-weight: 700; }
.nc-modal-close { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.nc-modal-close:hover { background: #F0F0F0; }
.nc-modal-body { padding: 0 20px 20px; overflow-y: auto; }
.nc-coffee-lead { margin: 0 0 16px; font-size: var(--nc-fs-m); line-height: 1.6; color: #4A4250; }
.nc-coffee-checkout { min-height: 120px; }
.nc-coffee-note { margin: 8px 0 0; font-size: var(--nc-fs-s); color: #6A6072; text-align: center; }
.nc-coffee-thanks { padding: 24px 0 8px; text-align: center; }
.nc-coffee-thanks p { margin: 0 0 8px; line-height: 1.6; }
.nc-coffee-thanks-mark { font-size: 40px; }
.nc-coffee-thanks-title { font-size: var(--nc-fs-l); font-weight: 700; }
.nc-coffee-thanks .nc-copy { margin-top: 12px; width: auto; padding: 0 16px; background: #703081; }

.nc-foot { position: relative; min-height: 64px; }
/* with candidate bands, the last band's color runs on to the bottom of the page */
.nc-main-bands ~ .nc-foot .nc-foot-dst { background: var(--dst-last, var(--dst-ground)); }
.nc-credit {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(31, 22, 38, 0.08), 0 2px 8px rgba(31, 22, 38, 0.10);
  color: #6A6072;
  font-size: var(--nc-fs-s);
  white-space: nowrap;
}
.nc-credit a { color: #1F1626; text-decoration: none; }
.nc-credit a:hover { opacity: 0.7; }
.nc-credit-sep { margin: 0 6px; }

.nc-panel { display: flex; align-items: center; justify-content: center; padding: clamp(32px, 5vw, 56px) clamp(16px, 3vw, 40px); }

/* ---------- card ---------- */
.nc-card {
  /* as wide as its widest row, which is the tab row: every other row (field + Copy,
     slider + stepper, the hint) is narrower, so they all line up with the tabs */
  width: fit-content;
  max-width: 100%;
  /* the tallest case, so both halves keep the same height: 16 padding + (16 label + 6 +
     36 tabs) + 12 + (16 label + 6 + 40 field row) + 12 + (4 rows of 36 + 3 gaps of 4) +
     12 + 21 hint + 16 padding */
  min-height: 364px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(31, 22, 38, 0.08), 0 4px 12px rgba(31, 22, 38, 0.10);
  /* the controls read 1pt smaller than the rest of the page; the captions
     (.nc-label, .nc-hint) keep the page sizes and are set in px below */
  --nc-fs-s: calc(13px - 1pt);
  --nc-fs-m: calc(14px - 1pt);
  --nc-fs-l: calc(16px - 1pt);
}
/* width 0 + min-width 100%: the rows fill the card but don't widen it, so the card's
   width comes from the tab row alone and the field, slider and hint follow it */
.nc-body { flex: 1; width: 0; min-width: 100%; display: flex; flex-direction: column; gap: 12px; }
.nc-stack-8 { display: flex; flex-direction: column; gap: 6px; }
.nc-stack-4 { display: flex; flex-direction: column; gap: 4px; }
.nc-label { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--nc-muted); }
.nc-hint { margin: auto 0 0; font-size: 13px; line-height: 1.6; color: var(--nc-muted); text-align: center; }
.nc-hint.is-error { color: #B42318; }

/* the row hugs the six labels instead of stretching; it wraps if the card gets too narrow */
.nc-tabs { display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; gap: 4px; }
.nc-tab {
  height: 36px;
  flex: none;
  /* the side padding PANTONE had when all six shared the row equally */
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: var(--nc-fs-s);
  font-weight: 600;
  text-decoration: none;
  color: var(--nc-muted);
}
.nc-tab:hover { background: var(--nc-soft); color: var(--nc-ink); }
.nc-tab[aria-current="true"] { background: var(--nc-accent); color: #FFFFFF; }

.nc-row { display: flex; gap: 8px; }

.nc-btn { border: 0; cursor: pointer; }
.nc-btn:hover { filter: brightness(0.95); }
.nc-copy {
  height: 40px;
  width: 120px;
  flex: none;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--nc-accent);
  color: #FFFFFF;
  font-size: var(--nc-fs-m);
  font-weight: 400;
}
.nc-copy:disabled { opacity: 0.4; cursor: default; filter: none; }

.nc-field, .nc-out {
  flex: 1 1 0;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--nc-ink);
  font-family: var(--nc-font);
  font-size: var(--nc-fs-l);
  font-weight: 400;
  letter-spacing: 0.02em;
}
.nc-field { border: 0; background: var(--nc-soft); }
.nc-field:focus { outline: 2px solid var(--nc-accent); outline-offset: 0; background: #FFFFFF; }
.nc-field.is-invalid { outline: 2px solid #B42318; outline-offset: 0; }
.nc-out { display: flex; align-items: center; border: 1px solid var(--nc-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: all; }

/* color picker */
.nc-pick { position: relative; width: 40px; height: 40px; flex: none; }
.nc-picker {
  display: block;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(31, 22, 38, 0.16);
}
.nc-picker { -webkit-appearance: none; appearance: none; background: none; cursor: pointer; }
.nc-picker::-webkit-color-swatch-wrapper { padding: 0; }
.nc-picker::-webkit-color-swatch { border: 0; border-radius: 8px; }
.nc-picker::-moz-color-swatch { border: 0; border-radius: 8px; }
.nc-pick-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--nc-ink);
  box-shadow: 0 1px 3px rgba(31, 22, 38, 0.3);
  pointer-events: none;
}

/* source channel rows */
.nc-chan { display: flex; align-items: center; gap: 12px; }
.nc-letter { width: 20px; flex: none; font-family: var(--nc-font); font-size: var(--nc-fs-l); font-weight: 400; color: var(--nc-ink); }
.nc-track-wrap { position: relative; flex: 1 1 0; min-width: 40px; height: 36px; display: flex; align-items: center; }
.nc-track { position: absolute; left: 0; right: 0; top: 14px; height: 8px; border-radius: 4px; background: var(--nc-soft); overflow: hidden; }
.nc-track-fill { height: 100%; border-radius: 4px; background: var(--nc-ink); }
.nc-stepper { display: flex; align-items: center; margin-left: auto; background: var(--nc-soft); border-radius: 8px; }
.nc-step {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--nc-ink);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.nc-step:hover { background: var(--nc-line); }
/* DIC / PANTONE: two buttons, no number - together they match the 120px of the others */
.nc-stepper-pair .nc-step { width: 60px; }
.nc-num {
  width: 48px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--nc-ink);
  text-align: center;
  font-family: var(--nc-font);
  font-size: var(--nc-fs-l);
  font-weight: 400;
}
.nc-num:focus { outline: 2px solid var(--nc-accent); outline-offset: 0; background: #FFFFFF; }

.nc-range { position: relative; display: block; width: 100%; height: 36px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; }
.nc-range::-webkit-slider-runnable-track { height: 36px; background: transparent; }
.nc-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: 6px; border-radius: 50%; border: 0; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 3px 10px rgba(0, 0, 0, 0.22); transition: transform 0.12s; }
.nc-range:active::-webkit-slider-thumb { transform: scale(1.15); }
.nc-range::-moz-range-track { height: 36px; background: transparent; }
.nc-range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; border: 0; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 3px 10px rgba(0, 0, 0, 0.22); }
.nc-range:focus-visible { outline: none; }
.nc-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 3px 10px rgba(0, 0, 0, 0.22), 0 0 0 4px var(--nc-accent); }
.nc-range:focus-visible::-moz-range-thumb { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 3px 10px rgba(0, 0, 0, 0.22), 0 0 0 4px var(--nc-accent); }

/* target channel rows */
.nc-out-row { display: flex; align-items: center; gap: 12px; min-height: 36px; }
.nc-bar-track { flex: 1; min-width: 0; height: 8px; border-radius: 4px; background: var(--nc-soft); overflow: hidden; }
.nc-bar-fill { height: 100%; border-radius: 4px; background: var(--nc-ink); }
.nc-val {
  /* same width as the Copy button, and as the From side's stepper (36 + 48 + 36) */
  width: 120px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  background: var(--nc-soft);
  color: var(--nc-ink);
  font-family: var(--nc-font);
  font-size: var(--nc-fs-l);
  font-weight: 400;
}

/* library candidates */
.nc-cand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px 0 6px;
  border-radius: 8px;
  background: transparent;
  color: var(--nc-ink);
  text-align: left;
}
.nc-cand:hover { background: var(--nc-soft); filter: none; }
.nc-cand-chip { width: 32px; height: 32px; flex: none; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(31, 22, 38, 0.16); }
.nc-cand-name { flex: 1; min-width: 0; font-family: var(--nc-font); font-size: var(--nc-fs-m); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-cand-note { font-size: var(--nc-fs-s); color: var(--nc-muted); }

/* swap */
.nc-swap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #FFFFFF;
  /* follows the source color like the Copy buttons */
  color: var(--src-t-accent, var(--nc-accent));
  box-shadow: 0 1px 2px rgba(31, 22, 38, 0.08), 0 4px 12px rgba(31, 22, 38, 0.10);
}
.nc-swap:hover { filter: brightness(0.95); color: var(--src-t-accent, var(--nc-accent)); }
.nc-swap:focus-visible { outline-color: var(--src-t-accent, var(--nc-accent)); }

/* desktop: pull both cards in toward the centred swap button instead of centring them
   in their own half, which leaves a widening gap as the window grows */
@media (min-width: 861px) {
  .nc-panel.nc-src-ground { justify-content: flex-end; padding-right: 48px; }
  .nc-panel.nc-dst-ground:not(.nc-panel-bands) { justify-content: flex-start; padding-left: 48px; }
}

/* library targets: the right half is split into one band per candidate */
.nc-panel-bands { flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 0; }
.nc-panel-bands .nc-card { min-height: 0; margin: clamp(20px, 3vw, 32px) auto; }
.nc-panel-bands .nc-body { margin-top: 12px; }
/* the source card lines up with the To card, which sits at the top of the right half */
@media (min-width: 861px) {
  .nc-main-bands .nc-panel.nc-src-ground { align-items: flex-start; padding-top: clamp(20px, 3vw, 32px); }
  /* same 48px from the seam as a non-band To panel gets from its padding */
  .nc-panel-bands .nc-card { margin-left: 48px; margin-right: auto; }
  /* the half is as tall as the bands, so 50% of it would drop the button below the cards:
     centre it on the From card instead (its top margin + half of its 364px) */
  .nc-main-bands .nc-swap { top: calc(clamp(20px, 3vw, 32px) + 182px); }
}
.nc-hint-icon { display: inline-flex; vertical-align: -4px; }
.nc-hint-icon svg { width: 16px; height: 16px; }
.nc-bands { flex: 1; display: flex; flex-direction: column; min-height: 420px; overflow-x: clip; }
.nc-band {
  flex: 1;
  min-height: 56px;
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 0 clamp(8px, 2vw, 28px) 0 clamp(4px, 1vw, 12px);
  font-weight: 400;
}
.nc-band > button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  margin: 6px 0;
}
.nc-band > button:hover { background: rgba(255, 255, 255, 0.22); }
.nc-band > button:focus-visible { outline: 3px solid currentColor; outline-offset: -3px; }
.nc-band-grip {
  width: 44px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  cursor: grab !important;
  touch-action: none;
}
.nc-band-grip:hover, .nc-band-grip:focus-visible { opacity: 1; }
.nc-bands.is-sorting, .nc-bands.is-sorting * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.nc-band { position: relative; transition: transform 0.18s ease, box-shadow 0.18s ease, color 0.25s; }
.nc-band.is-dragging {
  z-index: 2;
  transition: box-shadow 0.18s ease;
  box-shadow: 0 2px 6px rgba(31, 22, 38, 0.18), 0 18px 40px rgba(31, 22, 38, 0.38);
  will-change: transform;
}
.nc-band.no-anim { transition: none; }
.nc-band.is-dragging .nc-band-grip { opacity: 1; }
.nc-band .nc-band-name { flex: 1; min-width: 0; padding: 0 10px; text-align: left; font-size: var(--nc-fs-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-band .nc-band-note { flex: none; padding: 0 10px; font-size: var(--nc-fs-s); font-weight: 400; }
.nc-band.is-top .nc-band-name { font-size: var(--nc-fs-l); }
/* keep the grips clear of the centred swap button */
@media (min-width: 861px) { .nc-band { padding-left: 36px; } }

.nc-noscript { margin: 0; padding: 16px; text-align: center; }
.nc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 860px) {
  .nc-main, .nc-bar { grid-template-columns: minmax(0, 1fr); }
  .nc-wide { display: none !important; }
  .nc-ad-cell { background: var(--src-ground); padding-top: 0; }
  .nc-swapicon { transform: rotate(90deg); }
  /* stacked: each half as tall as its content, the swap button sits exactly on the seam
     (a zero-height row between the two halves) */
  .nc-main { grid-auto-rows: auto; }
  .nc-main > .nc-src-ground { grid-row: 1; }
  .nc-main > .nc-swap { position: relative; left: auto; top: auto; transform: none; grid-row: 2; justify-self: center; margin: -26px 0; z-index: 2; }
  .nc-main > .nc-dst-ground { grid-row: 3; }
  /* same space above the To card as below the From card, so the button sits midway between them */
  .nc-main > .nc-src-ground { padding-bottom: 46px; }
  .nc-main > .nc-dst-ground { padding-top: 46px; }
  .nc-panel-bands .nc-card { margin-top: 46px; }
  .nc-main > .nc-panel-bands { padding-top: 0; }
}
/* phones: keep field + Copy and slider + stepper on one line */
@media (max-width: 480px) {
  .nc-chan { gap: 8px; }
  .nc-step { width: 32px; }
  .nc-num { width: 40px; }
}
