/* ============================================================================
   Mindprint — the pattern page (public half).

   Consumes the canonical tokens from tokens.css; never redefines an --mp-* name.
   This is brand surface, not admin: the chrome is pure black and the artwork
   supplies every colour on the screen (D30). The one exception is deliberate —
   the pattern's own stored primary_color blooms behind its tile, which is the
   design system's "data-driven glow, used sparingly".

   Classes are pd-* prefixed so this layer and admin.css (loaded on the same page
   for an operator) can never reach into each other.
   ========================================================================== */

:root {
  --pd-wrap: 1180px;
}

/* The one piece of chrome that is not brand surface: an operator previewing the
   visitor's view of a record a visitor could not load. Peach, like every other
   "in flight, not final" state in the system. */
.pd-preview-note {
  max-width: var(--pd-wrap);
  margin: 14px auto -14px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 201, 160, .28);
  border-left: 3px solid var(--mp-peach);
  border-radius: 12px;
  background: rgba(255, 201, 160, .07);
  font-family: var(--mp-mono);
  font-size: 11px;
  line-height: 1.8;
  color: var(--mp-peach);
}

/* ══════════════════════════════════════════════════════════════════════════
   2 · Layout — art beside dossier, stacking under 900px.
   ═══════════════════════════════════════════════════════════════════════ */

.pd {
  max-width: var(--pd-wrap);
  margin: 0 auto;
  padding: clamp(26px, 5vh, 56px) clamp(16px, 3vw, 32px) clamp(56px, 9vh, 96px);
}

.pd-main {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

@media (max-width: 900px) {
  .pd-main { grid-template-columns: minmax(0, 1fr); }
}

/* ══════════════════════════════════════════════════════════════════════════
   3 · The artwork.

        The tile is the product. It gets the largest, quietest frame on the
        page, and the only colour treatment: a bloom in its own dominant hue,
        set inline from the pattern's stored primary_color. --pd-bloom degrades
        to transparent, so a pattern with no recorded colour simply has no glow
        rather than borrowing a house one.
   ═══════════════════════════════════════════════════════════════════════ */

.pd-stage {
  position: relative;
  isolation: isolate;
  border-radius: calc(var(--mp-r-card) + 8px);
}

/* The bloom itself — behind the tile, wider than it, and clipped by nothing. */
.pd-stage::before {
  content: "";
  position: absolute;
  inset: -14% -14% -20%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    color-mix(in srgb, var(--pd-bloom, transparent) 34%, transparent),
    transparent 72%);
  filter: blur(14px);
  pointer-events: none;
}

.pd-art {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--mp-r-card);
  overflow: hidden;
  border: 1px solid var(--mp-line);
  background: #0B0B0D;
}

.pd-art-single,
.pd-art-tiled {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transition: opacity .28s ease;
}

.pd-art-single { object-fit: cover; opacity: 1; }

/* 3×3 of the same file: the honest proof that the tile wraps, using the only
   asset that can prove it. Nine repeats is enough to read a lattice and few
   enough that the motif is still legible. */
.pd-art-tiled {
  background-image: var(--pd-tile);
  background-size: 33.3333% 33.3333%;
  background-repeat: repeat;
  opacity: 0;
}

.pd-art.is-tiled .pd-art-single { opacity: 0; }
.pd-art.is-tiled .pd-art-tiled { opacity: 1; }

/* The seam lines, drawn only while tiled — they say where to look. */
.pd-art-tiled::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, transparent calc(33.3333% - .5px), rgba(255, 255, 255, .22) calc(33.3333% - .5px) calc(33.3333% + .5px), transparent calc(33.3333% + .5px)),
    linear-gradient(to right, transparent calc(66.6666% - .5px), rgba(255, 255, 255, .22) calc(66.6666% - .5px) calc(66.6666% + .5px), transparent calc(66.6666% + .5px)),
    linear-gradient(to bottom, transparent calc(33.3333% - .5px), rgba(255, 255, 255, .22) calc(33.3333% - .5px) calc(33.3333% + .5px), transparent calc(33.3333% + .5px)),
    linear-gradient(to bottom, transparent calc(66.6666% - .5px), rgba(255, 255, 255, .22) calc(66.6666% - .5px) calc(66.6666% + .5px), transparent calc(66.6666% + .5px));
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}

