/* Paper and pencil tokens taken from the Home artwork. The side panel is a warm white for contrast. */
:root {
  --paper: #f0e9d8; /* measured average of the scene's paper, so the room sits flush */
  --white: #fdfcf9;
  --ink: #4a453a;
  --pencil: #84775f;
  --faint: #b0a690;
  --line: #d9d2c3;
  --rust: #a6462e;
  --terminal-blue: #b9c8c6; /* the square in Home */
  --sock-red: #a6462e;      /* Pebble's socks */
  --bulb-yellow: #e8c369;   /* the lamp's bulb */

  --serif-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

p { margin: 0; }

.label {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- wordmark ---------- */

.top {
  position: absolute;
  top: 0; left: 0;
  padding: 1.5rem 1.5rem 0;
  z-index: 1;
}

.wordmark {
  font-family: var(--serif-display);
  font-variation-settings: "SOFT" 100, "opsz" 72;
  font-weight: 200;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--ink);
}

/* ---------- layout ----------
   phone: room and bun share one swipeable view on paper; words and form below on white.
   desktop: paper half with one view at a time (scroll down/right to page), white half with words and form. */

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.stage-wrap { padding-top: 3.5rem; }

.stage {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  outline: none;
}
.stage::-webkit-scrollbar { display: none; }

.panel {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  margin: 0;
  height: min(78svh, 40rem);
  display: flex;
  justify-content: center;
}

.room img {
  width: auto;
  height: 100%;
  aspect-ratio: 390 / 780;
  /* the scene's own paper ground differs slightly from the page; fade its edges out */
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 5%, #000 95%, transparent),
    linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 5%, #000 95%, transparent),
    linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
  mask-composite: intersect;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  padding-block: 0.75rem 1.5rem;
}

.dots button {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.dots button::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pencil);
  opacity: 0.25;
  transition: opacity 0.2s ease;
}

.dots button[aria-current="true"]::after { opacity: 0.8; }

.side {
  background: var(--white);
  padding: 3rem 1.5rem 2rem;
}

.words { max-width: 21rem; margin-inline: auto; }

/* two shapes borrowed from the room, cropped by the panel's corners */
.side { position: relative; }
.words { position: relative; }

.marks {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.mark { position: absolute; display: block; overflow: visible; }

/* tall and narrow, flush to the top-right corner */
.mark-bar {
  top: 0;
  right: 0;
  width: 2.2rem;
  height: 4.8rem;
}

/* below the blue, cut off by the right edge */
.mark-dot {
  top: 5.4rem;       /* just below the blue (4.8rem tall) */
  right: -0.65rem;   /* centre slightly right of the blue's centre */
  width: 2.75rem;
  height: 2.75rem;
}

/* flush to the bottom-left corner */
.mark-square {
  bottom: 0;
  left: 0;
  width: 4.5rem;
  height: 1.65rem;
}

@media (max-width: 55.999rem) {
  .mark-bar { top: -0.6rem; right: -0.55rem; width: 1.8rem; height: 3.9rem; }
  .mark-dot { top: 3.8rem; right: -1rem; width: 2.25rem; height: 2.25rem; }
}

@media (min-width: 56rem) {
  /* one screen, no page scroll: the form stays put, the left side pages between views */
  html, body { height: 100%; overflow: hidden; }
  .top { position: fixed; padding: 2rem 2.5rem 0; }
  .page {
    --panel-h: min(84svh, 46rem);
    height: 100svh;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .stage-wrap {
    padding-top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .stage {
    width: max(calc(var(--panel-h) / 2), 21rem);
    overflow: hidden;
  }
  .panel { height: var(--panel-h); }
  .thing { min-height: 0; height: var(--panel-h); padding-inline: 0; }
  .dots { padding-bottom: 0; }
  .side {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem clamp(2rem, 6vw, 5rem);
    overflow-y: auto;
    scrollbar-width: none;
  }
  .side::-webkit-scrollbar { display: none; }
  .words { width: 100%; }
  .foot { position: absolute; right: 0; bottom: 0; padding: 0 2.5rem 1.75rem; }
  .mark-bar { width: 2.75rem; height: 6rem; }
  .mark-square { width: 6rem; height: 2.2rem; }
  .mark-dot { top: 6.75rem; right: -0.875rem; width: 3.5rem; height: 3.5rem; }
}

/* ---------- words ---------- */

.lede {
  font-family: var(--serif-display);
  font-variation-settings: "SOFT" 100, "opsz" 36;
  font-weight: 300;
  font-size: 1.375rem;
  line-height: 1.35;
  margin-bottom: 1rem;
}

.words > p + p { margin-top: 0.75rem; }

.aside { font-size: 0.9375rem; color: var(--faint); }

/* ---------- one thing: shelf fragment + details, no card chrome ---------- */

.thing {
  /* never clip the details on short phones: grow past the room's height if needed */
  height: auto;
  min-height: min(78svh, 40rem);
  flex-direction: column;
  justify-content: center;
  padding-inline: 1.5rem;
  text-align: center;
}

.thing-title {
  font-family: var(--serif-display);
  font-variation-settings: "SOFT" 100, "opsz" 36;
  font-weight: 300;
  font-size: 1.125rem;
  color: var(--pencil);
}

.thing .shelf {
  width: 100%;
  height: auto;
  margin-top: 0.5rem;
  /* a fragment of the shelf: the line fades in and out at both ends */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 22%, #000 78%, transparent);
}

.card { max-width: 19rem; margin: 1.25rem auto 0; }

.card h2 {
  font-family: var(--serif-display);
  font-variation-settings: "SOFT" 100, "opsz" 36;
  font-weight: 300;
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 0;
}

.card .where {
  font: 0.75rem/1.7 var(--sans);
  color: var(--faint);
  margin-top: 0.2rem;
}

.card section { margin-top: 1.4rem; }

.card h3 {
  font: 0.625rem/1.5 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 0.4rem;
}

.card section p { font-size: 0.9375rem; line-height: 1.6; }

/* ---------- form: a line per field, like the shelf ---------- */

.waitlist, .done { margin-top: 2.5rem; }

.field { display: block; }
.field[hidden] { display: none; }

.field input,
.field select {
  width: 100%;
  height: 2.75rem;
  padding: 0;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s ease;
}

.field input::placeholder { color: var(--faint); opacity: 1; }

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1 Q5 6 9 1' fill='none' stroke='%23b0a690' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.1rem center;
  padding-right: 1.5rem;
  cursor: pointer;
}

.field select:invalid { color: var(--faint); }

.field input:focus,
.field select:focus {
  outline: none;
  border-bottom-color: var(--pencil);
}

.field [aria-invalid="true"] { border-bottom-color: color-mix(in srgb, var(--rust) 60%, transparent); }

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

button[type="submit"] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.75rem;
  padding: 0.25rem 0;
  font: inherit;
  font-size: 1rem;
  color: var(--pencil);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

button[type="submit"]:hover { color: var(--ink); }
button[type="submit"]:focus-visible { outline: 1px dashed var(--pencil); outline-offset: 4px; }
button[type="submit"][disabled] { opacity: 0.5; cursor: default; }

.return { display: block; }

.status {
  min-height: 1.5em;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--rust);
}

.done p:not(.lede) { color: var(--faint); }

/* ---------- footer ---------- */

.foot {
  padding-top: 3rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--faint);
}

.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--pencil); }
