/* ── A save set's page (/saves/{slug}) ─────────────────────
   Loaded after saves.css (its .sv tokens, price block, steps and photo sheet). Header: wide game art
   on the end side fading into the card, the official cover and the set's name over the start side.
   Then the buy box (a sticky side column on wide screens, first on phones) and what the set contains.
   No inline styles: the CSP forbids them. */
.sd { --card: #161b22; --chip-bg: rgba(255, 255, 255, .05); }
html:not(.dark) .sd { --card: #ffffff; --chip-bg: rgba(15, 23, 42, .04); }

.sd-crumbs { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: .9375rem; color: var(--muted); min-width: 0; }
.sd-crumb-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--muted); font-weight: 600; text-decoration: none; border-radius: 8px; }
.sd-crumb-back:hover { color: var(--ink); }
.sd-crumb-back:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sd-crumb-back svg { width: 18px; height: 18px; }
[dir="rtl"] .sd-crumb-back svg { scale: -1 1; }
.sd-crumbs [aria-current] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }

/* ── Header ─────────────────────────────────────────────── */
.sd-hero {
    position: relative; isolation: isolate; overflow: hidden;
    border: 1px solid var(--line); border-radius: 28px; background: var(--card);
}
/* The art fades in slowly, so the text over its start edge stays on mostly plain card. */
.sd-art { position: absolute; inset-block: 0; inset-inline-end: 0; width: 60%; z-index: -1; }
.sd-art-img {
    display: block; width: 100%; height: 100%; object-fit: cover; object-position: 70% center;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, .3) 32%, #000 68%);
    mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, .3) 32%, #000 68%);
}
/* Mirrored layout, unmirrored art (it may carry a logo): the middle of the picture shows. */
[dir="rtl"] .sd-art-img {
    object-position: center;
    -webkit-mask-image: linear-gradient(to left, transparent 0%, rgba(0, 0, 0, .3) 32%, #000 68%);
    mask-image: linear-gradient(to left, transparent 0%, rgba(0, 0, 0, .3) 32%, #000 68%);
}
/* No wide art: the cover, blurred, as colour across the whole card. */
.sd-hero.no-art .sd-art { width: 100%; }
.sd-art-blur { display: block; width: 100%; height: 100%; object-fit: cover; filter: blur(56px) saturate(160%); scale: 1.3; opacity: .45; }
html:not(.dark) .sd-art-blur { opacity: .35; }

.sd-hero-inner {
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
    gap: clamp(20px, 3vw, 40px); padding: clamp(24px, 4vw, 52px);
}
.sd-meta { min-width: 0; max-width: 36rem; }
.sd-cover {
    display: block; width: clamp(150px, 16vw, 220px); aspect-ratio: 1; overflow: hidden; border-radius: 20px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 24px 50px -20px rgba(0, 0, 0, .75) !important;
    transition: transform var(--dur-press) var(--ease-out);
}
html:not(.dark) .sd-cover { box-shadow: 0 0 0 1px rgba(15, 23, 42, .08), 0 24px 50px -24px rgba(15, 23, 42, .45) !important; }
.sd-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sd-cover:active { transform: scale(var(--press-scale)); transition-duration: 100ms; }
.sd-cover:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }

.sd-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: .875rem; }
.sd-chip-pf { display: inline-flex; }
.sd-chip {
    display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px;
    border: 1px solid var(--line-strong); border-radius: 999px; background: var(--chip-bg);
    font-size: .8125rem; font-weight: 600; color: var(--ink);
}
.sd-chip svg { width: 15px; height: 15px; }
.sd-chip.is-id {
    border-color: transparent; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em;
}
.sd-chip.is-status { color: var(--muted); }
.sd-title {
    margin: 16px 0 0; font-size: clamp(2.25rem, 5.4vw, 4rem); line-height: 1.02; letter-spacing: -0.03em;
    color: var(--ink); text-wrap: balance; overflow-wrap: anywhere;
}
html[lang="ar"] .sd-title { line-height: 1.25; letter-spacing: 0; }
.sd-set { margin: 12px 0 0; font-size: clamp(1.0625rem, 1.9vw, 1.375rem); font-weight: 700; line-height: 1.3; color: var(--brand); text-wrap: balance; }
.sd-set .sv-label { font-size: .75rem; min-height: 24px; }
/* The game's other sets, as on its /saves card: each chip is that set's page. */
.sd-sets { margin-top: 14px; max-width: 34rem; }
.sd-buy .sv-custom-note { margin-top: 12px; }
.sd-summary { margin: 14px 0 0; max-width: 38rem; font-size: 1.0625rem; line-height: 1.55; color: var(--muted); }
.sd-hl { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; padding: 0; list-style: none; }
.sd-hl li {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
    border: 1px solid var(--line-strong); border-radius: 12px; background: var(--chip-bg);
    font-size: .9375rem; font-weight: 600; color: var(--ink);
}
.sd-hl svg { width: 16px; height: 16px; flex: none; color: var(--brand); }
.sd-store {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin-top: 14px;
    font-size: .875rem; font-weight: 600; color: var(--muted);
    text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; border-radius: 6px;
}
.sd-store:hover { color: var(--ink); text-decoration-color: currentColor; }
.sd-store:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sd-store svg { width: 15px; height: 15px; }
[dir="rtl"] .sd-store svg { scale: -1 1; }

