/* Hair Harvester — deals: the lists of lots, bids and deals, and the deal page. Loaded after the core stylesheet; scope every rule to this area's pages. */

/* ---------- the deal page: .dealpage (templates/bidding/deal.html) ----------
   The outer element also carries is-open, is-done or is-cancelled. */

/* the head: the lot's photo on a mount with the ribbon under it, the title, and the agreed price in the stitched frame */
.dealpage .dealhead { margin: 0 0 var(--s5); }
.dealpage .dealtitle { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3) 14px; align-items: center; }
.dealpage .dealtitle:has(> .lotmini) { grid-template-columns: auto minmax(0, 1fr); }
.dealpage .dealtitle .kicker { margin: 0 0 var(--s2); }
/* the same chip as in the list «Ставки й угоди», so the page says its state before anything else */
.dealpage .dealtitle .statline { margin: 0 0 var(--s2); line-height: 1; }
/* beside the photo the column is narrow: with text set very large the chip's word breaks inside it rather than past the screen */
.dealpage .dealtitle .state { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
/* the long-title rung; beside the photo the column is narrow, so on phones under 390 px the title steps down with the width */
.dealpage .dealtitle h1 { margin: 0; font-size: clamp(1.375rem, 7.45vw, var(--t-long)); }
.dealpage .dealtitle .meta { grid-column: 1 / -1; margin: 0; font-size: 1rem; line-height: 1.4; color: var(--ink-2); }
.dealpage .dealtitle .meta:empty { display: none; }
/* The mount is exactly as wide as the ribbon (105 stitches) plus its own margin, so the ribbon reads as the photo's hem. */
.dealpage .lotmini { --m: 1px; display: block; width: calc(105 * var(--m) + 16px); color: var(--ink); text-decoration: none; }
.dealpage .lotmini .mount { display: grid; gap: 7px; }
.dealpage .lotmini img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: var(--ground); outline: 1px solid rgba(23, 18, 15, .22); outline-offset: -1px; }
.dealpage .lotmini:hover .mount { box-shadow: inset 0 0 0 2px var(--ink); }
.dealpage .pricebox { margin: var(--s4) 0 0; container-type: inline-size; }
/* The amount follows the width of its frame, so that «1 250 000 грн» (6.3 em wide) stays inside the stitches on a 320 px phone
   and in the narrow desktop column. A longer amount wraps at a space instead of running over the frame.
   The first size is for a browser without container units. */
.dealpage .pricebox .amount { font-size: clamp(1.875rem, 11vw, 2.875rem); white-space: normal; overflow-wrap: anywhere; }
@supports (width: 1cqw) {
  .dealpage .pricebox .amount { font-size: clamp(1.75rem, 15.5cqw, 2.875rem); }
}
.dealpage .pricebox .when { margin: 0; }
/* «обрано 23 листопада» used to continue a sentence; standing alone it takes a capital. */
.dealpage .pricebox .when::first-letter { text-transform: uppercase; }
.dealpage > .note { max-width: 46em; }
/* a deal that did not happen: the price is void, so it leaves the stitched frame and steps back */
.dealpage.is-cancelled .pricebox { padding: 14px var(--s4) var(--s4); border: 0; box-shadow: inset 0 0 0 1px var(--line); }
.dealpage.is-cancelled .pricebox .amount { color: var(--ink-2); }

/* the two columns: the road of the deal, and the other side with the agreed terms */
.dealpage .dealgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
.dealpage .dealroad > h2 { margin: 0 0 20px; }
.dealpage .dealroad > .note { margin: 0 0 var(--s5); }

/* the road: the link to the contacts sits on its own line with a full touch field */
.dealpage .track { margin: 0; }
.dealpage .track li a.small { display: flex; align-items: center; width: fit-content; min-height: 44px; padding-block: 0; margin-bottom: -10px; }
.dealpage .track .sides { display: block; margin-top: 4px; font-weight: 400; }
/* The star means «here, now», so the road has one. When a side has confirmed, the template marks both the second and the
   last step as current: the last one keeps the star, and every step before it is drawn as passed, because the person has
   just said that everything happened. */
.dealpage .track li:has(~ li.now) { color: var(--ink); font-weight: 500; }
.dealpage .track li:has(~ li.now)::before { background-image: var(--i-node-done); }
.dealpage .track li:has(~ li.now)::after { background: var(--run-v-red); }

