:root {
  --red: #4A1A16;
  --bone: #F3EAD8;
  --bone-soft: #E9D9C2;
  --kraft: #D7BF96;
  --kraft-dark: #B39769;
  --kraft-light: #E6D3B0;
  --ink: #2B1A12;
  --brick: #B3322A;
  --brick-dark: #86221C;
  --twine: #E8DCC3;
  --display: "Rye", Georgia, "Times New Roman", serif;
  --body: "Bitter", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--red);
  color: var(--bone);
  font: 400 1.0625rem/1.55 var(--body);
}

.page {
  max-width: 29rem;
  margin: 0 auto;
  padding: max(1.75rem, env(safe-area-inset-top)) 1.125rem max(3rem, env(safe-area-inset-bottom));
}

.intro { text-align: center; }

.logo {
  display: block;
  width: min(12.5rem, 58vw);
  height: auto;
  margin: 0 auto 1.25rem;
}

h1 {
  margin: 0 0 .7rem;
  font: 400 clamp(2.35rem, 10.5vw, 3.4rem)/1.02 var(--display);
  letter-spacing: .005em;
  text-wrap: balance;
}

.lede {
  max-width: 23rem;
  margin: 0 auto;
  color: var(--bone-soft);
  text-wrap: pretty;
}

/* The twine runs from the copy down through the hole in the hang tag. */
.twine {
  position: relative;
  z-index: 2;
  display: block;
  width: 2.5rem;
  height: 5.6rem;
  margin: .5rem auto -2.05rem;
  overflow: visible;
}
.twine path {
  fill: none;
  stroke: var(--twine);
  stroke-width: 2.6;
  stroke-linecap: round;
}