/* ── Body ───────────────────────────────────────────────── */
.sd-body { display: grid; gap: 28px; margin-top: 28px; }
.sd-main { display: grid; gap: clamp(32px, 4vw, 48px); min-width: 0; }
.sd-section { scroll-margin-top: 96px; }
.sd-section .sv-h2 { margin-bottom: 16px; }
.sd-buy {
    display: grid; gap: 14px; align-content: start; padding: 22px;
    border: 1px solid var(--line); border-radius: 22px; background: var(--card);
}
/* One column, no wrapping (in a column a wrapping row would start a second column beside the box). */
.sd-buy .sv-buy-row { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 14px; }
.sd-buy .sv-join { flex-basis: auto; }
.sd-buy .sv-price { font-size: 2rem; }
.sd-buy .sv-price.is-ask { font-size: 1.125rem; }
.sd-buy .sv-price-was { font-size: 1.125rem; }
.sd-buy .sv-buy { width: 100%; min-height: 52px; font-size: 1.0625rem; }
.sd-buy .sv-soon { justify-content: center; min-height: 48px; border: 1px dashed var(--line-strong); border-radius: 999px; }
.sd-buy .sv-join { margin: 0; text-align: center; }
.sd-buy-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: .8125rem; line-height: 1.45; color: var(--muted); }
.sd-buy-note svg { width: 18px; height: 18px; flex: none; color: var(--brand); }
@media (min-width: 960px) {
    .sd-body { grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem); grid-template-areas: "main buy"; gap: 40px; margin-top: 40px; }
    .sd-main { grid-area: main; }
    .sd-buy { grid-area: buy; position: sticky; top: calc(var(--nav-h, 72px) + 20px); }
}

.sd-checks li { font-size: 1rem; }
.sd-text { margin: 0; font-size: 1rem; line-height: 1.55; color: var(--muted); }
.sd-ask {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 12px; padding: 0 18px;
    border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink);
    font-size: .9375rem; font-weight: 600; text-decoration: none;
    transition: border-color 150ms ease, transform var(--dur-press) var(--ease-out);
}
.sd-ask svg { width: 17px; height: 17px; flex: none; color: var(--brand); }
.sd-ask:hover { border-color: var(--brand); }
.sd-ask:active { transform: scale(var(--press-scale)); transition-duration: 100ms; }
.sd-ask:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.sd-ask.is-center { justify-content: center; margin-top: 0; }
.sd-steps { margin-top: 0; }

.sd-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(11rem, 100%), 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.sd-shot { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 14px; background: var(--surface); }
.sd-shot img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity 150ms var(--ease-out), scale 400ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .sd-shot:hover img { scale: 1.03; } }
.sd-shot:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ── More saves ─────────────────────────────────────────── */
.sd-more { margin-top: clamp(40px, 6vw, 64px); }
.sd-more .sv-section-head { margin-bottom: 16px; }
.sd-more-all { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; font-size: .9375rem; font-weight: 600; color: var(--brand); text-decoration: none; border-radius: 6px; }
.sd-more-all:hover { text-decoration: underline; text-underline-offset: 3px; }
.sd-more-all:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sd-more-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.sd-more-item {
    display: flex; align-items: center; gap: 14px; min-height: 76px; padding-block: 10px; padding-inline: 10px 14px;
    border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: inherit; text-decoration: none;
    transition: border-color 150ms ease, transform var(--dur-press) var(--ease-out);
}
.sd-more-item:hover { border-color: color-mix(in srgb, var(--brand) 55%, transparent); }
.sd-more-item:active { transform: scale(var(--press-scale)); transition-duration: 100ms; }
.sd-more-item:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.sd-more-thumb { width: 56px; height: 56px; flex: none; overflow: hidden; border-radius: 12px; background: var(--chip-bg); }
.sd-more-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sd-more-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sd-more-game { font-size: 1rem; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.sd-more-set { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
[dir="rtl"] .sd-more-set { letter-spacing: 0; }

/* ── Phones: the art becomes a band across the top; the cover overlaps its lower edge. ── */
@media (max-width: 767px) {
    .sd-hero { border-radius: 24px; }
    .sd-hero:not(.no-art) .sd-art { position: relative; width: 100%; aspect-ratio: 16 / 9; z-index: 0; }
    .sd-hero:not(.no-art) .sd-art-img,
    [dir="rtl"] .sd-hero:not(.no-art) .sd-art-img {
        object-position: 60% center;
        -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
        mask-image: linear-gradient(to bottom, #000 55%, transparent);
    }
    .sd-hero-inner { grid-template-columns: 1fr; align-items: start; gap: 18px; padding: 0 20px 24px; }
    .sd-hero.no-art .sd-hero-inner { padding-top: 24px; }
    .sd-hero:not(.no-art) .sd-hero-inner { position: relative; margin-top: -72px; }
    .sd-cover { width: 120px; border-radius: 16px; }
    .sd-title { margin-top: 12px; }
}

/* ── Preferences ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .sd-shot:hover img { scale: none; }
    .sd-cover:active, .sd-more-item:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
    .sd-art-blur { display: none; }
}
@media (prefers-contrast: more) {
    .sd-art-img { -webkit-mask-image: none; mask-image: none; opacity: .25; }
}

/* A set's header, price and contents panels (one per set of the game, js/save-sets.js): the hero's own
   spacing applies, not the cards' gap. A set that isn't on sale says so under its title. */
.sd-set-head { gap: 0; }
.sd-status { align-self: flex-start; margin: 12px 0 0; }
/* Inside a set panel (a flex column) the Ask link keeps its own width, as before. */
.sv-set > .sd-ask { align-self: flex-start; }
.sv-set > .sd-ask.is-center { align-self: stretch; }
