/* Hair Harvester — the lot page: gallery, price block, facts, bids. Loaded after the core stylesheet; scope every rule to this area's pages. */

/* Every rule below hangs on one of the page's own classes:
   .lotpage  the article at the top (head, photographs, price);
   .lotmore  the two columns under it (facts and terms; bids, the bid form, the feed);
   .lotzig   the divider between them.
   Composition follows sketch 09 (kicker, title, framed photograph with a caption and thumbnails, price with facts)
   drawn in the language of sketch 01 (linen, stitches, the ribbon). */

/* ---------- the frame of the page ---------- */
/* only the rows: the column gutter stays the core's, the same as in the two columns under the divider */
.lotpage { row-gap: var(--s4); }
.lotzig { margin: var(--s6) 0 var(--s5); }

/* ---------- head: lot number, the moderator's mark, state, title ---------- */
.lothead .lotmeta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; min-height: 26px; margin: 0 0 10px; }
.lothead .kicker { margin: 0; }
.lothead .lotstate { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 10px; }
.lothead h1 { margin: 0 0 10px; font-size: var(--t-long); line-height: 1.12; }
.lothead .prose { margin: 0; }
/* the moderator's word to the owner (rework, rejected): read before the photographs */
.lothead .note { margin: 14px 0 0; }
.lothead .note p { margin: 0; }
/* «ще не зрізано» is black, as the badge on the card, so it is not read as a second «ТОРГ» (F99). */
.lothead .state.uncut { background: var(--ink); }
.lothead .uncutnote { margin: 8px 0 0; }
.lotpage .stampnote { margin-top: 6px; }

/* ---------- photographs ----------
   One strip that scrolls sideways, one whole photograph per screen of it: never cropped, natural proportions, on ground cloth.
   Every photograph sits on its mount with its own caption, so the strip reads the same with and without the script.
   The strip is as tall as its tallest photograph, so nothing under it moves when the photograph changes. */
.lotgallery .stage {
  position: relative; display: flex; gap: var(--s2); overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none;
}
.lotgallery .stage::-webkit-scrollbar { display: none; }
.lotgallery .view { flex: 0 0 100%; display: flex; flex-direction: column; min-width: 0; margin: 0; scroll-snap-align: start; scroll-snap-stop: always; }
/* the 4:3 floor keeps room for a photograph that has not arrived yet; a taller one makes the cloth grow */
.lotgallery .view > a {
  flex: 1 0 auto; display: grid; place-items: center; aspect-ratio: 4 / 3;
  background: var(--weave), var(--ground); background-size: 3px 3px, 3px 3px, auto;
}
.lotgallery .view > a:focus-visible { outline-offset: -5px; }
.lotgallery .view img { width: auto; height: auto; max-width: 100%; max-height: 66vh; outline: 1px solid rgba(23, 18, 15, .22); outline-offset: -1px; }
@supports (height: 1svh) { .lotgallery .view img { max-height: min(66svh, 720px); } }
.lotgallery figcaption { padding: 8px 2px 0; color: var(--ink-2); font-size: 1rem; line-height: 1.2; }

/* thumbnails: a grid that takes as many as fit, so three stay small and twelve take two rows */
.lotgallery .thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: var(--s2); margin-top: var(--s2); }
.lotgallery .thumbs a { position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: var(--ground); }
.lotgallery .thumbs img { width: 100%; height: 100%; object-fit: cover; }
.lotgallery .thumbs a::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(23, 18, 15, .22); transition: box-shadow .15s; }
.lotgallery .thumbs a:hover::after { box-shadow: inset 0 0 0 3px var(--ink); }
/* the photograph on show: a red hem with a cloth line inside it (thicker, so not told by colour alone) */
.lotgallery .thumbs a[aria-current]::after { box-shadow: inset 0 0 0 3px var(--red), inset 0 0 0 5px var(--cloth); }
.lotpage .noimg { box-shadow: inset 0 0 0 1px var(--line); }

/* photographs that wait for a moderator (O4), shown to the owner and the moderators only, under the gallery buyers
   see: small pictures on their mounts, each with its mark and, for the owner, the way to remove it */
