/* ==========================================================================
   Contact: "Start a project"
   M07's outline: paint the picture of what happens next, a simple qualifying
   form, answers to the usual questions, and another way to reach Stephen.
   The form is a letter with blanks; a moon waxes as it fills, and the hare
   peeks up from the corner to cheer it on.
   ========================================================================== */

.ask {
  padding: clamp(8rem, 20vh, 12rem) var(--gutter) clamp(3rem, 7vw, 6rem);
}
.ask__eyebrow {
  margin-bottom: clamp(1.25rem, 3vh, 2rem);
  color: var(--soft);
}
.ask__title {
  font-size: var(--step-4);
  max-width: 11ch;
}
.ask__dek {
  max-width: 34ch;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
  font-size: var(--step-1);
  line-height: 1.35;
}

/* ---------- what happens next: three phases of the moon ---------- */

.next {
  padding: clamp(2rem, 5vw, 4rem) var(--gutter) clamp(4rem, 9vw, 8rem);
}
.next__title {
  padding-bottom: 1rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--rule);
  color: var(--soft);
}
.next__steps {
  display: grid;
  gap: clamp(2rem, 4vw, 3rem);
}
.next__moon {
  width: clamp(2rem, 3vw, 2.6rem);
  margin-bottom: 1.25rem;
}
.next__step {
  margin-bottom: 0.75rem;
  font-size: var(--step-2);
  line-height: 1.02;
}
.next__step .eyebrow {
  display: block;
  margin-bottom: 0.6rem;
  color: var(--soft);
}
.next__steps p {
  max-width: 34ch;
}
@media (min-width: 900px) {
  .next__steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: clamp(2rem, 4vw, 4rem);
  }
}

/* ---------- the letter ---------- */

.letter-wrap {
  padding: clamp(3rem, 7vw, 6rem) var(--gutter) var(--section);
  border-top: 1px solid var(--rule);
}
.letter {
  max-width: 62rem;
}
.letter__para {
  font-size: var(--step-2);
  line-height: 1.7;
  text-wrap: pretty;
}
.letter__para + .letter__para,
.blank--story + .letter__para {
  margin-top: 0.6em;
}

.blank input,
.blank select,
.blank textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid currentColor;
  padding: 0 0.1em;
  margin: 0;
  max-width: 100%;
  transition: border-color var(--dur-ui) linear, background-color var(--dur-ui) linear;
}
.blank input {
  font-style: italic;
}
.blank input::placeholder,
.blank textarea::placeholder {
  color: color-mix(in srgb, var(--fg) 38%, transparent);
  font-style: italic;
}
/* selects read like the rest of the sentence, with a small mono caret */
.blank--select select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 1.1em;
  font-style: italic;
  cursor: pointer;
  /* the script sizes each select to its current answer, so the sentence has no gaps */
  max-width: 100%;
  background: no-repeat right 0.1em center / 0.42em
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0h10L5 6z' fill='%23111112'/%3E%3C/svg%3E");
}
.blank--select select:invalid {
  color: color-mix(in srgb, var(--fg) 38%, transparent);
}
.blank--select option {
  color: var(--ink);
  font-style: normal;
}
/* the menu a blank opens on a mouse: a small white card in the mono hand,
   one hairline, the current answer marked with the nav's little full moon */
.blank-menu {
  position: absolute;
  z-index: 80;
  width: max-content;
  min-width: 12rem;
  max-width: calc(100vw - 16px);
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.45rem 0;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid currentColor;
  box-shadow: 0 0.6rem 1.6rem -0.8rem rgb(0 0 0 / 0.35);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  line-height: 1.3;
  outline: none;
  animation: blank-menu-in 0.16s var(--ease-out);
}
@keyframes blank-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
.blank-menu__group {
  padding: 0.7rem 1rem 0.3rem;
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--fg) 50%, transparent);
}
.blank-menu__group:first-child {
  padding-top: 0.35rem;
}
.blank-menu__option {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.42rem 1rem;
  cursor: pointer;
  white-space: nowrap;
}
.blank-menu__option.is-active {
  background: var(--fg);
  color: var(--bg);
}
.blank-menu__option[aria-selected]::after {
  content: "";
  width: 0.5em;
  height: 0.5em;
  margin-left: auto;
  border-radius: 50%;
  background: currentColor;
}
@media (prefers-reduced-motion: reduce) {
  .blank-menu {
    animation: none;
  }
}
.blank--story {
  display: block;
  margin-top: 0.4em;
}
.blank--story textarea {
  display: block;
  width: 100%;
  min-height: 6.5em;
  padding: 0.6em 0;
  font-family: var(--font-sans);
  font-size: var(--step-1);
  line-height: 1.45;
  resize: vertical;
  border-top: 1px solid var(--rule);
}
.blank :focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--fg) 6%, transparent);
  border-bottom-width: 2px;
}
.blank.is-wrong input,
.blank.is-wrong select,
.blank.is-wrong textarea {
  border-bottom: 2px dashed currentColor;
}
.letter__trap {
  position: absolute;
  left: -9999px;
}

