/* Tools: used by the Toolkit (toolkit.php) and the playground. Numbers follow the original idea list (new ideas lettered).
   Uses the site's colors (--ink, --paper, --tile ...) so dark mode works too. */

:is(.pgTile, .tkPanel) button {
    font: inherit;
    color: var(--ink);
    cursor: pointer;
}

.labSeg {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.labSeg button {
    padding: 6px 12px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    background: none;
    font-size: var(--step--half) !important;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.labSeg button.is-on {
    background-color: var(--ink);
    color: var(--paper);
}

:is(.pgTile, .tkPanel) li::before { display: none; }

:is(.pgTile, .tkPanel) input[type="color"] {
    width: 44px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--lightGrey);
    background: none;
    cursor: pointer;
}

:is(.pgTile, .tkPanel) input[type="text"] {
    width: 6.5em;
    padding: 6px 8px;
    border: 1px solid var(--lightGrey);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: var(--step--half);
    text-transform: uppercase;
}

/* 6 Palettes in PowerPoint: one 10 × 6 grid; the cells fade to the next palette in a diagonal wave (--k) */
.labOffice {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));   /* minmax(0, …): Safari could make the columns too wide */
    gap: 3px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.labOffice li {
    min-width: 0;
    padding-top: 62.5%;            /* height = width / 1.6; padding, not aspect-ratio, which iPhones got wrong in this grid */
    background-color: var(--c);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
    transition: background-color 0.5s ease calc(var(--k) * 35ms);
}

.labOffice .labThemeRow { margin-bottom: 6px; }

/* 15 Type scale: a ladder of sizes with the numbers next to them */
.labCheck {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--step--half);
    cursor: pointer;
}

.labLadder {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.labLadder li {
    display: grid;
    grid-template-columns: 7.5em 5em 1fr;
    align-items: baseline;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--lightGrey);
}

.labLadder .labStep { font-size: var(--step--half); color: var(--darkGrey); }
.labLadder .labPx { font-size: var(--step--half); font-weight: 600; }

.labLadder .labSample {
    overflow: hidden;
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: font-size 0.4s var(--ease);
}

.labLadder .is-half { opacity: 0.6; }
.labLadder .is-half .labSample { font-weight: 400; }

