/**
 * Rafiki Exchange look (docs/features/EXCHANGE.md § 3, mockups docs/ux/exchange/).
 * Exchange pages only; chrome, buttons and inputs come from the layout's sheets.
 * Phone first at 390px: one column, 16px gutters, 13px minimum text,
 * 44px tap targets.
 */
.exchange {
    --exchange-ink: var(--pocket-text-primary, #111827);
    --exchange-ink2: var(--pocket-text-secondary, #475569);
    --exchange-mute: var(--pocket-text-muted, #5b6474);
    --exchange-line: var(--pocket-border, #e2e6eb);
    --exchange-line2: var(--pocket-border-light, #eef1f4);
    --exchange-card: var(--pocket-card-bg, #ffffff);
    --exchange-accent: var(--pocket-active, #4f46e5);
    --exchange-accent-dark: var(--pocket-active-dark, #4338ca);
    --exchange-accent-soft: var(--pocket-active-soft, #eef2ff);
    --exchange-good: var(--good);
    --exchange-good-bg: var(--good-bg);
    --exchange-high: var(--high);
    --exchange-high-bg: var(--high-bg);
    --exchange-save: var(--save);
    --exchange-num: 'Barlow Semi Condensed', 'Barlow', sans-serif;
    --exchange-title: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    display: flex;
    flex-direction: column;
    gap: var(--pocket-space-lg);  /* the pocket block gap (docs/features/POCKET_PAGE_TOPS.md goal 8) */
    padding-bottom: 24px;
    color: var(--exchange-ink);
}

.exchange-muted {
    margin: 0;
    font-size: var(--pocket-font-size-xs);
    color: var(--exchange-mute);
}

.exchange-label {
    font: 700 var(--pocket-font-size-xs) var(--exchange-title);
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--exchange-mute);
}

.exchange-panel {
    background: var(--exchange-card);
    border: 1px solid var(--exchange-line);
    border-radius: 16px;
    padding: 14px;
}

.exchange-panel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

/* Welcome card on Browse: the shell, body slot and Got it are pocket/got-it-card.css. */
.exchange-welcome-title {
    margin: 0 0 6px;
    font: 700 16px var(--exchange-title);
}

.exchange-welcome-points {
    margin: 0;
    padding-left: 18px;
    font-size: var(--pocket-font-size-xs);
    line-height: 1.4;
}

/* Listing (screen 2) */
.exchange-gallery {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 calc(-1 * var(--pocket-space-lg, 16px));
    padding: 0 var(--pocket-space-lg, 16px);
}

.exchange-gallery-photo {
    flex: 0 0 100%;
    width: 100%;
    height: 236px;
    object-fit: cover;
    border-radius: 16px;
    scroll-snap-align: center;
    background: var(--exchange-line2);
}

.exchange-gallery-empty {
    height: 120px;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    margin: 0;
    background: var(--photo-placeholder);
}

.exchange-gallery-none {
    font: 600 var(--pocket-font-size-xs) var(--exchange-title);
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--photo-none);
}

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

.exchange-price-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin: 0;
}

.exchange-price {
    font: 700 32px/1 var(--exchange-num);
}

.exchange-save-form {
    position: absolute;
    top: 0;
    right: 0;
}

.exchange-listing-head:has(.exchange-save-form) {
    position: relative;
    padding-right: 52px;
}

.exchange-save {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--exchange-line);
    border-radius: 22px;
    background: var(--exchange-card);
    color: var(--exchange-ink2);
    font: 400 24px/1 'Barlow', sans-serif;
    cursor: pointer;
}

.exchange-save-on {
    color: var(--exchange-save);
}

/* Make offer: the form shows when its link targets it, or once an offer was typed */
.exchange-offer {
    display: none;
    flex-direction: column;
    gap: 8px;
}

.exchange-offer:target,
.exchange-offer-open {
    display: flex;
}

/* Contact (screen 2): Call · Make offer · Text seller on one row */
.exchange-contact-row {
    display: grid;
    grid-template-columns: 56px 1fr 1.3fr;
    gap: 8px;
}

.exchange-call {
    padding: 0;
}

.exchange-call svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.exchange-listing-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    font: 600 20px/1.25 'Barlow', sans-serif;
}

.exchange-sex,
.exchange-ped,
.exchange-own {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    font: 700 var(--pocket-font-size-xs) 'Barlow', sans-serif;
}

.exchange-sex-male { background: var(--pocket-male-bg, #e3f2fd); color: var(--pocket-male, #1565c0); }
.exchange-sex-female { background: var(--pocket-female-bg, #fce4ec); color: var(--pocket-female, #c2185b); }
.exchange-ped { background: var(--ped-bg); color: var(--ped); }

/* The seller's own listing wears this wherever it shows (templates/exchange/_own_badge.html). */
.exchange-own {
    align-self: flex-start;
    background: var(--exchange-accent);
    color: var(--on-brand);
}

.exchange-feed-card-mine {
    outline: 2px solid var(--exchange-accent);
}

.exchange-check {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 14px;
    font: 700 var(--pocket-font-size-xs) 'Barlow', sans-serif;
    background: var(--exchange-line2);
    color: var(--exchange-ink2);
}

.exchange-check-down { background: var(--exchange-good-bg); color: var(--exchange-good); }
.exchange-check-up { background: var(--exchange-high-bg); color: var(--exchange-high); }

/* The price check's similar sales, a description's "Each animal" and Sell's folded terms: one tappable line, a
   chevron that turns when open (comp rows: pocket/estimate-comps.css). */
.exchange-check-comps-line,
.exchange-description-each summary,
.exchange-fold-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: var(--pocket-target-min);
    margin-top: 6px;
    border-top: 1px solid var(--exchange-line);
    list-style: none;
    cursor: pointer;
    font-size: var(--pocket-font-size-xs);
    color: var(--exchange-ink2);
}

/* One line at 390px: the count and range never wrap; a long range ends in an ellipsis. */
.exchange-check-comps-line span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exchange-check-comps-line::-webkit-details-marker,
.exchange-description-each summary::-webkit-details-marker,
.exchange-fold-summary::-webkit-details-marker { display: none; }

.exchange-check-comps-line::after,
.exchange-description-each summary::after,
.exchange-fold-summary::after {
    content: '\203A';
    flex: none;
    font-size: 20px;
    color: var(--exchange-mute);
    transition: transform 0.15s;
}

.exchange-check-comps[open] .exchange-check-comps-line::after,
.exchange-description-each[open] summary::after,
.exchange-fold[open] > .exchange-fold-summary::after { transform: rotate(90deg); }

.exchange-seller {
    display: flex;
    align-items: center;
    gap: 12px;
}

.exchange-seller-mark {
    flex: none;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 23px;
    font: 700 18px 'Barlow', sans-serif;
    background: var(--exchange-accent-soft);
    color: var(--exchange-accent-dark);
}

.exchange-seller-name {
    margin: 0;
    font: 600 16px 'Barlow', sans-serif;
}

.exchange-terms {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
    margin: 0;
}

.exchange-terms dd {
    margin: 2px 0 0;
    font: 600 16px 'Barlow', sans-serif;
}

/* A listing's description from herd facts: a headline, then one fact per row: sentence lines, then labelled rows (one column at 390px). */
.exchange-description-headline {
    margin: 0;
    font: 600 18px/1.3 'Barlow', sans-serif;
}

/* The listing's stored words (M16), in place of the headline and lines. */
.exchange-listing-text {
    margin: 0;
}

.exchange-description-lines {
    display: grid;
    gap: 8px;
    margin: 10px 0 0;
}

.exchange-description-term,
.exchange-description-sentence { margin: 0; }

.exchange-description-lines dd {
    margin: 2px 0 0;
}

.exchange-description-lines dd,
.exchange-description-sentence {
    font-size: var(--pocket-font-size-xs);
    overflow-wrap: anywhere;
}

.exchange-description-animal {
    margin: 10px 0 0;
    font: 600 16px 'Barlow', sans-serif;
}

.exchange-notes {
    margin: 4px 0 0;
    font-size: var(--pocket-font-size-xs);
    white-space: pre-line;
}

.exchange-gone {
    padding: 48px 16px;
    text-align: center;
}

.exchange-gone-title {
    margin: 0 0 6px;
    font: 700 30px var(--exchange-title);
    text-transform: uppercase;
}

/* Shared by the composer and "You're live" */
.exchange-heading {
    margin: 4px 0 0;
    font: 700 26px/1.1 var(--exchange-title);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.exchange-center {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}

.exchange-btn {
    min-height: var(--pocket-control-height);
    border-radius: 14px;
    font-size: var(--pocket-font-size-sm);
    font-weight: 700;
}

.exchange-ped {
    margin-left: 4px;
}

/* Composer (screen 4) */
.exchange-ask-check {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-top: 10px;
}

.exchange-use-est {
    min-height: var(--pocket-target-min);
    padding: 0 14px;
    border: none;
    border-radius: 12px;
    background: var(--exchange-accent-soft);
    color: var(--exchange-accent);
    font-size: var(--pocket-font-size-xs);
    font-weight: 700;
}

.exchange-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.exchange-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.exchange-photo-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.exchange-photo,
.exchange-photo-add {
    position: relative;
    flex: none;
    width: 82px;
    height: 82px;
    border-radius: 12px;
    overflow: hidden;
}

.exchange-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.exchange-photo-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: var(--on-photo);
    font: 700 22px 'Barlow', sans-serif;
    text-shadow: 0 1px 3px var(--shade-text);
    cursor: pointer;
}

/* Edit's current photos: the same × tile control, a checkbox in a label; checked dims the tile and says Removed. */
.exchange-photo-current .exchange-photo-remove {
    display: grid;
    place-items: center;
    margin: 0;
}

.exchange-photo-check {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.exchange-photo-current .exchange-photo-remove:has(.exchange-photo-check:focus-visible) {
    outline: 2px solid var(--exchange-accent);
}

.exchange-photo-current:has(.exchange-photo-check:checked) img {
    opacity: 0.3;
}

.exchange-photo-current:has(.exchange-photo-check:checked)::after {
    content: 'Removed';
    position: absolute;
    inset: auto 0 6px;
    text-align: center;
    color: var(--exchange-ink);
    font: 700 var(--pocket-font-size-xs) 'Barlow', sans-serif;
}

.exchange-photo-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 2px dashed var(--brand-line);
    background: var(--exchange-accent-soft);
    color: var(--exchange-accent);
    font: 600 var(--pocket-font-size-xs) 'Barlow', sans-serif;
    cursor: pointer;
}

.exchange-photo-add[hidden] {
    display: none;
}

.exchange-photo-add-icon {
    font-size: 22px;
}

.exchange-photo-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.exchange-photos .exchange-muted {
    margin-top: 6px;
}

.exchange-group + .exchange-group,
.exchange-claim + .exchange-claim {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--exchange-line2);
}

.exchange-group-title {
    margin: 0;
    font: 600 17px 'Barlow', sans-serif;
}

/* The composer's preview of what buyers will read (the listing's description panel). */
.exchange-preview-label {
    margin: 10px 0 6px;
}

.exchange-price-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
}

.exchange-price-input {
    flex: 1;
    min-width: 0;
    min-height: var(--pocket-control-height);
    border: 0;
    border-bottom: 2px solid var(--exchange-line);
    background: transparent;
    font: 700 34px/1 var(--exchange-num);
    color: var(--exchange-ink);
}

.exchange-price-input:focus {
    outline: none;
    border-bottom-color: var(--exchange-accent);
}

/* Firm · OBO beside the price: the shared segmented control (pocket.css .pocket-seg), at a fixed width. */
.exchange-price-entry .pocket-seg {
    flex: none;
    width: 150px;
}

.exchange-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border: 1px solid var(--exchange-line);
    border-radius: 14px;
    background: var(--exchange-card);
}

.exchange-field-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    font: 600 17px 'Barlow', sans-serif;
    color: var(--exchange-ink);
}

.exchange-field-input:focus {
    outline: none;
}

.exchange-field:focus-within {
    border-color: var(--exchange-accent);
}

textarea.exchange-field-input {
    font-weight: 500;
    font-size: var(--pocket-font-size-field);  /* at least 16px: under it iOS zooms the page on focus, and pinch zoom is allowed now */
    resize: vertical;
}

.exchange-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.exchange-dock {
    position: sticky;
    bottom: var(--pocket-tab-height);  /* above the fixed tab bar */
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 4px calc(-1 * var(--pocket-space-lg, 16px)) 0;
    padding: 10px var(--pocket-space-lg, 16px) 14px;
    border-top: 1px solid var(--exchange-line);
    background: var(--dock-bg);
    text-align: center;
}

/* Report (M12): quiet, below the listing */
.exchange-report {
    text-align: center;
}

.exchange-report-btn {
    min-height: var(--pocket-target-min);
    border: none;
    background: none;
    color: var(--exchange-mute);
    font-size: var(--pocket-font-size-xs);
    text-decoration: underline;
}

/* You're live (screen 5) */
.exchange-live {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.exchange-live-ok {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin: 12px auto 0;
    border-radius: 38px;
    background: var(--exchange-good-bg);
    color: var(--exchange-good);
    font: 700 38px 'Barlow', sans-serif;
}

.exchange-live-card {
    display: flex;
    overflow: hidden;
    border: 1px solid var(--exchange-line);
    border-radius: 18px;
    background: var(--exchange-card);
    text-align: left;
}

.exchange-live-thumb {
    flex: none;
    width: 110px;
    min-height: 96px;
    object-fit: cover;
    background: var(--photo-placeholder);
}

.exchange-live-body {
    min-width: 0;
    padding: 10px 12px;
}

.exchange-live-price {
    margin: 0;
    font: 700 22px/1 var(--exchange-num);
}

.exchange-live-price small {
    font: 500 var(--pocket-font-size-xs) 'Barlow', sans-serif;
    color: var(--exchange-mute);
}

.exchange-live-title {
    margin: 4px 0 0;
    font: 600 15px 'Barlow', sans-serif;
}

.exchange-live-link {
    display: block;
    overflow-wrap: anywhere;
    font-size: var(--pocket-font-size-xs);
    color: var(--exchange-mute);
}

.exchange-share-title {
    margin: 6px 0 0;
    text-align: left;
}

.exchange-share {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.exchange-share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-height: var(--pocket-target-min);
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--exchange-ink2);
    font: 600 var(--pocket-font-size-xs) 'Barlow', sans-serif;
    text-decoration: none;
    cursor: pointer;
}

.exchange-share-btn[hidden] {
    display: none;
}

.exchange-share-btn::before {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    color: var(--on-fill);
    font: 700 24px 'Barlow', sans-serif;
}

/* Icons are decorative (the button says what it does): `/ ''` keeps screen readers off them. */
.exchange-share-text::before { content: '\2709'; content: '\2709' / ''; background: var(--exchange-good); }
.exchange-share-more::before { content: '\2197'; content: '\2197' / ''; background: var(--exchange-accent); color: var(--on-brand); }
.exchange-share-copy::before { content: '\1F517'; content: '\1F517' / ''; background: var(--share-copy); }

/* Exchange home: the seller's listings (screen 6 "Selling") */
.exchange-nudge {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--exchange-high-bg);
}

.exchange-nudge-icon {
    font-size: 24px;
}

.exchange-nudge-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: var(--pocket-font-size-xs);
    color: var(--exchange-ink2);
}

.exchange-nudge-text strong {
    font-size: 16px;
    color: var(--exchange-ink);
}

.exchange-nudge-yes {
    min-width: 64px;
    min-height: var(--pocket-target-min);
    border: 0;
    border-radius: 12px;
    background: var(--exchange-ink);
    color: var(--on-fill);
    font: 700 16px 'Barlow', sans-serif;
    cursor: pointer;
}

.exchange-sell-card {
    flex-direction: column;  /* a .exchange-live-card with a footer row */
}

.exchange-sell-main {
    display: flex;
    color: inherit;
    text-decoration: none;
}

.exchange-sell-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    flex: 1;
}

