/* Materials: chips, swatch grid with hover previews, material drawer (shared by
   ./ and the materials pages), and the materials pages themselves (Figma
   10904:50486, 10904:50556). Style from the slides; type from the other pages
   (Focal Text 14 / M 26, DaVinci). */

/* ---------- Chips (tabs, filters, small CTAs) ---------- */
.pchips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.pchip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px 7px;
  border: 0.5px solid var(--black);
  border-radius: 6px;
  background: var(--white);
  color: var(--black);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
  -webkit-backdrop-filter: blur(17px);
  backdrop-filter: blur(17px);
  transition:
    background-color 250ms ease,
    color 250ms ease,
    border-color 250ms ease;
}
.pchip:hover {
  background: rgb(0 0 0 / 0.05);
}
.pchip.is-on {
  border-color: rgb(0 0 0 / 0.7);
  background: rgb(0 0 0 / 0.41);
  color: var(--white);
}
.pchip--soft {
  border-color: rgb(0 0 0 / 0.2);
  background: rgb(93 36 36 / 0.01);
}
.pchip--warm {
  border-color: rgb(229 164 96 / 0.5);
  background: rgb(229 164 96 / 0.11);
}
.pchip--warm:hover {
  background: rgb(229 164 96 / 0.25);
}
.pchip--fill {
  border-color: rgb(171 171 171 / 0.1);
  border-radius: 2px;
  background: rgb(54 68 71 / 0.2);
}
.pchip--fill:hover {
  background: rgb(54 68 71 / 0.32);
}
.muted-50 {
  opacity: 0.5;
}

/* ---------- Swatch grid (Rivestimenti) ---------- */
.mgrid {
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.mgroup__title {
  margin-bottom: 12px;
}
.mgroup__items {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 6px;
}
/* swatch sizes (PDP options panel) */
:root {
  --sw-size: 60px; /* grid swatches (Finiture, Materiali, variant rows) */
  --sw-compact: 24px; /* compact tiles in the modals */
}
.mitem {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: var(--sw-size);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mitem > img {
  width: var(--sw-size);
  height: var(--sw-size);
  object-fit: cover;
  transition: filter 200ms ease;
}
.mitem:hover > img {
  filter: brightness(0.92);
}
.mitem__cap {
  white-space: nowrap;
}
/* the composition under the name (caption option "composition") */
.mitem__cap:has(.mitem__desc) {
  display: flex;
  flex-direction: column;
}
.mitem__desc {
  opacity: 0.6;
}
.mitem__more {
  padding: 0 3px;
  border-radius: 2px;
  background: rgb(0 0 0 / 0.08);
}
/* hover preview: "See details" + colour variants, under the swatch */
.mpop {
  position: absolute;
  z-index: 5;
  top: calc(var(--sw-size) - 8px);
  left: calc(var(--sw-size) - 18px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  border-radius: 2px;
  background: rgb(255 255 255 / 0.85);
  box-shadow: 0 0 17px rgb(0 0 0 / 0.08);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: calc(var(--ft-size, 14px) * 12 / 14);
  opacity: 0;
  translate: 0 4px;
  pointer-events: none;
  transition:
    opacity 200ms ease,
    translate 200ms ease;
}
.mitem:hover .mpop,
.mitem:focus-visible .mpop {
  opacity: 1;
  translate: 0 0;
  pointer-events: auto;
}
.mpop__label {
  opacity: 0.5;
}
.mpop__vars {
  display: flex;
  gap: 5px;
}
.mpop__vars img {
  width: 24px;
  height: 24px;
  object-fit: cover;
}
.mpop__vars img:hover {
  outline: 1px solid var(--black);
}

/* "some" / "all" views: a row of colours per material, name underneath */
[data-view="some"] .mgroup__items,
[data-view="all"] .mgroup__items {
  gap: 24px 32px;
}
[data-view="all"] .mset {
  width: calc(50% - 16px);
}
.mset {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
.mset__tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.mset__tiles img {
  width: var(--sw-size);
  height: var(--sw-size);
  object-fit: cover;
  transition: filter 200ms ease;
}
.mset__tiles img:hover {
  filter: brightness(0.9);
}
/* "compact" (modals): small tiles, hover = large preview */
[data-view="compact"] .mgroup__items {
  gap: 8px;
}
[data-view="compact"] .mgroup + .mgroup {
  margin-top: -8px;
}
.mtile {
  position: relative;
  display: block;
  width: var(--sw-compact);
  height: var(--sw-compact);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.mtile > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mtile__tip {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 50%;
  display: flex;
  flex-direction: column;
  width: 120px;
  padding: 4px;
  border-radius: 2px;
  background: rgb(255 255 255 / 0.9);
  box-shadow: 0 0 17px rgb(0 0 0 / 0.08);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: calc(var(--ft-size, 14px) * 12 / 14);
  line-height: calc(var(--ft-leading, 1.3) - 0.1);
  text-align: left;
  opacity: 0;
  translate: 0 4px;
  pointer-events: none;
  transition:
    opacity 200ms ease,
    translate 200ms ease;
}
.mtile__tip img {
  width: 112px;
  height: 112px;
  margin-bottom: 6px;
  object-fit: cover;
}
.mtile__tip span {
  margin-top: 4px;
  opacity: 0.5;
}
.mtile:hover .mtile__tip,
.mtile:focus-visible .mtile__tip {
  opacity: 1;
  translate: 0 0;
}

/* ---------- Detail (in the drawer or a modal) ---------- */
.mdetail {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* ---------- Drawer (material details) ---------- */
.mdrawer {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.mdrawer__scrim {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.1);
  cursor: pointer;
  opacity: 0;
  transition: opacity 350ms ease;
}
.mdrawer__close-tip {
  position: fixed;
  top: 0;
  left: 0;
  padding: 2px 4px;
  background: var(--white);
  font-size: calc(var(--ft-size, 14px) * 12 / 14);
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
}
.mdrawer__scrim:hover .mdrawer__close-tip {
  opacity: 1;
}
.mdrawer__panel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  width: calc(50vw - 24px); /* half the screen, as the PDP's section modals */
  max-width: calc(100vw - 24px);
  overflow-y: auto;
  background: var(--white);
  translate: calc(100% + 24px) 0;
  transition: translate 450ms cubic-bezier(0.22, 1, 0.36, 1);
}
.mdrawer.is-open .mdrawer__scrim {
  opacity: 1;
}
.mdrawer.is-open .mdrawer__panel {
  translate: 0 0;
}
.mdrawer__x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 2px;
  background: rgb(255 255 255 / 0.7);
  font-size: 18px;
  cursor: pointer;
}
.mdetail__img {
  width: 50%; /* half the drawer / modal */
  margin: 16px 16px 0;
  aspect-ratio: 1;
  object-fit: cover;
}
.mdetail__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}
.mdetail__code {
  opacity: 0.5;
}
.mdetail__variants {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.mswatch {
  display: grid;
  padding: 2px;
  border: 0;
  border-radius: 2px;
  background: none;
  cursor: pointer;
}
.mswatch img {
  width: 24px;
  height: 24px;
  object-fit: cover;
}
.mswatch.is-on {
  background: rgb(54 68 71 / 0.3);
}
.mdetail__specs {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 16px 0 0;
}
.mdetail__specs dt {
  opacity: 0.5;
}
.mdetail__specs dd {
  margin: 0;
}
/* a care instruction with its symbol */
.mdetail__care {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
}
.mdetail__care svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}
.mdetail__foot {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 16px;
  background: linear-gradient(transparent, var(--white) 30%);
}
.has-drawer {
  overflow: hidden;
}

/* ---------- Materials pages ---------- */
.mpage main {
  gap: 0; /* blocks.css spaces main's children by --block-gap */
  padding-top: 40px;
}
.mpage__statement {
  max-width: var(--st-max, 1277px);
  margin: 100px auto 0;
  padding: 0 16px;
  text-align: center;
}
.mpage__statement .t-davinci {
  font-size: var(--dv-title);
  line-height: 1;
}
.mpage__section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 150px;
  padding: 0 16px;
}
.mpage__section + .mpage__section {
  margin-top: 80px;
}
.mcards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.mcard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: rgb(0 0 0 / 0.7);
}
.mcard__img {
  overflow: hidden;
  aspect-ratio: 207 / 292;
}
.mcard__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale 700ms cubic-bezier(0.22, 1, 0.36, 1);
}
.mcard:hover .mcard__img img {
  scale: 1.04;
}
.mcard:hover {
  color: var(--black);
}

