/* ============================================================
   ENQUIRE — the letter (WP-19, the her-site wave stage 2; design brief § 5.7, § 5.8).
   Loaded after the frame's sheets by /enquire.html and /zh/enquire.html (the thank-you
   page moved to /page-404.css in stage 3, beside the other small pages). Every colour, face and step is a token from
   chishan.css :root. Classes are prefixed .enquire-.

   The device: the form is a letter to her — her own greeting at its head, written on
   lines, on a sheet of paper laid on the band ground.
   ============================================================ */

/* An element the script shows or hides by the attribute keeps that state */
.enquire [hidden] { display: none !important; }

/* With JavaScript off the fields are not shown: typed words could not reach the letter.
   The page's head script adds html.enq-js before the body is drawn. */
html:not(.enq-js) [data-enq-js-only] { display: none; }
html.enq-js [data-enq-nojs-only] { display: none; }

/* ---- The page: one section on the band, no closing band ---- */
.enquire-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--grid-gap);
  align-items: start;
}
.enquire-side { grid-column: 1 / 6; min-width: 0; }
.enquire-sheet { grid-column: 7 / 13; min-width: 0; }
/* The head reaches into the sixth column, the gap before the sheet, so her h1 keeps
   "Something lovely" on one line at 1440 (SectionHead caps itself at seven of twelve) */
.enquire-head.sh { max-width: none; margin-right: calc(-1 * (100% + var(--grid-gap)) / 5); margin-bottom: var(--s-7); }
/* …while the lede keeps to the five columns the channels below it fill */
.enquire-head .sh-lede { max-width: calc(100% * 5 / 6 - var(--grid-gap) / 6); }

/* A Chinese lede breaks at its punctuation, not inside a word (告诉我 / 们); a clause too
   long for its line still breaks anywhere, so nothing overflows */
.enquire-head .sh-lede:lang(zh) { word-break: keep-all; overflow-wrap: anywhere; }

/* Her channels stay beside the sheet while it is filled in, where the screen is tall enough */
@media (min-width: 761px) and (min-height: 760px) {
  .enquire-side { position: sticky; top: calc(var(--header-h) + var(--s-6)); }
}

/* ---- Her three channels: rows 56 px tall, a hairline between ---- */
.enquire-channels { list-style: none; border-top: 1px solid var(--line); }
.enquire-ch {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--s-4);
  min-height: 56px; padding-block: var(--s-1);
  border-bottom: 1px solid var(--line);
}
.enquire-ch-k { flex: 0 0 88px; }
.enquire-ch-v {
  min-width: 0; overflow-wrap: anywhere;
  font-family: var(--body); font-size: var(--t-lede); line-height: 1.3; font-weight: 500; color: var(--ink);
}
/* The email and the phone: the whole row past its label is the link, so on a phone the
   channel is one tap anywhere along its line (the underline stays under the words) */
.enquire-ch-link {
  display: inline-flex; align-items: center; min-height: 44px;
  flex: 1 1 auto; align-self: stretch;
  text-decoration: underline; text-decoration-color: var(--brass-deep);
  text-decoration-thickness: 1px; text-underline-offset: 5px;
  transition: text-decoration-color var(--dur-hover) var(--ease);
}
.enquire-ch-link:hover { text-decoration-color: var(--ink); text-decoration-thickness: 2px; }
.enquire-ch--wechat .enquire-ch-copy { margin-left: auto; }
/* Her "select to copy" line, shown only when copying failed (the script drops .vh) */
.enquire-ch-status {
  flex-basis: 100%; padding-bottom: var(--s-2);
  font-size: var(--t-label); line-height: var(--lh-label); color: var(--ink-soft);
}
.enquire-social { display: flex; align-items: center; gap: var(--s-4); min-height: 56px; border-bottom: 1px solid var(--line); }

