/*
 * /builder's Assistant interface: the shelf, its size and price, and a conversation.
 * On a phone the panel stands under the price; on a wide screen, beside the shelf.
 */

.nd-ask { display: none; }

.nd-app[data-mode="ask"] .nd-ask {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: min(50dvh, 420px);
  background: var(--nd-panel);
  border-top: 1px solid var(--nd-line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  font-feature-settings: "tnum" 1;
}

/* Nothing but the shelf on the stage, and one way to reach us in the panel. */
.nd-app[data-mode="ask"] .nd-stage-tools,
.nd-app[data-mode="ask"] .nd-fab,
.nd-app[data-mode="ask"] .nd-present,
.nd-app[data-mode="ask"] .nd-help { display: none; }

.nd-app[data-mode="ask"] .nd-main { flex: 1 1 auto; }
.nd-app[data-mode="ask"] .nd-stage { min-height: 0; }
.nd-app[data-mode="ask"] .nd-brand { display: flex; margin-right: auto; }
.nd-app[data-mode="ask"] .nd-brand span { display: inline; font-size: .9rem; }

/* ------------------------------------------------------------ conversation -- */

.nd-ask-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nd-ask-log::-webkit-scrollbar { display: none; }

.nd-ask-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  animation: nd-ask-in .22s cubic-bezier(.2, .7, .3, 1) both;
}
.nd-ask-row.is-me { justify-content: flex-end; }

@keyframes nd-ask-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.nd-ask-avatar {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--nd-accent-soft);
  color: var(--nd-accent);
}
.nd-ask-avatar svg { width: 15px; height: 15px; }

.nd-ask-stack {
  min-width: 0;
  max-width: calc(100% - 34px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.nd-ask-bubble {
  margin: 0;
  padding: 8px 12px;
  font-size: .9rem;
  font-weight: 400;
  line-height: 1.42;
  letter-spacing: .002em;
  color: var(--nd-ink);
  background: var(--nd-soft);
  border-radius: 4px 14px 14px 14px;
  overflow-wrap: anywhere;
}
/* A place our answers name, opening on Google Maps. */
.nd-ask-place {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.nd-ask-row.is-me .nd-ask-bubble {
  max-width: 82%;
  color: #fff;
  background: var(--nd-accent);
  border-radius: 14px 14px 4px 14px;
}

/* Thinking: three dots, drifting one after another. */
.nd-ask-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 13px;
}
.nd-ask-dot-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nd-accent);
  opacity: .3;
  animation: nd-ask-pulse 1.15s ease-in-out infinite;
}
.nd-ask-dot-pulse:nth-child(2) { animation-delay: .16s; }
.nd-ask-dot-pulse:nth-child(3) { animation-delay: .32s; }
@keyframes nd-ask-pulse {
  0%, 70%, 100% { opacity: .3; transform: none; }
  35% { opacity: 1; transform: translateY(-3px); }
}

/* A version of the shelf: its picture, price and size. Tap to go back to it. */
.nd-ask-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 244px;
  max-width: 100%;
  padding: 6px 12px 6px 6px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--nd-line);
  border-radius: 12px;
  transition: border-color .15s ease;
}
.nd-ask-card:not(:disabled):hover { border-color: var(--nd-line-strong); }
.nd-ask-card:disabled { cursor: default; color: inherit; }
.nd-ask-card.is-current { border-color: var(--nd-accent); }

.nd-ask-thumb {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--nd-soft);
}
.nd-ask-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.nd-ask-thumb img:not([src]) { visibility: hidden; }

.nd-ask-card-words {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  white-space: nowrap;
}
.nd-ask-card-words strong { font-size: .86rem; font-weight: 700; }
.nd-ask-card-words span { font-size: .74rem; color: var(--nd-muted); }

.nd-ask-card-state {
  flex: 0 0 auto;
  font-size: .74rem;
  font-weight: 700;
  color: var(--nd-accent);
}
.nd-ask-card:not(.is-current) .nd-ask-card-state { color: var(--nd-muted); }

