/**
 * Playground colors (dark only; the cookie banner has its own themes)
 */
:root {
    color-scheme: dark;
    --bg: #08090a;
    --surface: #111214;
    --raised: #191b1f;
    --raised-hover: #212429;
    --line: #202327;
    --line-strong: #30343a;
    --text: #d7dbe0;
    --heading: #f1f3f5;
    --muted: #9ba3ad;
    --accent: #6b93ff;
    --accent-hover: #8eadff;
    --accent-soft: rgba(107, 147, 255, .12);
    --accent-line: rgba(107, 147, 255, .6);
    --on-accent: #0d1220;
    --focus-color: #8fb2ff;
    --notice-bg: #231e14;
    --notice-line: #4a3d1f;
    --notice-text: #e8d6ad;
    --danger: #f08b82;
    --code-bg: #0e1012;
    --code-line: #22262b;

    --radius: .5rem;
    --d-select-height: 2.375rem;
    --d-checkbox-width: 1.125rem;
    --page-width: 84rem;
}

* {
    box-sizing: border-box;
}

html {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background-color: var(--bg);
    color: var(--text);
    -ms-touch-action: manipulation;
        touch-action: manipulation;
    scrollbar-width: thin;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-size: .9375rem;
    line-height: 1.55;
    background-color: var(--bg);
    overflow-x: hidden;
}

:not(#cc-main *):focus-visible {
    outline: .125rem solid var(--focus-color);
    outline-offset: .125rem;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 600;
    color: var(--heading);
    line-height: 1.25;
}

h2,
h3 {
    display: flex;
    align-items: center;
    gap: .6rem;
}

h2 {
    font-size: 1.2rem;
    letter-spacing: -.01em;
}

h3 {
    font-size: 1rem;
}

p {
    margin: 0;
}

b {
    font-weight: 600;
    color: var(--heading);
}

a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--accent-line);
    text-decoration-thickness: .0625rem;
    text-underline-offset: .2em;
    transition: color .15s ease;

    &:hover {
        color: var(--accent-hover);
    }
}

button,
select,
input,
textarea {
    font-family: inherit;
}

label {
    position: relative;
}

code {
    padding: .1rem .35rem;
    font-size: .8125rem;
    color: var(--heading);
    background: var(--raised);
    border: .0625rem solid var(--line);
    border-radius: .3rem;
}

p code {
    white-space: nowrap;
}

/** Workbench: steps on the left, the live config pinned on the right **/

.workbench {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 32rem);
    grid-template-areas:
        "steps code"
        "install code";
    column-gap: 3.5rem;
}

.workbench__steps {
    grid-area: steps;
}

.live-config {
    grid-area: code;
}

.installation {
    grid-area: install;
}

/** Steps **/

.step {
    padding: 2.25rem 0;
    border-top: .0625rem solid var(--line);
}

.workbench__steps > .step:first-child {
    border-top: 0;
}

.step__header {
    display: flex;
    gap: .9rem;
    margin-bottom: 1.5rem;
}

.step__number {
    flex: none;
    display: grid;
    place-items: center;
    width: 1.625rem;
    height: 1.625rem;
    margin-top: -.1rem;
    font-size: .8125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    border: .0625rem solid var(--line-strong);
    border-radius: 100%;
}

.step__description {
    margin-top: .3rem;
    max-width: 40rem;
    color: var(--muted);
}

/* content lines up with the step title */
.step > :not(.step__header) {
    margin-left: 2.5rem;
}

/** Controls **/

a.help-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    background: var(--raised);
    border: .0625rem solid var(--line);
    border-radius: 100%;
    transition: color .15s ease,
                background-color .15s ease,
                border-color .15s ease;

    &:hover {
        color: var(--on-accent);
        background-color: var(--accent);
        border-color: var(--accent);
    }
}

.styled-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .55rem 1rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--heading);
    background: var(--raised);
    border: .0625rem solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color .15s ease,
                border-color .15s ease,
                color .15s ease;

    &:hover {
        background: var(--raised-hover);
        border-color: var(--line-strong);
    }

    &:active:not(:disabled) {
        background: var(--raised);
        transform: translateY(.0625rem);
    }
}

.styled-btn--primary {
    color: var(--on-accent);
    background: var(--accent);
    border-color: var(--accent);

    &:hover {
        background: var(--accent-hover);
        border-color: var(--accent-hover);
    }

    &:active:not(:disabled) {
        background: var(--accent);
    }
}

.styled-btn--quiet {
    color: var(--muted);
    background: transparent;
    border-color: transparent;

    &:hover {
        color: var(--danger);
        background: transparent;
        border-color: var(--line);
    }
}

select,
input[type=checkbox],
input[type=radio] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-size: inherit;
    color: inherit;
}

/** Checkbox **/

