/* c.contact.css — contact popup (<dialog>#c-contact) styles.
   House look: sharp corners, mono uppercase labels, dark-red
   accent, grid-paper backdrop tint. Palette custom properties
   are declared on .c-root, which does not contain the top-layer
   dialog, so the values are repeated here literally. */

#c-contact {
  border: 1px solid #E3E4E8;
  border-top: 3px solid #9D2235;
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  background: #FFFFFF;
  color: #0A0A0B;
  font-family: "IBM Plex Sans", sans-serif;
  box-shadow: 0 30px 70px -30px rgba(10, 10, 11, .45);
}
#c-contact::backdrop {
  background: rgba(10, 10, 11, .55);
}

/* Three rows: a fixed header, a body that scrolls, and a footer that
   stays put. The footer must remain reachable when the software
   keyboard shrinks the sheet, which is why the body is the only part
   that scrolls. */
#c-contact form:not([hidden]),
#c-contact .cm-sent:not([hidden]) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: inherit;
}
.cm-head {
  flex: none;
  box-sizing: border-box;   /* 56px including the rule beneath it */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
  padding: 0 6px 0 24px;
  border-bottom: 1px solid #E3E4E8;
}
.cm-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 24px;
}
.cm-foot {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 24px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid #E3E4E8;
  background: #FFFFFF;
}
.cm-x {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  width: 44px;
  height: 44px;
  flex: none;
  font-size: 24px;
  line-height: 1;
  color: #626974;
  cursor: pointer;
}
.cm-x:hover { color: #0A0A0B; }

#c-contact h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cm-f { display: block; margin-bottom: 16px; }
.cm-l {
  display: block;
  margin-bottom: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #626974;
}
.cm-f input { height: 52px; }
.cm-f textarea { min-height: 104px; }
.cm-f input, .cm-f textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #E3E4E8;
  border-radius: 0;
  padding: 12px 14px;
  /* 16px exactly: iOS zooms the viewport when a focused field is
     under 16px, and the zoom does not undo itself on blur. */
  font: 16px/1.5 "IBM Plex Sans", sans-serif;
  color: #0A0A0B;
  background: #FCFCFD;
  resize: vertical;
}
/* Red border and paper fill are supplementary cues only — the focus
   ring below is what actually signals focus. */
.cm-f input:focus, .cm-f textarea:focus {
  border-color: #9D2235;
  background: #FFFFFF;
}

/* Repeated here rather than inherited from c.css because the dialog
   renders in the top layer, matching how this sheet already repeats
   the palette literally. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid #0A0A0B;
  outline-offset: 3px;
  border-radius: 0;
}

/* Honeypot: visually removed, still submittable by naive bots. */
.cm-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.cm-err { margin: 0 0 14px; font-size: 14px; color: #9D2235; }
.cm-err a { color: #9D2235; font-weight: 600; }

.cm-actions { display: flex; align-items: center; gap: 18px; }
.cm-direct { font-size: 13px; color: #626974; }

.cm-sent-t {
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
  margin-bottom: 8px;
}
.cm-sent p { margin: 0 0 22px; color: #2D3138; }

@media (max-width: 560px) {
  #c-contact form, #c-contact .cm-sent { padding: 22px 20px 24px; }
  .cm-actions { flex-wrap: wrap; }
}

/* Direct-address control. Looks like a link, is a button: pressing it
   copies rather than opening a mail client. */
.cm-copy {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: #9D2235;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cm-copy:hover { color: #7A1A29; }
.cm-copy.is-copied { color: #0A0A0B; text-decoration: none; }

/* Bottom sheet below 768px. dvh rather than vh so the sheet resizes
   with the software keyboard instead of being pushed off-screen. */
@media (max-width: 767.98px) {
  #c-contact {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-width: none;
    max-height: 90dvh;
    margin: 0;
    border: 0;
    border-top: 3px solid #9D2235;
    border-radius: 0;
    transform: translateY(100%);
    transition: transform .25s ease-out,
      overlay .25s ease-out allow-discrete,
      display .25s ease-out allow-discrete;
  }
  #c-contact[open] { transform: translateY(0); }
  /* The sheet starts off-screen on the frame it opens, so the
     transition has somewhere to travel from. */
  @starting-style {
    #c-contact[open] { transform: translateY(100%); }
  }
}

@media (prefers-reduced-motion: reduce) {
  #c-contact { transition: none; }
}

/* The page behind a modal dialog still scrolls on iOS. position:fixed
   is the only lock it honours; contact.js records the offset so the
   page does not jump to the top on close. */
body.cm-open { overflow: hidden; }