.pd-art.show-seams .pd-art-tiled::after { opacity: 1; }

.pd-art-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* Everything here reads as one row of art tools — a second, ragged line looks
   like a layout bug rather than a design choice. Below the layout stack (900px)
   there is only ever "Inspect the weave" (or its "Show the tile"/"Show tile
   edges" pair) plus the rating pair to fit, so a hard nowrap is safe; the
   scroll fallback only matters for extreme zoom or very long pattern names
   feeding into other .hbtn labels sharing this row in future. */
@media (max-width: 900px) {
  .pd-art-tools {
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .pd-art-tools::-webkit-scrollbar { display: none; }
}

/* The dossier column's action row — today just the heart (D56). */
.pd-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   4 · The dossier.
   ═══════════════════════════════════════════════════════════════════════ */

.pd-dossier > * + * { margin-top: 18px; }

.pd-eyebrow {
  margin: 0;
  font-family: var(--mp-mono);
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: 10.5px;
  color: var(--mp-mute);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pd-eyebrow .sep { color: var(--mp-line); }
.pd-eyebrow .new { color: var(--mp-peach); }

.pd-title {
  margin: 0;
  font-family: var(--mp-display);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.02;
  font-size: clamp(34px, 4.6vw, 58px);
  overflow-wrap: anywhere;
}

/* The dossier phrase — the enrichment's one-line read on the pattern, and per
   the designs the line that sits directly under the name. */
.pd-phrase {
  margin: 0;
  font-family: var(--mp-mono);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--mp-dim);
}

.pd-desc {
  margin: 0;
  max-width: 54ch;
  font-size: 15px;
  line-height: 1.75;
  color: var(--mp-dim);
}

.pd-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pd-tag {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  border-radius: var(--mp-r-pill);
  background: var(--mp-raise);
  border: 1px solid var(--mp-line);
  font-family: var(--mp-mono);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 10px;
  color: var(--mp-dim);
}

/* ── Ownership (D13–D16) — the collector hook, in one card ───────────────── */

.pd-own {
  --pd-own-tint: var(--mp-line-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--mp-line);
  border-left: 3px solid var(--pd-own-tint);
  border-radius: var(--mp-r-card);
  background: var(--mp-surface);
}

.pd-own-claimable { --pd-own-tint: var(--mp-pink); }
.pd-own-open      { --pd-own-tint: var(--mp-line-soft); }
.pd-own-markedup  { --pd-own-tint: var(--mp-peach); }
.pd-own-exclusive { --pd-own-tint: #E4344B; }

.pd-own-kind {
  font-family: var(--mp-mono);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 10px;
  color: var(--pd-own-tint);
  font-weight: 700;
}

.pd-own-lead {
  margin: 0;
  font-family: var(--mp-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.01em;
  color: var(--mp-ink);
}

.pd-own-note {
  margin: 0;
  font-family: var(--mp-mono);
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--mp-mute);
}

/* ══════════════════════════════════════════════════════════════════════════
   5 · Wear it on — the garment strip.
   ═══════════════════════════════════════════════════════════════════════ */

.pd-section {
  margin-top: clamp(40px, 7vh, 72px);
}

.pd-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-family: var(--mp-mono);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 10.5px;
  color: var(--mp-mute);
}

.pd-section-head b { color: var(--mp-dim); font-weight: 400; }

.pd-garments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pd-garment {
  border: 1px solid var(--mp-line);
  border-radius: var(--mp-r-card);
  background: var(--mp-surface);
  transition: border-color .15s;
}

.pd-garment:hover { border-color: rgba(255, 255, 255, .30); }

/* The tile became a doorway into the fitting room; the link owns the layout the li had. */
.pd-garment-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  color: inherit;
  text-decoration: none;
}

/* The frosted pane, at strip scale — the same treatment the New & Featured grid and the garment
   shelves carry (storefront.css), reached differently: the link's own padding is already the mat
   and the tile is already rounded, so the tint goes straight onto the image's background. Inset
   shadows on a replaced element paint under its content, so the lip stays behind the cut-out. */
.pd-garment img,
.pd-garment .pd-garment-blank {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  background-color: #0A0A0D;
  background-image: linear-gradient(158deg,
    rgb(var(--accent-rgb, 251 94 190) / var(--mp-pane-tint, .3)) 0%,
    rgba(23, 23, 29, .94) 54%,
    rgba(9, 9, 13, .98) 100%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / var(--mp-pane-lip, .16)),
    inset 0 0 0 1px rgb(var(--accent-rgb, 251 94 190) / calc(var(--mp-pane-lip, .16) * .5));
  transition: --mp-pane-tint .42s ease, --mp-pane-lip .42s ease;
}

.pd-garment:hover img,
.pd-garment:hover .pd-garment-blank {
  --mp-pane-tint: .6;
  --mp-pane-lip: .3;
}

/* A cell that exists but has no imagery yet — the diagonal keeps it honest, over the same pane so
   it sits on the strip's grid rather than reading as a different kind of thing. */
.pd-garment-blank {
  background-image:
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(255, 255, 255, .022) 6px 12px),
    linear-gradient(158deg,
      rgb(var(--accent-rgb, 251 94 190) / var(--mp-pane-tint, .3)) 0%,
      rgba(23, 23, 29, .94) 54%,
      rgba(9, 9, 13, .98) 100%);
}

