.studio-upload {
  --studio-mat: #dfe7e1;
  --studio-line: #bbc6bb;
  --studio-error: #873b2f;
  width: min(89%, 72rem);
  margin: 0 auto;
  padding-block: clamp(2rem, 4vw, 4.25rem) clamp(3rem, 7vw, 6rem);
  color: var(--gallery-ink);
}

.studio-upload [hidden] { display: none !important; }
.studio-upload__heading { margin-bottom: clamp(1.8rem, 3.2vw, 3rem); }
.studio-upload__heading p { margin: 0; color: var(--gallery-muted); font-size: 1rem; line-height: 1.55; }
.studio-upload__heading .studio-upload__step { color: #52654f; font-size: .83rem; font-weight: 650; }
.studio-upload h1, .studio-upload h2, .studio-upload legend {
  color: var(--gallery-pine);
  font-family: var(--gallery-serif);
  font-weight: 400;
}

.studio-upload h1 {
  margin: .42rem 0 .65rem;
  font-size: clamp(3.1rem, 6.25vw, 5.8rem);
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
  line-height: .97;
}

.studio-upload__form {
  display: grid;
  grid-template-columns: minmax(0, .83fr) minmax(0, 1.4fr);
  gap: 1.65rem clamp(1.8rem, 4.25vw, 4.25rem);
  align-items: start;
}

.studio-upload__source, .studio-upload__styles { min-width: 0; }
.studio-upload__source, .studio-upload__style-options { container-type: inline-size; }
.studio-upload__styles { margin: 0; padding: 0; border: 0; }
.studio-upload h2, .studio-upload legend {
  margin: 0 0 .85rem;
  padding: 0;
  font-size: clamp(1.85rem, 3vw, 2.55rem);
  letter-spacing: -.025em;
  line-height: 1.1;
}

.studio-upload__mat {
  padding: clamp(1rem, 2vw, 1.8rem);
  text-align: center;
  background: var(--studio-mat);
}

.studio-upload__example {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.1rem, 2vw, 1.6rem);
  max-width: 21rem;
  margin: 0 auto 1.1rem;
}

.studio-upload__example figure {
  flex: 0 0 auto;
  width: clamp(5.15rem, 7.4vw, 7rem);
  margin: 0;
  padding: .28rem .28rem .32rem;
  transform: rotate(-3deg);
  background: #fffdf5;
  box-shadow: 0 2px 4px #273e302d;
}

.studio-upload__example img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

