#studio {
    --paper: #e7d8b9;
    --muted: #c8b69a;
    --line: #594437;
    --accent: #e8a389;
    height: auto;
    min-height: 0;
    display: block;
    padding: 30px clamp(22px, 5vw, 68px) 50px;
    background: linear-gradient(105deg, #1b1411 5%, #1b1411e8 47%, #1b1411bd),
                url("assets/dark-bg.jpg") center 45% / cover;
}

#studio .header {
    position: static;
    align-items: center;
    height: auto;
    padding: 0 0 17px;
    gap: 10px;
}

#studio .section-heading {
    position: static;
    margin: 32px 0 25px;
    animation: none;
}

#studio .section-heading h2 {
    margin: 9px 0;
    font-size: clamp(30px, 5.3vw, 51px);
    animation: none;
}

#studio .section-heading span { color: var(--accent); letter-spacing: .12em; }
#studio .section-heading p { color: var(--muted); opacity: 1; margin: 0; line-height: 1.65; }
#studio .section-heading::after { display: none; }

.studio-workbench {
    --pigment: #913c30;
    --units: 5;
    --line-weight: 2.3;
    --motif-scale: 1;
    display: grid;
    grid-template-columns: minmax(148px, .72fr) minmax(0, 2.15fr) minmax(214px, 1fr);
    gap: clamp(14px, 2.1vw, 29px);
    padding: clamp(15px, 2.1vw, 28px);
    background: #1b1512f2;
    border: 1px solid var(--line);
    color: #f0e4cc;
    box-shadow: 0 20px 65px #0b080766;
}

.studio-workbench fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.studio-workbench legend { padding: 0; margin-bottom: 8px; font-size: 15px; color: var(--paper); }
.studio-options { display: grid; gap: 6px; }

.studio-options label {
    display: grid;
    place-items: center;
    position: relative;
    min-height: 38px;
    border: 1px solid var(--line);
    background: #281e19;
    cursor: pointer;
    font-size: 13px;
    transition: border-color .2s, background-color .2s, color .2s;
}

.studio-options input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

.studio-options label:has(input:checked) {
    border-color: #ca8065;
    background: #533026;
    color: #fff2dc;
    box-shadow: inset 0 -2px #ca8065;
}