.exchange-sell-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.exchange-state {
    flex-shrink: 0;
    padding: 3px 9px;
    border-radius: 8px;
    font-size: var(--pocket-font-size-xs);
    font-weight: 700;
    background: var(--exchange-line2);
    color: var(--exchange-ink2);
}

.exchange-state-live { background: var(--exchange-good-bg); color: var(--exchange-good); }
.exchange-state-expired,
.exchange-state-held,
.exchange-state-reported { background: var(--exchange-high-bg); color: var(--exchange-high); }

.exchange-sell-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 4px 14px 12px;
}

.exchange-sell-sold {
    min-height: var(--pocket-target-min);
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    background: var(--exchange-good);
    color: var(--on-fill);
    font: 700 15px 'Barlow', sans-serif;
    cursor: pointer;
}

/* Mark sold sheet (screen 7): on the pocket bottom sheet and its form body (.pocket-sheet-form, pocket.css;
   static/pocket/sheets.js) */
.pocket-sheet-form .exchange-label {
    margin-top: 8px;
}

.exchange-sold-price {
    min-height: 56px;
    padding: 0 14px;
    border: 1px solid var(--exchange-line);
    border-radius: 14px;
    font: 700 28px var(--exchange-num);
}

.exchange-sold-pick input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.exchange-sold-pick {
    position: relative;
    min-height: var(--pocket-target-min);
}

