/* ==========================================================================
   SYNTEXFLOW — SHARED START A PROJECT MODAL
   One component for every enquiry trigger across the site.
   Consumes design-tokens.css; no palette or typeface of its own.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Trigger helpers
   -------------------------------------------------------------------------- */

.sf-link--btn,
.footer-link--button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
}

.sf-link--btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  padding: 0 0 3px;
}

.footer-link--button {
  display: inline-block;
  font-family: inherit;
}

html.enq-ready,
body.enq-lock {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Overlay + dialog
   -------------------------------------------------------------------------- */

.sf-enq-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 120);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(4, 4, 6, 0.78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow: hidden;
  animation: sf-enq-fade 180ms var(--sf-ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.sf-enq-overlay[hidden] {
  display: none !important;
}

.sf-enq-dialog {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: min(88vh, 880px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(192, 124, 76, 0.07) 0%, transparent 55%),
    linear-gradient(180deg, var(--ink-3) 0%, var(--ink-2) 100%);
  box-shadow: var(--shadow-modal);
  animation: sf-enq-rise 220ms var(--sf-ease, cubic-bezier(0.22, 1, 0.36, 1));
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.sf-enq-dialog::-webkit-scrollbar {
  width: 8px;
}

.sf-enq-dialog::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

/* Hairline highlight along the top edge */
.sf-enq-dialog::before {
  content: "";
  position: absolute;
  top: 0;
  left: 32px;
  right: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--copper-line), transparent);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.sf-enq-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.sf-enq-kicker {
  display: inline-block;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--copper);
}

.sf-enq-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1.35rem, 2.6vw, 1.7rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--paper);
}

.sf-enq-support {
  margin: 12px 0 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted);
}

.sf-enq-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: -4px -4px 0 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color var(--transition-hover), border-color var(--transition-hover), background var(--transition-hover);
}

.sf-enq-close:hover {
  color: var(--paper);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

/* --------------------------------------------------------------------------
   Context line
   -------------------------------------------------------------------------- */

.sf-enq-context {
  margin: 20px 0 0;
  padding: 10px 14px;
  border: 1px solid var(--copper-line);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--copper-bright);
}

.sf-enq-context strong {
  color: var(--paper);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Form
   -------------------------------------------------------------------------- */

.sf-enq-form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sf-enq-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sf-enq-label,
.sf-enq-methods legend {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--paper);
}

.sf-enq-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sf-enq-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--faint);
}

.sf-enq-input,
.sf-enq-select,
.sf-enq-textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--ink-1);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  transition: border-color var(--transition-hover), background var(--transition-hover), box-shadow var(--transition-hover);
}

.sf-enq-input::placeholder,
.sf-enq-textarea::placeholder {
  color: var(--faint);
  opacity: 0.85;
}

.sf-enq-input:hover,
.sf-enq-select:hover,
.sf-enq-textarea:hover {
  border-color: var(--border-strong);
}

.sf-enq-input:focus,
.sf-enq-select:focus,
.sf-enq-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--ink-2);
  box-shadow: 0 0 0 3px var(--scarlet-soft);
}

.sf-enq-input[aria-invalid="true"],
.sf-enq-select[aria-invalid="true"],
.sf-enq-textarea[aria-invalid="true"] {
  border-color: #C4554D;
  box-shadow: 0 0 0 3px rgba(196, 85, 77, 0.12);
}

.sf-enq-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 19px) 20px, calc(100% - 14px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.sf-enq-select option {
  background: var(--ink-3);
  color: var(--paper);
}

.sf-enq-textarea {
  min-height: 108px;
  resize: vertical;
}

.sf-enq-error {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: #E0857F;
  min-height: 0;
}

.sf-enq-error:empty {
  display: none;
}

/* --------------------------------------------------------------------------
   Segmented contact method
   -------------------------------------------------------------------------- */

.sf-enq-methods {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sf-enq-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--ink-1);
}

.sf-enq-method {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.sf-enq-method input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.sf-enq-method span {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--transition-hover);
}

.sf-enq-method:hover span {
  color: var(--paper);
}

.sf-enq-method input:checked + span {
  color: var(--on-accent);
}

.sf-enq-method input:checked + span::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: var(--radius-pill);
  background: var(--copper);
}

.sf-enq-method {
  isolation: isolate;
}

.sf-enq-method input:focus-visible + span {
  outline: 2px solid var(--copper-bright);
  outline-offset: 3px;
  border-radius: 999px;
}