.nd-ask-offer {
  min-height: 34px;
  padding: 0 13px;
  font-size: .84rem;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--nd-line-strong);
  background: #fff;
}

/* One of our pages, under a reply: the same pill, read as a link. */
.nd-ask-link {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  color: inherit;
  text-decoration: none;
}

/* ---------------------------------------------------------------- the dock -- */

.nd-ask-dock { flex: 0 0 auto; padding: 4px 0 12px; }

.nd-ask-quick {
  display: flex;
  gap: 6px;
  padding: 2px 14px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  /* The row fades at its end, which says there is more to the right. */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent);
}
.nd-ask-quick::-webkit-scrollbar { display: none; }
.nd-ask-quick[hidden] { display: none; }

.nd-ask-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  font-size: .83rem;
  font-weight: 500;
  color: var(--nd-ink);
  border-radius: 999px;
  border: 1px solid var(--nd-line);
  background: #fff;
  transition: border-color .15s ease, background .15s ease;
}
.nd-ask-button:active { background: var(--nd-soft); }
.nd-ask-button[hidden] { display: none; }
.nd-ask-back { color: var(--nd-muted); }
.nd-ask-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .1);
}
.is-waiting .nd-ask-button { opacity: .55; }

.nd-ask-form {
  position: relative;
  display: flex;
  padding: 0 14px;
}
.nd-ask-form input {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  padding: 0 50px 0 16px;
  /* Under 16px and iOS zooms the page when the field is tapped. */
  font-size: 16px;
  border: 1px solid var(--nd-line-strong);
  border-radius: 14px;
  background: #fff;
  transition: border-color .15s ease;
}
.nd-ask-form input::placeholder { color: #8b9692; }
.nd-ask-form input:focus { outline: none; border-color: var(--nd-accent); }
.nd-ask-send {
  position: absolute;
  right: 20px;
  top: 6px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--nd-accent);
  border: 0;
  border-radius: 10px;
  transition: opacity .15s ease;
}
.nd-ask-send svg { width: 17px; height: 17px; }
.nd-ask-send:disabled { opacity: .45; }


/*
 * Reaching the team. Ink on white with a person-shaped mark: the green filled
 * button with WhatsApp's mark is for ordering, and this is a different thing.
 */
.nd-ask-team {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px 0 10px;
  font-size: .83rem;
  font-weight: 700;
  color: var(--nd-ink);
  background: #fff;
  border: 1px solid var(--nd-ink);
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}
.nd-ask-team { transition: background .2s ease, color .2s ease; }
.nd-ask-team.is-suggested { animation: nd-ask-suggest 1.3s ease-out 2; }
@keyframes nd-ask-suggest {
  0% { box-shadow: 0 0 0 0 rgba(36, 93, 95, .45); }
  100% { box-shadow: 0 0 0 9px rgba(36, 93, 95, 0); }
}
.nd-ask-team-icon { display: inline-flex; }
@media (max-width: 350px) {
  .nd-ask-team { font-size: .76rem; padding: 0 10px 0 8px; }
}
.nd-ask-team-icon svg { width: 15px; height: 15px; }


/* While the keyboard is up, the page is only what can be seen. */
.nd-keyboard .nd-app[data-mode="ask"] {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--nd-visible-top, 0px);
  height: var(--nd-visible-height, 100dvh);
}
.nd-keyboard .nd-app[data-mode="ask"] .nd-top,
.nd-keyboard .nd-app[data-mode="ask"] .nd-summary,
.nd-keyboard .nd-app[data-mode="ask"] .nd-breakdown,
.nd-keyboard .nd-app[data-mode="ask"] .nd-ask-quick,
.nd-keyboard .nd-app[data-mode="ask"] .nd-ask-colours,
.nd-keyboard .nd-app[data-mode="ask"] .nd-ask-over { display: none !important; }
.nd-keyboard .nd-app[data-mode="ask"] .nd-ask { height: 58%; padding-bottom: 8px; }

@media (max-height: 620px) {
  .nd-app[data-mode="ask"] .nd-ask { height: 54dvh; }
}

