/* contact.css -- variant A's contact room (contact.html).
 *
 * A single work in a gallery room: the shared canvas board
 * (shared/canvas-frame.css, .cf) hangs in the middle of the wall with the
 * contact form printed where a photograph would be, and its wall label --
 * on white board, .cf-plaque -- hangs beside it, bottom edges level
 * (BRIEF.md section 5). Bigger than a real label: here it carries the
 * contact details, and on a screen nobody can step closer to read it.
 *
 * Loaded after ring.css (palette, nav, buttons, fonts) and before
 * canvas-frame.css, which owns .cf / .cf-print's box. Board rules that bind
 * this file: nothing between the wall (.room) and a .cf may paint a
 * background or form a stacking context -- so .c-main and the grid it lays
 * out stay bare, and the only motion on the wall is the lamps.
 */

/* ---------- the room ---------- */

/* The wall: lit evenly by washers, a breath brighter right under the
   ceiling. Painted here, on the .cf-wall itself (never in between). */
.room {
  --wall: var(--a-bg);
  position: relative;
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100svh;
  background: radial-gradient(80% 42% at 50% 0%, var(--a-bg-hi) 0%, color-mix(in srgb, var(--a-bg-hi) 0%, transparent) 100%), var(--wall);
}

/* The nav floats on the wall at the top, exactly the homepage's (ring.css
   .nav, .nav-link[aria-current]); its links lead back into index.html. */

/* The hang: one work and its label, bottom edges level -- on a wide wall
   the work in the very middle with the label to its right. No room title:
   the work's own "Write to me." is the page heading (owner's call). */
.c-main {
  --work-w: 600px;
  --hang-gap: clamp(32px, 4vw, 72px);
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: minmax(0, var(--work-w));
  grid-template-areas: "plaque" "work";
  justify-content: center;
  /* The room fills the screen; the hang sits in the middle of the wall. Not
     the default stretch: the rows would grow with the room and the label,
     set at the bottom of its row, would drop below the work's bottom edge. */
  align-content: center;
  row-gap: 28px;
  padding: calc(max(env(safe-area-inset-top), clamp(14px, 2.4vw, 28px)) + 72px) clamp(20px, 4vw, 48px) clamp(56px, 8vh, 96px);
}
.c-plaque { grid-area: plaque; }
.c-work { grid-area: work; align-self: start; }   /* never stretched: an empty strip of border would show */

/* Medium: work and label side by side, the pair centred on the wall. */
@media (min-width: 700px) {
  .c-main {
    grid-template-columns: minmax(0, var(--work-w)) minmax(224px, 264px);
    grid-template-areas: "work plaque";
    column-gap: var(--hang-gap);
  }
  .c-plaque { align-self: end; }
}
/* Wide: the work in the very middle of the wall, the label beside it. */
@media (min-width: 1200px) {
  .c-main {
    --work-w: clamp(500px, 42vw, 640px);
    grid-template-columns: minmax(0, 1fr) var(--work-w) minmax(0, 1fr);
    grid-template-areas: ". work plaque";
    padding-top: calc(max(env(safe-area-inset-top), clamp(14px, 2.4vw, 28px)) + 84px);
  }
  .c-plaque { justify-self: start; width: min(100%, 280px); }
}

/* ---------- the label (.cf.cf-plaque: board, light and shadow are the module's) ---------- */

.c-plaque-in {
  container-type: inline-size;   /* inside the .cf, so it may (the board rules bind only the .cf and above) */
  padding: clamp(18px, 1.6vw, 24px) clamp(18px, 1.6vw, 24px) clamp(18px, 1.6vw, 22px);
}
/* Single column on a landscape phone / small tablet: the label runs as wide
   as the work, so it reads as a landscape label -- the work's details on the
   left, the ways to reach me on the right. */
@container (min-width: 440px) {
  .c-plaque-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 28px; }
  .c-plaque-grid .c-ways { margin-top: 0; padding: 0 0 0 28px; border-top: 0; border-left: 1px solid var(--a-line); }
}
.c-plaque p { margin: 0; }
.c-artist { font-size: 1rem; font-weight: 500; letter-spacing: -0.01em; }
.c-place { margin-top: 0.1rem; font-size: 0.86rem; color: var(--a-ink-2); }

