/* ============================================================
   CONTACT — "Write to me" (js/contact.js), over the home page
   ============================================================
   A modal <dialog> on the sheet's own ink: a small tracked kicker, a
   large title, three fields, the accent button; the address under
   them as the other way. Loaded after galaxy.css (the tokens). The
   phone keeps the same panel, the width of the page's gutters. */

.contact {
  width: min(560px, calc(100vw - 32px));   /* a phone too: the site's 16 px gutter */
  max-width: none;                         /* not the browser's own modal cap (100% − 2em − 6px) */
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  background: linear-gradient(180deg, #141822 0%, #0C0E13 100%);
  color: #E6E9F2;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: auto;
  overscroll-behavior: contain;
}
.contact::backdrop { background: rgba(3, 4, 9, 0.66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.contact[open] { animation: contactIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes contactIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
:root { scrollbar-gutter: stable; }   /* the lock below keeps the scrollbar's room: the page must not widen under the dialog */
:root.contact-open { overflow: hidden; }

.contact [hidden] { display: none !important; }
.contact-form, .contact-done { position: relative; padding: clamp(24px, 4.5vw, 38px); }
.contact-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  color: #9AA3B8;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.contact-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.contact-close:hover, .contact-close:focus-visible { color: #FFFFFF; border-color: rgba(var(--accent-rgb), 0.55); outline: none; }

.contact-kicker {
  margin: 0 0 0.6rem;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}
.contact-title { margin: 0; font-size: clamp(1.8rem, 4.2vw, 2.4rem); font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; color: #FFFFFF; }
.contact-lead { margin: 0.6rem 0 0; font-size: 0.98rem; line-height: 1.6; color: #9AA3B8; }

.contact-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 26px; }
.contact-field { display: grid; gap: 7px; }
.contact-field--wide { grid-column: 1 / -1; }
.contact-field span { font-size: 0.78rem; font-weight: 500; letter-spacing: 0.04em; color: #C3CAD8; }
.contact-field input,
.contact-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(5, 7, 12, 0.6);
  color: #F2F5FB;
  font: 400 1rem/1.5 'Space Grotesk', system-ui, sans-serif;   /* 16 px: iOS zooms into anything smaller */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.contact-field textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.contact-field input:focus,
.contact-field textarea:focus { outline: none; border-color: rgba(var(--accent-rgb), 0.7); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18); }
.contact-field [aria-invalid="true"] { border-color: #FF8A7A; }
/* For bots only: off the screen, out of the tab order, hidden from readers. */
.contact-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.contact-status { min-height: 1.45em; margin: 14px 0 0; font-size: 0.88rem; line-height: 1.45; color: #9AA3B8; }
.contact-status.is-bad { color: #FF9C8F; }
.contact-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 8px; }
.contact-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #05070D;
  font: 600 0.95rem 'Space Grotesk', system-ui, sans-serif;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.contact-send:hover { background: var(--accent-pale); }
.contact-send:active { transform: scale(0.98); }
.contact-send:disabled { opacity: 0.6; cursor: progress; }
.contact-send:focus-visible { outline: 2px solid var(--accent-pale); outline-offset: 3px; }
.contact-alt { margin: 0; font-size: 0.86rem; line-height: 1.6; color: #7C869A; }
.contact-alt a { color: #C3CAD8; text-underline-offset: 3px; }
.contact-alt a:hover { color: #FFFFFF; }
.contact-copy {
  margin-left: 4px;
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: none;
  color: #9AA3B8;
  font: 0.72rem var(--font-mono, 'JetBrains Mono', monospace);
  cursor: pointer;
}
.contact-copy:hover, .contact-copy:focus-visible { color: #FFFFFF; border-color: rgba(var(--accent-rgb), 0.55); outline: none; }

.contact-done { text-align: center; padding-block: 46px; }
.contact-check { display: block; width: 56px; height: 56px; margin: 0 auto 18px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.contact-check circle { stroke: rgba(var(--accent-rgb), 0.35); }
.contact-done .contact-send { margin-top: 26px; }

@media (max-width: 560px) {
  .contact-fields { grid-template-columns: minmax(0, 1fr); }
}
:root.is-phone .contact { border-radius: 22px; }
:root.is-phone .contact-send { width: 100%; }
:root.is-phone .contact-copy { min-height: 36px; padding: 6px 14px; }   /* a thumb's size, not a cursor's */

@media (prefers-reduced-motion: reduce) {
  .contact[open] { animation: none; }
  .contact-close, .contact-field input, .contact-field textarea, .contact-send { transition: none; }
}
