/* FABclean: a picture book. Pages are full-bleed colour fields either side of a gutter. */

@font-face { font-family: "Amatic SC"; src: url("../assets/fonts/AmaticSC-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Andika"; src: url("../assets/fonts/Andika-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Andika"; src: url("../assets/fonts/Andika-400i.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Andika"; src: url("../assets/fonts/Andika-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --sky: #019DDC;
  --sky-deep: #0A6FA3;
  --sky-pale: #DDF2FB;
  --grape: #9C57A4;
  --grape-deep: #7A3F85;
  --lilac: #F3E6F5;
  --lilac-mid: #E7C9EA;
  --sun: #FFC93C;
  --sun-pale: #FFF1C7;
  --ink: #2A1B45;
  --page: #FFFFFF;

  --display: "Amatic SC", "Arial Narrow", sans-serif;
  --body: "Andika", "Trebuchet MS", "Segoe UI", sans-serif;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --pad: clamp(1.5rem, 5vw, 5rem);
  --outline: 3px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--grape) var(--lilac);
  background: var(--grape);
}

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--page);
  caret-color: var(--grape);
  overflow-x: clip;
}

::selection { background: var(--sun); color: var(--ink); }

img, svg { display: block; max-width: 100%; }
.sprite { position: absolute; }

a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: .09em; }

:focus-visible { outline: var(--outline) solid var(--sun); outline-offset: 3px; border-radius: 6px; }
.page--white :focus-visible, .form :focus-visible { outline-color: var(--sky-deep); }

h1, h2, h3, p, ul, ol, fieldset, legend { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }

/* the display voice: tall hand capitals at the logo's marker weight */
h2, h3, .theend, .wordmark__sub, .ribbon, .bookmark, .sign, .house__cap, .thanks h1 {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .055em;
  -webkit-text-stroke: .04em currentColor;
  paint-order: stroke fill;
}
h2, h3, .theend {
  line-height: 1;
  text-wrap: balance;
}
h2 { font-size: clamp(3rem, 5.6vw, 5.25rem); }
h3 { font-size: clamp(2.4rem, 3.4vw, 3rem); }

.big { font-size: clamp(1.25rem, 1.55vw, 1.45rem); line-height: 1.5; text-wrap: pretty; }

.skip {
  position: fixed; left: 1rem; top: -5rem; z-index: 30;
  background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 14px;
  transition: top .3s var(--ease);
}
.skip:focus { top: 1rem; }

/* ---------- The book ---------- */

.spread {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
/* the gutter: where the two pages meet at the spine */
.spread::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 0; translate: -50% 0;
  border-left: 4px dashed rgb(42 27 69 / .34);
  pointer-events: none;
  z-index: 3;
}
.spread--night::after { border-left-color: rgb(255 255 255 / .3); }