.letter__send {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem clamp(1.5rem, 4vw, 3rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.letter__send .round-btn {
  border: 0;
  cursor: pointer;
  font-family: var(--font-mono);
}
.letter__progress {
  display: flex;
  align-items: center;
  gap: 1rem;
}
/* the same moon as the case studies' phase marker: a shadow slides off as the blanks fill */
.letter__moon {
  position: relative;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: var(--fg);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--fg);
}
.letter__shadow {
  position: absolute;
  inset: 1px;
  border-radius: 50%;
  background: var(--bg);
  transform: translateX(var(--wax, 0%));
  transition: transform 0.8s var(--ease-out);
}
.letter__status {
  color: var(--soft);
}

/* sent */
.sent {
  display: grid;
  gap: 1.25rem;
  justify-items: start;
  max-width: 40rem;
  padding: clamp(2rem, 6vw, 5rem) 0;
}
.sent[hidden] {
  display: none;
}
.sent:focus {
  outline: none;
}
.sent__seal {
  width: 4.5rem;
}
.sent__title {
  font-size: var(--step-4);
}
.sent__text {
  max-width: 34ch;
  font-size: var(--step-1);
  line-height: 1.35;
}

/* ---------- good questions ---------- */

.faq {
  display: grid;
  gap: clamp(2rem, 4vw, 3rem);
  padding: var(--section) var(--gutter);
  border-top: 1px solid var(--rule);
}
.faq__title {
  font-size: var(--step-3);
}
.faq__list {
  border-top: 1px solid var(--rule);
}
.faq details {
  border-bottom: 1px solid var(--rule);
}
.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: clamp(1rem, 2vw, 1.5rem) 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--step-2);
  line-height: 1.1;
  cursor: pointer;
  list-style: none;
}
.faq summary {
  transition: padding-left 0.5s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .faq summary:hover {
    padding-left: 0.35em;
  }
  .faq summary:hover::after {
    background: color-mix(in srgb, currentColor 35%, transparent);
  }
  .faq details[open] summary:hover::after {
    background: currentColor;
  }
}
.faq summary::-webkit-details-marker {
  display: none;
}
/* a new moon that fills when the answer is open */
.faq summary::after {
  content: "";
  flex: none;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  border: 1px solid currentColor;
  transition: background-color var(--dur-ui) linear;
}
.faq details[open] summary::after {
  background: currentColor;
}
.faq details p {
  max-width: 52ch;
  padding-bottom: clamp(1.25rem, 2.5vw, 2rem);
}
@media (min-width: 900px) {
  .faq {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  }
}

/* ---------- another way in ---------- */

.elsewhere {
  display: grid;
  gap: 1rem;
  padding: 0 var(--gutter) var(--section);
}
.elsewhere__title {
  color: var(--soft);
}
.elsewhere__mail {
  font-size: var(--step-3);
  overflow-wrap: anywhere;
}
.elsewhere__mail a {
  text-decoration-thickness: 1px;
}

/* prototype only: copy that waits on Stephen */
.tbd {
  background: none;
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
}
.tbd::after {
  content: "⚑";
  font-size: 0.5em;
  vertical-align: super;
  margin-left: 0.15em;
}

/* ---------- the hare peeks up from the corner ---------- */

.peek {
  display: none;
}
.motion .peek {
  position: fixed;
  right: clamp(0.5rem, 2vw, 2rem);
  bottom: 0;
  z-index: 40;
  display: block;
  width: clamp(7rem, 15vw, 13rem);
  pointer-events: none;
  /* the script raises it while the letter is on screen */
  translate: 0 100%;
}
.peek__hare img {
  /* mirrored so it looks into the page */
  scale: -1 1;
}
.peek__bubble {
  position: absolute;
  right: 72%;
  top: 4%;
  padding: 0.65em 0.9em;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  white-space: nowrap;
  opacity: 0;
  scale: 0.6;
  transform-origin: 100% 100%;
  transition: opacity var(--dur-ui) linear, scale 0.45s var(--ease-out);
}
.peek.is-talking .peek__bubble {
  opacity: 1;
  scale: 1;
}
@media (max-width: 759px) {
  .motion .peek {
    width: 6rem;
  }
}
.motion .peek {
  transition: translate 1.1s var(--ease-out);
}
.motion .peek.is-up {
  translate: 0 40%;
}
.motion .peek.is-cheering {
  translate: 0 20%;
}