.exchange-sold-pick:has(input:checked)::before,
.exchange-shine-pick:has(input:checked) .exchange-shine-label::before {  /* the shine row draws it on its label */
    content: '✓ ';
    content: '✓ ' / '';  /* decorative: the checkbox says it is ticked */
    white-space: pre;
}

.exchange-sold-pick:has(input:focus-visible) {
    outline: 2px solid var(--exchange-accent);
    outline-offset: 2px;
}

.exchange-sold-confirm {
    margin-top: 8px;
    border: 0;
    background: var(--exchange-good);
    color: var(--on-fill);
}

/* Buyer interest on each listing (screen 6): views, saves, contacts, offers */
.exchange-sell-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 0;
    padding: 12px 8px 4px;
    border-top: 1px solid var(--exchange-line2);
    text-align: center;
}

.exchange-sell-stat {
    display: flex;
    flex-direction: column-reverse;
    font-size: var(--pocket-font-size-xs);
    color: var(--exchange-mute);
}

.exchange-sell-stat dd {
    margin: 0;
    font: 700 24px var(--exchange-num);
    color: var(--exchange-ink);
}

.exchange-sell-stat-accent dd {
    color: var(--exchange-accent);
}

.exchange-sell-down,
.exchange-sell-edit {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    min-height: var(--pocket-target-min);
    padding: 0 18px;
    border: 1px solid var(--exchange-line);
    border-radius: 12px;
    background: var(--exchange-card);
    color: var(--exchange-ink);
    font: 600 15px 'Barlow', sans-serif;
    cursor: pointer;
}

