/* The public item page (design.html:877-974). MVP §37 is mobile-first and MVP
   §39 puts title and price above everything else, which is the order in the
   markup — this file sizes what is already there and moves only the photograph.

   The header, the footer and the skip link come from /css/marketing.css, which
   the shell links: the design draws the marketing chrome on this page and those
   rules already exist.

   No layer name: /f/ loads the shared layers and then this, and a page style is
   the last word by position. */

/* The design gives the artboard a 740px floor so the footer sits at the bottom
   of the window rather than halfway up it — a one-card page is short (design.html:878). */
body {
  display: flex;
  flex-direction: column;
  min-block-size: 100vh;
}

.item-main {
  flex: 1;
  padding-block: 50px 60px;
}

.item-loading {
  color: var(--text-muted);
  text-align: center;
}

/* The design's card: one column, 480px, warm on the white ground (D2), with the
   photograph bled to its edges. */
.item-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-inline-size: 480px;
  margin-inline: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-veil);
}

/* MVP §39's source order is title, price, thumbnail. The design's card leads
   with the photograph. `order` is how one file gets both: the DOM keeps the
   priority order, the screen gets the design. The banner outranks even that —
   "this item has been sold" is the first thing to read. */
#banner { order: -2; }
#photo  { order: -1; }

.banner {
  padding: 13px 26px;
  border-block-end: 1px solid var(--border);
  background: var(--accent-warm);
  color: var(--text);
  font-size: calc(13.5px * var(--type-scale));
  font-weight: 600;
  max-inline-size: none;
}

#photo {
  inline-size: 100%;
  /* The design's 280px band. `cover` because a seller's thumbnail is any shape
     and PHOTO_MAX_DIMENSION only caps it (§13). */
  block-size: 280px;
  object-fit: cover;
  background: var(--surface-sunken);
}

.item-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 26px 26px 30px;
}

.item-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Confirmed and the follower count, as two pills in a row. */
.item-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 6px; }

.item-pill {
  margin: 0;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: calc(13px * var(--type-scale));
  font-weight: 600;
  max-inline-size: none;

  &:empty { display: none; }
}

.item-pill--accent { background: var(--accent-tint); color: var(--accent); }

#title {
  font-size: calc(21px * var(--type-scale));
  font-weight: 700;
  letter-spacing: -.02em;
}

/* Bigger than the dashboard's .item-price: on the dashboard a price is one field
   in a list, and here it is MVP §39's second priority. The two surfaces never
   load each other's stylesheet.

   No tabular-nums, though the design asks for it (design.html:917) — Schibsted's
   tabular figures give the decimal point a full digit's advance, so "$899.00"
   reads as "$899 . 00". Part B's .tier-price dropped it for the same reason, and
   nothing on this page is being aligned against anything. */
.item-price {
  font-size: calc(24px * var(--type-scale));
  font-weight: 700;
  letter-spacing: -.02em;
}

.item-meta {
  color: var(--text-muted);
  font-size: calc(12.5px * var(--type-scale));
  max-inline-size: none;
}

.item-description {
  color: var(--text-secondary);
  font-size: calc(14.5px * var(--type-scale));
  line-height: 1.6;
  text-wrap: pretty;
  max-inline-size: none;
}

/* Every control in the card is full width and centred — the design stacks them
   rather than putting them in a row. */
.item-card .button {
  inline-size: 100%;
  justify-content: center;
}

/* The original-listing link: accent text at the right of the price. The
   space it left under the Follow region stays. */
.item-price-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
}