input[type="checkbox"]:not(.custom-input) {
    position: relative;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--d-checkbox-width);
    height: var(--d-checkbox-width);
    margin: 0;
    background: var(--surface);
    border: .0625rem solid var(--line-strong);
    border-radius: .3rem;
    cursor: pointer;
    transition: border-color .15s ease,
                background-color .15s ease;

    &:hover {
        border-color: var(--accent);
    }

    &:checked {
        background-color: var(--accent);
        border-color: var(--accent);
    }

    &:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

    &::after {
        content: "";
        position: absolute;
        margin-top: -.0625rem;
        width: .25rem;
        height: .5rem;
        border: .125rem solid var(--on-accent);
        border-top: 0;
        border-left: 0;
        opacity: 0;
        transform: scale(.8) rotate(43deg);
        transition: transform .15s ease, opacity .15s ease;
    }

    &:checked::after {
        opacity: 1;
        transform: scale(1) rotate(43deg);
    }
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.checkbox-div {
    display: flex;
    align-items: center;
    gap: .6rem;

    label {
        display: flex;
        align-items: center;
        gap: .5rem;
        cursor: pointer;
    }
}

/** Select with a label in front **/

.select-label {
    display: flex;
    width: 100%;
    max-width: 22rem;
    height: var(--d-select-height);
    margin-bottom: .5rem;
    font-size: .875rem;
    background: var(--surface);
    border: .0625rem solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;

    > span:first-child {
        flex: none;
        display: flex;
        align-items: center;
        min-width: 8.5rem;
        padding: 0 .85rem;
        color: var(--muted);
        background: var(--raised);
        border-right: .0625rem solid var(--line);
        white-space: nowrap;
    }
}

.select-input {
    position: relative;
    flex: 1;
}

select {
    width: 100%;
    height: 100%;
    padding: 0 2rem 0 .85rem;
    font-weight: 600;
    color: var(--heading);
    background: transparent;
    border: 0;
    border-radius: 0;
    outline: none;
    cursor: pointer;

    option {
        color: var(--heading);
        background: var(--surface);
    }

    &:disabled {
        color: var(--muted);
        cursor: not-allowed;

        ~ .arrow-icon::before {
            opacity: .4;
        }
    }
}

.select-label:hover:not(:has(select:disabled)) {
    border-color: var(--line-strong);
}

.select-label:has(select:focus-visible) {
    outline: .125rem solid var(--focus-color);
    outline-offset: .125rem;
}

select ~ .arrow-icon {
    position: absolute;
    top: 50%;
    right: .55rem;
    width: 1rem;
    height: 1rem;
    pointer-events: none;
    transform: translateY(-50%);

    &::before {
        content: "";
        position: absolute;
        top: 35%;
        left: 50%;
        padding: .15rem;
        border: solid var(--heading);
        border-width: 0 .125rem .125rem 0;
        transform: translate(-50%, -50%) rotate(45deg);
    }
}

/** Selectable tiles (categories, languages) **/

.custom-inputs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;

    label {
        cursor: pointer;
    }

    input {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        cursor: pointer;
        outline: none;
    }

    .label {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        height: 100%;
        padding: .7rem .9rem;
        font-weight: 600;
        color: var(--heading);
        background: var(--surface);
        border: .0625rem solid var(--line);
        border-radius: var(--radius);
        pointer-events: none;
        transition: border-color .15s ease,
                    background-color .15s ease;
    }

    label:hover .label {
        border-color: var(--line-strong);
    }

    input:checked ~ .label {
        background: var(--accent-soft);
        border-color: var(--accent-line);
    }

    input:focus-visible ~ .label {
        outline: .125rem solid var(--focus-color);
        outline-offset: .125rem;
    }

    .tick {
        position: relative;
        flex: none;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 1.25rem;
        height: 1.25rem;
        border: .0625rem solid var(--line-strong);
        border-radius: 100%;
        transition: background-color .15s ease, border-color .15s ease;

        &::after {
            content: "";
            position: absolute;
            margin-top: -.0625rem;
            width: .22rem;
            height: .45rem;
            border: .125rem solid var(--on-accent);
            border-top: 0;
            border-left: 0;
            opacity: 0;
            transform: rotate(43deg);
        }
    }

    input:checked ~ .label .tick {
        background: var(--accent);
        border-color: var(--accent);

        &::after {
            opacity: 1;
        }
    }

    .tick--locked,
    input:checked ~ .label .tick--locked {
        color: var(--muted);
        background: none;
        border: 0;

        &::after {
            display: none;
        }
    }

    input:disabled {
        cursor: not-allowed;

        ~ .label {
            background: var(--raised);
            border-color: var(--line);
        }
    }
}

.label__text {
    min-width: 0;

    small {
        display: block;
        margin-top: .15rem;
        font-size: .8125rem;
        font-weight: 400;
        line-height: 1.35;
        color: var(--muted);
    }
}

.custom-inputs--categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/** Step 2: languages **/

.languages {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
}

.custom-inputs--languages {
    grid-template-columns: repeat(2, minmax(0, 1fr));

    .label {
        font-weight: 500;
    }
}

#edit-translations-btn {
    width: 100%;
    margin-top: .75rem;

    &:disabled {
        color: var(--notice-text);
        background: var(--notice-bg);
        border-color: var(--notice-line);
        cursor: not-allowed;
    }
}

