/* ==========================================================================
   CONTACT PAGE (css/contact.css)
   --------------------------------------------------------------------------
   Rules used only by contact.html. Everything else on that page (buttons,
   panel, form controls, notice, tick list ...) comes from css/site.css.

   INDEX
     1. Hero points ....... the three short points under the page intro
     2. Guidance column ... the text to the left of the form
     3. Form panel ........ the framed form: head, field grid, submit row
     4. Results ........... the status message and the "copy message" box
     5. Print
   ========================================================================== */


/* ==========================================================================
   1. HERO POINTS
   Three short labels in a row, numbered 01 / 02 / 03 like items on a
   drawing. They stack on narrow phones.
   ========================================================================== */

.contact-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 40px;
  margin: clamp(28px, 4vw, 40px) 0 0;
  padding: 0;
  list-style: none;
  counter-reset: contact-point;
}

.contact-points__item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font: 500 0.75rem/1.5 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

/* The number in front of each point. The second "content" line tells
   screen readers not to read the number aloud (older browsers use the first). */
.contact-points__item::before {
  counter-increment: contact-point;
  content: counter(contact-point, decimal-leading-zero);
  content: counter(contact-point, decimal-leading-zero) / "";
  color: var(--ink-3);
}

@media (max-width: 599.98px) {
  .contact-points {
    flex-direction: column;
  }
}


/* ==========================================================================
   2. GUIDANCE COLUMN
   ========================================================================== */

.contact-guide__head {
  margin-bottom: 0;
}

.contact-guide__list-title {
  margin: 36px 0 12px;
}

/* "Direct inquiry line:" with the address underneath it. */
.contact-guide__direct {
  display: grid;
  gap: 4px;
  justify-items: start;
  margin-top: 28px;
}

.contact-guide__email {
  padding: 4px 0;                 /* a taller target for fingers */
  font-family: var(--font-mono);
  font-size: 1.125rem;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.contact-guide .notice {
  margin-top: 28px;
}


/* ==========================================================================
   3. FORM PANEL
   ========================================================================== */

/* Panel head: the title on the left, a short reminder on the right. */
.contact-form__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 20px;
}

/* Both are small monospace capitals; the title is the brighter of the two.
   (font-stretch and the others undo the normal heading styles.) */
.contact-form__title {
  font: inherit;
  font-stretch: 100%;
  letter-spacing: inherit;
  text-wrap: wrap;
  color: var(--ink);
}

.contact-form__mark {
  color: var(--ink-3);
}

.contact-form__form {
  padding: clamp(20px, 2.6vw, 32px);
}

.contact-form__key {
  margin-bottom: 20px;
}

/* The fields sit two to a row when the panel is wide enough for two columns
   of at least 230px, and one to a row when it is not. No breakpoint needed:
   the grid works it out from the panel's own width. */
.contact-form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 22px var(--gap);
  align-items: start;
}

/* Timing, subject and message always span the full width of the panel
   (their example text needs the room). */
.contact-form__wide {
  grid-column: 1 / -1;
}

/* If an example text ("placeholder") is ever too long for its box, it ends
   in "..." instead of being cut off mid-letter. */
.contact-form .input {
  text-overflow: ellipsis;
}

/* The smallest phones: a little less padding and smaller example text, so
   the longest example still fits in its box. What the visitor types stays
   at full size. */
@media (max-width: 359.98px) {
  .contact-form__form {
    padding: 16px;
  }

  .contact-form .input,
  .contact-form .textarea {
    padding-inline: 10px;
  }

  .contact-form .input::placeholder,
  .contact-form .textarea::placeholder {
    font-size: 0.8125rem;
  }
}

/* "(optional)" after a label: same small capitals, dimmer. */
.contact-form__opt {
  color: var(--ink-3);
  letter-spacing: 0.08em;
}

/* An error message starts with a small "!" mark, so that an error is never
   signalled by colour alone. */
.contact-form .field__error::before {
  content: "!";
  content: "!" / "";              /* the message itself says what is wrong */
  display: inline-block;
  width: 1.25em;
  margin-right: 8px;
  border: 1px solid currentColor;
  font: 600 0.75rem/1.25em var(--font-mono);
  text-align: center;
  vertical-align: 0.1em;
}

/* Submit row: the button, then the line that explains what it does. */
.contact-form__submit {
  display: grid;
  gap: 14px;
  justify-items: start;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.contact-form__submit .btn {
  min-width: min(100%, 220px);
}

.contact-form__submit-help {
  max-width: 54ch;
}

@media (max-width: 479.98px) {
  .contact-form__submit .btn {
    width: 100%;
  }
}


/* ==========================================================================
   4. RESULTS
   The status region is always on the page (screen readers need it to exist
   before a message is put into it) but takes up no room while it is empty.
   ========================================================================== */

.contact-form__status:not(:empty) {
  padding: 0 clamp(20px, 2.6vw, 32px) clamp(20px, 2.6vw, 32px);
}

/* Focus is moved here by the script after a submit. The ring is drawn
   around the message box inside it, not around the invisible wrapper. */
.contact-form__status:focus {
  outline: none;
}

.contact-form__status:focus-visible .notice {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

/* "Copy the message" box (email mode). */
.contact-form__fallback {
  padding: clamp(20px, 2.6vw, 32px);
  border-top: 1px solid var(--line-2);
}

/* When the message was too long to hand to the email app, copying it from
   this box is the visitor's next step, not a spare. The script adds this
   class then: the rule along the top turns amber, like the notice above it. */
.contact-form__fallback--needed {
  border-top: 2px solid var(--amber);
}

.contact-form__fallback-text {
  margin-top: 8px;
}

.contact-form__fallback-spec {
  margin: 20px 0 22px;
}

/* The read-only copy of the message: monospace, like a printout. */
.contact-form__fallback-body {
  min-height: 0;
  background: var(--bg);
  font: 400 0.875rem/1.6 var(--font-mono);
  color: var(--ink-2);
}

.contact-form__copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 18px;
}

.contact-form__copy-note {
  font-size: 0.875rem;
  color: var(--ink-2);
}


/* ==========================================================================
   5. PRINT
   On paper the form cannot be used, so only the guidance and the address
   are kept.
   ========================================================================== */

@media print {
  .contact-form {
    display: none;
  }
}
