/* The existing intersection observer starts each photographic sequence once.
   The resting presentation is complete with or without scripting. */
@keyframes cso-print-open {
  from { clip-path: inset(var(--print-opening, 0 25% 0 0)); }
  to   { clip-path: inset(0); }
}
@keyframes cso-print-caption {
  from { opacity: .72; translate: var(--caption-start, 0 .55rem); }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes cso-print-rule {
  from { transform: scaleX(.15); }
  to   { transform: scaleX(1); }
}
@keyframes cso-studio-object {
  from { scale: .94; translate: 0 .45rem; }
  to   { scale: 1; translate: 0 0; }
}

/* A small printer's rule connects the first photograph with its original caption. */
body.cso-public-v71 #contenuto .cso-page-gallery .cso-gallery-grid > figure:first-child figcaption::before {
  content: "";
  display: inline-block;
  width: 1.35rem;
  height: 1px;
  margin-inline-end: .62rem;
  vertical-align: .28em;
  background: currentColor;
  opacity: .55;
  transform-origin: left;
}
@media screen and (prefers-reduced-motion: no-preference) {
  body.cso-public-v71[data-motion="true"] #contenuto {
    --print-pace: .9s;
    --print-ease: cubic-bezier(.17,.72,.22,1);
  }

  /* Anchor boxes, focus outlines, zoom controls and links remain stationary. */
  body.cso-public-v71[data-motion="true"] #contenuto :is(
    .about-figure, .cso-home-line, .cso-home-service, .cso-home-feature__panel,
    .cso-line-card, .cso-gallery-grid > figure, .cso-page-panel:has(.cso-service-panel-media)
  ).is-revealed { animation: none; }

  /* Across facing pages the photograph opens towards its caption. The Ethica
     and workshop pictures retain their existing soft masks throughout. */
  body.template-index[data-motion="true"] #contenuto .cso-home-feature__panel.is-revealed .cso-home-feature__image img,
  body.template-index[data-motion="true"] #contenuto .about-figure.is-revealed img,
  body.template-index[data-motion="true"] #contenuto .cso-home-line.is-revealed .cso-photo__image {
    animation: cso-print-open var(--print-pace) var(--print-ease) backwards;
  }
  body.template-index[data-motion="true"] #contenuto .cso-home-line:nth-child(even) {
    --print-opening: 0 0 0 25%;
    --caption-start: .65rem 0;
  }
  body.template-index[data-motion="true"] #contenuto .about-figure.is-revealed figcaption::before {
    transform-origin: left;
    animation: cso-print-rule .6s var(--print-ease) .14s backwards;
  }
  body.template-index[data-motion="true"] #contenuto .about-figure.is-revealed figcaption,
  body.template-index[data-motion="true"] #contenuto .cso-home-line.is-revealed .cso-home-line__copy h3,
  body.template-index[data-motion="true"] #contenuto .cso-home-feature__panel.is-revealed .cso-home-feature__copy h2 {
    animation: cso-print-caption .6s var(--print-ease) .1s backwards;
  }
  body.template-index[data-motion="true"] #contenuto .cso-home-line.is-revealed .cso-home-line__copy p {
    animation: cso-print-caption .55s var(--print-ease) .18s backwards;
  }

  /* Give the laser photograph the long exposure. The two drawings/products
     on white settle into place at their original sizes. */
  body.template-index[data-motion="true"] #contenuto .cso-home-service:first-child.is-revealed img {
    --print-opening: 16% 2% 16% 2%;
    animation: cso-print-open var(--print-pace) var(--print-ease) backwards;
  }
  body.template-index[data-motion="true"] #contenuto .cso-home-service--studio.is-revealed img {
    animation: cso-studio-object .68s var(--print-ease) backwards;
  }

  /* A collection introduction presents three plates in reading order. Within
     longer archives, reserve the opening for the lead print and let the other
     photographs stay still while their captions arrive. */
  body.cso-collections-page[data-motion="true"] #contenuto .cso-line-card:nth-child(2) {
    --plate-delay: .075s;
    --print-opening: 0 0 20% 0;
  }
  body.cso-collections-page[data-motion="true"] #contenuto .cso-line-card:nth-child(3) {
    --plate-delay: .15s;
    --print-opening: 0 0 0 24%;
  }
  body.cso-collections-page[data-motion="true"] #contenuto .cso-line-card.is-revealed .cso-photo__image,
  body.cso-public-v71[data-motion="true"] #contenuto .cso-page-gallery .cso-gallery-grid > figure:first-child.is-revealed img,
  body.cso-v32-service-page[data-motion="true"] #contenuto .cso-page-panel:first-child.is-revealed .cso-service-panel-media img {
    animation: cso-print-open var(--print-pace) var(--print-ease) var(--plate-delay, 0s) backwards;
  }
  body.cso-public-v71[data-motion="true"] #contenuto .cso-page-gallery .cso-gallery-grid > figure.is-revealed figcaption,
  body.cso-collections-page[data-motion="true"] #contenuto .cso-line-card.is-revealed > .eyebrow {
    animation: cso-print-caption .5s var(--print-ease) calc(var(--plate-delay, 0s) + .09s) backwards;
  }
  body.cso-public-v71[data-motion="true"] #contenuto .cso-page-gallery .cso-gallery-grid > figure:first-child.is-revealed figcaption::before {
    animation: cso-print-rule .65s var(--print-ease) .14s backwards;
  }

  body.cso-public-v71[data-motion="true"] #contenuto :is(
    .about-figure, .cso-home-line, .cso-home-service, .cso-home-feature__panel,
    .cso-line-card, .cso-gallery-grid > figure, .cso-page-panel
  ).is-revealed:focus-within :is(img, h2, h3, p, figcaption) {
    animation: none !important;
  }
}
@media screen and (max-width: 760px) and (prefers-reduced-motion: no-preference) {
  body.cso-public-v71[data-motion="true"] #contenuto {
    --print-pace: .68s;
    --print-opening: 0 0 15% 0;
    --caption-start: 0 .35rem;
  }
  body.template-index[data-motion="true"] #contenuto .cso-home-line:nth-child(even),
  body.cso-collections-page[data-motion="true"] #contenuto .cso-line-card:nth-child(n) {
    --print-opening: 0 0 15% 0;
    --caption-start: 0 .35rem;
    --plate-delay: 0s;
  }
}