.exchange-soon {
    border-style: dashed;
}

/* Exchange tab (screen 1 Browse, screen 6 Selling): the shared pocket search, filter bar, sheets, section
   title and welcome card (docs/features/POCKET_PAGE_TOPS.md goal 8); in the column's 16px gap, so they keep no margin
   of their own, and the section title sits 8px over its first card as on every pocket page. */
.exchange > .pocket-search,
.exchange > .pocket-filter-bar,
.exchange > .pocket-got-it-card {
    margin-bottom: 0;
}

.exchange > .pocket-section-title {
    margin-bottom: calc(var(--pocket-space-sm) - var(--pocket-space-lg));
}

/* The shared card look (.pocket-ledger: the card radius and shadow, no border; goal 8). */
.exchange-feed-card {
    position: relative;
    overflow: hidden;
    border: 0;
    border-radius: var(--pocket-card-radius);
    background: var(--exchange-card);
    box-shadow: var(--pocket-card-shadow);
}

/* The card is an article: the link covers photo and text, the heart sits over the photo (screen 1). */
.exchange-feed-link {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}

.exchange-feed-heart {
    position: absolute;
    top: 12px;
    right: 12px;
}

.exchange-feed-seller {
    font-weight: 600;
}

.exchange-feed-photo {
    position: relative;
    display: block;
    height: 200px;
    background: var(--photo-placeholder);
}

