/* ==========================================================================
   CESURNES — Piece (template-piece.php)
   The page came as a static export styled entirely inline; every declaration
   below is one of those inline styles moved onto a class, so the rendering is
   unchanged. Loaded only on this page, after closing-band.css and
   order-dialog.css (the closing band and the order popup are the
   Collection's). Classes are "piece-*": ".piece" belongs to the home page.
   ========================================================================== */

/* The export gives every link on this page a terracotta hover. :where() keeps
   it at the export's a:hover weight, so the .btn hover colours still win. */
:where(.page-piece) a:hover { color: var(--c-terracota); }

/* =================================================================== piece */
.piece-detail {
  padding: clamp(110px, 10vw, 150px) var(--gutter) clamp(64px, 7vw, 110px);
  background: var(--c-white);
  color: var(--c-black);
}

.piece-detail__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(40px, 5.5vw, 104px);
  max-width: 1440px;
  margin: 0 auto;
}

.piece-detail__media {
  position: relative;
  flex: 1.1 1 460px;
  min-width: 0;
}

/* The photo stays in view while the text scrolls, from 1000px wide, below
   the header. Narrower, it sits in the flow above the name (the export's
   offset there pushed it onto the name). */
@media (min-width: 1000px) {
  .piece-detail__media {
    position: sticky;
    top: clamp(96px, 8vw, 120px);
  }
}

.piece-detail__figure {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #f2efea;
}

.piece-detail__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* The button over each photo that enlarges it (.piece-lightbox below): the
   whole frame, the photo inside unchanged. The focus ring sits inside, the
   frames clipping anything outside. */
.piece-zoom {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}

.piece-zoom:focus-visible { outline-offset: -4px; }

.piece-detail__body {
  display: flex;
  flex: 1 1 400px;
  flex-direction: column;
  gap: clamp(36px, 3.4vw, 52px);
  min-width: 0;
}

.piece-detail__head {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 1.6vw, 22px);
  padding-bottom: clamp(24px, 2.4vw, 34px);
  border-bottom: 1px solid var(--c-black);
}

.piece-detail__crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  line-height: 16px;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
}

/* The export's inline colour: no hover change. */
.piece-detail__crumb,
.piece-detail__crumb:hover { color: var(--c-muted); }

.piece-detail__crumb-current { color: var(--c-terracota); }

.piece-detail__name {
  font-size: clamp(42px, 5.4vw, 96px);
  line-height: .92;
  font-weight: 100;
  text-transform: uppercase;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.piece-detail__price {
  font-size: clamp(28px, 2.8vw, 44px);
  line-height: 1;
  font-weight: 100;
  color: var(--c-terracota);
}

.piece-detail__about {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 1.6vw, 22px);
}

.piece-detail__label {
  font-size: 13px;
  line-height: 16px;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-terracota);
}

.piece-detail__text {
  max-width: 58ch;
  font-size: clamp(16px, 1.2vw, 18px);
  line-height: 1.65;
  font-weight: 300;
  color: #3a3837;
  text-wrap: pretty;
}

/* What the description's visual editor adds ("Description de la page"):
   lists in the paragraphs' type, bold, links. */
.piece-detail__about :is(ul, ol) {
  max-width: 58ch;
  padding-left: 1.2em;
  font-size: clamp(16px, 1.2vw, 18px);
  line-height: 1.65;
  font-weight: 300;
  color: #3a3837;
}

.piece-detail__about ul { list-style: disc; }
.piece-detail__about ol { list-style: decimal; }
.piece-detail__about :is(strong, b) { font-weight: 500; }

.piece-detail__about a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.piece-detail__buy {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.piece-detail__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

.piece-qty {
  display: flex;
  align-items: center;
  height: 56px;
  border: 1px solid var(--c-black);
}

.piece-qty__btn {
  width: 52px;
  height: 100%;
  font-size: 18px;
  font-weight: 300;
  cursor: pointer;
}

.piece-qty__value {
  min-width: 32px;
  text-align: center;
  font-size: 16px;
  font-weight: 400;
}

.piece-detail__order {
  flex: 1 1 200px;
  height: 56px;
  cursor: pointer;
}

.piece-detail__note {
  font-size: 14px;
  line-height: 1.5;
  font-weight: 300;
  color: var(--c-muted);
}

.piece-detail__specs {
  display: flex;
  flex-direction: column;
  margin: 0;
  border-top: 1px solid var(--c-black);
}

.piece-detail__spec {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(9, 8, 7, .14);
}

.piece-detail__spec-key {
  font-size: 13px;
  line-height: 16px;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
}

.piece-detail__spec-value {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 400;
  text-align: right;
}

.piece-detail__questions {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--c-black);
}

.piece-detail__question { border-bottom: 1px solid rgba(9, 8, 7, .14); }

.piece-detail__toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 20px 0;
  font-size: clamp(16px, 1.2vw, 18px);
  line-height: 1.2;
  font-weight: 300;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}

.piece-detail__sign {
  font-size: 22px;
  font-weight: 200;
}

.piece-detail__answer {
  max-width: 52ch;
  padding: 0 0 22px;
  font-size: 15px;
  line-height: 1.6;
  font-weight: 300;
  color: #3a3837;
  text-wrap: pretty;
}

/* ================================================================== photos */
.piece-gallery {
  padding: 0 var(--gutter) 4px;
  background: var(--c-white);
}