/* Editorial photographs share a single crop edge. The full-bleed Home cover
   keeps its text-side gradient; its final image stays at the native CSS scale. */
body.cso-public-v71 {
  --cso-photo-radius: 12px;
}
@media (max-width: 760px) {
  body.cso-public-v71 { --cso-photo-radius: 10px; }
}
body.template-index #shopify-section-hero .cso-campaign__figure .hero-image {
  filter: none !important;
  opacity: 1 !important;
  scale: none !important;
  transform: none !important;
  border-radius: 0;
}
body.template-index #shopify-section-hero .cso-campaign__figure > .cso-campaign__zoom {
  max-width: 1400px;
  margin-left: auto;
}
/* Keep the one-shot entrance visible without magnifying the raster. */
@media (prefers-reduced-motion: no-preference) {
  html:not(.cso-logo-entry) body.template-index[data-motion="true"] #shopify-section-hero .cso-campaign__figure .hero-image {
    animation: cso-cover-print .9s cubic-bezier(.18,.71,.24,1) backwards;
  }
}
@keyframes cso-cover-print {
  from { clip-path: inset(0 0 2% 5%); }
  to { clip-path: inset(0); }
}

body.cso-public-v71 #contenuto :is(
  .cso-page-hero__figure, .cso-home-feature__image, .cso-home-line__image,
  .cso-home-service__image, .about-figure, .cso-gallery-image,
  .cso-diamond-editorial__image, .cso-line-card__image,
  .cso-service-panel-media, .cso-lab-service-v63__media
) img {
  opacity: 1 !important;
  filter: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
  image-rendering: auto;
  mix-blend-mode: normal;
  scale: none !important;
  transform: none !important;
}
body.cso-public-v71 #contenuto .cso-page-hero.cso-hero-blend .cso-page-hero__figure,
body.template-index #contenuto .cso-home-about .about-figure {
  border-radius: 0 !important;
  overflow: visible !important;
}
body.cso-public-v71 #contenuto .cso-page-hero.cso-hero-blend .cso-page-hero__figure > .cso-photo,
body.cso-public-v71 #contenuto .cso-diamond-editorial__image > .cso-photo,
body.template-index #contenuto .cso-home-feature__image > picture,
body.template-index #contenuto .cso-home-collections__grid .cso-home-line__image > .cso-photo,
body.template-index #contenuto .cso-home-about .about-figure > .cso-gallery-open {
  border: 0;
  padding: 0;
  border-radius: var(--cso-photo-radius) !important;
  overflow: hidden !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}