.c-ways { margin: 1.1rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--a-line); }
.c-way + .c-way { margin-top: 0.85rem; }
.c-ways dt { font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--a-ink-3); }
.c-ways dd { margin: 0.2rem 0 0; font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.c-ways a {
  position: relative; color: var(--a-ink); text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: rgba(17, 17, 17, 0.28);
  transition: text-decoration-color 0.2s ease;
}
.c-ways a:hover { text-decoration-color: currentColor; }
.c-ways a:focus-visible { outline: 2px solid var(--a-ink); outline-offset: 3px; border-radius: 2px; }
/* 44px tall tap target without moving the type (as the nav links do). */
.c-ways a::before { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 44px; margin-top: -22px; }
.c-note { display: block; margin-top: 0.15rem; font-size: 0.8rem; color: var(--a-ink-2); }

/* Instagram: the glyph alone, linked. Its link box is the 44px tap target,
   pulled back by the same 9px so the glyph lines up with the text above. */
.c-ways a.c-ig {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: -9px 0 -9px -9px;
  color: var(--a-ink-2); text-decoration: none; border-radius: 10px;
  transition: color 0.2s ease;
}
.c-ways a.c-ig::before { content: none; }
.c-ways a.c-ig:hover { color: var(--a-ink); }
.c-ig svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.c-ig .c-ig-dot { fill: currentColor; stroke: none; }

/* ---------- the work: the form is the print ---------- */

.c-sheet {
  /* The print's own palette: a pale, matte ground of soft daylight -- the
     border (the module's, the wall's tone) frames it a few levels lighter. */
  --s-ground: #ebe8e1;
  --s-ink: var(--a-ink);
  --s-ink-2: #43413d;
  --s-ink-3: #5a5853;          /* small print: >= 4.5:1 on the whole ground */
  --s-ph: #66635d;             /* placeholders: >= 4.6:1 on the ground, still lighter than the labels */
  --s-line: rgba(17, 17, 17, 0.34);
  --s-rule: rgba(17, 17, 17, 0.11);
  --s-error: #9a2f25;
  --lh: 30px;                  /* the Message lines' pitch */
  container-type: inline-size;
  color: var(--s-ink);
  background:
    radial-gradient(120% 85% at 16% 0%, #f0eee9 0%, color-mix(in srgb, #f0eee9 0%, transparent) 70%),
    linear-gradient(170deg, #ebe8e1 0%, #e6e2da 100%);
}

/* The form and the done view share one cell; the hidden one keeps its room,
   so the canvas never changes height when the message goes -- the label
   beside it stays level with its bottom edge, and the visitor's words hang
   centred on a canvas the size the form was. */
.c-stack { display: grid; }
.c-stack > .c-form, .c-stack > .c-done { grid-area: 1 / 1; }
.c-form[hidden] { display: grid; visibility: hidden; }
.c-done[hidden] { display: block; visibility: hidden; }
.c-done { align-self: center; }

.c-inner { padding: clamp(22px, 7.5cqi, 48px) clamp(18px, 7.5cqi, 48px) clamp(22px, 7cqi, 44px); }

.c-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px 26px; }
@container (min-width: 440px) {
  .c-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .c-f-name, .c-f-msg, .c-send, .c-status, .c-privacy, .c-fallback { grid-column: 1 / -1; }
}

/* The page's h1, printed on the canvas (ring.css's bare h1 is the homepage
   headline: every value it sets is overridden here). */
.c-title {
  margin: 0 0 clamp(20px, 4.4cqi, 30px);
  font-size: clamp(1.9rem, 8.4cqi, 3.1rem); font-weight: 500; line-height: 1; letter-spacing: -0.04em;
}

.c-field { display: flex; flex-direction: column; min-width: 0; }
/* One fixed line box, so Phone (with its 选填) and Email -- side by side --
   put their lines at exactly the same height. */
.c-label {
  display: flex; align-items: center; gap: 0.6em; height: 18px;
  font-size: 0.7rem; line-height: 18px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--s-ink-2);
}
.c-label em { font-style: normal; letter-spacing: 0.04em; text-transform: none; font-size: 1.1em; line-height: 18px; color: var(--s-ink-3); }

/* Fields as lines printed on the canvas, to write along. */
.c-input {
  width: 100%; margin: 0; padding: 8px 0 9px;
  border: 0; border-bottom: 1px solid var(--s-line); border-radius: 0;
  background: transparent; color: var(--s-ink); caret-color: var(--s-ink);
  font: inherit; font-size: 16px;      /* below 16px iOS zooms the page on focus */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.c-input::placeholder { color: var(--s-ph); opacity: 1; }
.c-input:focus { outline: none; border-bottom-color: var(--s-ink); box-shadow: 0 1px 0 0 var(--s-ink); }
/* A wrong field: a red line, thickening when focused -- as a right one goes
   from a thin grey line to a thick black one. */
.c-input[aria-invalid="true"] { border-bottom-color: var(--s-error); box-shadow: none; }
.c-input[aria-invalid="true"]:focus { box-shadow: 0 1px 0 0 var(--s-error); }
/* Autofill would paint a pale blue slab over the print. */
.c-input:-webkit-autofill,
.c-input:-webkit-autofill:hover,
.c-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--s-ink);
  -webkit-box-shadow: 0 0 0 1000px var(--s-ground) inset;
  transition: background-color 600000s 0s, border-color 0.2s ease;
}