.exchange-feed-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* No photo, no photo box: the heart then sits over the text, so the body leaves it room. */
.exchange-feed-card:not(:has(.exchange-feed-photo)) .exchange-feed-body {
    padding-right: 60px;
}

.exchange-feed-badge {
    position: absolute;
    top: 12px;
    left: 12px;
}

.exchange-feed-count {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--scrim-badge);
    color: var(--on-photo);
    font: 600 var(--pocket-font-size-xs) 'Barlow', sans-serif;
}

.exchange-feed-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px 14px;
}

.exchange-feed-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font: 600 19px/1.25 'Barlow', sans-serif;
}

/* The description's headline on a feed card: the strongest herd fact, under the title (wraps at 390px). */
.exchange-feed-headline {
    font-size: var(--pocket-font-size-xs);
    color: var(--exchange-ink2);
}

.exchange-verified {
    color: var(--exchange-good);
    font-weight: 600;
}

.exchange-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.exchange-tag,
.exchange-kind {
    padding: 4px 10px;
    border-radius: 8px;
    background: var(--exchange-line2);
    color: var(--exchange-ink2);
    font: 600 var(--pocket-font-size-xs) 'Barlow', sans-serif;
}

/* The seller's Ranch or Broker tag beside their name (docs/features/EXCHANGE_BROKERS.md goal 6): an .exchange-tag, smaller,
   on the name's line; a broker's is outlined instead of filled, the one visual difference. */