/* 24 Micro-interaction library */
.labLib {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

.labLib figure {
    display: grid;
    grid-template-rows: 90px auto;
    place-items: center;
    margin: 0;
    padding: 10px;
    background: var(--paper);
}

.labLib figcaption {
    font-size: var(--step--half);
    color: var(--darkGrey);
    text-align: center;
}

/* Like */
.labLike {
    position: relative;
    width: 52px;
    height: 52px;
    border: 1px solid var(--lightGrey);
    border-radius: 50%;
    background: var(--paper);
    font-size: 1.4rem !important;
    transition: color 0.2s ease;
}

.labLike svg { display: block; width: 1em; height: 1em; margin: auto; fill: currentColor; }

.labLike[aria-pressed="true"] { color: #db1924 !important; animation: labPop 0.35s ease; }

@keyframes labPop { 50% { transform: scale(1.3); } }

.labLike i {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    margin: -3px;
    border-radius: 50%;
    background: #db1924;
    opacity: 0;
}

.labLike.is-burst i { animation: labBurst 0.6s ease-out forwards; }
.labLike i:nth-child(1) { --a: 0deg; } .labLike i:nth-child(2) { --a: 60deg; } .labLike i:nth-child(3) { --a: 120deg; }
.labLike i:nth-child(4) { --a: 180deg; } .labLike i:nth-child(5) { --a: 240deg; } .labLike i:nth-child(6) { --a: 300deg; }

@keyframes labBurst {
    0% { opacity: 1; transform: rotate(var(--a)) translateY(0); }
    100% { opacity: 0; transform: rotate(var(--a)) translateY(-38px); }
}

/* Bouncy switch */
.labToggle {
    width: 54px;
    height: 30px;
    padding: 3px;
    border: 0;
    border-radius: 999px;
    background: var(--lightGrey);
    transition: background-color 0.3s ease;
}

.labToggle span {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.labToggle[aria-pressed="true"] { background: #3b817b; }
.labToggle[aria-pressed="true"] span { transform: translateX(24px); }

/* Menu to close */
.labBurger {
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
}

.labBurger i {
    position: absolute;
    left: 10px;
    width: 24px;
    height: 2px;
    background: var(--ink);
    transition: transform 0.35s var(--ease), opacity 0.2s ease;
}

.labBurger i:nth-child(1) { top: 14px; }
.labBurger i:nth-child(2) { top: 21px; }
.labBurger i:nth-child(3) { top: 28px; }
.labBurger[aria-pressed="true"] i:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.labBurger[aria-pressed="true"] i:nth-child(2) { opacity: 0; transform: scaleX(0); }
.labBurger[aria-pressed="true"] i:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Copy */
.labCopy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    background: none;
    font-size: var(--step--half) !important;
}

.labCopy svg { width: 16px; height: 16px; }

.labCopy path {
    fill: none;
    stroke: #23845e;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 0.4s ease;
}

.labCopy.is-done path { stroke-dashoffset: 0; }

/* Send */
.labSend {
    position: relative;
    min-width: 96px;
    height: 40px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper) !important;
    font-size: var(--step--half) !important;
    transition: min-width 0.35s var(--ease), background-color 0.3s ease;
}

.labSend.is-busy { min-width: 40px; padding: 0; }
.labSend.is-busy span { display: none; }

.labSend.is-busy::after {
    content: "";
    position: absolute;
    inset: 10px;
    border: 2px solid var(--paper);
    border-right-color: transparent;
    border-radius: 50%;
    animation: labSpin 0.7s linear infinite;
}

.labSend.is-sent { background: #23845e; }

@keyframes labSpin { to { transform: rotate(360deg); } }

/* Stars */
.labStars { display: flex; }

.labStars button {
    padding: 0 2px;
    border: 0;
    background: none;
    color: var(--lightGrey) !important;
    font-size: 1.5rem !important;
    transition: color 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.labStars button.is-lit { color: #e3b04b !important; }
.labStars button:hover { transform: scale(1.2); }

/* Checkbox that draws */
.labTick { cursor: pointer; }
.labTick input { position: absolute; opacity: 0; }
.labTick svg { display: block; width: 34px; height: 34px; }
.labTick rect { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; transition: fill 0.25s ease; }

.labTick path {
    fill: none;
    stroke: var(--paper);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 0.35s ease 0.1s;
}

.labTick input:checked + svg rect { fill: var(--ink); }
.labTick input:checked + svg path { stroke-dashoffset: 0; }
.labTick input:focus-visible + svg { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Ripple */
.labRipple {
    position: relative;
    overflow: hidden;
    padding: 10px 20px;
    border: 0;
    border-radius: 999px;
    background: #3b817b;
    color: #fff !important;
    font-size: var(--step--half) !important;
}

.labRipple i {
    position: absolute;
    width: 10px;
    height: 10px;
    margin: -5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    animation: labRipple 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes labRipple { to { transform: scale(18); opacity: 0; } }

/* Contrast close-up (color system): the preview, the ratio and the four WCAG checks */
.labConPreview { padding: 22px; transition: background-color 0.3s ease, color 0.3s ease; }
.labConBig { margin: 0 0 8px; font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.labConSmall { margin: 0; font-size: 0.85rem; }

.labConScore { display: flex; align-items: baseline; gap: 14px; }
.labConRatio { font-size: var(--step-2); line-height: 1; }
.labConVerdict { font-weight: 600; }

.labConRules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.labConRules li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
    padding: 10px 12px;
    background: var(--paper);
    font-size: var(--step--half);
}

.labConRules .labMark {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
}

.labConRules .is-pass .labMark { background: #23845e; }
.labConRules .is-fail .labMark { background: #db1924; }
.labConRules b { font-size: var(--step-0); }

/* 29 + A palettes */
.labPalImg { aspect-ratio: 16 / 10; object-fit: cover; }

.labPal {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

.labPal li {
    flex: 1;
    display: flex;
    align-items: flex-end;
    height: 60px;
    padding: 5px;
    background: var(--c);
    color: var(--t, #fff);
    font-size: 0.6rem;
    transition: background-color 0.4s ease;
}

.labFile { font-size: var(--step--half); text-decoration: underline; cursor: pointer; }
.labFile input { position: absolute; width: 1px; opacity: 0; }

/* A Hexadic: a color wheel with six dots, 60° apart */
.labHexa { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }

.labWheel {
    position: relative;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: conic-gradient(from 90deg, red, yellow, lime, cyan, blue, magenta, red);
}

.labWheelHole {
    position: absolute;
    inset: 34px;
    border-radius: 50%;
    background: var(--tile);
}

.labWheel i {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transform: rotate(var(--a)) translateX(68px);
    transition: transform 0.5s var(--ease), background-color 0.3s ease;
}

.labWheel i:first-of-type { width: 28px; height: 28px; margin: -14px; }

.labHexaPick { display: flex; align-items: center; gap: 8px; font-size: var(--step--half); cursor: pointer; }

/* ---------- Toolkit (toolkit.php) ---------- */
/* Phones: the tools as a row of buttons to swipe through, one tool below.
   Tablet and desktop: the menu as a column on the left (3 of 12 columns), the chosen tool beside it.
   tools.js hides all panels but the chosen one; without JavaScript they are all listed. */

.tkIntroBlock h1 {
    font-size: var(--step-1);
    text-transform: uppercase;
}

.tkIntroBlock p {
    max-width: 52ch;
    color: var(--darkGrey);
}

.toolkit {
    margin: 5vh 0;
}

.tkMenu {
    display: flex;
    gap: 6px;
    margin: 0 calc(-1 * var(--gridMargin)) 20px;
    padding: 2px var(--gridMargin) 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tkMenu::-webkit-scrollbar { display: none; }

.tkMenu a {
    flex: none;
    padding: 8px 16px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    color: var(--ink);
    font-size: var(--step--half);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.tkMenu a:hover,
.tkMenu a[aria-current="true"] {
    background-color: var(--ink);
    color: var(--paper);
}

.tkPanel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: clamp(20px, 3vw, 40px);
    background-color: var(--tile);
}

.tkPanel + .tkPanel { margin-top: var(--gridGap); } /* only when JavaScript is off and all are listed */

.tkPanel[hidden] {
    display: none; /* hidden (set by tools.js) must win over display: flex above */
}

.tkPanel h2 {
    margin: 0;
    font-size: var(--step-1);
    font-weight: 600;
}

.tkIntro {
    max-width: 60ch;
    margin: 0;
    color: var(--darkGrey);
}

.tkPanel.is-entering {
    animation: tkIn 0.4s var(--ease);
}

@keyframes tkIn {
    from { opacity: 0; transform: translateY(8px); }
}

/* The tools a little larger here than in the playground tiles */
.tkPanel .labPalImg { max-width: 640px; }
.tkPanel .labPal { max-width: 640px; }

@media (min-width: 700px) {
    .toolkit {
        display: grid;
        grid-template-columns: repeat(var(--gridCols), 1fr);
        column-gap: var(--gridGap);
        align-items: start;
    }

    .tkMenu {
        grid-column: 1 / span 3;
        position: sticky;
        top: 120px;
        flex-direction: column;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .tkMenu a {
        border-radius: 999px;
        white-space: normal;
    }

    .tkPanels {
        grid-column: 4 / -1;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tkPanel.is-entering { animation: none; }
}


/* ---------- Color system (Toolkit) ---------- */
/* One list of theme colors, shown four ways (tools.js builds the content). Wide parts scroll sideways
   inside their own box (.csScroll) on small screens, so the page itself never does. */

.csys {
    display: grid;
    gap: 14px;
}

.csStep {
    margin: 22px 0 0;
    font-size: var(--step-half);
    font-weight: 600;
}

.csStep:first-child { margin-top: 0; }

.csScroll {
    position: relative;        /* keeps hidden labels inside (they are positioned absolutely), so nothing widens the page */
    overflow-x: auto;
    scrollbar-width: thin;
}

/* 1 Theme colors: one column per color, the shades below */
.csGrid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(84px, 1fr);  /* three colors fit a narrow phone; ten scroll sideways */
    gap: 6px;
}

.csHead {
    position: relative;
    display: grid;
    gap: 4px;
    margin-bottom: 6px;
}

.csHead input[type="color"] {
    width: 100% !important;
    height: 44px !important;
    border-radius: 6px;
}

.csHead input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.csHead input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }

.pgTile .csHex,
.tkPanel .csHex {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.csRemove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--lightGrey);
    border-radius: 50%;
    background: var(--paper);
    font-size: 0.9rem !important;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.csCol:hover .csRemove,
.csRemove:focus-visible { opacity: 1; }

@media (hover: none) {
    .csRemove { opacity: 1; }
}

.csCells {
    display: grid;
    gap: 3px;
}

.csCell {
    padding: 7px 6px;
    background-color: var(--c);
    color: var(--t);
    font-size: 0.68rem;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); /* keeps white shades visible */
}

.csCell.is-theme {
    margin-bottom: 5px;
    font-weight: 600;
}

.csAdd {
    justify-self: start;
    padding: 8px 16px;
    border: 1px dashed var(--ink);
    border-radius: 999px;
    background: none;
    font-size: var(--step--half) !important;
}

.csAdd:disabled {
    border-style: solid;
    border-color: var(--lightGrey);
    color: var(--darkGrey) !important;
    cursor: default;
}

/* 2 Contrast matrix */
.csLegend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--step--half);
    color: var(--darkGrey);
}

.csLegend li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.csBadge {
    display: inline-block;
    min-width: 2.6em;
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    color: #fff;
}

.csBadge.is-aaa   { background: #1d6b4c; }
.csBadge.is-aa    { background: #23845e; }
.csBadge.is-large { background: #b07a12; }
.csBadge.is-fail  { background: #c0392b; }

.csMatrix {
    border-collapse: separate;
    border-spacing: 3px;
}

.csMatrix td { padding: 0; }

.csSame {
    color: var(--darkGrey);
    text-align: center;
}

.csPair {
    display: grid;
    grid-template-rows: auto auto auto;
    justify-items: center;
    width: 62px;
    padding: 6px 2px;
    border: 0;
    border-radius: 6px;
    background: var(--bg);
    color: var(--fg) !important;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.csPair:hover { transform: scale(1.06); }
.csPair.is-on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }

.csAa {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.csRatio {
    font-size: 0.62rem;
    margin-bottom: 3px;
}

.csDetail {
    display: grid;
    gap: 12px;
    padding: 16px;
    background: var(--paper);
}

/* 3 Color codes: one card per color */
.csCodes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 10px;
}

.csCard {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 14px;
    padding: 14px;
    background: var(--paper);
}

.csCardSwatch {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    background: var(--c);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.csCard dl {
    display: grid;
    grid-template-columns: 3.4em 1fr auto;
    align-items: center;
    gap: 6px 10px;
    margin: 0;
    font-size: var(--step--half);
}

.csCard dt { color: var(--darkGrey); }

.csCard dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.csCard button {
    padding: 3px 10px;
    border: 1px solid var(--lightGrey);
    border-radius: 999px;
    background: var(--paper);
    font-size: 0.7rem !important;
}

/* 4 Color blindness: the grid five times, small */
.csBlind {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px var(--gridGap);
}

@media (max-width: 420px) {
    .csBlind { grid-template-columns: 1fr; }
}

.csBlind figure { margin: 0; }

.csBlind figcaption {
    margin-top: 6px;
    font-size: var(--step--half);
    color: var(--darkGrey);
}

.csMini {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
}

.csMini div { display: grid; gap: 2px; }

.csMini span {
    height: 18px;
    background: var(--c);
}

.csMini span:first-child { margin-bottom: 3px; }

/* Palette from a picture: the actions under it */
.tkActions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
}

.csUsePalette {
    padding: 8px 16px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    background: none;
    font-size: var(--step--half) !important;
}

/* Phones: the tool menu stays at the top of the screen while scrolling through a tool */
@media (max-width: 699px) {
    .tkMenu {
        position: sticky;
        top: 0;
        z-index: 5;
        background-color: var(--paper);
        padding-top: 10px;
    }
}


/* Type scale (Toolkit): your own base size */
.tsControls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 20px;
}

.tsBase {
    display: grid;
    gap: 4px;
    font-size: var(--step--half);
}

.tsBase span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tsBaseIn {
    width: 4.5em;
    padding: 6px 8px;
    border: 1px solid var(--lightGrey);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
}

.tsLadder .labPx small {
    font-weight: 400;
    color: var(--darkGrey);
}

.tsCopy {
    padding: 8px 16px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    background: none;
    font-size: var(--step--half) !important;
}


/* ---------- Color gradient (Toolkit) ---------- */
/* The preview with its rail of stops beside it; the hue picker, direction and the two-stop comparison next to them */
.grTool {
    display: grid;
    gap: 18px;
    font-size: var(--step--half);
}

.grStage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 8px;
}

.grPreview {
    height: clamp(260px, 42vw, 440px);
    border-radius: 18px;
}

.grRail {
    position: relative;
    margin: 0;
    touch-action: none;
}

.grRail::before {                   /* the line the stops sit on */
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 46px;
    width: 2px;
    margin-left: -1px;
    background: var(--ink);
    opacity: 0.25;
}

.grHandle {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    transform: translateY(-50%);
    cursor: grab;
}

.grHandle:active { cursor: grabbing; }

.grChip {
    width: 30px;
    height: 30px;
    border: 3px solid #fff;
    border-radius: 6px;
    background: var(--c);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.grDot {
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--ink);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.grTag {
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--paper);
    font-size: 0.7rem;
    white-space: nowrap;
    box-shadow: 0 0 0 1px var(--lightGrey);
}

.grHandle:focus-visible { outline: none; }
.grHandle:focus-visible .grChip { outline: 2px solid var(--ink); outline-offset: 2px; }

.grPick {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.grPick input {
    width: 52px !important;
    height: 52px !important;
    border-radius: 6px;
}

.grPick input::-webkit-color-swatch-wrapper { padding: 0; }
.grPick input::-webkit-color-swatch { border: 0; border-radius: 5px; }
.grPick small { color: var(--darkGrey); }

.grAngle {
    display: grid;
    gap: 4px;
    max-width: 420px;
}

.grAngle span {
    display: flex;
    align-items: center;
    gap: 10px;
}

.grAngle input { flex: 1; }

.grStops {
    border-collapse: separate;
    border-spacing: 4px;
    font-size: var(--step--half);
}

.grStops th {
    padding: 0 6px;
    font-weight: 400;
    color: var(--darkGrey);
    text-align: left;
    white-space: nowrap;
}

.grStops tbody th {
    color: var(--ink);
    font-weight: 600;
}

.grStops input {
    width: 4.2em;
    padding: 6px 8px;
    border: 1px solid var(--lightGrey);
    border-radius: 6px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
}

.grStops td.is-same input {        /* the one consistent hue */
    border-color: #23845e;
    background: rgba(35, 132, 94, 0.12);
}

.grStops .grHex {
    width: 6.2em;
    text-transform: uppercase;
}

.grStops .grColor {               /* the swatch you click to pick the stop's color */
    width: 38px !important;
    height: 34px !important;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
}

.grStops .grColor::-webkit-color-swatch-wrapper { padding: 0; }
.grStops .grColor::-webkit-color-swatch { border: 0; border-radius: 5px; }

.grStops tr.is-auto input:not(.grColor) {   /* calculated from the light source and anchor */
    color: var(--darkGrey);
    border-style: dashed;
}

.grReset {
    padding: 8px 16px;
    border: 1px solid var(--lightGrey);
    border-radius: 999px;
    background: none;
    font-size: var(--step--half) !important;
}

.grCopy {
    padding: 8px 16px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    background: none;
    font-size: var(--step--half) !important;
}


/* Phones: a narrower rail, so the preview gets the room; the stop names are in the table below */
@media (max-width: 699px) {
    .grStage { grid-template-columns: minmax(0, 1fr) 96px; }
    .grName { display: none; }
}

/* Removing a stop (hold or falloff) and adding them back calculated */
.grDel {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--lightGrey);
    border-radius: 50%;
    background: var(--paper);
    font-size: 1rem !important;
    line-height: 1;
}

.grDel:hover { border-color: var(--ink); }

.grFill {
    padding: 8px 16px;
    border: 1px dashed var(--ink);
    border-radius: 999px;
    background: none;
    font-size: var(--step--half) !important;
}

.grFill[hidden] { display: none; }