/* Message: ruled like letter paper; the lines scroll with the text, and the
   field (so the canvas, and its shadow) grows as you write (contact.js). */
.c-lines {
  display: block; resize: none; overflow-y: hidden;
  padding: 2px 0 0; line-height: var(--lh);
  min-height: calc(var(--lh) * 3 + 2px);
  background-image: repeating-linear-gradient(180deg, transparent 0, transparent calc(var(--lh) - 1px), var(--s-rule) calc(var(--lh) - 1px), var(--s-rule) var(--lh));
  background-position: 0 2px; background-attachment: local;
}

.c-err { margin: 6px 0 0; font-size: 0.82rem; line-height: 1.45; color: var(--s-error); }
.c-err[hidden] { display: none; }

/* The trap: off the canvas, out of the tab order and the accessibility tree. */
.c-trap { position: absolute; left: -10000px; top: 0; width: 1px; height: 1px; overflow: hidden; }

.c-send {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 8px;
}
/* Invisible reCAPTCHA has no box: only form-core's note line (proof-of-work
   fallback, file:// preview) ever shows here (ring.css, form core). */
.c-captcha { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; max-width: 100%; }
.c-captcha .fc-note { color: var(--s-ink-2); }
.c-submit { flex: none; min-width: 120px; margin-left: auto; }   /* wrapped under the widget: still at the right */
.c-submit[aria-busy="true"] { cursor: progress; opacity: 0.72; }
@container (max-width: 379px) { .c-submit { width: 100%; } }

.c-status { margin: 0; font-size: 0.88rem; line-height: 1.6; color: var(--s-error); }
.c-status[hidden] { display: none; }
.c-privacy { margin: -4px 0 0; font-size: 0.78rem; line-height: 1.6; color: var(--s-ink-3); }
.c-privacy a { color: var(--s-ink-2); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }   /* → terms.html */
.c-privacy a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 2px; }

/* ---------- after sending: the visitor's words become the work ---------- */

.c-done-eyebrow { margin: 0; font-size: 0.72rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--s-ink-2); }
.c-done-eyebrow:focus { outline: none; }   /* focused by script only, to land the reader here */
.c-quote { margin: clamp(14px, 4cqi, 26px) 0 0; }
.c-quote-text {
  margin: 0;
  font-size: clamp(1.35rem, 5.6cqi, 2.15rem); font-weight: 500; line-height: 1.22; letter-spacing: -0.025em;
  white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 9; line-clamp: 9; overflow: hidden;
}
.c-quote-by { margin-top: 1rem; font-size: 0.95rem; color: var(--s-ink-2); }
.c-done-note { margin: clamp(18px, 5cqi, 30px) 0 0; max-width: 34em; font-size: 0.95rem; line-height: 1.7; color: var(--s-ink-2); overflow-wrap: anywhere; }
.c-done-note a { color: var(--s-ink); }
.c-done-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
/* Opened as a file: the done view says plainly that nothing went out. */
.c-done.is-demo .c-done-eyebrow { display: inline-block; padding: 4px 8px; border: 1px dashed var(--s-error); border-radius: 4px; color: var(--s-error); }
/* No JavaScript, no form (it can't send): the three ways in. Inside the .cf: may paint. */
html:not(.js) .c-form, html:not(.js) .c-done { display: none; }
.c-stack > noscript { grid-area: 1 / 1; }
.c-nojs p { margin: 0 0 12px; font-size: 0.95rem; line-height: 1.9; color: var(--s-ink-2); }
.c-nojs a { color: var(--s-ink); }

/* ---------- small screens ---------- */

@media (max-width: 699px) {
  .c-main { row-gap: 24px; }
}
@media (max-width: 479px) {
  .c-main { padding-top: calc(max(env(safe-area-inset-top), 14px) + 70px); }
}
/* Touch: the send button and the done actions at a full 48px already (ring.css .btn). */
