/* ============================================================
   Contact Panel — slide-out enquiry form
   Injected into every page by components.js. Theme (dark / light)
   is set at open-time to mirror the nav's current state so the
   panel never clashes with the hero behind it. Also shares styles
   with the standalone /contact page via .enquiry-form.
   ============================================================ */

/* Root — fixed-position full-height layer, sits above everything. */
.contact-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear .35s;
}
.contact-panel.is-open {
  pointer-events: auto;
  visibility: visible;
  transition: visibility 0s linear 0s;
}

.contact-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  transition: opacity .3s ease;
}
.contact-panel.is-open .contact-panel__backdrop { opacity: 1; }

.contact-panel__sheet {
  position: absolute;
  top: 0; right: 0;
  height: 100dvh;
  width: min(480px, 100vw);
  background: var(--bg);
  color: var(--white);
  border-left: 1px solid var(--border);
  box-shadow: -40px 0 80px rgba(0, 0, 0, .4);
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.7, 0, .2, 1);
  display: flex;
  flex-direction: column;
  outline: none;
}
.contact-panel.is-open .contact-panel__sheet { transform: translateX(0); }

/* Light variant — mirrors nav.on-light cream + ink palette. */
.contact-panel--light .contact-panel__sheet {
  background: #F5F5F0;
  color: var(--ink);
  border-left-color: #d9d3bc;
  box-shadow: -40px 0 80px rgba(0, 0, 0, .25);
}

