@layer components {
    .palette-picker {
        margin: 0;
        padding: 0;
        border: 0;
    }

    .palette-picker__title {
        margin: 0 0 var(--space-2);
        padding: 0;
        font-family: var(--font-heading);
        font-size: var(--text-h4);
        font-weight: var(--font-heading-weight);
    }

    /* Two by two on a phone, four in a row from a tablet up. */
    .palette-picker__options {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-3);

        @media (min-width: 40rem) {
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }
    }

    .palette-picker__option {
        position: relative;
        display: flex;
        flex-direction: column;
        gap: var(--space-1);
        min-block-size: 44px;
        cursor: pointer;

        & input {
            position: absolute;
            inline-size: 1px;
            block-size: 1px;
            opacity: 0;
        }
    }

    .palette-picker__swatch {
        display: block;
        inline-size: 100%;
        block-size: auto;
        border-radius: var(--radius-md);
        outline: 2px solid transparent;
        outline-offset: 2px;
    }

    .palette-picker__option:hover .palette-picker__swatch {
        outline-color: var(--color-accent-300);
    }

    .palette-picker__option:has(input:checked) .palette-picker__swatch {
        outline-color: var(--color-accent);
    }

    .palette-picker__option:has(input:focus-visible) .palette-picker__swatch {
        outline: 2px solid var(--color-accent);
        outline-offset: 4px;
    }

    .palette-picker__option:has(input:checked) .palette-picker__label {
        font-weight: 600;
    }

    .palette-picker__label {
        font-size: var(--text-s);
        line-height: 1.3;
    }

    .palette-picker__sky { fill: var(--swatch-sky); }
    .palette-picker__land { fill: var(--swatch-fill); }

    .palette-picker__ridge {
        fill: none;
        stroke: var(--swatch-stroke);
        stroke-width: 2;
    }

    .palette-picker__dot { fill: var(--swatch-accent); }
}