/* Her place line (label voice) and its note; hours and an address only when she sets them */
.enquire-place { margin-top: var(--s-6); }
.enquire-place-k { margin-bottom: var(--s-1); }
.enquire-place-note { font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-soft); max-width: var(--measure); }
.enquire-place-lines {
  display: flex; flex-direction: column; list-style: none; font-style: normal;
  font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-soft);
  margin-block: var(--s-2);
}

/* ---- Copy: a text button. Its two words share one grid cell, so the box is as wide as
   the wider word and nothing moves when "Copy" becomes "Copied to clipboard". ---- */
.enquire-copy {
  display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding: 0 2px;
  font-family: var(--body); font-size: var(--t-small); font-weight: 500; line-height: 1.3; color: var(--ink);
  background: none; border: 0; border-radius: var(--r-control); cursor: pointer;
}
.enquire-swap { display: inline-grid; justify-items: start; }
.enquire-swap > span {
  grid-area: 1 / 1;
  text-decoration: underline; text-decoration-color: var(--brass-deep);
  text-decoration-thickness: 1px; text-underline-offset: 5px;
  transition: text-decoration-color var(--dur-hover) var(--ease);
}
.enquire-copy:hover .enquire-swap > span { text-decoration-color: var(--ink); text-decoration-thickness: 2px; }
.enquire-swap-b { visibility: hidden; }
.enquire-copy.is-done .enquire-swap-a { visibility: hidden; }
.enquire-copy.is-done .enquire-swap-b { visibility: visible; text-decoration-color: transparent; }
/* Beside the WeChat id the word sits at the row's right edge */
.enquire-ch-copy .enquire-swap { justify-items: end; }

/* ---- The sheet: a paper panel on the band, a hairline edge, no shadow ---- */
.enquire-sheet {
  background: var(--paper); --well: var(--band);
  border: 1px solid var(--line);
  padding: var(--s-7);
}
/* Her greeting, the letter's first line */
.enquire-hello {
  font-family: var(--display); font-style: italic; font-weight: 400;
  font-size: 30px; line-height: 1.2; color: var(--ink);
  margin-bottom: var(--s-6);
}
.enquire-hello:lang(zh) { font-family: var(--cjk); font-style: normal; font-weight: 500; font-size: 26px; line-height: 1.4; }

/* Fields: the label above in the label voice, then the input as a line */
.enquire-row--two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s-6); }
.enquire-row--org[data-year="off"] .enquire-field--org { grid-column: 1 / -1; }
/* Each field keeps 32 px under its line; an error message sits inside it, so nothing moves */
.enquire-field { position: relative; min-width: 0; padding-bottom: var(--s-6); }
.enquire-label { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.enquire-req { font-weight: 400; flex: none; }
.enquire-input {
  display: block; width: 100%; height: 52px; padding: 0; margin: 0;
  font-family: var(--body); font-size: 17px; line-height: 1.4; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0;
  -webkit-appearance: none; appearance: none;
  transition: border-color var(--dur-hover) var(--ease), box-shadow var(--dur-hover) var(--ease);
}
.enquire-input::placeholder { color: var(--ink-soft); opacity: 1; }
/* Focus: the underline becomes 2 px ink (the second pixel drawn inside, so the box does not
   grow) and the ring shows */
.enquire-input:focus-visible {
  border-bottom-color: var(--ink); box-shadow: inset 0 -1px 0 var(--ink);
  outline: 2px solid var(--ink); outline-offset: 3px; border-radius: var(--r-control);
}
.enquire-input:focus:not(:focus-visible) { border-bottom-color: var(--ink); box-shadow: inset 0 -1px 0 var(--ink); outline: none; }
.enquire-input[type="date"] { min-width: 0; }
.enquire-input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.enquire-input[type="date"]::-webkit-calendar-picker-indicator { opacity: .7; cursor: pointer; }
/* An error: the underline and a 13 px line in seal red (brief § 2.1: one of red's three uses) */
.enquire-field.is-error .enquire-input { border-bottom-color: var(--seal); box-shadow: inset 0 -1px 0 var(--seal); }
.enquire-error {
  position: absolute; left: 0; right: 0; bottom: var(--s-1);
  font-size: var(--t-label); line-height: var(--lh-label); color: var(--seal);
}

/* The interest select: a line like the others, with a drawn chevron */
.enquire-select { position: relative; }
.enquire-select .enquire-input { padding-right: var(--s-6); text-overflow: ellipsis; cursor: pointer; }
.enquire-chevron {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-soft); pointer-events: none;
}
/* A workshop carried from its page (?workshop=), shown while its interest is chosen */
.enquire-carried { margin-top: var(--s-3); font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-soft); }