@media (max-width: 350px) {
  .nd-app[data-mode="ask"] .nd-brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .nd-ask-team.is-suggested { animation: none; }
  .nd-ask-row { animation: none; }
  .nd-ask-dot-pulse { animation: none; opacity: .6; }
}

@media (min-width: 860px) {
  .nd-app[data-mode="ask"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .nd-app[data-mode="ask"] .nd-top { grid-column: 1 / -1; }
  .nd-app[data-mode="ask"] .nd-main { grid-column: 1; grid-row: 2; }
  .nd-app[data-mode="ask"] .nd-breakdown,
  .nd-app[data-mode="ask"] .nd-summary { grid-column: 1; }
  .nd-app[data-mode="ask"] .nd-ask {
    grid-column: 2;
    grid-row: 2 / span 2;
    height: auto;
    border-top: 0;
    border-left: 1px solid var(--nd-line);
  }
}

/* ------------------------------------------------- this mode's own chrome -- */

.nd-ask-bar,
.nd-ask-over { display: none; }

.nd-app[data-mode="ask"] .nd-top,
.nd-app[data-mode="ask"] .nd-summary,
.nd-app[data-mode="ask"] .nd-breakdown { display: none; }

.nd-app[data-mode="ask"] .nd-ask-bar:not([hidden]) {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  background: #fff;
}

.nd-ask-home {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  color: inherit;
  text-decoration: none;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .01em;
}
.nd-ask-home img { display: block; width: 24px; height: auto; }

.nd-ask-bar .nd-ask-team {
  min-height: 40px;
  padding: 4px 12px 4px 9px;
  gap: 8px;
  border: 1px solid var(--nd-line-strong);
  border-radius: 12px;
}
.nd-ask-team-words { display: flex; flex-direction: column; line-height: 1.12; }
.nd-ask-team-words strong { font-size: .8rem; font-weight: 700; }
.nd-ask-team-words small { font-size: .68rem; font-weight: 500; color: var(--nd-muted); }

.nd-ask-more {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--nd-ink);
  background: #fff;
  border: 1px solid var(--nd-line);
  border-radius: 12px;
}
.nd-ask-more svg { width: 18px; height: 18px; }

.nd-ask-menu {
  position: absolute;
  top: calc(100% - 2px);
  right: 12px;
  min-width: 214px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--nd-line);
  border-radius: 14px;
  box-shadow: var(--nd-shadow);
  animation: nd-ask-in .16s cubic-bezier(.2, .7, .3, 1) both;
}
.nd-ask-menu[hidden] { display: none; }
.nd-ask-menu-item {
  padding: 10px 12px;
  text-align: left;
  font-size: .88rem;
  font-weight: 500;
  color: var(--nd-ink);
  background: none;
  border: 0;
  border-radius: 9px;
}
.nd-ask-menu-item:hover,
.nd-ask-menu-item:focus-visible { background: var(--nd-soft); }
.nd-ask-menu-item:disabled { opacity: .4; cursor: default; background: none; }
.nd-ask-menu-rule { height: 1px; margin: 6px 4px; background: var(--nd-line); }
.nd-ask-menu-note { margin: 4px 12px 2px; font-size: .72rem; color: var(--nd-muted); }