body.cso-public-v71 #contenuto :is(.cso-page-hero__figure, .cso-diamond-editorial__image) > .cso-photo > img,
body.template-index #contenuto :is(.cso-home-feature__image, .cso-home-line__image, .about-figure) img {
  border-radius: 0 !important;
}
body.template-index #contenuto .cso-home-collections__grid .cso-home-line__image,
body.template-index #contenuto .cso-home-feature__image,
body.cso-public-v71 #contenuto .cso-diamond-editorial__image {
  border-radius: 0 !important;
  overflow: visible;
}
body.template-index #contenuto .cso-home-about .about-figure {
  max-width: min(100%, 541px);
}
body.cso-laboratory-v63 #contenuto .cso-page-hero.cso-hero-blend .cso-page-hero__figure {
  max-width: 524px;
  justify-self: center;
}
body.cso-public-v71 #contenuto .cso-diamond-editorial__image > .cso-photo:has(img[src$="cso-page-ethica-grezzo-uno.webp"]) {
  max-width: 480px;
}
body.cso-public-v71 #contenuto .cso-page-hero.cso-hero-blend .cso-page-hero__figure--contain > .cso-photo {
  /* The frame follows the photograph instead of rounding the letterbox. */
  width: min(100%, calc(31rem * var(--cso-photo-ratio, 1.4))) !important;
  aspect-ratio: var(--cso-photo-ratio, 1.4) !important;
  justify-self: center;
}

/* Centre contained prints without transforming a fractional-size raster.
   The inner frame has the exact aspect ratio of the original photograph. */
body.cso-public-v71 #contenuto :is(.cso-line-card__image--contain, .cso-page-gallery:not([data-gallery-title="Le persone di CSO"]) .cso-gallery-image--contain) {
  position: relative;
  border-radius: 0 !important;
  overflow: visible;
}
body.cso-public-v71 #contenuto :is(.cso-line-card__image--contain, .cso-page-gallery:not([data-gallery-title="Le persone di CSO"]) .cso-gallery-image--contain) > .cso-photo {
  position: absolute;
  inset: 0;
  width: min(100%, calc(100% * var(--cso-photo-ratio, 1) / var(--cso-slot-ratio, 1)));
  height: min(100%, calc(100% * var(--cso-slot-ratio, 1) / var(--cso-photo-ratio, 1)));
  margin: auto;
  padding: 0;
  border-radius: var(--cso-photo-radius) !important;
  overflow: hidden;
  transform: none !important;
  scale: none !important;
  box-shadow: none;
}
body.cso-public-v71 #contenuto :is(.cso-line-card__image--contain, .cso-page-gallery:not([data-gallery-title="Le persone di CSO"]) .cso-gallery-image--contain) > .cso-photo > img {
  width: 100%;
  height: 100%;
  border-radius: 0 !important;
  padding: 0 !important;
  object-fit: contain !important;
}

/* Free-standing service images own their visible corners, including square
   photographs sitting in a wider white slot. Avoid scaling tiny originals up. */
body.cso-public-v71 #contenuto :is(.cso-service-panel-media, .cso-lab-service-v63__media, .cso-home-services__grid .cso-home-service__image) {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  border-radius: 0 !important;
  background: #fff;
  overflow: visible;
}
body.cso-public-v71 #contenuto :is(.cso-service-panel-media, .cso-lab-service-v63__media, .cso-home-services__grid .cso-home-service__image) > img {
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  padding: 0 !important;
  border-radius: var(--cso-photo-radius) !important;
  object-fit: contain !important;
}

body.cso-public-v71 #contenuto .cso-lab-service-v63 {
  border-radius: var(--cso-photo-radius);
  overflow: visible;
}
body.cso-v32-service-page #contenuto .cso-page-hero.cso-hero-blend .cso-page-hero__figure > .cso-photo,
body.cso-laboratory-v63 #contenuto .cso-page-hero.cso-hero-blend .cso-page-hero__figure > .cso-photo {
  width: min(100%, calc(30rem * var(--cso-photo-ratio, 1))) !important;
  aspect-ratio: var(--cso-photo-ratio, 1) !important;
  justify-self: center;
}