/* Tessuti (10904:50556) */
.mtitle {
  margin-top: 130px;
  text-align: center;
}
.mtitle .t-davinci {
  font-size: var(--dv-title);
}
.mcrumbs {
  display: flex;
  gap: 16px;
  margin-top: 150px;
  padding: 0 16px;
}
.mcrumbs a {
  opacity: 0.5;
}
.mintro {
  max-width: 533px;
  margin-top: 16px;
  padding: 0 16px;
}
.mfilters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 40px;
  padding: 0 16px;
}
.filters,
.mfilters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: calc(var(--ft-size, 14px) * 12 / 14);
}
:is(.filters, .mfilters) button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  opacity: 0.5;
  cursor: pointer;
}
:is(.filters, .mfilters) button.is-on {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ftiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 30px 10px;
  margin: 40px 0 160px;
  padding: 0 16px;
}
.ftile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ftile__img {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
}
.ftile__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale 700ms cubic-bezier(0.22, 1, 0.36, 1);
}
.ftile:hover .ftile__img img {
  scale: 1.05;
}
.ftile__cat {
  opacity: 0.5;
}
.ftile[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .mcards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ftiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ---------- Download chip (Figma 10905:54472) ---------- */
.dl {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 4px 6px;
  border-radius: 2px;
  font-size: var(--ft-size, 14px);
  line-height: calc(var(--ft-leading, 1.3) - 0.3);
  letter-spacing: calc(var(--ft-tracking, 0.03em) - 0.01em);
  transition: background-color 250ms ease;
}
.dl:hover {
  background-image: linear-gradient(90deg, rgb(0 0 0 / 0.06), rgb(0 0 0 / 0.03));
}
.dl__icon {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: var(--white);
}
.dl__icon img {
  width: 13.75px;
  height: 13.75px;
}
.dl small {
  font-size: inherit;
  opacity: 0.5;
}

/* finishes (Materiali): no caption under the swatch; name + "See details" on hover */
.mitem--finish .mpop {
  top: calc(100% + 4px);
  left: 0;
  white-space: nowrap;
}
/* hairline edge so very light swatches (e.g. Bianco Camargue) stay visible */
:is(.mitem > img, .mset__tiles img, .mtile > img, .mswatch img) {
  outline: 0.5px solid rgb(0 0 0 / 0.08);
  outline-offset: -0.5px;
}