/* --------------------------------------------------------------------------
   Notice (frontend-only, no claim of delivery)
   -------------------------------------------------------------------------- */

.sf-enq-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--copper-line);
  border-radius: var(--radius-input);
  background: rgba(192, 124, 76, 0.08);
}

.sf-enq-notice[hidden] {
  display: none !important;
}

.sf-enq-notice__icon {
  flex: 0 0 auto;
  display: inline-flex;
  margin-top: 1px;
  color: var(--copper-bright);
}

.sf-enq-notice__copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}

.sf-enq-notice__copy strong {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--paper);
}

.sf-enq-notice__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.sf-enq-notice__close:hover {
  color: var(--paper);
}

/* --------------------------------------------------------------------------
   Submit
   -------------------------------------------------------------------------- */

.sf-enq-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

.sf-enq-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 13px 22px;
  border: 1px solid var(--copper);
  border-radius: var(--radius-pill);
  background: var(--copper);
  color: var(--on-accent);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-hover), border-color var(--transition-hover), transform var(--transition-hover);
}

.sf-enq-submit:hover {
  background: var(--copper-bright);
  border-color: var(--copper-bright);
}

.sf-enq-submit:active {
  transform: translateY(1px);
}

.sf-enq-arrow {
  transition: transform var(--transition-hover);
}

.sf-enq-submit:hover .sf-enq-arrow {
  transform: translateX(3px);
}

.sf-enq-micro {
  margin: 0;
  text-align: center;
  font-size: 0.6875rem;
  line-height: 1.5;
  color: var(--faint);
}

/* Honeypot field */
.sf-enq-gotcha {
  display: none !important;
  visibility: hidden;
  position: absolute;
  left: -9999px;
}

/* Notice status variants */
.sf-enq-notice--success {
  border-color: rgba(52, 199, 89, 0.35);
  background: rgba(52, 199, 89, 0.08);
}
.sf-enq-notice--success .sf-enq-notice__icon {
  color: #34C759;
}

.sf-enq-notice--error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}
.sf-enq-notice--error .sf-enq-notice__icon {
  color: #EF4444;
}

.sf-enq-notice__retry {
  align-self: flex-start;
  margin-top: 6px;
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 180ms ease;
}
.sf-enq-notice__retry:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--copper-line);
}

.sf-enq-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
}

.sf-enq-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(11, 11, 13, 0.3);
  border-radius: 50%;
  border-top-color: var(--on-accent);
  animation: sf-spin 0.65s linear infinite;
}

@keyframes sf-spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Motion preferences
   -------------------------------------------------------------------------- */

@keyframes sf-enq-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sf-enq-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .sf-enq-overlay,
  .sf-enq-dialog {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   Mobile: full-screen sheet
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .sf-enq-overlay {
    align-items: stretch;
    padding: 0;
  }

  .sf-enq-dialog {
    max-width: none;
    max-height: none;
    height: 100vh;
    height: 100dvh;
    padding:
      calc(22px + env(safe-area-inset-top))
      calc(20px + env(safe-area-inset-right))
      calc(20px + env(safe-area-inset-bottom))
      calc(20px + env(safe-area-inset-left));
    border: 0;
    border-radius: 0;
    animation: sf-enq-rise 200ms var(--sf-ease, cubic-bezier(0.22, 1, 0.36, 1));
  }

  .sf-enq-dialog::before {
    left: 20px;
    right: 20px;
  }

  .sf-enq-title {
    font-size: 1.45rem;
  }

  .sf-enq-close {
    width: 44px;
    height: 44px;
    margin: -6px -6px 0 0;
  }

  .sf-enq-form {
    margin-top: 20px;
    gap: 16px;
  }

  .sf-enq-input,
  .sf-enq-select,
  .sf-enq-textarea {
    font-size: 16px;
    min-height: 48px;
  }

  .sf-enq-method {
    min-height: 44px;
  }

  .sf-enq-submit {
    min-height: 50px;
  }

  .sf-enq-actions {
    position: sticky;
    bottom: calc(-20px - env(safe-area-inset-bottom));
    z-index: 2;
    margin: 4px calc(-20px - env(safe-area-inset-right)) calc(-20px - env(safe-area-inset-bottom)) calc(-20px - env(safe-area-inset-left));
    padding: 14px calc(20px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
    background: linear-gradient(180deg, transparent 0%, var(--ink-2) 30%, var(--ink-2) 100%);
    border-top: 1px solid var(--line-soft);
  }
}