/* The price and Order, standing on the shelf's lower edge. */
.nd-app[data-mode="ask"] .nd-ask-over:not([hidden]) {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px 12px;
  pointer-events: none;
}
.nd-ask-figures { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.nd-ask-figures strong { font-size: 1.14rem; font-weight: 700; letter-spacing: -.01em; }
.nd-ask-figures span { font-size: .74rem; color: var(--nd-muted); white-space: nowrap; }
.nd-ask-figures .nd-ask-depth { font-size: .7rem; }
.nd-ask-figures .nd-ask-depth:empty { display: none; }
.nd-ask-order {
  pointer-events: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px 0 13px;
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
  background: var(--nd-whatsapp);
  border: 0;
  border-radius: 12px;
}
.nd-ask-order svg { width: 17px; height: 17px; fill: #fff; }
.nd-ask-order:disabled { opacity: .5; }

.nd-app[data-mode="ask"] .nd-hint { bottom: 64px; }
.nd-app[data-mode="ask"] .nd-ask { height: min(47dvh, 400px); }
.nd-keyboard .nd-app[data-mode="ask"] .nd-ask-bar { display: none; }

@media (max-width: 350px) {
  .nd-ask-home span { display: none; }
}

@media (min-width: 860px) {
  .nd-app[data-mode="ask"] { grid-template-rows: auto minmax(0, 1fr); }
  .nd-app[data-mode="ask"] .nd-ask-bar { grid-column: 1; grid-row: 1; }
  .nd-app[data-mode="ask"] .nd-main { grid-column: 1; grid-row: 2; }
  /* The whole column, top to bottom: the phone height above stopped it part way and left a gap (Ben, 10 Nov). */
  .nd-app[data-mode="ask"] .nd-ask { grid-column: 2; grid-row: 1 / span 2; height: auto; }
}

/* After a pinch: the way back to the whole shelf, top centre of the stage. */
.nd-ask-whole { display: none; }
.nd-app[data-mode="ask"][data-ask-zoomed] .nd-ask-whole {
  display: inline-flex;
  align-items: center;
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  min-height: 34px;
  padding: 0 14px;
  font-size: .84rem;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--nd-line-strong);
  background: #fff;
}

/*
 * Chat with our team: a small panel under the bar, like the menu. One switch,
 * Include this shelf, and Open WhatsApp. Ink, not WhatsApp green: the green
 * button is Order, and this is a question.
 */
button.nd-ask-team { font: inherit; cursor: pointer; }
.nd-ask-teampanel {
  position: absolute;
  top: calc(100% - 2px);
  right: 12px;
  width: min(320px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--nd-line);
  border-radius: 14px;
  box-shadow: var(--nd-shadow);
  animation: nd-ask-in .16s cubic-bezier(.2, .7, .3, 1) both;
}
.nd-ask-teampanel[hidden] { display: none; }
.nd-ask-teamshelf {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 6px 6px;
  border: 1px solid var(--nd-line);
  border-radius: 12px;
  cursor: pointer;
}
.nd-ask-teamshelf[hidden] { display: none; }
.nd-ask-teamshelf .nd-ask-thumb[hidden] { display: none; }
.nd-ask-teamshelf .nd-ask-thumb { transition: opacity .15s ease; }
.nd-ask-teamshelf.is-off .nd-ask-thumb { opacity: .3; }
.nd-ask-teamshelf-words { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nd-ask-teamshelf-words strong { font-size: .9rem; font-weight: 700; }
.nd-ask-teamshelf-words small { font-size: .74rem; color: var(--nd-muted); }
.nd-ask-teamshelf.is-off .nd-ask-teamshelf-words small { opacity: .6; }

/* A switch, not a checkbox: on is the accent, as the rest of the chat. */
.nd-ask-switch {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  position: relative;
  width: 44px;
  height: 26px;
  margin: 0 4px 0 0;
  border-radius: 999px;
  background: var(--nd-line-strong);
  cursor: pointer;
  transition: background .15s ease;
}
.nd-ask-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(32, 36, 36, .25);
  transition: transform .15s ease;
}
.nd-ask-switch:checked { background: var(--nd-accent); }
.nd-ask-switch:checked::after { transform: translateX(18px); }
.nd-ask-switch:focus-visible { outline: 2px solid var(--nd-accent); outline-offset: 2px; }

.nd-ask-teamgo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  font-size: .92rem;
  font-weight: 700;
  color: #fff;
  background: var(--nd-ink);
  border-radius: 12px;
  text-decoration: none;
}
.nd-ask-teamgo .nd-ask-team-icon svg { width: 17px; height: 17px; }
.nd-ask-teamnote { margin: -2px 2px 0; font-size: .74rem; color: var(--nd-muted); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .nd-ask-teampanel { animation: none; }
}
