/* Writing's article's visuals (article/writing*.js): the letter, a reader's inbox and each reader's copy, as mail
   draws them, which stays light at night. */

.of-writing :is(.writing-mail, .writing-copy) { border: 1px solid #d9d4c7; background: #fffdf8; color: #2a2823; text-align: left; box-shadow: 0 22px 40px -22px rgba(0, 0, 0, .4); }
.of-writing [data-edit] { border-radius: 4px; outline: 1.5px solid transparent; overflow-wrap: anywhere; cursor: text; transition: outline-color .25s, box-shadow .4s var(--soft); }
.of-writing [data-edit]:is(:hover, :focus) { outline-color: color-mix(in srgb, var(--app-tint) 60%, transparent); }
.of-writing .writing-costs { width: 100%; border-collapse: collapse; font-size: .9em; line-height: 1.35; }
.of-writing .writing-costs :is(th, td) { padding: 4px 0 4px 6px; border-bottom: 1px solid #e6e0d2; text-align: right; vertical-align: bottom; }
.of-writing .writing-costs :is(th, td):first-child { padding-left: 0; text-align: left; }
.of-writing .writing-costs th { font: 600 10.5px/1.35 var(--face-sans); color: #6a655b; }
.of-writing .writing-costs td:nth-child(2) { color: #6f6a5f; }
.of-writing .writing-costs b { font-weight: 600; }

/* ---- the letter: its lines, each chosen by its grip, down to where a phone's first screen ends ---- */
.of-writing .writing-mail { width: min(420px, 100%); overflow: hidden; border-radius: 16px; }
.of-writing .writing-from { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid #ebe6da; font: 12px/1.4 var(--face-sans); }
.of-writing .writing-from i { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #6b4683; font-style: normal; font-weight: 600; color: #fff; }
.of-writing .writing-from p { flex: 1; min-width: 0; }
.of-writing .writing-from b { display: block; font-weight: 600; }
.of-writing .writing-from span { color: #6a655b; }
.of-writing .writing-from small { flex: none; padding: 1px 8px; border-radius: 20px; background: #f1ebf6; font-size: 10.5px; font-weight: 600; color: #6b4683; }
.of-writing .writing-body { padding: 8px 0; font: 14px/1.5 var(--face-serif); }
.of-writing :is(.writing-block, .writing-cheer) { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: start; }
.of-writing .writing-block { cursor: pointer; transition: background-color .4s var(--soft), box-shadow .4s var(--soft); }
.of-writing .writing-below { background: #f5f1e7; }
.of-writing .writing-block.writing-chosen { background: #efe8f5; }
.of-writing .writing-block.over { box-shadow: inset 0 0 0 2px #6b4683; }
.of-writing .writing-grip { grid-column: 1; display: grid; place-items: center; justify-self: center; width: 28px; height: 32px; margin-top: 1px; padding: 0; border: 0; border-radius: 6px; background: none; color: #8f887a; cursor: grab; }
.of-writing .writing-grip:is(:hover, [aria-pressed="true"]) { background: rgba(107, 70, 131, .12); color: #6b4683; }
.of-writing .writing-grip svg { width: 10px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.of-writing .writing-text { grid-column: 2; min-width: 0; padding: 5px 18px 5px 4px; }
.of-writing .writing-price { font-size: 21px; line-height: 1.3; font-weight: 500; }
.of-writing .writing-year { font-size: 13px; color: #6a655b; }
.of-writing .writing-cheer { color: #6a655b; font-size: 13px; }
.of-writing .writing-cheer p { margin-bottom: 5px; }
.of-writing .writing-cheer .writing-cheerhead { font-size: 17px; line-height: 1.35; color: #2a2823; }
.of-writing .writing-fold { grid-column: 1 / -1; margin: 0; padding: 3px 10px 4px; border-top: 1.5px dashed #a8492f; background: #fffdf8; font: 600 10.5px/1.5 var(--face-sans); text-align: center; color: #98402a; cursor: default; }

/* ---- the inbox: the letter's row over other mail, at the reader's text size ---- */
.of-writing .writing-inbox { --writing-text: 13px; width: min(320px, 100%); overflow: hidden; padding: 16px 0 12px; border: 6px solid #1c1b19; border-radius: 36px; background: #fff; color: #1d1d1f; font: var(--writing-text)/1.38 -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif; text-align: left; box-shadow: 0 22px 40px -22px rgba(0, 0, 0, .4); }
.of-writing .writing-inbox.writing-size1 { --writing-text: 11px; }
.of-writing .writing-inbox.writing-size3 { --writing-text: 17px; }
.of-writing .writing-inboxtitle { padding: 4px 18px 6px; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.of-writing .writing-search { margin: 0 14px 8px; padding: 5px 11px; border-radius: 9px; background: #eeeef0; font-size: 12px; color: #6e6e73; }
.of-writing .writing-row { position: relative; margin: 0 8px; padding: 8px 8px 8px 18px; border-top: 1px solid #e8e8ea; }
.of-writing .writing-ours::before { content: ""; position: absolute; left: 4px; top: calc(8px + var(--writing-text) * .69 - 4.5px); width: 9px; height: 9px; border-radius: 50%; background: #2563eb; }
.of-writing .writing-who { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.of-writing .writing-who b { min-width: 0; overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.of-writing .writing-who small { flex: none; font-size: .85em; color: #6e6e73; }
.of-writing .writing-subject { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.of-writing .writing-subject[data-edit]:focus { white-space: normal; text-overflow: clip; }
.of-writing .writing-sum { display: inline-block; }
.of-writing .writing-subject:focus .writing-sum { display: inline; }
.of-writing .writing-preview { display: -webkit-box; overflow: hidden; color: #6e6e73; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.of-writing .writing-row:not(.writing-ours) :is(.writing-who b, .writing-subject) { font-weight: 400; color: #48484c; }

/* ---- each reader's copy: two letters side by side, one chosen ---- */
.of-writing .writing-copies { display: flex; justify-content: center; align-items: flex-start; gap: 16px; width: 100%; padding: 0 4px; }
.of-writing .writing-column { display: flex; flex: 1 1 0; flex-direction: column; align-items: center; gap: 12px; min-width: 0; max-width: 320px; cursor: pointer; }
.of-writing .writing-tab { padding: 3px 12px; border: 0; border-radius: 20px; background: none; font-size: 12.5px; line-height: 1.6; white-space: nowrap; color: var(--muted); }
.of-writing .writing-chosen .writing-tab { background: color-mix(in srgb, var(--app-tint) 16%, var(--paper)); font-weight: 600; color: var(--ink-strong); }
/* Chosen by its outline, so that the shadow stays an underlined word's to light. */
.of-writing .writing-column .writing-copy { align-self: stretch; padding: 12px 15px 10px; border-radius: 12px; outline: 0 solid var(--app-tint); font: 13px/1.5 var(--face-serif); transition: transform .6s var(--move), outline-width .25s var(--soft), box-shadow .4s var(--soft); }
.of-writing .writing-column.writing-chosen .writing-copy { transform: translateY(-4px); outline-width: 3px; }
/* On what stands in the copy itself: a margin inside a part that grows in would be missing until it had grown. */
.of-writing .writing-copy > * { margin-bottom: 8px; }
.of-writing .writing-copy .writing-to { padding-bottom: 6px; border-bottom: 1px solid #ebe6da; font: 11px/1.5 var(--face-sans); color: #6a655b; }
.of-writing .writing-copy .writing-lead { font-size: 18px; line-height: 1.3; font-weight: 500; }
.of-writing .writing-note { position: relative; padding: 6px 38px 6px 9px; border: 1.5px dashed color-mix(in srgb, #6b4683 55%, transparent); border-radius: 10px; font-size: 12.5px; }
.of-writing .writing-note button { position: absolute; right: 4px; top: calc(50% - 14px); width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: #efeadd; font-size: 16px; line-height: 28px; color: #2a2823; }
.of-writing .writing-note button:hover { background: #2a2823; color: #fff; }
.of-writing .writing-ghost { border: 1.5px dashed #cdc6b5; border-radius: 10px; }
.of-writing .writing-ghost button { width: 100%; min-height: 34px; padding: 5px 9px; border: 0; border-radius: 8px; background: none; font: 12px/1.5 var(--face-sans); color: #6a655b; }
.of-writing .writing-copy .writing-unsent { margin: 8px 0 0; font: 600 10.5px/1.5 var(--face-sans); text-align: right; color: #6b4683; }

/* ---- narrow: a shorter inbox, so that enough of it is seen at once for its part to make its change; and the chosen
   copy alone, under the two names, which choose ---- */
@container (width < 760px) {
  .of-writing .writing-row:last-child { display: none; }
  .of-writing .writing-copies { display: grid; grid-template-columns: repeat(2, auto); justify-content: center; gap: 12px 4px; }
  .of-writing .writing-column { display: contents; }
  .of-writing .writing-tab { grid-row: 1; min-height: 36px; padding: 4px 10px; }
  .of-writing .writing-column:not(.writing-chosen) .writing-copy { display: none; }
  .of-writing .writing-column.writing-chosen .writing-copy { grid-row: 2; grid-column: 1 / -1; justify-self: center; width: min(340px, 100%); transform: none; }
}
