/* ============================================================
 * user_ui — Item page.
 * ============================================================
 *
 * Page-local stylesheet of the public item page
 * (`item/item_page.html`): the hero's spacing, the row under it (the
 * image, the boxed description and the price box with a universal group
 * member's link to its group and "Sell now" / "Buy now"), the details
 * panel, and the "Similar items" grid with its boxed heading and its
 * pager last. Loaded only by that template through the base shell's
 * {% block extra_css %}. Everything is scoped under `.item-page`;
 * colours, radii and type come from shared/tokens.css
 * (documentation/user/DESIGN_SYSTEM.md), so both themes work unchanged.
 * "Sell now" and "Buy now" are the shared `.btn.primary.sm`, greyed out
 * by shared/buttons.css when the template renders one as a disabled
 * <button>; this sheet only stacks them full width at the price box's
 * bottom and gives the links their focus ring.
 *
 * The hero is the Price List's: its title and lead are the shared hero
 * copy (shared/page_hero.css), the band behind it and the mascot on its
 * right are the shared ones (shared/decorations.css lists `.item-page`).
 * This sheet only spaces it, and keeps it tall enough to hold the
 * mascot, which sits out of flow: a short title would otherwise leave
 * the mascot hanging over the price box.
 *
 * `.item-box` is the one card look of the page — surface, border,
 * radius — shared by the image, the description, the price box and the
 * details panel; each sets its own padding. The "Similar items" section
 * is not boxed: its cards sit on the page, and only its heading wears
 * the same look, as a small label, so the site-wide background lines
 * never run behind the title.
 *
 * The row is a grid of named areas: image, description, price box on
 * wide screens; image and price box over the description on tablets;
 * image, price box, description stacked on phones — the template's
 * order. Without a description the wide row keeps its empty middle, so
 * the image and the price box keep their sides; on tablets and phones
 * the description row is declared only on `.has-description` (set by
 * the template), so no empty row adds its gap above the details panel.
 *
 * On wide screens (the three-column row, above 960px) the row is one
 * 300px track (`--item-row-height`) and its boxes stretch to it, so the
 * 300×300 image, the description and the price box are all exactly
 * 300px tall: a longer description scrolls inside its box, and the
 * price box keeps its prices and group link at the top and the two
 * buttons pinned to its bottom. From 960px down the track is dropped
 * and the boxes are top-aligned at their natural height, the image
 * still a square.
 *
 * The images come from Steam's CDNs, so their size is not known when the
 * page is written (DESIGN_SYSTEM.md §11, "CDN-sourced thumbnails"): each
 * art box reserves a square with `aspect-ratio`, and the image sits out
 * of flow inside it, contained.
 *
 * Located at ui/user/static/user_ui/css/item/item_page.css
 * ============================================================ */

/* ---------- HERO ----------
 * The min-height holds the shared mascot (decorations.css: 14px above
 * the copy, 300px tall; 6px below it and 200px tall from 1024px down; in
 * flow from 760px down). */
.item-page .item-hero {
    padding: 56px 0 24px;
}
.item-page .item-hero .wrap {
    min-height: 290px;
}

/* ---------- BODY AND ROW ---------- */
.item-page .item-body {
    position: relative;
    z-index: 1;
    padding: 0 0 100px;
}
.item-page .item-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}
/* The image column is as wide as the row is tall, so the image box is a
   300×300 square. */
.item-page .item-layout {
    --item-row-height: 300px;
    display: grid;
    grid-template-columns: var(--item-row-height) minmax(0, 1fr) 320px;
    grid-template-rows: var(--item-row-height);
    grid-template-areas: "art description price";
    gap: 28px;
    align-items: stretch;
}

/* ---------- IMAGE ---------- */
.item-page .item-art {
    grid-area: art;
    position: relative;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.item-page .item-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 18px;
}
.item-page .item-art-empty {
    width: 40%;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    background: var(--bg-2);
}

/* ---------- DESCRIPTION ---------- */
.item-page .item-description-box {
    grid-area: description;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
}
/* A tab stop (tabindex="0"), so a keyboard can scroll a long text. */
.item-page .item-description-box:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}
.item-page .item-description {
    margin: 0;
    color: var(--text);
    font-size: 15.5px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

/* ---------- PRICE BOX ----------
 * A column: the info part (heading, price lines, group link) takes the
 * room the buttons leave, so in the 300px row the buttons sit at the
 * box's bottom. Should the info ever outgrow that room (a group name
 * wrapping onto several lines), it scrolls inside its part and the
 * buttons stay in view. The info part reaches 4px into the box's
 * padding (negative margin, matching padding) so its scroll clip does
 * not cut the group link's focus ring (2px outline, 2px offset). */
.item-page .item-price-box {
    grid-area: price;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    padding: 20px;
}
.item-page .item-price-info {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin: -4px;
    padding: 4px;
}
.item-page .item-box-heading {
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-mute);
    margin: 0 0 14px;
}
.item-page .item-price-lines {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}
.item-page .item-price-line {
    margin: 0;
    color: var(--text);
    font-size: 17px;
    line-height: 1.4;
}
.item-page .item-price-line.is-closed {
    color: var(--text-dim);
    font-size: 15px;
}
.item-page .item-price-amount {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 700;
    color: var(--orange);
}
.item-page .item-price-group {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.5;
}
.item-page .item-price-group-link {
    color: var(--orange);
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}
.item-page .item-price-group-link:hover {
    color: var(--text);
}
.item-page .item-price-group-link:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
    border-radius: 2px;
}
/* One column: each button fills the box's width, "Sell now" over "Buy
   now" (the template's order). */
