/* ============================================================
   3DCORE — Service-page quote modal (SVCQUOTE-01)
   House brand: red #E31E24 stamp, ink #16181D, steel paper.
   Scoped to .dp3-sq-* + the trigger .svc-cta-out.dp3-sq-open.
   ============================================================ */

/* Bulletproofing against horizontal overflow (the mobile bug):
   border-box so width:100%+padding never overflows; min-width:0 so flex/grid
   items can shrink below their content's intrinsic width. */
#dp3-sq-modal, #dp3-sq-modal *, #dp3-sq-modal *::before, #dp3-sq-modal *::after { box-sizing: border-box; }
#dp3-sq-modal .dp3-sq-dialog,
#dp3-sq-modal .dp3-sq-grid,
#dp3-sq-modal .dp3-sq-panel,
#dp3-sq-modal .dp3-sq-files,
#dp3-sq-modal .dp3-sq-file,
#dp3-sq-modal .dp3-sq-fields,
#dp3-sq-modal .dp3-sq-field { min-width: 0; }

/* Trigger button (replaces the old "Написати нам" sidebar link) */
.svc-cta-out.dp3-sq-open {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  cursor: pointer;
  margin-top: 10px;
  padding: 13px 20px;
  border: 1px solid #E31E24;
  border-radius: 10px;
  background: #E31E24;
  color: #fff;
  font: 600 15px/1.2 "Inter", system-ui, sans-serif;
  letter-spacing: .01em;
  transition: background-color .15s ease, border-color .15s ease;
}
.svc-cta-out.dp3-sq-open:hover,
.svc-cta-out.dp3-sq-open:focus { background: #C01A1F; border-color: #C01A1F; color: #fff; }

/* Overlay + dialog */
html.dp3-sq-lock { overflow: hidden; }
.dp3-sq-overlay {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(22, 24, 29, .62);
  opacity: 0; transition: opacity .18s ease;
  overflow-x: hidden;
}
.dp3-sq-overlay.on { opacity: 1; }
.dp3-sq-overlay[hidden] { display: none; }
.dp3-sq-dialog {
  position: relative;
  width: 100%; max-width: min(920px, 100%); max-height: 92vh; overflow-y: auto; overflow-x: hidden;
  background: #fff; border-radius: 14px;
  box-shadow: 0 24px 70px rgba(20, 23, 30, .28);
  padding: clamp(20px, 3vw, 32px);
  font-family: "Inter", system-ui, sans-serif; color: #16181D;
  transform: translateY(8px); transition: transform .18s ease;
}
.dp3-sq-overlay.on .dp3-sq-dialog { transform: none; }
.dp3-sq-close {
  position: absolute; top: 10px; right: 12px;
  width: 44px; height: 44px; border: 0; background: none;
  font-size: 30px; line-height: 1; color: #5C6470; cursor: pointer; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.dp3-sq-close:hover { background: #F4F6F8; color: #16181D; }

/* Head */
.dp3-sq-head { margin: 0 0 18px; padding-right: 40px; }
.dp3-sq-eyebrow {
  display: block; font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 600; font-size: .7rem; letter-spacing: .18em; color: #E31E24; margin-bottom: 8px;
}
.dp3-sq-head h2 {
  font-family: "Archivo", system-ui, sans-serif; font-weight: 700;
  font-size: clamp(1.4rem, 3.4vw, 1.9rem); line-height: 1.12; margin: 0 0 6px; color: #16181D;
}
.dp3-sq-sub { margin: 0; color: #5C6470; font-size: 14.5px; line-height: 1.5; }

/* Grid — minmax(0,1fr) so a long filename can't blow out the column width */
.dp3-sq-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }

/* Viewer (ink "specimen" ground; model = neutral steel). 4/3, capped so it never dominates. */
.dp3-sq-viewer {
  position: relative; min-width: 0; border-radius: 12px; overflow: hidden;
  background: #16181D; border: 1px solid #20232B; aspect-ratio: 4 / 3; max-height: 56vh;
}
.dp3-sq-viewer canvas { display: block; width: 100% !important; height: 100% !important; }
.dp3-sq-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; text-align: center;
  color: rgba(242, 244, 247, .72); padding: 22px; font-size: 13.5px; line-height: 1.5;
}
.dp3-sq-empty svg { width: 50px; height: 50px; opacity: .5; }
.dp3-sq-spin {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(22, 24, 29, .55); color: #fff; font-size: 14px;
}
.dp3-sq-spin.on { display: flex; }
.dp3-sq-viewer.dp3-sq-noviewer { display: none; } /* three/CDN failed -> hide preview, form still works */

/* Panel */
.dp3-sq-panel { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.dp3-sq-drop {
  border: 2px dashed #C9CED4; border-radius: 12px; padding: 18px 14px;
  text-align: center; cursor: pointer; background: #FAFBFC; transition: .16s; font-size: 14px; color: #16181D;
}
.dp3-sq-drop:hover, .dp3-sq-drop.drag { border-color: #E31E24; background: #FFF5F4; }
.dp3-sq-drop b { color: #E31E24; }
.dp3-sq-drop small { display: block; color: #5C6470; margin-top: 5px; font-size: 12px; }
.dp3-sq-files { display: flex; flex-direction: column; gap: 6px; }
.dp3-sq-file {
  display: flex; align-items: center; gap: 10px; min-width: 0; background: #F4F6F8;
  border-radius: 9px; padding: 8px 11px; font-size: 13px;
}
.dp3-sq-file .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp3-sq-file .vol { flex: none; color: #5C6470; font-variant-numeric: tabular-nums; }
.dp3-sq-file .rm { flex: none; border: 0; background: none; color: #C01A1F; font-weight: 700; font-size: 16px; cursor: pointer; line-height: 1; }
.dp3-sq-vol {
  display: flex; align-items: center; justify-content: space-between;
  background: #16181D; color: #F2F4F7; border-radius: 10px; padding: 11px 14px;
}
.dp3-sq-vol[hidden] { display: none; }
.dp3-sq-vol-lbl {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .72rem;
  letter-spacing: .04em; color: rgba(242, 244, 247, .7); text-transform: uppercase;
}
.dp3-sq-vol-val { font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 600; font-size: 15px; }

/* Fields */
.dp3-sq-fields { display: flex; flex-direction: column; gap: 11px; }
.dp3-sq-field { display: block; }
.dp3-sq-field > span {
  display: block; font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 600;
  font-size: .72rem; letter-spacing: .03em; color: #16181D; margin-bottom: 5px;
}
.dp3-sq-field > span i { color: #E31E24; font-style: normal; }
.dp3-sq-field input, .dp3-sq-field textarea {
  width: 100%; box-sizing: border-box; min-height: 46px; padding: 11px 13px;
  font-family: "Inter", system-ui, sans-serif; font-size: 16px; color: #16181D;
  background: #fff; border: 1px solid #DCE0E6; border-radius: 9px;
  -webkit-appearance: none; appearance: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.dp3-sq-field textarea { min-height: 74px; resize: vertical; line-height: 1.5; }
.dp3-sq-field input:focus, .dp3-sq-field textarea:focus {
  outline: none; border-color: #E31E24; box-shadow: 0 0 0 3px rgba(227, 30, 36, .15);
}
.dp3-sq-field ::placeholder { color: #9AA1AB; opacity: 1; }
.dp3-sq-hp { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* honeypot — clipped (NOT left:-9999px, which inflated the scroll width) */

/* Submit + messages */
.dp3-sq-submit {
  width: 100%; min-height: 50px; border: 0; border-radius: 10px;
  background: #E31E24; color: #fff; cursor: pointer;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 600;
  font-size: 15px; letter-spacing: .03em; text-transform: uppercase;
  transition: background-color .15s ease, transform .05s ease;
}
.dp3-sq-submit:hover { background: #C01A1F; }
.dp3-sq-submit:active { transform: translateY(1px); }
.dp3-sq-submit:disabled { opacity: .6; cursor: not-allowed; }
.dp3-sq-msg { display: none; font-size: 14px; border-radius: 9px; padding: 10px 13px; }
.dp3-sq-msg.on { display: block; }
.dp3-sq-msg.ok { background: #ECFDF3; color: #15803D; border: 1px solid #BBF7D0; }
.dp3-sq-msg.err { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.dp3-sq-msg.info { background: #FFF7ED; color: #9A3412; border: 1px solid #FED7AA; } /* heads-up (e.g. file >50 MB), not an error */
.dp3-sq-privacy { margin: 0; font-size: 11.5px; color: #9AA1AB; text-align: center; line-height: 1.4; }

/* Mobile (<=760px): full-height sheet, form/upload FIRST, viewer a capped preview below */
@media (max-width: 760px) {
  .dp3-sq-overlay { padding: 0; align-items: stretch; }
  .dp3-sq-dialog { max-width: none; min-height: 100dvh; height: auto; max-height: none; border-radius: 0; padding: 18px 16px 32px; }
  .dp3-sq-grid { display: flex; flex-direction: column; gap: 16px; align-items: stretch; } /* stretch, NOT start: in a column flex, start makes items size to content width = overflow */
  .dp3-sq-panel { order: 1; }
  .dp3-sq-viewer { order: 2; aspect-ratio: auto; height: clamp(200px, 40vh, 280px); max-height: none; }
  .dp3-sq-close { width: 48px; height: 48px; }
  .dp3-sq-file .rm { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
}
@media (max-width: 999px) {
  .dp3-sq-field input, .dp3-sq-field textarea { font-size: 16px; min-height: 48px; }
  .svc-cta-out.dp3-sq-open { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .dp3-sq-overlay, .dp3-sq-dialog, .dp3-sq-submit { transition: none !important; }
}
