/* Contact Overlay */
.contact-overlay {
  position: fixed;
  inset: 0;
  /* Bound to the visible (dynamic) viewport so iOS Safari (esp. Private Mode
     with the URL bar pinned) doesn't push the panel below the fold. */
  height: 100vh;
  height: 100dvh;
  z-index: 9998;
  pointer-events: none;
  visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-overlay.active {
  pointer-events: auto;
  visibility: visible;
}

/* Backdrop — dim overlay (blur applied to body content via class) */
.contact-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.contact-overlay.active .contact-overlay-backdrop {
  opacity: 1;
}

/* Blur all page content when contact is open */
body.contact-open > *:not(.contact-overlay):not(.floating-nav) {
  filter: blur(20px);
  transition: filter 0.3s ease;
}

body > *:not(.contact-overlay):not(.floating-nav) {
  transition: filter 0.3s ease;
}

/* Floating panel — white frosted card */
.contact-panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(48px) saturate(1.3);
  -webkit-backdrop-filter: blur(48px) saturate(1.3);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  padding: 28px 28px 24px;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.04);
  transform: translateY(8px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease;
}

.contact-overlay.active .contact-panel {
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease;
}

/* Close button */
.contact-panel-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.04);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.35);
  transition: background 0.15s ease, color 0.15s ease;
  padding: 0;
}

.contact-panel-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.6);
}

/* Header */
.contact-panel-header {
  margin-bottom: 20px;
  padding-right: 32px;
}

.contact-heading {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.contact-description {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(0, 0, 0, 0.5);
  letter-spacing: -0.24px;
}

/* Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-field {
  display: flex;
  flex-direction: column;
}

.contact-label {
  font-size: 11px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.5);
  line-height: 24px;
  letter-spacing: -0.02em;
}

.contact-input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  color: #000;
  letter-spacing: -0.24px;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.contact-input::placeholder {
  color: rgba(0, 0, 0, 0.2);
}

.contact-input:hover {
  border-color: rgba(0, 0, 0, 0.1);
}

.contact-input:focus {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.03);
}

.contact-textarea {
  height: 64px;
  padding: 8px 10px;
  resize: none;
  line-height: 1.4;
}

/* Actions */
.contact-actions {
  margin-top: 14px;
}

.contact-submit {
  width: 100%;
  height: 36px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 3px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.24px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.contact-submit:hover {
  background: rgba(0, 0, 0, 0.6);
}

.contact-submit.is-sending {
  cursor: default;
  animation: contact-submit-pulse 1.4s ease-in-out infinite;
}

.contact-submit.is-sending:hover {
  background: #000;
}

@keyframes contact-submit-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.contact-legal {
  font-size: 10px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.45);
  line-height: 1.4;
  margin-top: 10px;
}

/* Email row at bottom of panel */
.contact-panel-email {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  text-align: center;
}

.contact-email-label {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.5);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  display: block;
}

.contact-email-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.contact-email {
  font-size: 12px;
  color: #000;
  letter-spacing: -0.24px;
  text-decoration: none;
}

.contact-email:hover {
  opacity: 0.5;
}

.contact-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 3px;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}

.contact-copy-btn:hover {
  border-color: rgba(0, 0, 0, 0.2);
  color: rgba(0, 0, 0, 0.6);
}

.contact-copy-btn.copied {
  color: rgba(0, 0, 0, 0.5);
}

/* Anti-spam: honeypot hidden field + checkbox */
.contact-honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  pointer-events: none;
}

.contact-verify {
  margin-top: 12px;
}

.contact-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 11px;
  color: rgba(0, 0, 0, 0.5);
  letter-spacing: -0.01em;
}

.contact-checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 3px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  background: rgba(0, 0, 0, 0.02);
  transition: all 0.15s ease;
}

.contact-checkbox input[type="checkbox"]:checked {
  background: #000;
  border-color: #000;
}

.contact-checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

/* Body lock */
body.contact-open {
  overflow-y: scroll;
  position: fixed;
  width: 100%;
}

/* Hide old elements if present */
.contact-overlay .contact-footer-email {
  display: none;
}

/* Responsive */
@media (max-width: 520px) {
  /* Reserve space at the bottom so the panel never sits under the floating nav */
  .contact-overlay {
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }
  .contact-panel {
    max-width: calc(100% - 24px);
    max-height: calc(100vh - 180px);
    max-height: calc(100dvh - 180px);
    padding: 24px 20px 20px;
    border-radius: 10px;
  }
}