.studio-options label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 1; }
.studio-patterns label { grid-template-columns: 40px minmax(0, 1fr); gap: 8px; padding: 6px; justify-items: start; }
.studio-patterns label img { width: 40px; height: 40px; object-fit: cover; }
.studio-notes { min-height: 62px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.studio-reference { display: inline-flex; gap: .4em; font-size: 12px; color: var(--accent); text-underline-offset: .25em; }

.studio-preview {
    min-width: 0;
    margin: 0;
    border: 1px solid #b39b77;
    background: var(--paper);
    color: #432a20;
    align-self: start;
}

.studio-preview figcaption {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 11px 14px;
    border-bottom: 1px solid #aa8b65;
    letter-spacing: .08em;
    font-size: 13px;
}

.studio-preview figcaption strong { color: #763e2d; font-size: 12px; font-weight: normal; }

.studio-plate {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    overflow: hidden;
    color: var(--pigment);
    background:
        repeating-linear-gradient(0deg, #64472c11 0 1px, transparent 1px 5px),
        radial-gradient(ellipse, #f4e6c7 12%, #ead9b5 65%, #c7ad83);
    transition: color .32s;
}

.studio-workbench:has([name="color"][value="rice"]:checked) .studio-plate {
    background:
        repeating-linear-gradient(0deg, #deb47d0b 0 1px, transparent 1px 5px),
        radial-gradient(ellipse, #50362a, #241a16 78%);
}

.studio-svg { display: block; width: 92%; height: auto; stroke-width: var(--line-weight); }
.motif-size { transform: scale(var(--motif-scale)); transition: transform .32s ease; }
.motif-set { animation: motif-arrive .42s ease-out; }
.motif-set use { transform: rotate(calc(1turn * var(--i) / var(--units))); transition: transform .35s cubic-bezier(.22,.7,.3,1); }
.motif-set, .studio-notes p, .studio-preview strong span { display: none; }
.studio-preview strong span { white-space: nowrap; }
@keyframes motif-arrive { from { opacity: .35; transform: rotate(-8deg); } to { opacity: 1; transform: rotate(0); } }

.studio-preview > p {
    margin: 0;
    padding: 8px 14px;
    border-top: 1px solid #aa8b65;
    color: #573b2d;
    font-size: 12px;
    line-height: 1.5;
}

.studio-controls { display: grid; gap: 10px; align-content: start; }
.studio-count .studio-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.studio-size .studio-options, .studio-weight .studio-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.studio-colors .studio-options { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.studio-colors label { padding: 5px 0; gap: 4px; font-size: 11px; min-height: 47px; }
.studio-colors i { width: 17px; height: 17px; border: 1px solid #d1b99a; border-radius: 50%; background: var(--swatch); }
.studio-reset {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .55em;
    min-height: 41px;
    padding: 5px 9px;
    font: inherit;
    font-size: 13px;
    border: 1px solid var(--line);
    color: #fff0d6;
    background: #281e19;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .2s, border-color .2s;
}

#studio .side-nav {
    position: static;
    display: flex;
    flex-flow: row wrap;
    justify-content: flex-end;
    gap: 12px 24px;
    height: auto;
    padding: 15px 0 0;
    border-right: 0;
}
#studio .side-nav .active { color: var(--accent); border: 0; padding: 0; }

@media (hover: hover) {
    .studio-options label:hover, .studio-reset:hover { border-color: var(--accent); background: #6e3b2d; }
}

@media (max-width: 850px) {
    .studio-workbench { grid-template-columns: minmax(0, 1fr) minmax(206px, .74fr); }
    .studio-sources { grid-column: 1 / -1; }
    .studio-patterns .studio-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .studio-notes { min-height: auto; }
    .studio-notes p { margin: 8px 0 4px; }
}

@media (max-width: 570px) {
    #studio { padding: 19px 12px 31px; }
    #studio .section-heading { margin-top: 27px; padding-inline: 4px; }
    .studio-workbench { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 10px; }
    .studio-patterns label { grid-template-columns: 1fr; justify-items: center; text-align: center; min-height: 44px; }
    .studio-patterns label img { display: none; }
    .studio-options label { min-height: 44px; }
    .studio-plate { aspect-ratio: 1.13; }
    .studio-svg { width: 86%; }
    .studio-reset { min-height: 44px; }
    #studio .side-nav { justify-content: center; gap: 8px 14px; }
}


.studio-workbench:has([name="pattern"][value="cloud"]:checked) :is(.motif-cloud, .note-cloud, .caption-cloud) { display: revert; }
.studio-workbench:has([name="pattern"][value="beast"]:checked) :is(.motif-beast, .note-beast, .caption-beast) { display: revert; }
.studio-workbench:has([name="pattern"][value="border"]:checked) :is(.motif-border, .note-border, .caption-border) { display: revert; }

.studio-workbench:has([name="count"][value="2"]:checked) { --units: 2; }
.studio-workbench:has([name="count"][value="2"]:checked) .motif-set use:nth-child(n+3) { display: none; }
.studio-workbench:has([name="count"][value="3"]:checked) { --units: 3; }
.studio-workbench:has([name="count"][value="3"]:checked) .motif-set use:nth-child(n+4) { display: none; }
.studio-workbench:has([name="count"][value="4"]:checked) { --units: 4; }
.studio-workbench:has([name="count"][value="4"]:checked) .motif-set use:nth-child(n+5) { display: none; }
.studio-workbench:has([name="count"][value="5"]:checked) { --units: 5; }
.studio-workbench:has([name="count"][value="5"]:checked) .motif-set use:nth-child(n+6) { display: none; }
.studio-workbench:has([name="count"][value="6"]:checked) { --units: 6; }
.studio-workbench:has([name="count"][value="6"]:checked) .motif-set use:nth-child(n+7) { display: none; }
.studio-workbench:has([name="count"][value="7"]:checked) { --units: 7; }
.studio-workbench:has([name="count"][value="7"]:checked) .motif-set use:nth-child(n+8) { display: none; }
.studio-workbench:has([name="count"][value="8"]:checked) { --units: 8; }
.studio-workbench:has([name="count"][value="8"]:checked) .motif-set use:nth-child(n+9) { display: none; }
.studio-workbench:has([name="count"][value="9"]:checked) { --units: 9; }
.studio-workbench:has([name="count"][value="9"]:checked) .motif-set use:nth-child(n+10) { display: none; }

.studio-workbench:has([name="weight"][value="fine"]:checked) { --line-weight: 1.4; }
.studio-workbench:has([name="weight"][value="medium"]:checked) { --line-weight: 2.3; }
.studio-workbench:has([name="weight"][value="bold"]:checked) { --line-weight: 3.5; }
.studio-workbench:has([name="size"][value="small"]:checked) { --motif-scale: 0.78; }
.studio-workbench:has([name="size"][value="regular"]:checked) { --motif-scale: 1; }
.studio-workbench:has([name="size"][value="large"]:checked) { --motif-scale: 1.1; }
.studio-workbench:has([name="color"][value="cinnabar"]:checked) { --pigment: #913c30; }
.studio-workbench:has([name="color"][value="ink"]:checked) { --pigment: #28221e; }
.studio-workbench:has([name="color"][value="rice"]:checked) { --pigment: #f0e0c2; }
.studio-workbench:has([name="color"][value="gold"]:checked) { --pigment: #78501f; }
.studio-workbench:has([name="color"][value="jade"]:checked) { --pigment: #30615a; }