.lotnew { margin-top: var(--s4); padding-top: 14px; background: var(--run) top / auto 2px repeat-x; scroll-margin-top: var(--s4); }
.lotnew h2 { margin: 0 0 var(--s2); font-size: var(--t-panel); }
.lotnew > p { margin: 0 0 var(--s3); line-height: 1.45; }
.lotnew .note { margin: 0 0 var(--s3); }
.lotnew .newthumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3) var(--s2); }
.lotnew .newphoto { margin: 0; padding: 6px 6px 0; background: var(--cloth); box-shadow: inset 0 0 0 1px var(--line); }
.lotnew .newphoto img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.lotnew figcaption { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 6px; }
/* the mark is three words in a card: it wraps between them, never inside «модератора» */
.lotnew figcaption .state { max-width: 100%; white-space: normal; letter-spacing: .06em; }
.lotnew figcaption .link { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- the length from the description ----------
   A block of its own under the photographs: the ribbon never lies over a picture and never claims to be its scale. */
.lotmeasure { --m: 3px; margin-top: var(--s4); padding-top: 14px; background: var(--run) top / auto 2px repeat-x; }
.lotmeasure .mira { --m: inherit; margin: 12px 0 0; }
.lotmeasure .measurehead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; max-width: calc(105 * var(--m)); margin: 0; }
.lotmeasure .measurehead .caps { color: var(--ink-2); font-size: .84375rem; letter-spacing: .1em; }
.lotmeasure .measurehead b { font: 700 1.5rem/1 var(--serif); letter-spacing: -.01em; white-space: nowrap; }
@media (max-width: 359.98px) { .lotmeasure { --m: 2.5px; } }

/* ---------- price ---------- */
.lotpage .pricebox { margin: 0 0 var(--s3); }
.lotpage .pricenote:empty { display: none; }
/* a six-digit price must stay inside the frame on the narrowest phones */
@media (max-width: 359.98px) { .lotpage .pricebox .amount { font-size: min(2.375rem, 13vw); } }
/* what the page knows about the price: one line per fact between running stitches */
.lotpage .pricefacts { margin: 12px 0 0; }
.lotpage .pricefacts div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 12px; padding: 9px 0 8px; background: var(--run) top / auto 2px repeat-x; }
.lotpage .pricefacts dt { color: var(--ink-2); font-size: 1rem; line-height: 1.25; }
.lotpage .pricefacts dd { margin: 0 0 0 auto; min-width: 0; font: 700 1.1875rem/1.2 var(--serif); text-align: right; overflow-wrap: anywhere; }
.lotpage .priceacts { margin-top: 14px; align-items: stretch; }
/* the owner's actions fill their rows: the first one takes a whole row, the rest share the next */
.lotpage .priceacts > * { flex: 1 1 auto; }
.lotpage .priceacts > :first-child:not(:only-child) { flex-basis: 100%; }
/* a form is as tall as the link beside it, and its button fills it: the pair in a row stands level */
.lotpage .priceacts form { display: flex; }
.lotpage .priceacts form .btn { width: 100%; }
.lotpage .priceacts:not(:has(*)) { display: none; }
.lotpage .priceact { margin-top: 14px; }
.lotpage .pricebox .note { margin: 14px 0 0; }
.lotpage .pricebox .todo { margin-top: 14px; }
.lotpage .waiting { margin: 12px 0 0; }
.lotpage .mybid { margin: 12px 0 0; }
.lotpage .newcomer { margin: 12px 0 0; text-align: center; }
.lotpage .seller { margin: 10px 0 0; }

/* ---------- under the divider: facts, terms, bids ---------- */
.lotmore > section > :first-child { margin-top: 0; }
.lotmore .feedhead.first { margin-top: 0; }
.lotmore #bids, .lotmore #bid { scroll-margin-top: 0; }

/* the owner's bid cards */
.lotmore .bidcard .verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 8px 0; }
/* the verdict on the terms: a sign and a word, not a level chip */
.lotmore .match { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.0625rem; line-height: 1.25; }
.lotmore .match::before { content: ""; flex: none; width: 14px; height: 12px; background: var(--i-check-ink) center / 14px 12px no-repeat; }
.lotmore .match.tension { color: var(--red); }
.lotmore .match.tension::before { width: 18px; height: 18px; background: var(--i-star) center / 18px 18px no-repeat; }
.lotmore .bidcard .prose { margin: 8px 0; }
/* The summary's label follows the fold without scripts (F09). lot.html hides the open-state label with an inline
   style, so that the page reads right even before this sheet arrives; !important is what lets the open state win. */
