@font-face {
  font-family: Unbounded;
  src: url("brand/unbounded-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Space Mono";
  src: url("brand/space-mono.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --ink: #413b32;
  --paper: #fff8df;
  --border: #4f4f4f;
  --heading: Unbounded, Arial, sans-serif;
  font-family: "Space Mono", monospace;
  color: var(--ink);
  background: #f2e1cf;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: url("brand/squares.png") center / cover fixed no-repeat,
    linear-gradient(212deg, #f2e8c9, #f2d9d5) fixed;
}

main {
  width: min(100% - 28px, 420px);
  margin: 0 auto;
  padding: 26px 0 24px;
  text-align: center;
}

.booth, .media-kit {
  padding: 15px clamp(12px, 4vw, 26px) 13px;
  border: 3px solid var(--border);
  border-radius: 7px;
  box-shadow: 2px 3px 0 var(--border);
}

.booth { background: linear-gradient(45deg, #e0c21f, #f2d749 60%); }

.brand {
  display: block;
}

.brand img {
  display: block;
  width: 100%;
  height: auto;
}

h1 {
  margin: 4px 0 14px;
  color: #493120;
  font: 700 clamp(1.4rem, 6vw, 1.65rem) / 1.2 var(--heading);
  letter-spacing: -.055em;
}

.view {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #6f512d;
  background: #ffd773;
}

.view.transparent {
  background: conic-gradient(#ece6da 25%, #fff9ed 0 50%, #ece6da 0 75%, #fff9ed 0) 0 0 / 20px 20px;
}

canvas { display: block; width: 100%; height: 100%; }

#status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 7px;
  font-size: .875rem;
  background: var(--paper);
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px 10px;
  margin: 11px 0 5px;
  text-align: left;
}

.field {
  display: grid;
  gap: 3px;
  font-size: .875rem;
}

select, .swatch {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background-color: var(--paper);
  color: var(--ink);
  padding: 0 6px;
  font: 1rem "Space Mono", monospace;
  cursor: pointer;
}

.swatch { padding: 4px; }
.swatch span { display: block; height: 100%; background: var(--swatch); border: 1px solid #6f512d; }
.swatch[aria-expanded="true"] { outline: 2px solid #543923; outline-offset: -2px; }
.swatch:disabled { opacity: .52; cursor: default; }

#color-picker {
  grid-column: 1 / -1;
  padding: 0 9px 9px;
  border: 1px solid var(--border);
  background: var(--paper);
  font-size: .875rem;
}

.picker-header { display: flex; align-items: center; justify-content: space-between; }

#close-color-picker {
  min-height: 44px;
  padding: 0 5px;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

#color-plane {
  position: relative;
  width: min(100%, 200px);
  margin: 0 auto 10px;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  background: linear-gradient(to top, #fff, transparent),
    linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  touch-action: none;
  cursor: crosshair;
}

#color-marker {
  position: absolute;
  left: var(--hue);
  top: var(--saturation);
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #222;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#color-picker label { display: block; width: min(100%, 200px); margin: auto; }

#brightness {
  display: block;
  appearance: none;
  width: min(100%, 200px);
  height: 44px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

#brightness::-webkit-slider-runnable-track {
  height: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(to right, #000, var(--bright));
}

#brightness::-moz-range-track {
  height: 8px;
  border: 1px solid var(--border);
  background: linear-gradient(to right, #000, var(--bright));
}

#brightness::-webkit-slider-thumb {
  appearance: none;
  width: 17px;
  height: 22px;
  margin-top: -7px;
  border: 2px solid var(--border);
  background: var(--paper);
}

#brightness::-moz-range-thumb {
  width: 13px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 0;
  background: var(--paper);
}

.check {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  font-size: .875rem;
  cursor: pointer;
}

.check input {
  flex: none;
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: #543923;
}

#outline {
  grid-column: 1 / -1;
  justify-self: center;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
}

#outline[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

#snap, .back {
  font-family: var(--heading);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: #493120;
}

#snap {
  min-width: 116px;
  min-height: 44px;
  border: 0;
  background: transparent;
  font-size: 1.28rem;
  cursor: pointer;
}

#snap:disabled { opacity: .48; cursor: default; }
#save-status { margin: 4px 0; font-size: .875rem; }
#download { display: inline-block; padding: 12px 7px; color: #493120; }

.media-kit {
  margin-top: 16px;
  background: linear-gradient(45deg, #404ce3, #4d59ed 60%);
  color: #fff;
  line-height: 1.5;
}

.media-kit h2 { margin: 3px 0 10px; font: 700 1.125rem / 1.3 var(--heading); }
.media-kit p { margin: 8px 0; }
.media-kit ul { margin: 9px 0 11px; padding-left: 1.25rem; text-align: left; }
.media-kit li + li { margin-top: 6px; }
.media-kit a { color: inherit; text-underline-offset: 3px; }
.media-kit a:focus-visible { outline-color: #fff; }
.media-download { display: inline-grid; align-items: center; min-height: 44px; font: 700 .875rem / 1.4 var(--heading); }

.back { display: inline-block; margin-top: 11px; padding: 14px 7px; font-size: .85rem; }
:focus-visible { outline: 2px solid #162957; outline-offset: 2px; }

@media (max-width: 370px) {
  main { width: calc(100% - 20px); padding-top: 12px; }
  .controls { gap: 5px 7px; }
}

@media (max-width: 430px) {
  select { font-size: .875rem; padding-inline: 4px; }
}