/* The hang tag */
.tag {
  position: relative;
  padding: 3.6rem 1.4rem 1.6rem;
  color: var(--ink);
  background-color: var(--kraft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .33 0 0 0 0 .22 0 0 0 0 .1 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  clip-path: polygon(0 2.4rem, 2.4rem 0, calc(100% - 2.4rem) 0, 100% 2.4rem, 100% 100%, 0 100%);
  border-radius: 0 0 .4rem .4rem;
  transform-origin: 50% 1.45rem;
}
/* punched hole with a reinforcement ring */
.tag::before {
  content: "";
  position: absolute;
  top: .9rem;
  left: 50%;
  width: 1.1rem;
  height: 1.1rem;
  margin-left: -.55rem;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 .32rem var(--kraft-dark), inset 0 1px 2px rgba(0, 0, 0, .5);
}
.tag.swing { animation: swing 1.1s cubic-bezier(.3, .6, .4, 1); }
@keyframes swing {
  0% { transform: rotate(0); }
  20% { transform: rotate(-3deg); }
  45% { transform: rotate(2deg); }
  70% { transform: rotate(-.8deg); }
  100% { transform: rotate(0); }
}

.field + .field { margin-top: 1.6rem; }

label, .label {
  display: block;
  margin-bottom: .4rem;
  font-weight: 700;
  font-size: 1rem;
}

input[type="text"] {
  display: block;
  width: 100%;
  padding: .3rem .1rem .35rem;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 600 1.375rem/1.3 var(--body);
  -webkit-appearance: none;
  appearance: none;
}
input[type="text"]:focus {
  outline: none;
  border-bottom-color: var(--brick);
  box-shadow: 0 2px 0 var(--brick);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Photo picker: the empty state is a shirt you drop photos onto */
.drop {
  display: block;
  margin: 0;
  padding: 1rem 1rem 1.2rem;
  border-radius: .6rem;
  background: rgba(255, 249, 236, .32);
  text-align: center;
  font-weight: 400;
  cursor: pointer;
  transition: background-color .15s;
}
.drop:hover, .drop.over { background: rgba(255, 249, 236, .55); }
#photos:focus-visible ~ .drop,
#photos:focus-visible ~ .shots .add {
  outline: 3px solid var(--brick);
  outline-offset: 3px;
}
.tee {
  display: block;
  width: 9.5rem;
  height: auto;
  margin: 0 auto .6rem;
  overflow: visible;
}
.tee-body { fill: var(--kraft-light); stroke: var(--ink); stroke-width: 3.2; stroke-linejoin: round; }
.tee-stitch { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-dasharray: 4 4; opacity: .55; }
.tee-plus { fill: none; stroke: var(--brick); stroke-width: 5; stroke-linecap: round; }
.drop-title { display: block; font-weight: 700; font-size: 1.15rem; }
.drop-hint { display: block; margin-top: .1rem; font-size: .95rem; opacity: .82; }

.shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.shot, .add {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: .45rem;
  overflow: hidden;
}
.shot { background: var(--kraft-dark); box-shadow: 0 1px 0 rgba(255, 255, 255, .35), 0 2px 6px rgba(43, 26, 18, .25); }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shot .nopic {
  display: flex; align-items: center; justify-content: center;
  height: 100%; padding: .75rem;
  text-align: center; font-size: .9rem; font-weight: 600; overflow-wrap: anywhere;
}
.shot.busy::after {
  content: "Getting it ready";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(230, 211, 176, .85);
  font-size: .9rem; font-weight: 600;
}
.rm {
  position: absolute;
  top: .35rem; right: .35rem;
  width: 2.4rem; height: 2.4rem;
  display: grid; place-items: center;
  padding: 0;
  border: 0; border-radius: 50%;
  background: rgba(43, 26, 18, .8);
  color: #fff;
  cursor: pointer;
}
.rm svg { width: 1rem; height: 1rem; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.rm:focus-visible { outline: 3px solid var(--bone); outline-offset: -5px; }
.add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  margin: 0;
  border: 2px dashed rgba(43, 26, 18, .5);
  background: rgba(255, 249, 236, .2);
  font-weight: 700;
  cursor: pointer;
}
.add:hover { background: rgba(255, 249, 236, .45); }
.add svg { width: 2rem; height: 2rem; stroke: var(--brick); stroke-width: 3; stroke-linecap: round; fill: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.error {
  margin: 1.2rem 0 0;
  padding: .7rem .9rem;
  border-left: 4px solid var(--brick);
  border-radius: .25rem;
  background: #F6E6D6;
  color: #6A1B14;
  font-weight: 600;
  font-size: .98rem;
}

.go {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 1.6rem;
  padding: 1rem 1.25rem;
  overflow: hidden;
  border: 0;
  border-radius: .55rem;
  background: var(--brick);
  color: #FFF6EA;
  font: 700 1.2rem/1.2 var(--body);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--brick-dark);
  transition: transform .08s, box-shadow .08s;
}
.go:hover { background: #A52D25; }
.go:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--brick-dark); }
.go:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.go[disabled] { cursor: progress; }
.go-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(0, 0, 0, .25);
  transition: width .25s ease-out;
}
.go-text { position: relative; }

.fine {
  margin: .9rem 0 0;
  text-align: center;
  font-size: .875rem;
  opacity: .78;
}

/* After entering */
.done, .closed { text-align: center; }
.done:focus { outline: none; }
.done h2, .closed h2 {
  margin: .2rem 0 .4rem;
  font: 400 2.1rem/1.1 var(--display);
  color: var(--brick);
}
.done p, .closed p { margin: 0 auto; max-width: 21rem; }
.print {
  width: 62%;
  margin: 1.2rem auto 0;
  padding: .45rem .45rem 1.4rem;
  background: #FBF6EC;
  box-shadow: 0 2px 8px rgba(43, 26, 18, .3);
  transform: rotate(-2deg);
}
.print img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.again {
  margin-top: 1.5rem;
  padding: .8rem 1.2rem;
  border: 2px solid var(--ink);
  border-radius: .55rem;
  background: transparent;
  color: var(--ink);
  font: 700 1.05rem/1.2 var(--body);
  cursor: pointer;
}
.again:hover { background: rgba(255, 249, 236, .4); }
.again:focus-visible { outline: 3px solid var(--brick); outline-offset: 3px; }

@media (min-width: 40rem) {
  .page { padding-top: 3rem; }
  .tag { padding-left: 2rem; padding-right: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tag.swing { animation: none; }
  .go-fill, .go, .drop { transition: none; }
}