.studio-upload__example figcaption { padding-top: .23rem; white-space: nowrap; color: #465346; font: italic .82rem/1.05 var(--gallery-serif); }
.studio-upload__example p { max-width: 14ch; margin: 0; text-align: left; font-size: .97rem; line-height: 1.45; }
.studio-upload__selection { min-width: 0; margin: 0 0 .8rem; }
.studio-upload__selection img { display: block; width: 100%; height: clamp(7rem, 13vw, 12rem); object-fit: contain; }
.studio-upload__selection figcaption {
  margin: .4rem auto 0;
  overflow-wrap: anywhere;
  color: #435345;
  font-size: .8rem;
  line-height: 1.3;
}

.studio-upload__picker {
  position: relative;
  display: block;
  max-width: 100%;
  margin-inline: auto;
}

.studio-upload__picker input { max-width: 100%; width: 100%; font: inherit; font-size: .9rem; }
.studio-upload__picker input::file-selector-button, .studio-upload__picker-text {
  border: 1px solid #536250;
  border-radius: 2rem;
  padding: .62rem 1.1rem;
  color: var(--gallery-pine);
  background: #f7f8ed;
  font: 650 .9rem/1.3 var(--gallery-sans);
  cursor: pointer;
}

.studio-upload__source:not([data-enhanced]) .studio-upload__picker-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

.studio-upload__source[data-enhanced] .studio-upload__picker { width: fit-content; }
.studio-upload__source[data-enhanced] .studio-upload__picker-text { display: grid; min-height: 44px; place-items: center; }
.studio-upload__source[data-enhanced] .studio-upload__picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.studio-upload__picker:hover .studio-upload__picker-text { background: #fffdf4; }
.studio-upload__picker:has(:focus-visible) { border-radius: 2rem; outline: 3px solid #88601b; outline-offset: 3px; }
.studio-upload__hint { margin: .55rem 0 0; color: #455544; font-size: .8rem; line-height: 1.45; }
.studio-upload__error { margin: .65rem 0 0; color: var(--studio-error); font-size: .94rem; line-height: 1.5; }
.studio-upload__form-error { grid-column: 1 / -1; margin: 0; border-left: 3px solid; padding-left: .8rem; }

.studio-upload__swatches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(.5rem, 1.1vw, 1rem);
}

.studio-upload__swatch {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
  padding: .32rem .32rem .7rem;
  border: 1px solid #c9c9bb;
  cursor: pointer;
}

.studio-upload__swatch:has(:checked) { border-color: var(--gallery-pine); box-shadow: inset 0 0 0 1px var(--gallery-pine); background: #eeefe2; }
.studio-upload__swatch:hover { border-color: #5b715d; }
.studio-upload__swatch:has(:focus-visible) { outline: 3px solid #88601b; outline-offset: 3px; }
.studio-upload__swatch input {
  position: absolute;
  z-index: 1;
  top: .68rem;
  right: .68rem;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  appearance: none;
  border: 1px solid #657661;
  border-radius: 50%;
  background: #fffdf5;
  box-shadow: 0 0 0 2px #fffdf3;
  cursor: pointer;
}

.studio-upload__swatch input:checked { background: radial-gradient(circle, var(--gallery-pine) 0 44%, #fffdf5 48%); }
@media (forced-colors: active) {
  .studio-upload__swatch input { appearance: auto; }
}

.studio-upload__swatch img { display: block; width: 100%; height: auto; aspect-ratio: 1.1; object-fit: cover; object-position: 50% 46%; }
.studio-upload__swatch-name {
  margin: .55rem .28rem 0;
  color: var(--gallery-pine);
  font: 400 clamp(1.35rem, 2.25vw, 2.05rem)/1.04 var(--gallery-serif);
  letter-spacing: -.02em;
}
.studio-upload__swatch-detail { margin: .25rem .28rem 0; color: var(--gallery-muted); font: 400 .82rem/1.4 var(--gallery-sans); }

.studio-upload__finish {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.2rem;
  border-top: 1px solid var(--studio-line);
  padding-top: 1.2rem;
}

.studio-upload__terms { max-width: 70ch; color: var(--gallery-muted); font-size: .85rem; line-height: 1.55; }
.studio-upload__terms p { margin: 0; }
.studio-upload__submit {
  flex: none;
  min-height: 48px;
  border: 1px solid var(--gallery-pine);
  border-radius: 2rem;
  padding: .7rem 1.4rem;
  color: #fffdf2;
  background: var(--gallery-pine);
  font: 650 1rem/1.25 var(--gallery-sans);
  cursor: pointer;
}

.studio-upload__submit:hover { background: #182f25; }
@media (max-width: 779px) {
  .studio-upload { width: min(90%, 38rem); }
  .studio-upload__form { grid-template-columns: minmax(0, 1fr); gap: 1.55rem; }
  .studio-upload__mat { padding: 1.15rem; }
  .studio-upload__example { margin-bottom: .75rem; }
  .studio-upload__selection img { height: 9rem; }
  .studio-upload__swatch { padding: .24rem .24rem .55rem; }
  .studio-upload__swatch input { top: .52rem; right: .52rem; width: .95rem; height: .95rem; }
  .studio-upload__swatch-name { margin: .48rem .12rem 0; font-size: clamp(1.18rem, 5vw, 1.8rem); }
  .studio-upload__swatch-detail { margin: .2rem .12rem 0; font-size: .75rem; }
  .studio-upload__finish { align-items: start; flex-direction: column; gap: .8rem; padding-top: 1rem; }
}

@media (max-width: 400px) {
  .studio-upload { width: 92%; }
  .studio-upload__swatches { gap: .38rem; }
  .studio-upload__submit { width: 100%; }
}

@container (max-width: 18rem) {
  .studio-upload__swatches { grid-template-columns: minmax(0, 1fr); }
  .studio-upload__swatch {
    display: grid;
    grid-template-columns: minmax(0, 30%) minmax(0, 1fr);
    gap: .15rem .6rem;
    align-content: center;
    padding: .35rem;
  }
  .studio-upload__swatch img { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .studio-upload__swatch input { left: .52rem; right: auto; top: .52rem; }
  .studio-upload__swatch-name { align-self: end; }
  .studio-upload__swatch-name, .studio-upload__swatch-detail { grid-column: 2; margin: 0; overflow-wrap: anywhere; }
  .studio-upload__example { flex-wrap: wrap; gap: .75rem; }
  .studio-upload__example p { max-width: 20ch; text-align: center; }
}