/* A single opening spread. Its provenance sits with the workshop story below. */
#shopify-section-hero .cso-campaign__inner {
  align-items: start;
  padding-top: clamp(24px, 2.05vw, 36px);
  padding-bottom: clamp(30px, 3.3vw, 52px);
}
#shopify-section-hero .cso-campaign__stage { --campaign-height: clamp(375px, 49svh, 490px); }
#shopify-section-hero .cso-campaign__figure > a.cso-campaign__zoom {
  inset-block: 5px clamp(13px, 1.15vw, 20px);
  right: var(--campaign-pad);
  border-radius: var(--cso-photo-radius);
}
#shopify-section-hero .cso-campaign__zoom > picture { border-radius: inherit; }
#shopify-section-hero .cso-campaign__figure .cso-campaign__zoom::after {
  inset: auto clamp(12px, 1.8vw, 24px) clamp(12px, 1.8vw, 24px) auto;
}
#shopify-section-hero .cso-campaign__edition { align-items: center; }
#shopify-section-hero .cso-campaign__note .cso-campaign__origin {
  margin: 0 0 .65rem;
  color: #655b50;
  font: 500 .8125rem/1.5 var(--sans);
}
#shopify-section-hero .cso-campaign__story { max-width: 46ch; }
#shopify-section-hero .cso-campaign__history { max-width: 38ch; }
@media (prefers-reduced-motion: no-preference) {
  html:not(.cso-logo-entry) body.template-index[data-motion=true] #shopify-section-hero .cso-campaign__figure .hero-image {
    animation: cso-cover-print 1.12s cubic-bezier(.2,.74,.27,1) backwards;
  }
}
@keyframes cso-cover-print {
  from { clip-path: inset(0 13% 0 0 round var(--cso-photo-radius)); }
  to { clip-path: inset(0 round var(--cso-photo-radius)); }
}
@media (max-width: 700px) {
  #shopify-section-hero .cso-campaign__stage { --mobile-photo-height: clamp(171px, 53vw, 290px); }
  #shopify-section-hero .cso-campaign__figure > a.cso-campaign__zoom {
    inset: 4px var(--campaign-pad) auto;
    height: var(--mobile-photo-height);
  }
  #shopify-section-hero .cso-campaign__inner { padding: calc(var(--mobile-photo-height) + 21px) var(--campaign-pad) 24px; }
  #shopify-section-hero .cso-campaign__zoom picture::after {
    background: linear-gradient(0deg,#fff,rgba(255,255,255,.78) 4%,rgba(255,255,255,.28) 10%,transparent 20%);
  }
  #shopify-section-hero .cso-campaign__figure .hero-image { object-position: 70% 73%; }
  #shopify-section-hero .cso-campaign__history { max-width: 38ch; }
}
@media (min-width: 701px) and (max-width: 1000px) {
  #shopify-section-hero .cso-campaign__stage { --campaign-height: clamp(318px, 41vw, 414px); }
}

/* Keep the compact layouts on touch devices. The wider opening gives way to
   a collection spread, a contact sheet of services and a short review panel. */
