/* The contact form, the same on every page: a panel that slides in from the right (from the bottom
   on a phone) and leaves the page usable behind it, so a visitor can read on while they write.
   contact.js builds it; it takes the page's own colours, light or dark. */
dialog.contact {
  position: fixed; inset: 0 0 0 auto; z-index: 50; margin: 0; height: 100%; max-height: none; width: min(26rem, 100%); border: 0; padding: 0;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--background); color: var(--foreground); border-left: 1px solid var(--border); box-shadow: -24px 0 60px rgba(0, 0, 0, 0.18);
  font: 400 15px/1.5 var(--font-sans); text-align: left;
  transform: translateX(100%); transition: transform 0.35s cubic-bezier(.2, .7, .2, 1), display 0.35s allow-discrete;
}
dialog.contact[open] { transform: none; }
@starting-style { dialog.contact[open] { transform: translateX(100%); } }
/* Coming back to a page with the form already open, it is simply there. */
.contact-instant dialog.contact, .contact-instant body { transition: none !important; }

.ct-sheet { padding: 1.75rem 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; min-height: 100%; }
.ct-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.contact h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; border: 0; padding: 0; margin: 0; }
.ct-head p { color: var(--muted-foreground); font-size: 0.875rem; margin-top: 0.25rem; }
.ct-close { width: 2rem; height: 2rem; flex: none; display: grid; place-items: center; margin: -0.35rem -0.45rem 0 0; padding: 0; border: 0; background: none;
  cursor: pointer; color: var(--muted-foreground); transition: color 0.15s; }
.ct-close:hover { color: var(--foreground); }
.ct-close svg { width: 1.15rem; height: 1.15rem; }
.contact form { display: flex; flex-direction: column; gap: 1rem; }
.contact label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.875rem; font-weight: 500; }
.contact input, .contact textarea {
  font: 400 0.9rem/1.5 var(--font-sans); color: var(--foreground); width: 100%;
  border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem 0.75rem; background: transparent; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.contact textarea { min-height: 8rem; resize: vertical; }
.contact input:focus-visible, .contact textarea:focus-visible { outline: none; border-color: var(--muted-foreground); box-shadow: 0 0 0 3px var(--ring); border-radius: calc(var(--radius) - 2px); }
/* Sending is the one button the public pages keep: shadcn's primary button, the page's ink on its paper. */
.ct-send { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; align-self: flex-start; height: 2.25rem; padding: 0 1rem;
  border: 0; border-radius: calc(var(--radius) - 2px); background: var(--foreground); color: var(--background);
  font: 500 0.875rem var(--font-sans); cursor: pointer; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); transition: background 0.15s; }
.ct-send svg { width: 1rem; height: 1rem; flex: none; }
.ct-send:hover { background: color-mix(in srgb, var(--foreground) 88%, var(--background)); }
.ct-send:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.contact :focus-visible { outline-color: var(--foreground); }
.ct-send:disabled { opacity: 0.6; cursor: default; }
.ct-note { font-size: 0.8rem; color: var(--muted-foreground); }
.ct-note.is-sent { color: var(--foreground); font-size: 0.875rem; font-weight: 500; }
.ct-note.is-wrong { color: var(--foreground); }
/* A field people never see; only a script fills it in, and the sender drops anything that does. */
.ct-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ct-foot { margin-top: auto; font-size: 0.8rem; color: var(--muted-foreground); }
.ct-foot a { color: var(--foreground); text-underline-offset: 4px; }

/* A saved draft shows as a small dot by Contact in the menu, taking no room so the menu never wraps for it. */
.contact-trigger { position: relative; }
.contact-draft .contact-trigger::after { content: ""; position: absolute; top: 50%; right: -9px; width: 5px; height: 5px; margin-top: -3px; border-radius: 50%;
  background: currentColor; pointer-events: none; }

/* On a wide screen the page moves over to make room, so none of it is hidden behind the form. */
@media (min-width: 1100px) {
  body { transition: padding-right 0.35s cubic-bezier(.2, .7, .2, 1); }
  .contact-open body { padding-right: 26rem; }
}

/* On a phone the form rises from the bottom instead. */
@media (max-width: 560px) {
  dialog.contact { inset: auto 0 0 0; width: 100%; max-width: none; height: fit-content; max-height: 92svh; border-left: 0; border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0; box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.2); transform: translateY(100%); }
  .ct-sheet { min-height: 0; padding-bottom: max(1.75rem, env(safe-area-inset-bottom)); }
  .ct-foot { margin-top: 0.25rem; }
  @starting-style { dialog.contact[open] { transform: translateY(100%); } }
}
@media (prefers-reduced-motion: reduce) { dialog.contact, body { transition: none !important; } }
@media print { dialog.contact { display: none !important; } .contact-open body { padding-right: 0; } }