.piece-gallery__row {
  display: grid;
  gap: 4px;
  max-width: 1440px;
  margin: 0 auto;
}

.piece-gallery__row--large { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }

.piece-gallery__row--small {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  margin-top: 4px;
}

.piece-gallery__figure {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #f2efea;
}

.piece-gallery__row--small .piece-gallery__figure { aspect-ratio: 3 / 4; }

.piece-gallery__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Each frame, the same photo cropped on a detail of it. */
.piece-gallery__image--whole      { transform: scale(1);   transform-origin: 50% 50%; }
.piece-gallery__image--matter     { transform: scale(2.4); transform-origin: 50% 55%; }
.piece-gallery__image--silhouette { transform: scale(1.7); transform-origin: 50% 30%; }
.piece-gallery__image--texture    { transform: scale(3.2); transform-origin: 40% 60%; }
.piece-gallery__image--base       { transform: scale(1.4); transform-origin: 50% 85%; }

/* ======================================================= photos enlarged */
/* template-parts/piece/lightbox.php. The dialog covers the viewport over a
   near-black backdrop; the photo is shown whole, as large as fits. */
.piece-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: transparent;
  color: var(--c-white);
  /* A sideways swipe changes the photo (piece.js), not the browser's
     history; pinching still zooms. */
  touch-action: pan-y pinch-zoom;
  overscroll-behavior: contain;
}

.piece-lightbox[open] { animation: piece-lightbox-in .25s ease-out; }

/* The page behind, blurred and darkened (--c-black), so the photo stands
   out. Without backdrop-filter, a near-opaque black instead. */
.piece-lightbox::backdrop {
  background: rgba(9, 8, 7, .62);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .piece-lightbox::backdrop { background: rgba(9, 8, 7, .94); }
}

@keyframes piece-lightbox-in {
  from { opacity: 0; }
}

/* Room for the close button above and, on phones, the arrows below. A click
   on this area, around the photo, closes (piece.js). */
.piece-lightbox__figure {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  padding: 64px 12px 72px;
}

.piece-lightbox__image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* The loupe (piece.js, mouse only): a square following the pointer over the
   photo, the photo magnified inside it. The pointer hides under it. */
.piece-lightbox__loupe {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(160px, 15vw, 240px);
  aspect-ratio: 1;
  background-color: #f2efea;
  background-repeat: no-repeat;
  box-shadow: 0 0 0 1px rgba(252, 252, 252, .9), 0 18px 48px rgba(9, 8, 7, .45);
  pointer-events: none;
  will-change: transform;
}

.piece-lightbox[data-loupe] .piece-lightbox__image { cursor: none; }

.piece-lightbox__close,
.piece-lightbox__nav {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--c-white);
  opacity: .75;
  transition: opacity .2s ease;
}

.piece-lightbox__close:hover,
.piece-lightbox__nav:hover { opacity: 1; }

.piece-lightbox :focus-visible { outline-color: var(--c-white); }

.piece-lightbox__close {
  top: 8px;
  right: 8px;
  font-size: 34px;
  font-weight: 200;
  line-height: 1;
}

.piece-lightbox__nav { bottom: 12px; }
.piece-lightbox__nav--prev { left: 8px; }
.piece-lightbox__nav--next { right: 8px; }
.piece-lightbox__nav[hidden] { display: none; }

.piece-lightbox__count {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  line-height: 48px;
  font-weight: 300;
  letter-spacing: .06em;
  color: var(--c-white);
}

/* Wider, the arrows sit halfway down, either side of the photo. */
@media (min-width: 768px) {
  .piece-lightbox__figure { padding: 72px 104px; }

  .piece-lightbox__close {
    top: 16px;
    right: 16px;
  }

  .piece-lightbox__nav {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .piece-lightbox__nav--prev { left: clamp(16px, 2.5vw, 40px); }
  .piece-lightbox__nav--next { right: clamp(16px, 2.5vw, 40px); }

  .piece-lightbox__count { bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .piece-lightbox[open] { animation: none; }
}

/* ================================================================ related */
.piece-related {
  padding: clamp(80px, 10vw, 150px) var(--gutter);
  background: var(--c-white);
  color: var(--c-black);
}

.piece-related__inner {
  display: flex;
  flex-direction: column;
  gap: clamp(36px, 4vw, 56px);
  max-width: 1440px;
  margin: 0 auto;
}

.piece-related__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--c-black);
}

.piece-related__title {
  font-size: clamp(34px, 4.6vw, 72px);
  line-height: .95;
  font-weight: 100;
  text-transform: uppercase;
}

.piece-related__all {
  font-size: 13px;
  line-height: 16px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.piece-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: clamp(40px, 4vw, 64px) 21px;
}

/* The export's inline colour: no hover change. */
.piece-card,
.piece-card:hover {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--c-black);
}

.piece-card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #f2efea;
}

.piece-card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.4s cubic-bezier(.22, .61, .36, 1);
}

.piece-card__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--c-black);
}

.piece-card__name {
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.1;
  font-weight: 300;
  text-transform: uppercase;
}

.piece-card__price {
  font-size: 15px;
  line-height: 1;
  font-weight: 400;
  white-space: nowrap;
}

.piece-card__material {
  font-size: 13px;
  line-height: 16px;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-terracota);
}