/* the safety block: black cloth with a stitch, a star and rhombus bullets */
.dealpage .safety { position: relative; margin: var(--s6) 0 0; padding: var(--s4); background: var(--ink); color: var(--cloth); }
.dealpage .safety::after { content: ""; position: absolute; inset: 5px; border: 1px dashed rgba(248, 244, 234, .4); pointer-events: none; }
.dealpage .safety h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: var(--t-panel); }
.dealpage .safety h2::before { content: ""; flex: none; width: 27px; height: 27px; background: var(--i-star-cloth) center / 27px 27px no-repeat; }
.dealpage .safety ul { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.dealpage .safety li { display: grid; grid-template-columns: 15px minmax(0, 1fr); gap: 12px; font-size: 1.0625rem; line-height: 1.4; }
.dealpage .safety li::before { content: ""; width: 15px; height: 15px; margin-top: 5px; background: var(--i-rhomb-cloth) center / 15px 15px no-repeat; }
/* a finished deal keeps the advice, but quietly: nothing is left to hand over */
.dealpage.is-done .safety { background: var(--panel); color: var(--ink); box-shadow: inset 4px 0 0 var(--ink); }
.dealpage.is-done .safety::after { display: none; }
.dealpage.is-done .safety h2::before { background-image: var(--i-star); }
.dealpage.is-done .safety li::before { background-image: var(--i-rhomb); }

/* the confirmation and the way out */
.dealpage .confirm { margin-top: var(--s5); }
.dealpage .confirm p { margin: 10px 0 0; }
.dealpage details.wrong > p:first-of-type { margin-top: 0; }
.dealpage details.wrong .field { margin-bottom: var(--s4); }
.dealpage details.wrong > p:last-child { margin: var(--s4) 0 0; }
/* «Без пояснень» beside the reason (O1): a pill without scripts, a quiet button with them; the field it makes inert
   keeps its text but steps back, and the line under the button says what is sent instead */
.dealpage .reasonfield .noreason { margin-top: 10px; }
/* without scripts the pill carries a tick box, as the sell form's check pills do: a dark pill alone does not say «on» */
.dealpage .noreason input + span::before { content: ""; flex: none; width: 20px; height: 20px; background: var(--cloth); box-shadow: inset 0 0 0 1.5px var(--ink); }
.dealpage .noreason input:checked + span::before { background: var(--red) var(--i-check) center / 14px 12px no-repeat; box-shadow: none; }
.dealpage .reasonfield .noreasonbtn { margin-top: 10px; }
.dealpage .reasonfield .noreasonsaid { margin: 8px 0 0; }
.dealpage .reasonfield.noreason-on textarea { opacity: .5; cursor: not-allowed; }
.dealpage .reasonfield .help:not([hidden]) { display: block; margin-top: 8px; }

/* the other side: contacts as large tap targets, the buyer's comment as a quotation */
.dealpage .party { scroll-margin-top: var(--s4); container-type: inline-size; }
.dealpage .party h2 { margin: 0 0 6px; }
.dealpage .party h2 .nick { color: var(--red); overflow-wrap: anywhere; }
.dealpage .party h2 + p { margin: 0; }
.dealpage .party h3 { margin-top: 20px; }
.dealpage .contact a { font-size: 1.25rem; }
/* An address is longer than a number. Its size follows the width of the panel, between 16 and 18 px, so that an address of
   about thirty letters keeps one line in a single-column tile; a longer one breaks after «@», where the template puts
   a break opportunity, and not at an arbitrary letter. */
.dealpage .contact a.mail { font-size: 1.125rem; }
@supports (width: 1cqw) {
  .dealpage .contact a.mail { font-size: clamp(1rem, 6.6cqw - .26875rem, 1.125rem); }
}
.dealpage .contact .ico { width: 22px; height: 22px; }
.dealpage .quote { margin: var(--s3) 0 0; padding: 2px 0 2px 14px; box-shadow: inset 3px 0 0 var(--red); font-style: italic; }

/* the agreed terms: each side's level as a chip of its thread */
/* one line per side with the chips in one column, so the two levels are compared at a glance */
.dealpage .agreed .who { display: grid; gap: 6px; }
/* the label column is 5.4em, or wider when a label needs it (text set very large); a chip that still does not fit wraps */
.dealpage .agreed .who > span { display: grid; grid-template-columns: minmax(5.4em, max-content) minmax(0, max-content); justify-content: start; align-items: center; gap: 6px; }
.dealpage .agreed .who .lv { white-space: normal; }
.dealpage .agreed + p { margin: var(--s3) 0 0; }

@media (min-width: 640px) {
  .dealpage .contact { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .dealpage .safety { padding: var(--s5) 28px; }
}

@media (min-width: 960px) {
  .dealpage .dealhead { display: grid; grid-template-columns: minmax(0, 1fr) clamp(380px, 39%, 480px); gap: 64px; align-items: center; margin-bottom: var(--s7); }
  .dealpage .dealtitle { gap: var(--s4) 28px; }
  .dealpage .dealtitle:has(> .lotmini) .lotmini { grid-row: 1 / span 2; }
  .dealpage .dealtitle:has(> .lotmini) .name { align-self: end; }
  .dealpage .dealtitle:has(> .lotmini) .meta { grid-column: 2; align-self: start; }
  /* balanced lines keep a lone «см» off the last line; on a phone the column is too narrow for it and the plain wrap reads better */
  .dealpage .dealtitle h1 { font-size: var(--t-long); text-wrap: balance; }
  .dealpage .dealtitle .meta { font-size: 1.0625rem; }
  .dealpage .lotmini { --m: 1.5px; }
  .dealpage .pricebox { margin: 0; }
  .dealpage .pricebox .amount { font-size: 3.75rem; }
  .dealpage .dealgrid { grid-template-columns: minmax(0, 1fr) clamp(380px, 39%, 480px); gap: 64px; align-items: start; }
  .dealpage .contact { grid-template-columns: minmax(0, 1fr); }
  .dealpage .contact a.mail { font-size: 1.25rem; }
  @supports (width: 1cqw) {
    .dealpage .pricebox .amount { font-size: clamp(1.75rem, 15.5cqw, 3.75rem); }
    .dealpage .contact a.mail { font-size: clamp(1rem, 6.6cqw - .26875rem, 1.25rem); }
  }
}

/* One column (phone and tablet): the other side's contacts must not wait behind the safety block. The two sections dissolve
   into the grid and the order becomes: the road, the confirmation, the way out, the contacts, the safety block, the agreed
   terms. «контакти ↓» still points down and «в умовах нижче» of the safety block still has the terms below it. The safety
   block holds nothing that takes focus, so the keyboard order stays the order on the screen. */
@media (max-width: 959.98px) {
  .dealpage .dealgrid { gap: 0; }
  .dealpage .dealroad, .dealpage .dealside { display: contents; }
  .dealpage .party { order: 1; margin: var(--s6) 0 0; }
  .dealpage .safety { order: 2; }
  .dealpage .dealside > .panel:not(.party) { order: 3; margin: var(--s6) 0 var(--s5); }
}


/* ---------- «Ставки й угоди»: .dealslist (templates/bidding/my_deals.html) ---------- */
.dealslist { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
.dealslist h2 { margin: 0 0 var(--s3); }
.dealslist .empty { margin: 0; }
/* a row whose lot left publication shows no photograph: a pale rhombus on the cloth says the gap is meant */
.dealslist .item span.th { background: var(--i-node) center / 27px 27px no-repeat, var(--ground); }
/* such a row is not a link (the lot page is closed to the buyer), so it does not answer the pointer like one */
.dealslist a.item:not([href]) { cursor: default; }
.dealslist a.item:not([href]):hover b { text-decoration: none; }
/* a winning bid whose deal was called off: the word stays, the check mark and the ink outline of «all is well» go */
.dealslist .state.bid-void { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--pale); }
.dealslist .state.bid-void::before { display: none; }
/* a calm line under a row («Ви підтвердили · чекаємо на…») reads as a remark, not as the next step (F44, F87, F115) */
.dealslist .next .calm { font-weight: 400; color: var(--ink-2); }
/* the folded earlier versions of a bid leave no gap before the next row (F29) */
.dealslist details.bidhist { margin: 0; }
.dealslist details.bidhist .tips { margin: 0 0 var(--s4); }

@media (min-width: 960px) {
  .dealslist { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: start; }
  /* two lists side by side: the row is narrower, so the next step goes back under the title */
  .dealslist .item:has(> .th) { grid-template-columns: 88px minmax(0, 1fr); }
  .dealslist .item .next { grid-column: 2; text-align: left; max-width: none; }
}


/* ---------- the public profile of a person: .pubprofile (templates/accounts/public_profile.html) ---------- */
.pubprofile .intro { margin: 0 0 var(--s6); padding: 0 0 var(--s5); background: var(--run) bottom / auto 2px repeat-x; }
.pubprofile .intro h1 { margin: 0 0 var(--s2); overflow-wrap: anywhere; }
/* the facts: one per line at every width, so no separator is ever left hanging at the end of a line */
.pubprofile .intro .since { margin: 0; padding: 0; list-style: none; font-size: 1.0625rem; line-height: 1.5; }
/* The check mark and the weight go with the words, so the mark is not told by colour. */
.pubprofile .intro .verified { color: var(--ink); font-weight: 700; }
.pubprofile .intro .verified::before { content: ""; display: inline-block; width: 14px; height: 12px; margin-right: 6px; background: var(--i-check-ink) center / 14px 12px no-repeat; }
.pubprofile .intro .bio { margin: var(--s4) 0 0; padding: 2px 0 2px 14px; box-shadow: inset 3px 0 0 var(--red); }
.pubprofile .intro .plinks { margin: var(--s3) 0 0; }
.pubprofile .intro .plinks + .plinks { margin-top: 0; }
.pubprofile .intro .plinks a { display: inline-flex; align-items: center; min-height: 44px; padding-block: 0; }
.pubprofile > h2 { margin-top: 0; }

@media (min-width: 960px) {
  /* the person on the left, their own words on the right */
  .pubprofile .intro:has(> .bio) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 64px; align-items: start; }
  .pubprofile .intro:has(> .bio) > * { grid-column: 1; }
  .pubprofile .intro:has(> .bio) > .bio { grid-column: 2; grid-row: 1 / span 4; align-self: center; margin: 0; }
}