.item-body:has(#listing:not([hidden])) .follow { margin-block-end: 40px; }

.item-listing {
  flex: none;
  font-size: calc(16px * var(--type-scale));
  font-weight: 700;
  text-decoration: none;

  &:hover { text-decoration: underline; }
}

/* MVP §39 ranks the Follow action fifth on this page; it is still the only thing
   on it a visitor can DO, so it stacks as its own block. The design gives it no
   border of its own — the card is already the border. */
.follow {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Not following: the Follow button over its note. */
.follow-head { display: flex; flex-direction: column; gap: 8px; }
.follow-head > button { order: -1; align-self: flex-start; }
.follow-check { display: none; }
.follow-text p { margin: 0; }

/* Following: one row, a check, the lead over the note, Unfollow as a link. */
.follow.is-following .follow-head {
  flex-direction: row;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);

  & > button { order: 0; align-self: center; margin-inline-start: auto; color: var(--text-muted); font-weight: 600; }
  & .follow-text { min-inline-size: 0; }
  & #follow-lead { font-weight: 700; font-size: calc(17px * var(--type-scale)); }
}

.follow.is-following .follow-check {
  display: block;
  flex: none;
  inline-size: 36px;
  block-size: 36px;
  border-radius: 50%;
  background: var(--accent);
  fill: none;
  stroke: var(--on-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.follow-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-block-start: 4px;
}

.follow-form label {
  font-size: calc(13px * var(--type-scale));
  font-weight: 600;
}

.follow-form .required { color: var(--danger); }

.follow-form input {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: calc(15px * var(--type-scale));
}

/* Realtor Relaunch R6: the share checkbox sits under the email field, in the
   label's own weight, not the field label's. */
.follow-form .follow-share {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 400;
}

.follow-form .follow-share input { padding: 0; margin-block-start: 3px; }

/* R14, R15: R5's contact request and the feedback question, each under an
   eyebrow, stacked like the follow region. */
.item-contact,
.item-feedback-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-feedback-box { margin-block-start: 16px; }

.item-eyebrow {
  color: var(--text-muted);
  font-size: calc(12px * var(--type-scale));
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.item-actions { display: flex; flex-direction: column; gap: 10px; }

.item-action-main { justify-content: center; }

/* The other actions: rows in one card, a title (and contact's line) and an
   arrow. */
.item-action-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  overflow: hidden;

  &:empty { display: none; }
}

.item-action-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;

  & + & { border-block-start: 1px solid var(--border); }
  & > span:first-child { display: flex; flex-direction: column; gap: 2px; }
  & strong { font-size: calc(15px * var(--type-scale)); }
  & .item-meta { font-size: calc(13.5px * var(--type-scale)); }
  &:hover { background: var(--surface-sunken); }
  &:disabled { opacity: .55; cursor: not-allowed; }
}

.item-action-arrow { flex: none; color: var(--accent); font-size: calc(18px * var(--type-scale)); }

.item-feedback {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.item-feedback fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }

.item-feedback-question {
  margin-block-end: 12px;
  font-size: calc(17px * var(--type-scale));
  font-weight: 700;
  letter-spacing: -.01em;
}

/* The answers: radios drawn as pills, the chosen one filled. */
.item-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.item-chip {
  position: relative;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--text);
  font-size: calc(14px * var(--type-scale));
  font-weight: 600;
  cursor: pointer;

  & input { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; margin: 0; opacity: 0; cursor: pointer; }
  &:has(input:checked) { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
  &:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
}

.item-chips-more { color: var(--accent); font-weight: 600; text-decoration: none; }

.item-feedback-rest {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-block-start: 14px;
  border-block-start: 1px solid var(--border);

  & > .button { justify-content: center; }
}

.item-feedback-rest legend,
.item-feedback-rest > label {
  margin-block-end: 8px;
  font-size: calc(14px * var(--type-scale));
  font-weight: 700;
}

.item-feedback-rest > label { margin-block: 4px 0; }

.item-optional { color: var(--text-muted); font-weight: 400; }

/* Feedback Options O3: what might help, checkbox tiles. */
.item-feedback-helps { display: flex; flex-wrap: wrap; gap: 8px; }

.item-feedback-help {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text);
  font-size: calc(14px * var(--type-scale));
  font-weight: 600;
  cursor: pointer;

  &:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
  &:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
}

.item-feedback textarea,
.item-action-form textarea {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.item-action-form {
  display: flex;
  flex-direction: column;
  gap: 8px;

  & label { font-size: calc(13px * var(--type-scale)); font-weight: 600; }
}

#contact-status:empty,
#feedback-status:empty { display: none; }

/* Empty until something is said, and it must not reserve space while empty —
   role=status on an empty element is silent, which is correct. */
#follow-status:empty,
#follow-lead:empty { display: none; }

#follow-status {
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: calc(13.5px * var(--type-scale));
  max-inline-size: none;
}

/* The not-found body, and the one the itemPage function serves for a code with
   no document — the same panel, so the two pages are one design (D11). */
.item-notice {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  max-inline-size: 480px;
  margin-inline: auto;
  padding: 34px 26px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-veil);
  text-align: center;
}

.item-notice h1 {
  font-size: calc(21px * var(--type-scale));
  font-weight: 700;
  letter-spacing: -.02em;
}

.item-notice p {
  max-inline-size: none;
  color: var(--text-secondary);
  font-size: calc(14.5px * var(--type-scale));
}

.item-notice .button { inline-size: auto; }

@media (max-width: 42rem) {

  .item-main { padding-block: 28px 40px; }

  #photo { block-size: 220px; }

  .banner { padding-inline: 20px; }

  .item-body { padding: 20px 20px 24px; }

  /* Following, narrow: the check beside the lead, the note and Unfollow under the lead. */
  .follow.is-following .follow-head {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 16px;

    & .follow-text { display: contents; }
    & #follow-note, & > button { grid-column: 2; }
    & > button { justify-self: start; margin-inline-start: 0; }
  }
}