/* Close button — top-right, matches nav icon treatment. */
.contact-panel__close {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  background: transparent;
  border: 1px solid var(--border);
  cursor: none;
  transition: background .2s, border-color .2s, color .2s;
  z-index: 2;
}
.contact-panel__close svg { width: 18px; height: 18px; }
.contact-panel__close:hover { background: rgba(255, 255, 255, .06); border-color: var(--blue); color: var(--blue); }
.contact-panel--light .contact-panel__close { border-color: #d9d3bc; }
.contact-panel--light .contact-panel__close:hover { background: rgba(91, 90, 255, .08); }

/* Scrollable inner so long forms + on-screen keyboards don't clip. */
.contact-panel__inner {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 64px 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  -webkit-overflow-scrolling: touch;
}

.contact-panel__head { display: flex; flex-direction: column; gap: 10px; }
.contact-panel__title {
  font-family: var(--font-display);
  font-weight: var(--heading-weight);
  font-size: clamp(32px, 4vw, 44px);
  letter-spacing: -.03em;
  line-height: 1.05;
  margin: 0;
}
.contact-panel__title em {
  font-style: italic;
  font-weight: 500;
  color: var(--cream);
}
.contact-panel--light .contact-panel__title em { color: var(--blue); }
.contact-panel__sub {
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 42ch;
  margin: 0;
}
.contact-panel--light .contact-panel__sub { color: #4a4331; }

/* Divider */
.contact-panel__divider {
  height: 1px;
  background: var(--border);
  margin: 12px -40px 4px;
}
.contact-panel--light .contact-panel__divider { background: #d9d3bc; }

/* Contact row — email button + linkedin icon */
.contact-panel__contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.contact-panel__email {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: inherit;
  transition: border-color .2s, color .2s, background .2s;
  font-family: var(--font-ui);
  font-size: 14px;
}
.contact-panel__email svg { width: 18px; height: 18px; }
.contact-panel__email:hover { color: var(--blue); border-color: var(--blue); background: rgba(91, 90, 255, .08); }
.contact-panel--light .contact-panel__email { border-color: #d9d3bc; }

.contact-panel__linkedin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: inherit;
  transition: border-color .2s, color .2s, background .2s;
}
.contact-panel__linkedin svg { width: 18px; height: 18px; }
.contact-panel__linkedin:hover { color: var(--blue); border-color: var(--blue); background: rgba(91, 90, 255, .08); }
.contact-panel--light .contact-panel__linkedin { border-color: #d9d3bc; }

.contact-panel__note {
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.contact-panel--light .contact-panel__note { color: #6a6250; }

/* Lock body scroll when panel is open */
.panel-lock, .panel-lock body { overflow: hidden; }

@media (max-width: 540px) {
  .contact-panel__sheet { width: 100vw; border-left: none; }
  .contact-panel__inner { padding: 72px 22px 28px; }
  .contact-panel__divider { margin: 8px -22px 4px; }
}

/* ============================================================
   Enquiry form — shared between panel and /contact page.
   ============================================================ */
.enquiry-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.enquiry-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.enquiry-form__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.contact-panel--light .enquiry-form__label { color: #6a6250; }

.enquiry-form input,
.enquiry-form select,
.enquiry-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  /* Resting border + background needs to be visibly contrasted
     against the dark form bg on every browser. Previously the rule
     used `var(--border)` (#2a2a2a) on `rgba(255,255,255,.02)` (~#111)
     which Mac Chrome rendered just-about-visibly via subpixel
     antialiasing but Windows Chrome flattened to the same dark grey
     as the page — fields were effectively invisible until focused.
     The brighter border + slightly-lifted surface fixes that on every
     platform. `color-scheme: dark` tells the browser to render any
     UA chrome (the select dropdown popover, autofill backgrounds,
     scroll bar) in dark mode so they don't pop white on focus. */
  color-scheme: dark;
  border: 1px solid #3a3a3a;
  background: #1a1a1a;
  color: var(--white, #fff);
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: var(--body-letter-spacing);
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
  cursor: none;
  -webkit-appearance: none;
  appearance: none;
}
.enquiry-form input:hover:not(:focus),
.enquiry-form select:hover:not(:focus),
.enquiry-form textarea:hover:not(:focus) {
  border-color: #4a4a4a;
}
.enquiry-form select {
  background-image: linear-gradient(45deg, transparent 48%, currentColor 48%, currentColor 52%, transparent 52%),
                    linear-gradient(-45deg, transparent 48%, currentColor 48%, currentColor 52%, transparent 52%);
  background-repeat: no-repeat;
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 6px 6px, 6px 6px;
  padding-right: 36px;
}
.enquiry-form textarea { resize: vertical; min-height: 108px; }
.enquiry-form input:focus,
.enquiry-form select:focus,
.enquiry-form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(91, 90, 255, .18);
}
.enquiry-form input::placeholder,
.enquiry-form textarea::placeholder { color: var(--muted-2); }

/* Light variant */
.contact-panel--light .enquiry-form input,
.contact-panel--light .enquiry-form select,
.contact-panel--light .enquiry-form textarea,
.enquiry-form--light input,
.enquiry-form--light select,
.enquiry-form--light textarea {
  background: #fff;
  border-color: #d9d3bc;
  color: var(--ink);
}

.enquiry-form__submit {
  width: 100%;
  justify-content: center;
  margin-top: 6px;
}

/* Success state — replaces the form content in place. */
.enquiry-form__success {
  display: none;
  padding: 28px 0 4px;
}
.enquiry-form__success h3 {
  font-family: var(--font-display);
  font-weight: var(--heading-weight);
  font-size: clamp(22px, 2.4vw, 28px);
  letter-spacing: -.02em;
  margin: 0 0 10px;
  line-height: 1.15;
}
.enquiry-form__success p {
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}
.enquiry-form__success a { color: var(--blue); border-bottom: 1px solid currentColor; }
.contact-panel--light .enquiry-form__success p { color: #4a4331; }

.enquiry-form.is-success .enquiry-form__field,
.enquiry-form.is-success .enquiry-form__submit,
.enquiry-form.is-success .enquiry-form__error { display: none; }
.enquiry-form.is-success .enquiry-form__success { display: block; }

/* Honeypot — off-screen but focusable for rare screen-reader users
   who might tab through. Browsers won't autofill it; real people
   almost never touch it; bots love it. */
.enquiry-form__hp {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

/* Inline error box — shown when /api/contact fails or the server
   rejects the submission. Includes a mailto: fallback link. */
.enquiry-form__error {
  padding: 12px 14px;
  border: 1px solid rgba(232, 69, 60, .4);
  background: rgba(232, 69, 60, .08);
  color: #ffd3d0;
  border-radius: 10px;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 4px;
}
.enquiry-form__error a {
  color: inherit;
  font-weight: 500;
  border-bottom: 1px solid currentColor;
}
.enquiry-form__error-msg { margin-bottom: 10px; line-height: 1.5; }
.enquiry-form__error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}
.enquiry-form__error-action {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid currentColor;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  background: transparent;
  color: inherit;
  cursor: none;
  transition: background .2s;
}
.enquiry-form__error-action:hover { background: rgba(232, 69, 60, .15); }
.enquiry-form__error-address { font-size: 12px; opacity: .9; }
.enquiry-form__error-pre {
  margin: 10px 0 0;
  padding: 10px;
  background: rgba(0, 0, 0, .25);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow: auto;
  user-select: all;
  color: inherit;
}
.contact-panel--light .enquiry-form__error,
.enquiry-form--light .enquiry-form__error,
.contact-layout__form .enquiry-form__error {
  color: #8a2e28;
  background: rgba(232, 69, 60, .08);
  border-color: rgba(232, 69, 60, .35);
}
.contact-panel--light .enquiry-form__error-pre,
.contact-layout__form .enquiry-form__error-pre {
  background: rgba(0, 0, 0, .05);
  border-color: rgba(232, 69, 60, .2);
}