.page { position: relative; min-width: 0; }
.page--white { background: var(--page); }
.page--sky { background: var(--sky); }
.page--grape { background: var(--grape); color: #fff; }
.page--sun { background: var(--sun); }
.page--night { background: var(--ink); color: #fff; }

.page--text, .page--titled {
  display: grid;
  align-content: center;
  padding: clamp(3.5rem, 8vw, 7rem) var(--pad);
}
.page__inner { width: 100%; max-width: 34rem; margin-inline: auto; }
.page__inner > * + * { margin-top: 1.25rem; }
.page__inner > h2 + * { margin-top: 1.5rem; }

.page--art { overflow: hidden; min-height: 78svh; }
.scene { position: absolute; inset: 0; width: 100%; height: 100%; }

.tale {
  position: absolute; z-index: 2; top: clamp(1.5rem, 4vw, 3.5rem); left: var(--pad); right: var(--pad);
  max-width: 17em;
  font-weight: 700; font-size: clamp(1.2rem, 1.75vw, 1.6rem); line-height: 1.3; text-wrap: balance;
}
.tale--flow, .page--titled .tale { position: static; }
.page--titled .tale { max-width: 34rem; width: 100%; margin-inline: auto; color: var(--sun); }
.tale--flow { justify-self: start; }

.page--white h2 { color: var(--grape); }
.page--night h2 { color: var(--sun); }

/* ---------- Cover ---------- */

.cover { min-height: 100svh; }
.cover .page--art { min-height: 100svh; }
.cover__title { padding-block: clamp(1.75rem, 6svh, 5rem); }
.cover__title .page__inner { max-width: 31rem; }
.cover__title .page__inner > * + * { margin-top: clamp(.75rem, 2.2svh, 1.25rem); }

.wordmark { display: grid; justify-items: start; gap: .35rem; }
.wordmark__svg { width: min(100%, clamp(11rem, 24vw, 20rem), 33svh); height: auto; overflow: visible; }
.wordmark__sub {
  font-size: clamp(1.25rem, min(1.7vw, 3.4svh), 1.6rem); line-height: 1.1;
  color: var(--ink);
}
.storyline {
  font-weight: 700;
  font-size: clamp(1.45rem, min(2.5vw, 4.3svh), 2.3rem);
  line-height: 1.22;
  text-wrap: balance;
  margin-top: clamp(1rem, 3svh, 1.75rem) !important;
}
.lede { max-width: 30rem; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 2rem !important; }
.cover .actions { margin-top: clamp(1.1rem, 3.4svh, 2rem) !important; }

/* ---------- Ribbons (buttons) ---------- */

.ribbon {
  --notch: 1.1rem;
  display: inline-block;
  font-size: 1.75rem; line-height: 1;
  color: #fff; background: var(--grape);
  padding: .6rem calc(1.6rem + var(--notch)) .68rem 1.5rem;
  border: 0; border-radius: 6px 0 0 6px;
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--notch)) 50%, 100% 100%, 0 100%);
  text-decoration: none; cursor: pointer;
  transition: translate .35s var(--ease), background-color .2s;
}
.ribbon:hover { background: var(--grape-deep); translate: .4rem 0; }
.ribbon:active { background: var(--ink); }
.ribbon--sun { background: var(--sun); color: var(--ink); }
.ribbon--sun:hover { background: #fff; }
.ribbon[disabled] { background: #8d8399; cursor: progress; }
.ribbon:focus-visible { outline: 0; box-shadow: none; background: var(--ink); color: #fff; }
.ribbon--sun:active, .ribbon--sun:focus-visible { background: #fff; color: var(--grape-deep); }

.textlink { font-weight: 700; color: var(--sky-deep); }
.textlink:hover { color: var(--grape-deep); text-decoration-thickness: .16em; }
.page--grape .textlink, .backcover .textlink { color: #fff; }
.backcover .textlink:hover { color: var(--sun); }

/* the bookmark that hangs over the top of the book */
.bookmark {
  position: fixed; z-index: 20; top: 0; right: clamp(1rem, 4vw, 3.5rem);
  background: var(--sun); color: var(--ink);
  font-size: 1.5rem; line-height: 1;
  text-decoration: none;
  padding: 1.6rem .9rem 1.9rem;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - .9rem), 0 100%);
  filter: drop-shadow(0 6px 10px rgb(42 27 69 / .28));
  translate: 0 -1rem;
  transition: translate .45s var(--ease);
}
.bookmark span { display: block; }
.bookmark:hover, .bookmark:focus-visible { translate: 0 0; }
.bookmark:focus-visible { outline: 0; background: var(--ink); color: #fff; }
.bookmark.is-away { translate: 0 -110%; }

/* ---------- The cleans ---------- */

.page--titled { align-content: center; gap: clamp(1.5rem, 3vw, 2.5rem); overflow: hidden; }
.still { width: min(100%, 31rem); margin-inline: auto; }

.tiers { display: grid; gap: 2.25rem; }
.tier { position: relative; padding-left: 0; }
.tier + .tier { padding-top: 2.75rem; }
/* paw prints walk from one tier down to the next: each clean carries on from the last */
.tier + .tier::before {
  content: "";
  position: absolute; top: -.35rem; left: .15rem;
  width: 9rem; height: 2.2rem;
  background: currentColor;
  -webkit-mask: url("../assets/paws.svg") left center / contain no-repeat;
          mask: url("../assets/paws.svg") left center / contain no-repeat;
  opacity: .85;
}
.tier--basic { color: var(--sky-deep); }
.tier--standard { color: var(--grape); }
.tier--premium { color: #8A6300; }
.tier > p { color: var(--ink); margin-top: .35rem; }

.jobs { display: flex; flex-wrap: wrap; gap: 1rem 1.15rem; margin-top: 1rem; }
.jobs li {
  display: grid; justify-items: center; gap: .35rem;
  font-size: .95rem; font-weight: 700; line-height: 1.2; color: var(--ink);
  min-width: 4.6rem; text-align: center; white-space: nowrap;
}
.jobs .ico {
  width: 4rem; height: 4rem; padding: .85rem;
  border-radius: 50%;
  color: var(--ink);
  background: var(--sky-pale);
}
.tier--standard .ico { background: var(--lilac); }
.tier--premium .ico { background: var(--sun-pale); }
.ico { width: 1.5rem; height: 1.5rem; flex: none; }

.aside { margin-top: 2.5rem !important; padding-top: 1.5rem; border-top: 2px dashed var(--lilac-mid); }

/* ---------- Exit clean ---------- */

.ticks { display: grid; gap: .55rem; margin-top: 1.5rem !important; }
.ticks li { position: relative; padding-left: 2rem; }
.ticks li::before {
  content: "";
  position: absolute; left: 0; top: .42em;
  width: 1.2rem; height: 1.2rem; top: .25em;
  background: var(--sun);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 13l5 5L20 6' fill='none' stroke='%23000' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 13l5 5L20 6' fill='none' stroke='%23000' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.note { margin-top: 1.75rem !important; padding: 1rem 1.25rem; border: 2px dashed rgb(255 255 255 / .55); border-radius: 14px; }
.note strong { color: var(--sun); }
.boxlabels text { font-family: var(--display); font-weight: 700; font-size: 44px; letter-spacing: .06em; }
.boxlabels .sm { font-size: 34px; }

/* ---------- About ---------- */

.sign { font-size: 2.6rem; line-height: 1; color: var(--grape); rotate: -3deg; transform-origin: left; margin-top: 1.75rem !important; }

/* ---------- Quote form ---------- */

.page--house { display: grid; min-height: 0; }
.house { position: sticky; top: 0; height: 100svh; display: grid; grid-template-rows: auto auto auto; align-content: center; gap: clamp(1.5rem, 4vh, 3rem); padding: clamp(1.5rem, 4vw, 3.5rem); padding-bottom: clamp(1.5rem, 4vw, 3rem); }
.house__svg { width: 100%; height: auto; max-height: 62svh; overflow: visible; }
.house__cap {
  justify-self: center; text-align: center;
  font-size: clamp(1.4rem, 2vw, 1.85rem); line-height: 1.15; text-wrap: balance;
  color: var(--ink); background: #fff; padding: .6rem 1.4rem .7rem; border-radius: 18px;
  border: 3px solid var(--ink);
  max-width: 100%;
}

.form { margin-top: 2.25rem !important; display: grid; gap: 2rem; }
.hp { position: absolute; left: -200vw; width: 1px; height: 1px; opacity: 0; }

legend, .field label {
  display: block; font-weight: 700; font-size: 1.05rem; margin-bottom: .6rem;
}
.opt { font-weight: 400; color: #5d5270; font-size: .95rem; }

.rooms { display: grid; gap: .85rem; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem .6rem .55rem 1rem; background: var(--sky-pale); border-radius: 18px; }
.stepper label { display: flex; align-items: center; gap: .65rem; font-weight: 700; }
.stepper__ctl { display: flex; align-items: center; gap: .25rem; }
.stepper button {
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  border: 3px solid var(--ink); background: #fff; color: var(--ink);
  padding: 0; cursor: pointer;
  display: grid; place-items: center;
  transition: background-color .15s, scale .25s var(--ease);
}
.stepper button svg { width: 1.5rem; height: 1.5rem; }
.stepper button:hover { background: var(--sun); }
.stepper button:active { scale: .9; }
.stepper button[disabled] { opacity: .35; cursor: default; background: #fff; }
.stepper input {
  width: 3.2rem; border: 0; background: transparent; text-align: center;
  font-family: var(--display); font-weight: 700; font-size: 2.6rem; line-height: 1; color: var(--ink);
  -webkit-text-stroke: .04em currentColor;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
  padding: 0;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: .6rem; }
.chips legend { width: 100%; }
.chips label { position: relative; cursor: pointer; }
.chips input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chips span {
  display: block; padding: .55rem 1.1rem; border-radius: 999px;
  border: 3px solid var(--ink); background: #fff; font-weight: 700; line-height: 1.3;
  transition: background-color .15s, color .15s, scale .25s var(--ease);
}
.chips label:hover span { background: var(--lilac); }
.chips input:checked + span { background: var(--grape); color: #fff; border-color: var(--grape); }
.chips input:focus-visible + span { outline: var(--outline) solid var(--sky-deep); outline-offset: 3px; }
.chips input:active + span { scale: .96; }
.chips[disabled] { opacity: .45; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem 1rem; }
.field--wide { grid-column: 1 / -1; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: .7rem .9rem; border: 3px solid var(--ink); border-radius: 14px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 7rem; }
.field input:hover, .field textarea:hover { border-color: var(--grape); }
.field input:focus-visible, .field textarea:focus-visible { outline: 0; border-color: var(--sky-deep); box-shadow: 0 0 0 4px var(--sky-pale); }
.field [aria-invalid="true"] { border-color: #B3261E; background: #FFF4F2; }
.err { color: #B3261E; font-size: .95rem; font-weight: 700; margin-top: .4rem; }
.fine { font-size: .95rem; color: #5d5270; max-width: 30rem; }
.form .actions { margin-top: 0 !important; }

/* house parts drawn by main.js */
.h-pop { animation: h-pop .5s var(--ease) both; transform-box: fill-box; transform-origin: 50% 60%; }
@keyframes h-pop { from { transform: scale(.2); opacity: 0; } }
.h-rise { animation: h-rise .65s var(--ease) both; }
.h-hop { animation: h-hop .55s var(--ease); }
@keyframes h-hop { 35% { transform: translateY(-34px); } }
@keyframes h-rise { from { transform: translateY(var(--from, 0px)); } }

/* ---------- Back cover ---------- */

.backcover { background: var(--grape); color: #fff; padding: clamp(4rem, 10vw, 8rem) var(--pad) 3rem; text-align: center; position: relative; }
.backcover__inner { max-width: 40rem; margin-inline: auto; }
.backcover__inner > * + * { margin-top: 1.25rem; }
.theend { font-size: clamp(4rem, 11vw, 5.75rem); color: var(--sun); }
.colophon { font-size: .95rem; margin-top: 2.5rem !important; }
.backcover__paws { width: min(100%, 22rem); margin: 2.5rem auto 0; }

/* ---------- Motion: the book's own ---------- */

@media (prefers-reduced-motion: no-preference) {
  /* the wordmark writes itself, once */
  .motion .wordmark__svg path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: write .5s var(--ease) forwards; }
  .motion .wm-fab path:nth-child(1) { animation-delay: .15s; }
  .motion .wm-fab path:nth-child(2) { animation-delay: .27s; }
  .motion .wm-fab path:nth-child(3) { animation-delay: .36s; }
  .motion .wm-fab path:nth-child(4) { animation-delay: .5s; }
  .motion .wm-fab path:nth-child(5) { animation-delay: .64s; }
  .motion .wm-fab path:nth-child(6) { animation-delay: .76s; }
  .motion .wm-fab path:nth-child(7) { animation-delay: .86s; }
  .motion .wm-fab path:nth-child(8) { animation-delay: .96s; }
  .motion .wm-clean path:nth-child(1) { animation-delay: 1.12s; }
  .motion .wm-clean path:nth-child(2) { animation-delay: 1.24s; }
  .motion .wm-clean path:nth-child(3) { animation-delay: 1.34s; }
  .motion .wm-clean path:nth-child(4) { animation-delay: 1.42s; }
  .motion .wm-clean path:nth-child(5) { animation-delay: 1.52s; }
  .motion .wm-clean path:nth-child(6) { animation-delay: 1.62s; }
  .motion .wm-clean path:nth-child(7) { animation-delay: 1.72s; }
  .motion .wm-dot { animation: dot .5s var(--ease) 2.05s both; transform-box: fill-box; transform-origin: center; }
  @keyframes write { to { stroke-dashoffset: 0; } }
  @keyframes dot { from { transform: scale(0); } }

  .motion .wave { transform-box: fill-box; transform-origin: 100% 100%; animation: wave 1.1s ease-in-out 1.4s 3 alternate; }
  @keyframes wave { to { transform: rotate(-13deg); } }

  .motion .bubble { animation: bubble 7s ease-in-out infinite alternate; }
  .motion .b2 { animation-duration: 9s; } .motion .b3 { animation-duration: 6s; } .motion .b4 { animation-duration: 11s; } .motion .b5 { animation-duration: 8s; }
  @keyframes bubble { to { transform: translate(-14px, -26px); } }

  /* each right-hand page turns in on the spine as it arrives */
  @supports (animation-timeline: view()) {
    @media (min-width: 60rem) {
      .motion .spread:not(.cover):not(.spread--quote) > .page:last-child {
        transform-origin: left center;
        animation: turn linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 70%;
      }
      @keyframes turn {
        from { transform: perspective(2200px) rotateY(-24deg); filter: brightness(.86); }
        to { transform: perspective(2200px) rotateY(0deg); filter: brightness(1); }
      }
    }
  }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- One page at a time on small screens ---------- */

@media (max-width: 59.99rem) {
  .spread { grid-template-columns: 1fr; }
  .spread::after { display: none; }
  .cover { min-height: 0; }
  .cover .page--art, .page--art { min-height: 0; aspect-ratio: 1 / 1; }
  .spread--night .page--art { order: -1; }
  .tale { top: 1.25rem; left: 1.25rem; right: 1.25rem; font-size: 1.15rem; max-width: 15em; }
  .page--titled .tale { font-size: 1.25rem; }
  .jobs { gap: .9rem .6rem; }
  .tier--basic .jobs { display: grid; grid-template-columns: repeat(3, max-content); }
  .tier--premium .jobs { display: grid; grid-template-columns: repeat(4, 1fr); }
  .tier--premium .jobs li { min-width: 0; font-size: .8125rem; }
  .tier--premium .jobs .ico { width: 3.5rem; height: 3.5rem; padding: .7rem; }
  .cover .page--art { aspect-ratio: 3 / 2; }
  .page--text, .page--titled { padding-block: 3rem 3.5rem; }
  .cover__title { padding-top: 2rem; }
  .page--titled { padding-bottom: 2rem; }
  .storyline { margin-top: 1.1rem !important; font-size: 1.5rem; }
  .cover .actions { margin-top: 1.5rem !important; }
  .wordmark__svg { width: 9.5rem; }
  .house__svg { aspect-ratio: 700 / 520 !important; }
  .page--house { aspect-ratio: auto; }
  .house { position: static; height: auto; padding: 1.25rem 1.25rem 1.5rem; gap: .75rem; }
  .house__svg { height: auto; max-height: none; aspect-ratio: 620 / 520; }
  .fields { grid-template-columns: 1fr; }
  .bookmark { font-size: 1.25rem; padding: 1.4rem .7rem 1.6rem; right: .9rem; }
  .ribbon { font-size: 1.6rem; }
}
