/* The dress code view (views/dress-code.js), opened from the invitation
   view. Uses the save-the-date stylesheet's .back-nav, .eyebrow and .reveal. */

/* The page never scrolls: .dresscode is scaled down by script to fit the
   viewport instead (as the invitation view does). The back button sits
   outside it, since a transformed parent would break its fixed position. */
html[data-view="dress-code"],
html[data-view="dress-code"] body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.dresscode {
  /* One width drives both the illustration and the palette row, so they
     keep the same proportion to each other at every screen size. */
  --art: min(240px, 50vw);
  background: var(--cream);
  transform-origin: top center;
  padding-top: clamp(5rem, 12vh, 7rem);
  padding-bottom: clamp(4rem, 10vh, 6rem);
  text-align: center;
}

.dresscode-head h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(2.2rem, 8vw, 5.2rem);
  color: var(--olive);
  margin: 0.2em 0 0;
  line-height: 1.05;
}

.dresscode-level {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  font-size: clamp(0.85rem, 2.6vw, 1.15rem);
  color: var(--sienna);
  margin: 1.2em 0 0;
}

.dresscode-label-avoid {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  font-size: clamp(0.85rem, 2.6vw, 1.15rem);
  color: var(--sienna);
  margin: 1.2em 0 0;
}

.dresscode-copy {
  max-width: 600px;
  margin: clamp(1.8rem, 4vh, 2.4rem) auto 0;
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1.6vw, 0.95rem);
  line-height: 1.85;
  color: var(--charcoal-soft);
}

.dresscode-copy .deadline-highlight {
  white-space: nowrap;
}

.dresscode-art {
  width: var(--art);
  height: auto;
  margin: clamp(2rem, 5vh, 3rem) auto;
}

.dresscode-label {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  font-size: clamp(0.55rem, 1.1vw, 0.65rem);
  color: var(--sienna);
  margin: 0 0 1.4rem;
}

.swatches {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  width: var(--art);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  --gap: calc(var(--art) * 0.06);
  gap: 1.4rem var(--gap);
}

/* Sized as one of five across the row (the palette had five swatches); with
   four, the row is centered and the extra room goes between them. */
.swatches li {
  width: calc(var(--art) * 0.176);
}

/* watercolor blot: an uneven outline, pigment pooling toward one edge, and
   paper grain, all roughened by the #watercolor-edge filter */
.swatches .swatch {
  display: block;
  aspect-ratio: 1;
  border-radius: 52% 48% 55% 45% / 46% 54% 47% 53%;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.28), transparent 55%),
    radial-gradient(circle at 72% 78%, rgba(0, 0, 0, 0.12), transparent 60%),
    var(--swatch);
  filter: url(#watercolor-edge);
  position: relative;
}

.swatches .swatch::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.14;
  mix-blend-mode: multiply;
}

.swatches li:nth-child(2) .swatch { border-radius: 47% 53% 44% 56% / 55% 45% 52% 48%; }
.swatches li:nth-child(3) .swatch { border-radius: 55% 45% 51% 49% / 48% 56% 44% 52%; }
.swatches li:nth-child(4) .swatch { border-radius: 49% 51% 57% 43% / 52% 47% 53% 48%; }
.swatches li:nth-child(5) .swatch { border-radius: 44% 56% 48% 52% / 50% 46% 54% 50%; }

.swatches .swatch-name {
  display: block;
  margin-top: 0.7rem;
  font-family: var(--font-sans);
  font-size: calc(var(--art) * 0.042);
  white-space: nowrap;
  margin-inline: -0.5rem;
  line-height: 1.15;
  color: var(--charcoal);
}

.dresscode-avoid {
  margin-top: clamp(2.6rem, 7vh, 4rem);
  padding-top: clamp(2.2rem, 6vh, 3rem);
  border-top: 1px solid rgba(166, 63, 0, 0.18);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.avoid-text {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1.6vw, 0.95rem);
  line-height: 1.85;
  color: var(--charcoal-soft);
}

/* More breathing room beside the text on phones */
@media (max-width: 600px) {
  .dresscode-copy,
  .dresscode-avoid {
    margin-left: 1.5rem;
    margin-right: 1.5rem;
  }
}