.exchange-kind {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid transparent;
    vertical-align: middle;
    white-space: nowrap;
}

.exchange-kind-broker {
    background: transparent;
    border-color: var(--exchange-ink2);
}

.exchange-fab {
    position: fixed;
    right: 16px;
    bottom: calc(var(--pocket-dock-height) + 16px);
    z-index: 20;
    display: inline-flex;
    align-items: center;
    min-height: 52px;
    padding: 0 22px;
    border-radius: 26px;
    background: var(--exchange-accent);
    color: var(--on-brand);
    font: 700 18px 'Barlow', sans-serif;
    text-decoration: none;
    box-shadow: 0 8px 24px var(--brand-glow-strong);
}

/* Selling's invite card (EXCHANGE_RULES M13): the row itself is pocket.css's .pocket-field-row. */
.exchange-invite-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

/* A guest's way in as a seller (docs/features/EXCHANGE_DOOR.md goal 1): a plain link at the feed's foot, not the + Sell button. */
.exchange-feed-foot {
    margin: 16px 0 8px;
    text-align: center;
}

.exchange-feed-foot a {
    display: inline-block;
    padding: 12px 8px;
    color: var(--exchange-accent);
    font-weight: 600;
}

/* The seller's answers to buyers' "I bought from this listing" on Selling (M14). */
.exchange-claim-answers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* Sell's card per group (docs/features/EXCHANGE_LISTING_WRITER.md Phase 2, mockup boards Main, Edit, Writing,
   Fallback): what buyers will see, Edit and Rewrite, the text box, then Enhance listing. */