.item-page .item-trade-actions {
    flex: 0 0 auto;
    display: grid;
    gap: 8px;
}
.item-page .item-trade-action:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

/* ---------- DETAILS ---------- */
.item-page .item-details {
    margin-top: 40px;
    padding: 24px 28px;
}
.item-page .item-details-list {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    column-gap: 32px;
}
.item-page .item-details-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-2);
}
.item-page .item-details-row dt {
    color: var(--text-mute);
    font-size: 14px;
}
.item-page .item-details-row dd {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

/* ---------- SIMILAR ITEMS ----------
 * No box around the section: the cards sit on the page. The heading is
 * a section title, twice the box headings' size (28px), bold in the
 * accent colour, inside a small label with the `.item-box` look, so the
 * background lines never cross it. Five columns by two rows on wide
 * screens, fewer below. Each card (`--surface-2`) has its art box
 * reserving a square like the main image (CDN-sourced, size unknown),
 * with a killstreak kit's target weapon laid over its corner.
 *
 * The cards of a row are even, like the Trade page's
 * (trade/trade.css, `.trade-page .item-name`): the name is clamped to
 * three lines with the '…' at the end of the third, in a box exactly
 * three line boxes tall for every card, its spacing kept outside it
 * (overflow clips at the padding edge, so a padding inside the box would
 * show part of the line after the clamped one). Under it "Buy at" and
 * "Sell at" are one line each, cut with '…' rather than wrapped, so both
 * sit at the same height in every card. Both amounts are bold in the
 * accent colour the price box's amounts use. The pager is rendered
 * `hidden` and shown by item_page.js; its `display: flex` would
 * otherwise override the attribute, hence the `[hidden]` rule. */
.item-page .item-similar {
    margin-top: 40px;
}
.item-page .item-similar-heading {
    width: fit-content;
    max-width: 100%;
    margin: 0 0 18px;
    padding: 8px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    font-family: var(--font-head);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--orange);
    overflow-wrap: anywhere;
}
.item-page .item-similar-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 18px;
}
.item-page .item-similar-grid[aria-busy="true"] {
    opacity: .6;
}
.item-page .item-similar-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}
.item-page .item-similar-link {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius);
}
.item-page .item-similar-link:hover {
    color: var(--orange);
}
.item-page .item-similar-link:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}
.item-page .item-similar-art {
    position: relative;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: var(--bg-2);
    border-radius: var(--radius);
}
.item-page .item-similar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}
.item-page .item-similar-overlay {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 45%;
    height: 45%;
    object-fit: contain;
}
.item-page .item-similar-art-empty {
    width: 40%;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    background: var(--line);
}
.item-page .item-similar-name {
    flex: 0 0 auto;
    height: calc(3 * 1.35em);
    min-height: 0;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.item-page .item-similar-prices {
    display: grid;
    gap: 2px;
}
.item-page .item-similar-price {
    margin: 0;
    color: var(--text-dim);
    font-size: 12.5px;
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-page .item-similar-amount {
    font-weight: 700;
    color: var(--orange);
}
.item-page .item-similar-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}
.item-page .item-similar-pager[hidden] {
    display: none;
}
.item-page .item-similar-nav {
    height: 40px;
    padding: 0 18px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.item-page .item-similar-nav:hover {
    border-color: var(--orange);
    color: var(--orange);
}
.item-page .item-similar-nav:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}
/* After :hover, so a disabled button does not light up under the pointer. */
.item-page .item-similar-nav:disabled {
    opacity: .45;
    cursor: default;
    border-color: var(--line);
    color: var(--text);
}
.item-page .item-similar-status {
    color: var(--text-mute);
    font-size: 14px;
}
.item-page .item-similar-error {
    margin: 12px 0 0;
    color: var(--orange);
    font-size: 14px;
    text-align: center;
}
.item-page .item-similar-error:empty {
    margin: 0;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) {
    .item-page .item-layout {
        grid-template-columns: var(--item-row-height) minmax(0, 1fr) 280px;
        gap: 24px;
    }
    .item-page .item-similar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
    .item-page .item-hero .wrap { min-height: 210px; }
}
@media (max-width: 960px) {
    .item-page .item-layout {
        grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
        grid-template-rows: none;
        grid-template-areas: "art price";
        align-items: start;
    }
    .item-page .item-layout.has-description {
        grid-template-areas:
            "art price"
            "description description";
    }
    .item-page .item-similar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .item-page .item-hero { padding: 40px 0 20px; }
}
@media (max-width: 760px) {
    .item-page .item-hero .wrap { min-height: 0; }
    .item-page .item-body { padding: 0 0 60px; }
    .item-page .item-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "art"
            "price";
        gap: 18px;
    }
    .item-page .item-layout.has-description {
        grid-template-areas:
            "art"
            "price"
            "description";
    }
    .item-page .item-art { width: 100%; max-width: 320px; }
    .item-page .item-details { padding: 18px 20px; }
    .item-page .item-details-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .item-page .item-similar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