.no-translations-error .custom-inputs .label {
    border-color: var(--notice-line);
}

.languages__options {
    display: flex;
    flex-direction: column;

    h3 {
        margin-bottom: .9rem;
    }

    .checkbox-div {
        margin: .5rem 0 .75rem;
    }
}

.language__details {
    margin: .5rem 0 0;
    max-width: 22rem;
    padding: .6rem .85rem;
    font-size: .875rem;
    background: var(--raised);
    border-radius: var(--radius);

    div {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: .15rem 0;
    }

    dt {
        color: var(--muted);
    }

    dd {
        margin: 0;
    }

    code {
        background: var(--surface);
    }
}

/** Step 3: layout **/

.layout-groups {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2.5rem;

    h3 {
        margin-bottom: .2rem;
    }

    .checkbox-group {
        margin-top: 1rem;
    }
}

.layout-group__description {
    margin-bottom: 1rem;
    font-size: .875rem;
    color: var(--muted);
}

.layout-extras {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem 2rem;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: .0625rem dashed var(--line);
}

.layout-extras__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/** Step 4: themes **/

.themes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;

    label {
        position: relative;
        cursor: pointer;
    }

    input {
        position: absolute;
        inset: 0;
        margin: 0;
        opacity: 0;
        cursor: pointer;
    }

    .input-label {
        display: flex;
        flex-direction: column;
        gap: .2rem;
        height: 100%;
        padding: .9rem;
        background: var(--surface);
        border: .0625rem solid var(--line);
        border-radius: .625rem;
        pointer-events: none;
        transition: border-color .15s ease,
                    background-color .15s ease;
    }

    label:hover .input-label {
        border-color: var(--line-strong);
    }

    input:checked + .input-label {
        background: var(--accent-soft);
        border-color: var(--accent-line);
        box-shadow: 0 0 0 .0625rem var(--accent-line);
    }

    input:focus-visible + .input-label {
        outline: .125rem solid var(--focus-color);
        outline-offset: .125rem;
    }

    .theme-type {
        font-size: .75rem;
        font-weight: 600;
        color: var(--muted);
    }

    .theme-name {
        margin-bottom: .6rem;
        font-weight: 600;
        color: var(--heading);
    }

    .theme-preview {
        display: flex;
        flex-direction: column;
        gap: .4rem;
        padding: .8rem;
        background: var(--cc-bg);
        border: .0625rem solid rgba(127, 127, 127, .25);
        border-radius: .4rem;
    }

    /* the plugin's default (light) colors, so the preview doesn't follow the active theme */
    .theme-preview--light {
        --cc-bg: #fff;
        --cc-primary-color: #2c2f31;
        --cc-secondary-color: #5e6266;
        --cc-btn-primary-bg: #30363c;
        --cc-btn-secondary-bg: #eaeff2;
    }

    .theme-preview__line {
        width: 80%;
        height: .4rem;
        border-radius: 1rem;
        background: var(--cc-primary-color);
    }

    .theme-preview__line--short {
        width: 55%;
        background: var(--cc-secondary-color);
    }

    .theme-preview__btns {
        display: flex;
        gap: .4rem;
        margin-top: .3rem;
    }

    .theme-preview__btn {
        flex: 1;
        height: 1rem;
        border-radius: .25rem;
        background: var(--cc-btn-primary-bg);
    }

    .theme-preview__btn--secondary {
        background: var(--cc-btn-secondary-bg);
    }
}

.custom-themes {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;

    .hl {
        margin: 0;
        overflow: hidden;
    }
}

/** Code blocks (Shiki output) are dark in both modes **/

.hl {
    background: var(--code-bg);
    border-color: var(--code-line);
}

/** Misc **/

@keyframes fadeIn {
    from {
        opacity: 0;
        visibility: hidden;
    }
    to {
        opacity: 1;
        visibility: visible;
    }
}

.fade-in {
    opacity: 0;
    visibility: hidden;
    animation: fadeIn .4s ease .3s forwards;
}

.cc--disable-transitions #cc-main,
.cc--disable-transitions #cc-main .cm,
.cc--disable-transitions #cc-main .pm {
    --cc-modal-transition-duration: 0s;
}

@media (prefers-reduced-motion: reduce) {
    .fade-in {
        animation-duration: 0s;
        animation-delay: 0s;
    }
}

/** Smaller screens: one column, the config sits right before step 5 **/

@media only screen and (max-width: 68rem) {
    .workbench {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "steps"
            "code"
            "install";
    }
}

@media only screen and (max-width: 48rem) {
    .languages,
    .layout-groups {
        grid-template-columns: minmax(0, 1fr);
        gap: 2rem;
    }

    .themes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .step > :not(.step__header) {
        margin-left: 0;
    }
}

@media only screen and (max-width: 30rem) {
    .workbench {
        padding: 0 1rem;
    }

    .custom-inputs--categories {
        grid-template-columns: minmax(0, 1fr);
    }

    .themes {
        gap: .5rem;
    }

}