.exchange-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.exchange-buyers-see {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border-radius: 12px;
    background: var(--pocket-bg);
}

.exchange-text-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.exchange-text-tools { display: inline-flex; gap: 4px; margin-right: -10px; }

.exchange-text-tool,
.exchange-text-link,
.exchange-rewrite-menu button {
    min-height: var(--pocket-target-min);
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: var(--exchange-accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.exchange-text-link { min-height: 0; padding: 0; text-decoration: underline; }

.exchange-rewrite-menu {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--exchange-line);
    border-radius: 12px;
    background: var(--exchange-card);
    overflow: hidden;
}

.exchange-rewrite-menu[hidden] { display: none; }
.exchange-rewrite-menu .exchange-label { padding: 10px 12px 4px; }

.exchange-rewrite-menu button {
    padding: 0 12px;
    border-top: 1px solid var(--exchange-line2);
    color: var(--exchange-ink);
    font-weight: 500;
    text-align: left;
}

/* The text keeps its last words while a new one is written (no layout shift); a shimmer says it is writing. */
.exchange-text-region { min-height: 72px; }
.exchange-text-region .exchange-description { margin: 0; padding: 0; border: 0; background: none; }
.exchange-text-notice { margin: 0; }

.exchange-text-writing {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    font-weight: 600;
    color: var(--exchange-accent);
}

.exchange-text-writing[hidden] { display: none; }

.exchange-shim {
    width: 92%;
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--exchange-line2) 0%, var(--exchange-card) 50%, var(--exchange-line2) 100%);
    background-size: 400px 100%;
    animation: exchange-shimmer 1.2s linear infinite;
}

.exchange-shim-short { width: 58%; }

@keyframes exchange-shimmer {
    from { background-position: -200px 0; }
    to { background-position: 200px 0; }
}

@media (prefers-reduced-motion: reduce) {
    .exchange-shim { animation: none; }
}

.exchange-text-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.exchange-text-editor[hidden] { display: none; }
.exchange-text-input { resize: vertical; font-size: 17px; line-height: 1.4; }

/* Enhance listing: the card's call to action (one 52px line, its band on the right) and its sheet. */
.exchange-enhance-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 10px 16px;
    border: 1px solid var(--exchange-accent);
    border-radius: 12px;
    background: var(--exchange-card);
    color: var(--exchange-accent);
    font: inherit;
    cursor: pointer;
}

.exchange-enhance-cta[hidden] { display: none; }
.exchange-enhance-cta-wrap { display: flex; flex-direction: column; gap: 8px; }
.exchange-enhance-title { font-weight: 600; font-size: 17px; }

/* The sheet is tall: what buyers will see stays pinned at the top of its scrolling body. */
.exchange-enhance-content {
    height: 92vh;
    height: 92dvh;
    max-height: none;
    background: var(--pocket-bg);
}

.exchange-enhance-body {
    display: flex;
    flex-direction: column;
    gap: var(--pocket-space-lg);
    padding-inline: 16px;
}

.exchange-enhance-pinned {
    position: sticky;
    top: 0;
    z-index: 1;
    padding-top: 8px;
    background: var(--pocket-bg);
}

.exchange-enhance-pinned .exchange-buyers-see {
    border: 1px solid var(--exchange-line);
    background: var(--exchange-card);
}

/* In the sheet the text is read, not edited: Edit lives on the card. */
.exchange-enhance-pinned [data-text-edit] { display: none; }