/* "Tell us a little more", written on lines: a rule under every line of text */
.enquire-lines {
  --rule: 32px;
  height: auto; min-height: calc(var(--rule) * 5 + 1px);
  margin-top: var(--s-2);
  padding-top: var(--s-1);
  line-height: var(--rule);
  resize: vertical;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--rule) - 1px), var(--line) calc(var(--rule) - 1px), var(--line) var(--rule));
  background-position: 0 var(--s-1);
  background-attachment: local;
}

/* With scripts off: her draft's lines as ruled blanks, the letter the mail app opens with */
.enquire-template { list-style: none; margin-bottom: var(--s-6); }
.enquire-template li {
  display: flex; align-items: flex-end; min-height: 44px; padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--line);
  font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-soft);
}

/* ---- The foot of the letter: one button, and Copy ---- */
.enquire-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4) var(--s-6);
  padding-top: var(--s-3);
}
/* Her fallback when copying is refused: the draft, selected, beside her line */
.enquire-ready { margin-top: var(--s-5); }
.enquire-ready-line { font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-soft); max-width: var(--measure); margin-bottom: var(--s-4); }
.enquire-ready-label { display: block; margin-bottom: var(--s-2); }
.enquire-draft {
  display: block; width: 100%; padding: var(--s-3);
  font-family: var(--body); font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink);
  background: var(--band); border: 1px solid var(--line-strong); border-radius: var(--r-control);
  resize: vertical;
}

/* ---- Phone (brief § 5.7): label, h1, lede, the channel rows, then the sheet edge to edge
   inside the gutter, every field in one column ---- */
/* 761–1079 the channels' column is narrow: each label stands over its value, so the
   address, the number and the WeChat id with its Copy each keep one line */
@media (min-width: 761px) and (max-width: 1079px) {
  .enquire-ch { padding-block: var(--s-3) var(--s-1); }
  .enquire-ch-k { flex-basis: 100%; }
  .enquire-ch-v { font-size: 17px; }
}
@media (max-width: 1079px) {
  .enquire-sheet { padding: var(--s-6); }
  .enquire-row--two { grid-template-columns: minmax(0, 1fr); }
  .enquire-row--org[data-year="off"] .enquire-field--org { grid-column: auto; }
}
@media (max-width: 760px) {
  .enquire-grid { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-7); }
  .enquire-side, .enquire-sheet { grid-column: 1; }
  .enquire-head.sh { margin-right: 0; }
  .enquire-head .sh-lede { max-width: var(--measure); }
  .enquire-sheet { padding: var(--s-5); }
  .enquire-ch-k { flex-basis: 72px; }
  .enquire-ch-v { font-size: 17px; }
  .enquire-hello { margin-bottom: var(--s-5); font-size: 26px; }
  .enquire-hello:lang(zh) { font-size: 22px; }
  .enquire-actions { flex-direction: column; align-items: stretch; }
  .enquire-open { width: 100%; }
  .enquire-actions .enquire-copy { align-self: flex-start; }
}

/* Motion: only colour changes on hover and focus; none under reduced motion */
@media (prefers-reduced-motion: reduce) {
  .enquire-ch-link, .enquire-swap > span, .enquire-input { transition: none; }
}