.lotmore .bidcard details.buyerterms[open] > summary .whenopen { display: inline !important; }
.lotmore .bidcard details.buyerterms[open] > summary .whenclosed { display: none; }
.lotmore .bidcard tr.differs th { box-shadow: inset 3px 0 0 var(--red); padding-left: 8px; }
.lotmore .oldrounds { margin-top: var(--s3); }
.lotmore .bidcard .row { margin-top: 12px; }
/* choosing a buyer is the action of the card: it takes the whole row on a phone, the refusal stands under it */
.lotmore .bidcard .row form:first-child { flex: 1 1 100%; }
.lotmore .bidcard .row form:first-child .btn { width: 100%; }

/* the bid form */
/* the quick amounts the script adds stand in one row of four (two rows of two on the narrowest phones) */
.lotmore .bidpanel .quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lotmore .bidpanel .quick .btn { padding-inline: 4px; }
@media (max-width: 359.98px) { .lotmore .bidpanel .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lotmore .bidpanel form[data-bid-form] { margin-top: var(--s4); }
/* why the bid was refused, repeated at the anchor the refusal returns to */
.lotmore .bidpanel .bidrefused { margin: 12px 0 var(--s4); }
.lotmore .bidpanel .bidrefused p { margin: 0; }
/* the question before an improbably high bid (O5): the sum to confirm and the way to correct it, side by side */
.lotmore .bidpanel .bidcheck { margin: 12px 0 var(--s4); scroll-margin-top: var(--s4); }
.lotmore .bidpanel .bidcheck p { margin: 0 0 8px; }
.lotmore .bidpanel .bidcheck .bidcheckacts { margin-top: 12px; }
/* The bid form's terms (O6): the differing ones stand open, the agreeing ones wait under one line that reads like a
   term row (the same stitched line above, the same height, «показати» where a row says «змінити»). The child
   combinators keep the group's own words off the rows inside it, which say «змінити» and «згорнути» as before. */
.lotmore .bidpanel .termgroup { padding: 6px 0; background: var(--run) top / auto 2px repeat-x; }
.lotmore .bidpanel .termgroup > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; min-height: 48px; padding: 6px 0; }
.lotmore .bidpanel .termgroup > summary::-webkit-details-marker { display: none; }
.lotmore .bidpanel .termgroup > summary .q { flex: 1 1 auto; min-width: 0; font-weight: 700; }
.lotmore .bidpanel .termgroup > summary .change::after { content: "показати"; font-size: 1rem; text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.lotmore .bidpanel .termgroup[open] > summary .change::after { content: "сховати"; }
.lotmore .bidpanel .termgroup > summary:focus-visible { outline: 3px dashed var(--ink); outline-offset: 3px; }
/* A clash made inside the group is said on its line too, in the words and the red of a term's own reason, so that
   folding the line does not hide it (the page script writes it; leftover 8). */
.lotmore .bidpanel .termgroup > summary .clashmsg:not([hidden]) { display: block; position: relative; margin: 6px 0 0; padding-left: 22px; color: var(--red); font-size: 1rem; font-weight: 700; line-height: 1.35; }
.lotmore .bidpanel .termgroup > summary .clashmsg::before { content: ""; position: absolute; left: 0; top: 4px; width: 14px; height: 14px; background: var(--i-cross) center / 14px 14px no-repeat; }
/* the rows inside the group stand a little in from its line, so the line reads as their heading */
.lotmore .bidpanel .termgroup > .term { margin-left: 12px; }
.lotmore .bidpanel .termgroup > .term.clash { margin-left: 2px; }
/* whether a term agrees, in words beside the seller's answer; a difference is said in bold red as well */
.lotmore .bidpanel .termmark::before { content: "· "; }
.lotmore .bidpanel .termmark.off { color: var(--red); font-weight: 700; }
/* Without the script the mark is the one the page was drawn with: once another level is pressed it steps aside,
   as the chip does (hairharvester.css), and so does a clash the page was drawn with, frame and reason. */
html:not(.js) .term:has(.levels input:checked:not([checked])) [data-term-mark] { display: none; }
html:not(.js) .term.clash:has(.levels input:checked:not([checked])) { margin: 0; padding: 6px 0; background: var(--run) top / auto 2px repeat-x; box-shadow: none; }
html:not(.js) .term.clash:has(.levels input:checked:not([checked])) .clashmsg { display: none; }
/* The count on the line of agreeing terms counts the whole form, and without the script it cannot follow a change
   anywhere in it: once any answer differs from the drawn one the «: N з M» steps aside and the line keeps its words. */
html:not(.js) form:has(.term .levels input:checked:not([checked])) [data-agree-tally] { display: none; }
.lotmore .bidpanel .bidwords { margin-top: 14px; }
.lotmore .bidpanel .takeback { margin-top: 12px; text-align: center; }

/* the feed of bids on a phone: the amount on the left, who and when beside it, so a date never breaks in two */
.lotmore .feed .when { text-align: right; }
/* in a bidder's own row the amount and the name are bold; the date is not the fact to stress */
.lotmore .feed tr.mine .when { font-weight: 400; }
@media (max-width: 639.98px) {
  .lotmore .feed, .lotmore .feed tbody { display: block; }
  .lotmore .feed tr { display: grid; grid-template-columns: 7.2em minmax(0, 1fr); column-gap: 12px; padding: 10px 0; }
  .lotmore .feed td { padding: 0; }
  .lotmore .feed td:first-child { grid-row: 1 / span 2; }
  .lotmore .feed td:only-child { grid-column: 1 / -1; }
  .lotmore .feed .when { grid-column: 2; text-align: left; }
  /* a feed narrower than ten lines of its own text size (a browser set to a large default text): the amount
     takes a line of its own and who and when go under it, or the second column would be squeezed to nothing */
  .lotmore .feed { container-type: inline-size; }
  @container (max-width: 10em) {
    .lotmore .feed tr { grid-template-columns: minmax(0, 1fr); }
    .lotmore .feed td:first-child { grid-row: auto; }
    .lotmore .feed .when { grid-column: 1; }
  }
}

/* the bar of a visitor on a phone: the price and the way in. Its words are longer than a bidder's, so they may take two lines. */
.stickybid.guest > span { flex: none; }
.stickybid.guest .btn { flex: 0 1 auto; min-width: 0; padding: 4px 12px; font-size: min(1rem, 17px); line-height: 1.15; text-align: center; text-wrap: balance; }
/* on the narrowest phones the visitor's two lines fill the bar already at the usual size: no growth at all */
@media (max-width: 359.98px) { .stickybid.guest .btn { font-size: min(1rem, 16px); } }

/* the moderator's panel: an ordinary panel, set apart from the feed above it */
.lotmore .staffpanel { margin-top: var(--s4); }
.lotmore .staffpanel form { margin-top: var(--s4); }

/* ---------- 640 px: tablet ---------- */
@media (min-width: 640px) {
  .lotmeasure { --m: 5px; }
  .lotgallery .thumbs { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .lotmore .bidcard .row form:first-child { flex: 0 1 auto; }
}

/* ---------- a tablet held upright ----------
   Between the wide phone and the desktop the photographs and the price already stand side by side;
   the facts and the bids under them stay in one column until 960 px, as the core lays them. */
@media (min-width: 760px) and (max-width: 959.98px) {
  .lotpage { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: var(--s5); align-items: start; }
  .lotpage .lotphotos { grid-column: 1; grid-row: 1 / span 2; }
  .lotpage .lothead { grid-column: 2; grid-row: 1; }
  .lotpage .side { grid-column: 2; grid-row: 2; }
  .lotmeasure { --m: 3px; }
  /* the price frame with its own button is beside the photograph on the first screen here, so the bar that repeats it
     on a phone is not shown: one red button, not two. The page keeps room for the tab bar only. */
  .stickybid { display: none; }
  body.has-stickybid { padding-bottom: calc(var(--tab) + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- 960 px: desktop ----------
   Photographs and the ribbon take the left column from top to bottom; the head and the price stand in the right one,
   and the price stays in view while the photographs scroll past. */
@media (min-width: 960px) {
  .lotpage { grid-template-rows: auto 1fr; row-gap: var(--s5); }
  .lotpage .lotphotos { grid-column: 1; grid-row: 1 / span 2; }
  .lotpage .lothead { grid-column: 2; grid-row: 1; }
  .lotpage .side { grid-column: 2; grid-row: 2; align-self: start; }
  .lothead h1 { margin-bottom: 14px; }
  .lothead .lotmeta { margin-bottom: 14px; }
  .lotgallery .thumbs { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  .lotmeasure { --m: 4px; }
  .lotzig { margin: var(--s7) 0 var(--s6); }
  /* The price follows a larger default text of the browser only as far as its column allows (a four-digit sum is
     4.5 em wide, a six-digit one 5.6 em, in a frame 302 px wide at 960 px). It never falls below its size at the
     usual 16 px, so the usual look stays exactly as it was. The first line is for a browser without container units. */
  .lotpage .pricebox { container-type: inline-size; }
  .lotpage .pricebox .amount { font-size: min(3.75rem, 60px); }
  @supports (width: 1cqw) {
    .lotpage .pricebox .amount { font-size: min(3.75rem, max(60px, 17.5cqw)); }
  }
}
/* the left column is wide enough for a larger ribbon only from here */
@media (min-width: 1200px) {
  .lotmeasure { --m: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .lotgallery .stage { scroll-behavior: auto; }
}

/* ---------- a sample lot (load_samples) ----------
   The explanation opens the page before the crumbs: panel cloth with a red top edge as thick as the panel's ink one,
   a heading in the serif of the page, the sentence, and the two ways on. Prominent by size and by its
   place, not by a new colour. The mark in the head stands where a real lot has the moderator's stamp. */
.samplenote { margin: 0 0 var(--s5); padding: var(--s4) var(--s4) var(--s3); background: var(--panel); box-shadow: inset 0 4px 0 var(--red); }
.samplenote h2 { margin: 4px 0 8px; font-size: var(--t-section); line-height: 1.15; }
.samplenote p { margin: 0 0 var(--s3); }
.samplenote .sampleacts { margin: var(--s4) 0 var(--s2); }
.samplenote .sampleacts .btn { flex: 1 1 14rem; }
@media (max-width: 959px) {
  /* The two ways on stand side by side on a phone, so that the photograph is nearer. */
  .samplenote .sampleacts { flex-wrap: nowrap; }
  .samplenote .sampleacts .btn { flex: 1 1 0; min-width: 0; padding-inline: 10px; text-align: center; }
}
/* On a phone the second paragraph folds away; on a wide screen it stands open and the fold is gone. */
.samplenote .samplewide { display: none; }
.samplenote .samplemore { margin: 0 0 var(--s3); }
.samplenote .samplemore > summary { display: inline-block; min-height: 44px; padding: 10px 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 4px; list-style: none; }
.samplenote .samplemore > summary::-webkit-details-marker { display: none; }
.samplenote .samplemore > summary::before { content: "+ "; font-weight: 700; }
.samplenote .samplemore[open] > summary::before { content: "− "; }
.samplenote .samplemore > p { margin: 0 0 var(--s2); }
.lothead .samplemark { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 5px; background: var(--red); color: var(--cloth); font: 700 .9375rem/1.2 var(--sans); letter-spacing: .18em; text-transform: uppercase; }
.lothead .samplemark::before { content: ""; flex: none; width: 10px; height: 10px; background: var(--i-rhomb-cloth) center / 10px 10px no-repeat; }
.lothead .samplemark::after { content: ""; position: absolute; inset: 3px; border: 1px dashed rgba(248, 244, 234, .6); pointer-events: none; }
@media (min-width: 960px) {
  .samplenote { padding: var(--s5) var(--s6) var(--s4); }
  .samplenote > p:not(.kicker) { max-width: 46em; }
  .samplenote .sampleacts .btn { flex: 0 1 auto; }
  .samplenote .samplewide { display: block; }
  .samplenote .samplemore { display: none; }
}
