/* ==========================================================================
   Contact rail + enquiry chat
   Sticky shortcuts on the right edge (Email / WhatsApp / Contact us / Top)
   and a chat-style enquiry box in the corner. The chat has no automated
   reply yet — the box hands the message to the Contact form, so nothing a
   buyer types is lost and no fake "sent" state is shown.
   ========================================================================== */

.dd-quickrail {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  width: 56px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Each shortcut is its own pill that grows leftwards on hover, so the label
   never runs off the right edge of the screen. */
.dd-quickrail-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid var(--fm-line);
  border-right: 0;
  border-radius: 14px 0 0 14px;
  background: var(--fm-surface);
  color: var(--fm-ink-2);
  font-family: var(--fm-font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--sh-sm);
  transition: width .22s ease, background-color .18s ease, color .18s ease;
}

.dd-quickrail-btn svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0 18px;
}

.dd-quickrail-btn span {
  white-space: nowrap;
  opacity: 0;
  transition: opacity .18s ease;
}

.dd-quickrail-btn:hover,
.dd-quickrail-btn:focus-visible {
  width: 128px;
  background: var(--fm-rose-tint);
  color: var(--fm-rose-deep);
  outline: none;
}

.dd-quickrail-btn:hover span,
.dd-quickrail-btn:focus-visible span { opacity: 1; }

.dd-quickrail-btn--wa { color: #1F9D55; }
.dd-quickrail-btn--wa:hover,
.dd-quickrail-btn--wa:focus-visible { color: #178046; background: #EEF8F1; }

/* ---------------- Chat box ---------------- */

.dd-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 61;
  font-family: var(--fm-font-body);
}

.dd-chat-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--fm-rose-deep);
  color: #fff;
  box-shadow: var(--sh-lg);
  cursor: pointer;
  transition: transform .18s ease, background-color .18s ease;
}

.dd-chat-toggle:hover { transform: translateY(-2px); background: var(--fm-rose); }
.dd-chat-toggle svg { width: 24px; height: 24px; }

.dd-chat.is-open .dd-chat-toggle { display: none; }

.dd-chat-panel {
  width: 340px;
  max-height: min(78vh, 620px);
  display: flex;
  flex-direction: column;
  background: var(--fm-surface);
  border: 1px solid var(--fm-line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  overflow: hidden;
}

.dd-chat-panel[hidden] { display: none; }

.dd-chat-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--fm-rose-soft);
  border-bottom: 1px solid var(--fm-line);
}

.dd-chat-avatar {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  background: var(--fm-surface);
  border: 1px solid var(--fm-line);
  display: grid;
  place-items: center;
  font-family: var(--fm-font-display);
  font-size: 15px;
  color: var(--fm-rose-deep);
}

.dd-chat-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: var(--r-pill);
  background: #28A745;
  border: 2px solid var(--fm-rose-soft);
}

.dd-chat-id { display: flex; flex-direction: column; line-height: 1.3; }
.dd-chat-id b { font-size: var(--fs-sm); color: var(--fm-ink); font-weight: var(--fw-semibold); }
.dd-chat-id span { font-family: var(--fm-font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--fm-ink-3); }

.dd-chat-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--fm-ink-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.dd-chat-close:hover { background: rgba(74, 31, 51, .07); color: var(--fm-ink); }

.dd-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-4);
  background: var(--fm-surface-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.dd-chat-bubble {
  max-width: 88%;
  padding: var(--sp-3) var(--sp-4);
  border-radius: 14px 14px 14px 4px;
  background: var(--fm-surface);
  border: 1px solid var(--fm-line);
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--fm-ink-2);
}

.dd-chat-stamp {
  font-family: var(--fm-font-mono);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--fm-ink-3);
}

.dd-chat-form { display: flex; flex-direction: column; gap: var(--sp-2); }

.dd-chat-form label {
  font-family: var(--fm-font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fm-ink-3);
}