.pd-garment-name {
  font-family: var(--mp-mono);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 9.5px;
  color: var(--mp-mute);
  line-height: 1.5;
}

.pd-garment-price {
  font-family: var(--mp-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--mp-ink);
}

.pd-empty {
  padding: clamp(22px, 4vh, 36px) 24px;
  border: 1px dashed var(--mp-line);
  border-radius: var(--mp-r-card);
  text-align: center;
  font-family: var(--mp-mono);
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--mp-mute);
}

/* ── More like this (D26) ────────────────────────────────────────────────────
   Rhymes with the garment rail directly above it — same grid, same card — so the
   two read as one row of options rather than two competing inventions. The
   artwork is square here because a pattern is a square tile; only garments have
   a body shape. */
.pd-similar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pd-similar-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* A name that wraps to two lines must not make its card taller than the one
     beside it — the artwork has to sit on one line across the rail. */
  height: 100%;
  padding: 10px;
  border: 1px solid var(--mp-line);
  border-radius: var(--mp-r-card);
  background: var(--mp-surface);
  text-decoration: none;
  overflow: hidden;                /* the artwork moves on hover; the corner has to clip it */
  transition: border-color .2s ease, background .2s ease;
}

.pd-similar-card:hover,
.pd-similar-card:focus-visible {
  border-color: var(--mp-line-soft);
  background: var(--mp-raise);
}

.pd-similar-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  background: #0B0B0D;
  /* The hover pushes into the artwork rather than enlarging the card: the frame
     holds still, the pattern comes closer. */
  transform: scale(1);
  transition: transform .45s ease;
}

.pd-similar-card:hover img,
.pd-similar-card:focus-visible img { transform: scale(1.06); }

.pd-similar-name {
  font-family: var(--mp-mono);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 9.5px;
  line-height: 1.5;
  color: var(--mp-mute);
}

.pd-similar-card:hover .pd-similar-name,
.pd-similar-card:focus-visible .pd-similar-name { color: var(--mp-ink); }

/* Operator-only readout: the distance the rail is ordered by, kept quiet enough
   that it never competes with the artwork it annotates. */
.pd-similar-score {
  position: absolute;
  right: 14px;
  top: 14px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgb(0 0 0 / .62);
  font-family: var(--mp-mono);
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--mp-dim);
}

@media (prefers-reduced-motion: reduce) {
  .pd-similar-card img { transition: none; }
  .pd-similar-card:hover img,
  .pd-similar-card:focus-visible img { transform: none; }
  .pd-garment img,
  .pd-garment .pd-garment-blank { transition: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   6 · Footer meta — R6: identity and dates confirm, they never lead.
   ═══════════════════════════════════════════════════════════════════════ */

.pd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: clamp(36px, 6vh, 60px);
  padding-top: 18px;
  border-top: 1px solid var(--mp-line);
  font-family: var(--mp-mono);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 10px;
  color: var(--mp-line-soft);
}

@media (prefers-reduced-motion: reduce) {
  .pd-art-single,
  .pd-art-tiled,
  .pd-art-tiled::after { transition: none; }
}

/* .hbtn's own display would beat the UA sheet's [hidden] — the .grm.hide lesson. */
.pd-art-tools [hidden] { display: none; }