.exchange-enhance-animal {
    display: flex;
    flex-direction: column;
    gap: var(--pocket-space-lg);
}

.exchange-enhance-animal[hidden] { display: none; }

.exchange-enhance-purpose {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.exchange-enhance-purpose p { margin: 0; flex: 1; }

.exchange-enhance-help {
    flex: none;
    min-width: var(--pocket-target-min);
    min-height: var(--pocket-target-min);
    padding: 0;
}

.exchange-enhance-saved { margin: 0; font-weight: 600; }

/* Sell's folded Terms and Papers and notes (G9): the line says what is set; the body holds the fields. */
.exchange-fold { padding: 4px 14px; }
.exchange-fold-summary { margin-top: 0; border-top: 0; font-size: var(--pocket-font-size-sm); }
.exchange-fold-text { display: flex; flex-direction: column; }
.exchange-fold-title { font-weight: 600; font-size: 17px; color: var(--exchange-ink); }
.exchange-fold-body { display: flex; flex-direction: column; gap: var(--pocket-space-lg); padding-bottom: 12px; }

.exchange-shine-words { margin-bottom: 6px; }

/* Ticked facts the preview does not print yet, each with what to do (Phase 3 G8). */
.exchange-shine-pending {
    margin: 8px 0 0;
    padding-left: 20px;
    font-size: var(--pocket-font-size-xs);
}

.exchange-shine-band { margin: 10px 0 4px; }

.exchange-shine-meter {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.exchange-shine-meter span {
    height: 6px;
    border-radius: 3px;
    background: var(--exchange-line);
}

.exchange-shine-strength[data-strength="1"] .exchange-shine-meter span:nth-child(-n+1) { background: var(--down); }
.exchange-shine-strength[data-strength="2"] .exchange-shine-meter span:nth-child(-n+2) { background: var(--exchange-high); }
.exchange-shine-strength[data-strength="3"] .exchange-shine-meter span { background: var(--exchange-good); }

.exchange-hurts-flag {
    margin: 8px 0 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--danger-bg);
    color: var(--danger-text);
    font-size: var(--pocket-font-size-sm);
}

.exchange-shine-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.exchange-shine-group legend { padding: 0; }

/* A fact row: one label with its checkbox, the full width of the column (a modifier on .exchange-sold-pick). */
.exchange-shine-pick {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    padding: 10px 14px;
    border: 1px solid var(--exchange-line);
    border-radius: 14px;
    background: var(--exchange-card);
    cursor: pointer;
}

/* The base pick's ticked "✓" would be a grid item of its own here; the label carries it instead (the shared
   rule above). */
.exchange-shine-pick:has(input:checked)::before { content: none; }

/* pressed: the tap is acknowledged; a Hurts fact My Herd records (review N9) has nothing to press, its tick only
   shows whether the listing states it */
.exchange-shine-pick:not(:has(input:disabled)):active { background: var(--exchange-line2); }
.exchange-shine-pick:has(input:disabled) { cursor: default; border-style: dashed; }  /* locked: a shape, not a colour */

.exchange-shine-pick:has(input:checked) {
    border-color: var(--exchange-accent);
    background: var(--exchange-accent-soft);
}

.exchange-shine-hurts .exchange-shine-pick:has(input:checked) {
    border-color: var(--danger-text);
    background: var(--danger-bg);
}

.exchange-shine-label { font-weight: 600; }

.exchange-shine-verdict {
    grid-column: 1;
    font-size: var(--pocket-font-size-xs);
    color: var(--exchange-mute);
}

.exchange-shine-lift {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    font: 600 var(--pocket-font-size-sm) var(--exchange-num);
    text-align: right;
}

.exchange-shine-hurts .exchange-shine-lift { color: var(--danger-text); }

.exchange-shine-note { padding: 0 14px; }

.exchange-shine-input { padding: 4px 14px 0; }