@media screen and (min-width: 1180px) {
  body.template-index #contenuto .cso-home-highlights__grid { align-items: stretch; }
  body.template-index #contenuto .cso-home-highlights .cso-home-priority {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-block: clamp(1.6rem, 2.5vw, 2.7rem);
  }
  body.template-index #contenuto .cso-home-priority__label { color: #715a45; }
  body.template-index #contenuto .cso-home-priority h3 { font-size: clamp(2.25rem, 3vw, 3.45rem); }
  body.template-index #contenuto .cso-home-priority .rte { max-width: 43ch; }
  body.template-index #contenuto .cso-home-priority--gold .cso-home-priority__copy { max-width: 46ch; }

  body.template-index #contenuto .cso-home-collections > .container {
    display: grid;
    grid-template-columns: minmax(0, .74fr) minmax(0, 2fr);
    gap: clamp(26px, 3.2vw, 50px);
    align-items: start;
    padding-top: clamp(1.75rem, 3vw, 3.3rem);
    border-top: 1px solid var(--chapter-rule);
  }
  body.template-index #contenuto .cso-home-collections__heading {
    display: grid;
    justify-items: start;
    padding: 0;
    border: 0;
    gap: 1rem;
  }
  body.template-index #contenuto .cso-home-collections__heading h2 {
    max-width: 10ch;
    font-size: clamp(2.7rem, 3.7vw, 4.1rem);
    line-height: 1.05;
  }
  body.template-index #contenuto .cso-home-collections__grid {
    margin: 0;
    gap: clamp(20px, 2vw, 34px);
  }
  body.template-index #contenuto .cso-home-collections__grid > .cso-home-line:nth-child(n) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "plate" "description";
    align-content: start;
    gap: 1rem;
  }
  body.template-index #contenuto .cso-home-collections__grid > .cso-home-line .cso-home-line__image {
    aspect-ratio: 4 / 3;
  }
  body.template-index #contenuto .cso-home-collections__grid .cso-home-line__image > .cso-photo > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  body.template-index #contenuto .cso-home-collections__grid .cso-home-line__copy {
    max-width: none;
    justify-self: stretch;
    padding: 0;
  }
  body.template-index #contenuto .cso-home-line__copy h3 { line-height: 1.12; }
  body.template-index #contenuto .cso-home-line__copy p { max-width: 41ch; }

  body.template-index #contenuto .cso-home-services__heading { align-items: baseline; }
  body.template-index #contenuto .cso-home-services__intro { max-width: 62ch; }
  body.template-index #contenuto .cso-home-services__grid {
    gap: clamp(2rem, 3.3vw, 3.5rem) clamp(1.25rem, 2.2vw, 2.25rem);
  }
  body.template-index #contenuto .cso-home-services__grid > .cso-home-service:nth-child(n) .cso-home-service__image {
    aspect-ratio: 1.5;
    background: white;
    border: 1px solid var(--chapter-rule);
    border-radius: var(--cso-photo-radius) !important;
    overflow: hidden;
  }
  body.template-index #contenuto .cso-home-services__grid .cso-home-service__image > img {
    border-radius: 0 !important;
  }
  body.template-index #contenuto .cso-home-services__grid > .cso-home-service:not(.cso-home-service--studio) .cso-home-service__image > img {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
  }
  body.template-index #contenuto .cso-home-services__grid > .cso-home-service:nth-child(n) .cso-home-service__copy {
    padding: 1rem 0 0;
  }
  body.template-index #contenuto .cso-home-service__copy p { max-width: 43ch; }
  body.template-index #contenuto .cso-home-services__more {
    display: flex;
    justify-content: flex-end;
    padding-top: .7rem;
    border-top: 1px solid var(--chapter-rule);
  }

  body.template-index #contenuto .cso-reviews__grid { align-items: center; }
  body.template-index #contenuto .cso-reviews__card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "source source" "name action" "address action" "privacy privacy";
    gap: .35rem clamp(.9rem, 1.3vw, 1.4rem);
    padding: clamp(1.3rem, 2.5vw, 2.6rem);
    background: #f8f7f4;
    border: 1px solid var(--chapter-rule);
    border-radius: var(--cso-photo-radius);
  }
  body.template-index #contenuto .cso-reviews__source { grid-area: source; margin: 0 0 .75rem; }
  body.template-index #contenuto .cso-reviews__card h3 { grid-area: name; font-size: clamp(1.6rem, 2vw, 2.15rem); }
  body.template-index #contenuto .cso-reviews__address { grid-area: address; margin: 0; }
  body.template-index #contenuto .cso-reviews__link { grid-area: action; align-self: center; margin: 0; max-width: 16rem; }
  body.template-index #contenuto .cso-reviews__privacy {
    grid-area: privacy;
    max-width: none;
    padding-top: .85rem;
    margin: .65rem 0 0;
    border-top: 1px solid var(--chapter-rule);
  }

  /* The caption follows its own photograph while the zoom button keeps
     its independent focus outline. The full image never shifts under the cursor. */
  body.template-index #contenuto .cso-home-line__image:focus-visible ~ .cso-home-line__copy h3,
  body.template-index #contenuto .cso-home-service__image:focus-visible ~ .cso-home-service__copy h3 {
    color: #76563b;
  }
  body.template-index #contenuto .cso-home-line__image > .cso-photo { translate: none; }
}
@media screen and (min-width: 1180px) and (hover: hover) and (pointer: fine) {
  body.template-index #contenuto .cso-home-line__image:hover ~ .cso-home-line__copy h3,
  body.template-index #contenuto .cso-home-service__image:hover ~ .cso-home-service__copy h3 {
    color: #76563b;
  }
}
@media screen and (min-width: 1180px) and (prefers-reduced-motion: no-preference) {
  body.template-index[data-motion=true] #contenuto :is(.cso-home-line__copy, .cso-home-service__copy) h3 {
    transition: color .18s ease-out;
  }
  body.template-index[data-motion=true] #contenuto .cso-home-line__image:is(:hover, :focus-visible) > .cso-photo {
    translate: none;
  }
}
