/* The colour editor (/designs/<slug>/colours/, colours.js): the palette on
   one side, the design or its piece sheet in the middle, the colour count and
   code on the other. Drawings are in mm; strokes keep their screen width. */

.colours-hero { padding-bottom: 20px; }
.c-head { display: grid; gap: 10px; justify-items: start; padding: 24px 0 4px; }
.c-head h1 { font-size: clamp(34px, 4.4vw, 56px); }
.c-back { font-weight: 600; font-size: 15px; color: var(--mut); text-decoration: none; }
.c-back:hover { text-decoration: underline; text-underline-offset: 4px; }
.c-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.colours { padding: 8px 0 80px; }
.c-label { font: 700 13px/1.3 var(--text); letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }
.c-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; margin-bottom: 18px; }
.c-start { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.c-starts { display: flex; flex-wrap: wrap; gap: 8px; }
.c-starts [hidden] { display: none; }
.scheme.blank i { background: repeating-linear-gradient(45deg, #f4f2eb 0 3px, #cfcabd 3px 4.5px); }
/* "Paste a code": dashed like the design page's own-colours chip; it opens
   into a field of the same shape */
.scheme.code { border-style: dashed; background: transparent; cursor: pointer; }
.scheme.code:hover { border-color: var(--acc); }
.scheme.code i { display: grid; place-items: center; color: var(--mut); background: var(--wall); }
.scheme.code svg { width: 16px; height: 16px; }
.code-form { gap: 6px; padding: 0 4px 0 14px; border-color: var(--acc); }
.code-form input { width: 12.5em; min-width: 0; border: 0; padding: 0; background: transparent; color: var(--ink);
                   font: 14px/1 Consolas, 'Courier New', monospace; outline: none; }
.code-form input::placeholder { color: var(--mut); font-family: var(--text); }
.code-form:focus-within { box-shadow: inset 0 0 0 1px var(--acc); }
.code-form button { height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--acc); color: var(--acc-ink);
                    font: 700 14px/1 var(--text); cursor: pointer; }
.c-msg { margin: -6px 0 14px; color: var(--acc); font-weight: 600; font-size: 15px; }
.c-msg:empty { display: none; }
.c-history { display: flex; gap: 8px; }
.c-history .btn:disabled { opacity: .35; cursor: default; filter: none; }

.c-grid { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 24px; align-items: start; }
/* The palette sticks only beside the design or pieces, never over the count. */
.c-work { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 24px; align-items: start; min-width: 0; }
.c-palette, .c-summary { background: var(--paper); border-radius: 10px; padding: 18px; position: sticky;
                          top: calc(var(--sticky-top, 0px) + 16px); }

/* palette */
.c-picked { display: flex; align-items: center; gap: 10px; min-height: 32px; margin: 10px 0 2px; font-weight: 600; font-size: 15px; line-height: 1.3; }
.c-picked i { width: 28px; height: 28px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.c-sub { font: 600 13px/1 var(--text); color: var(--mut); margin: 16px 0 8px; }
.c-line { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.c-sw { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 50%; background: var(--c); cursor: pointer;
        box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.c-sw:hover { transform: scale(1.08); }
.c-sw[aria-pressed="true"] { box-shadow: inset 0 0 0 1px rgba(0,0,0,.2), 0 0 0 2px var(--paper), 0 0 0 4px var(--acc); }
.c-sw.used::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%;
                    background: var(--ink); border: 2px solid var(--paper); }
.c-sw.out::before { content: ''; position: absolute; left: -2px; top: -2px; width: 9px; height: 9px; border-radius: 50%;
                    background: var(--paper); border: 2px solid var(--acc); }

/* the stage: the design or the piece sheet */
.c-stage { min-width: 0; border-radius: 10px; padding: 14px;
           background: radial-gradient(110% 80% at 30% 15%, var(--wall-lit), var(--wall) 70%); }
.c-views { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); }
.c-views button { height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--ink);
                  font: 600 15px/1 var(--text); cursor: pointer; }
.c-views button:hover { background: var(--wall); }
.c-views button[aria-selected="true"] { background: var(--wall); box-shadow: inset 0 0 0 2px var(--acc); }
.c-art svg { display: block; width: 100%; height: auto; max-height: calc(100vh - 150px - var(--sticky-top, 0px)); margin: 10px auto 0; touch-action: manipulation; }
.c-plate { fill: #1d1e1c; stroke: rgba(255,255,255,.1); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.c-body, .c-ink { cursor: pointer; }
.c-body.blank { stroke: #a9a395; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.c-hl { pointer-events: none; }
.c-hl path { fill: none; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.c-hl path:first-child { stroke: rgba(255,255,255,.95); stroke-width: 4px; }
.c-hl path:last-child { stroke: #1f2420; stroke-width: 1.5px; }
.c-readout { min-height: 1.6em; margin-top: 8px; text-align: center; font-weight: 600; font-size: 15px; }

.c-sheet { padding: 4px 2px; }
.c-sheet h3 { margin: 18px 0 10px; }
.c-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.c-card { display: grid; justify-items: center; gap: 6px; padding: 10px 10px 8px; border-radius: 8px; background: var(--paper); }
.c-pc { display: grid; justify-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer;
        font: 700 13px/1 var(--text); color: var(--mut); }
.c-pc svg { display: block; overflow: visible; }
.c-pc:hover .c-body { stroke: var(--acc); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.c-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.c-chip { width: 24px; height: 24px; padding: 3px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--paper); cursor: pointer; }
.c-chip:hover { border-color: var(--acc); }
.c-chip i { display: block; width: 100%; height: 100%; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }

/* colour count, colours used, the code */
.c-count { font: 800 34px/1.1 var(--display); font-stretch: 110%; margin: 6px 0 2px; }
.c-left:empty { display: none; }
.c-used { list-style: none; padding: 0; display: grid; gap: 2px; margin: 12px 0 18px; }
.c-used button { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%;
                 padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left;
                 font: 600 15px/1.2 var(--text); cursor: pointer; }
.c-used button:hover { background: var(--wall); }
.c-used button[aria-pressed="true"] { background: var(--wall); box-shadow: inset 0 0 0 2px var(--acc); }
.c-used i { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.c-ct { font-weight: 400; font-size: 13px; color: var(--mut); white-space: nowrap; }
.c-out { color: var(--acc); margin: 0 0 6px 40px; font-size: 13px; }
.c-code { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.c-code input { width: 100%; min-width: 0; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line);
                background: var(--wall); color: var(--ink); font: 14px/1.2 Consolas, 'Courier New', monospace; }
.c-code-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 1140px) {
  .c-grid { grid-template-columns: minmax(0, 1fr); }
  .c-work { grid-template-columns: 220px minmax(0, 1fr); }
  .c-summary { position: static; }
  .c-line { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
/* One column: the design, then the palette held at the bottom of the screen
   as one scrolling strip, then the count and code. */
@media (max-width: 760px) {
  .c-grid, .c-work { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .c-stage { order: 1; padding: 10px; }
  .c-palette { order: 2; position: sticky; top: auto; bottom: 0; z-index: 2; padding: 10px 12px 12px;
               border-radius: 10px 10px 0 0; box-shadow: 0 -6px 18px rgba(var(--shadow), .18); }
  .c-summary { order: 3; }
  .c-palette .c-label { display: none; }
  .c-picked { margin: 0 0 8px; min-height: 0; }
  .c-picked i { width: 22px; height: 22px; }
  .c-swatches { display: flex; gap: 7px; overflow-x: auto; padding: 4px 4px 6px; scrollbar-width: thin; }
  .c-sub { display: none; }
  .c-line { display: flex; gap: 7px; }
  .c-sw { width: 36px; flex: none; }
  .c-art svg { max-height: 70vh; }
}