.dd-chat-form input,
.dd-chat-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--fm-line-strong);
  border-radius: var(--r-sm);
  background: var(--fm-surface);
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--fm-ink);
}

.dd-chat-form textarea { resize: vertical; min-height: 74px; }

.dd-chat-form input:focus,
.dd-chat-form textarea:focus {
  outline: none;
  border-color: var(--fm-rose);
  box-shadow: var(--sh-focus);
}

.dd-chat-send {
  margin-top: var(--sp-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--fm-rose-deep);
  color: #fff;
  font-family: var(--fm-font-mono);
  font-size: var(--fs-eyebrow);
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}

.dd-chat-send:hover { background: var(--fm-rose); }

.dd-chat-foot {
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
  border-top: 1px solid var(--fm-line);
  background: var(--fm-surface);
  font-size: 11px;
  line-height: 1.5;
  color: var(--fm-ink-3);
}

.dd-chat-foot a { color: var(--fm-rose-deep); }

/* Phones keep the shortcuts — they are the whole point of the rail for a
   buyer on a handset. Compact squares, no label expansion, no layout push. */
/* Phones: one soft capsule instead of four detached squares. The four white
   tiles read as stickers dropped on the page; grouping them into a single
   translucent bar makes the same shortcuts look deliberate and keeps them
   off the reading column. Top is dropped — the browser already has one. */
@media (max-width: 900px) {
  .dd-quickrail {
    top: auto;
    bottom: 92px;
    right: 12px;
    transform: none;
    width: 42px;
    gap: 0;
    padding: 4px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .86);
    border: 1px solid var(--fm-line);
    box-shadow: 0 6px 20px rgba(74, 31, 51, .14);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    touch-action: none;
    cursor: grab;
  }
  .dd-quickrail.is-shown { opacity: 1; pointer-events: auto; }
  .dd-quickrail.is-dragging { cursor: grabbing; box-shadow: 0 10px 28px rgba(74, 31, 51, .22); }

  .dd-quickrail-btn {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: var(--r-pill);
    background: transparent;
    box-shadow: none;
  }
  .dd-quickrail-btn + .dd-quickrail-btn { margin-top: 2px; }
  .dd-quickrail-btn svg { width: 17px; height: 17px; margin: 0 9px; }
  .dd-quickrail-btn span { display: none; }
  .dd-quickrail-btn:hover,
  .dd-quickrail-btn:focus-visible {
    width: 34px;
    background: var(--fm-rose-tint);
    color: var(--fm-rose-deep);
  }
  /* Top duplicates the browser's own control on a phone. */
  .dd-quickrail-btn[data-dd-top] { display: none; }

  .dd-chat { right: 14px; bottom: 14px; }
  .dd-chat-panel { width: calc(100vw - 28px); max-width: 360px; }
}

@media print {
  .dd-quickrail, .dd-chat { display: none; }
}

/* ---------- WhatsApp QR on the contact page ---------- */
.dd-wa-qr {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--fm-line);
}

.dd-wa-qr img {
  flex: none;
  width: 112px;
  height: 112px;
  border: 1px solid var(--fm-line);
  border-radius: var(--r-sm);
  background: #fff;
}

.dd-wa-qr span {
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--fm-ink-3);
}

.dd-wa-qr b { color: var(--fm-ink); font-weight: var(--fw-medium); white-space: nowrap; }

.dd-wa-qr-label {
  display: block;
  font-family: var(--fm-font-mono);
  font-size: 10px;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--fm-rose-deep);
  margin-bottom: 4px;
}

.dd-wa-qr span { max-width: 176px; }

/* A buyer reading on the phone cannot scan their own screen. */
@media (max-width: 560px) {
  .dd-wa-qr { display: none; }
}

/* Which product this request is about, carried over from the product page */
.dd-contact-ctx {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--fm-ink-2);
}
.dd-contact-ctx-label {
  font-family: var(--fm-font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fm-rose-deep);
}
