/* The editorial column sits above the photographed book; the opposite column
   holds the largest device that fits the available height at its native ratio. */
#conteudo {
  --lab-passage:clamp(152px,min(21vw,25svh),264px);
}
#conteudo #aplicativo {
  --blend-depth:clamp(40px,7svh,88px);
  --device-height:min(81vw,clamp(260px,calc(100svh - var(--nav-h) - 126px),782px));
  --subject-x:25%;
  --subject-y:81%;
  --lab-ink:url(laboratorio-paginas-pt.webp);
  --floor-edge:clamp(16px,2.1vw,29px);
  padding-bottom:var(--lab-passage);
  /* Under the outgoing desk edge, continue its slate reflection. Starting
     the incoming light from the hero's near-black would draw a dark seam. */
  background:linear-gradient(to bottom,#080c1b 0,
    #080c1b calc(100% - var(--lab-passage) - var(--floor-edge) * 2),
    #302e39 calc(100% - var(--lab-passage)),#343442 100%);
  mask-image:none;
}
html[lang^=en] #conteudo #aplicativo { --lab-ink:url(laboratorio-paginas-en.webp); }
html[lang^=es] #conteudo #aplicativo { --lab-ink:url(laboratorio-paginas-es.webp); }
html[lang^=ru] #conteudo #aplicativo { --lab-ink:url(laboratorio-paginas-ru.webp); }
html[lang^=de] #conteudo #aplicativo { --lab-ink:url(laboratorio-paginas-de.webp); }
html[lang^=fr] #conteudo #aplicativo { --lab-ink:url(laboratorio-paginas-fr.webp); }
#conteudo #aplicativo .gallery-inner {
  max-width:1500px;
  min-height:0;
  padding-block:calc(var(--blend-depth) + 11px) clamp(26px,4svh,48px);
}
#aplicativo .showroom {
  grid-template-columns:minmax(0,1.02fr) minmax(0,1fr);
  grid-template-areas:"editorial presentation";
  column-gap:clamp(26px,5.5vw,94px);
  align-items:start;
  margin:0;
  min-height:0;
}
#aplicativo .gallery-editorial {
  grid-area:editorial;
  min-width:0;
  padding-top:clamp(8px,1.65svh,24px);
}
#aplicativo .chapter-head {
  display:block;
  text-shadow:none;
}
#aplicativo .mask-title {
  font-size:clamp(48px,4.95vw,85px);
  line-height:.98;
}
#aplicativo .mask-title > span {
  display:block;
  max-width:100%;
  vertical-align:top;
}
#aplicativo .mask-title > span + span { margin-inline-start:0; }
#aplicativo .mask-title > span:first-child { padding-inline-end:.2em; }
#aplicativo .topic-index { margin-top:clamp(16px,2svh,26px); }
#aplicativo .gallery-tabs {
  display:flex;
  flex-wrap:wrap;
  gap:0 clamp(12px,1.18vw,23px);
  width:fit-content;
  max-width:100%;
  align-items:center;
  padding:0;
  border-bottom:1px solid rgb(193 202 222 / 25%);
}
#aplicativo .gallery-tabs a {
  gap:0;
  min-height:43px;
  padding:4px 0;
  border:0;
  box-shadow:none;
  color:#cbd1dc;
  font-size:clamp(13px,1.04vw,16px);
  white-space:nowrap;
}
#aplicativo .gallery-tabs .icon { display:none; }
#aplicativo .gallery-tabs a[aria-selected=true] { color:white; box-shadow:inset 0 -2px #ccadf3; }
#aplicativo .scene-info {
  max-width:41ch;
  margin-top:clamp(16px,2.1svh,26px);
}
#aplicativo .topic h3 {
  max-width:20ch;
  font-size:clamp(25px,2.35vw,38px);
  line-height:1.07;
}
#aplicativo .topic p {
  margin-top:9px;
  max-width:40ch;
  color:#e2e4ef;
  line-height:1.53;
}
#aplicativo .mode-options { gap:6px; margin-top:12px; }
#aplicativo .mode-options button { min-height:40px; }
#aplicativo .gallery-presentation {
  grid-area:presentation;
  display:grid;
  min-width:0;
  margin:0;
}
#aplicativo .showroom-product {
  grid-area:auto;
  display:grid;
  height:var(--device-height);
  place-items:center;
  transform:none;
}
.armed #aplicativo .showroom-product {
  opacity:var(--product-visibility,1);
  transform:translateY(var(--product-rise,0px));
}
#aplicativo .showroom-product:focus-within { opacity:1; transform:none; }
#aplicativo .gallery-phone, #aplicativo .gallery-mac {
  justify-self:center;
  margin:0;
  height:auto;
  max-width:100%;
  scale:none;
}
#aplicativo .showroom .gallery-phone { width:min(100%,calc(var(--device-height) * 811 / 1519)); }
/* The hardware photograph contains an earlier UI. Back the new projection
   with opaque glass inside the same screen mask, including its curved edges. */
#aplicativo .gallery-phone .screen-window { background-color:#070a17; }
#aplicativo .showroom .gallery-mac { width:min(100%,calc(var(--device-height) * 1397 / 980)); }
#aplicativo .gallery-presentation:has(.gallery-mac:not([hidden])) {
  min-height:calc(var(--device-height) + 28px);
  align-content:center;
}
#aplicativo .showroom:has(.gallery-mac:not([hidden])) .showroom-product { height:auto; }
#aplicativo .gallery-glow { display:none; }
#aplicativo .capture-caption {
  margin:8px 0 0;
  text-align:center;
  font-size:clamp(11px,.87vw,13px);
  line-height:1.4;
  color:#cbd2df;
}
#aplicativo .gallery-photo:focus-visible { outline:2px solid #eee4ff; outline-offset:4px; }

/* The room and the foreground are registered plates sharing one sensor crop.
   Changing focal length while retreating keeps the book on its original plane. */
#aplicativo .book-world {
  position:absolute;
  inset:0 0 var(--lab-passage);
  height:auto;
  align-self:stretch;
  width:100%;
  background:#0a1018;
  overflow:hidden;
  transform:none;
  /* Fade only the distant room on entry and the final strip of metal on
     exit. Live text, hardware, and the moving instrument keep their ink. */
  mask-image:linear-gradient(to bottom,
    transparent 0,
    rgb(0 0 0 / .1) calc(var(--blend-depth) * .18),
    rgb(0 0 0 / .56) calc(var(--blend-depth) * .53),
    rgb(0 0 0 / .95) calc(var(--blend-depth) * .85),
    #000 var(--blend-depth),
    #000 calc(100% - var(--floor-edge)),
    rgb(0 0 0 / .78) calc(100% - var(--floor-edge) * .8),
    rgb(0 0 0 / .32) calc(100% - var(--floor-edge) * .59),
    rgb(0 0 0 / .06) calc(100% - var(--floor-edge) * .39),
    transparent calc(100% - 2px));
}
/* The next chapter's actual moving white/lilac light rises into a dedicated
   area below the bench. The gradient is opaque before its first heading. */
#conteudo #aplicativo + .cinema {
  margin-top:calc(-1 * var(--lab-passage));
  padding-top:calc(var(--lab-passage) + clamp(52px,6.8vw,110px));
  mask-image:
    linear-gradient(to bottom,
      transparent 0,
      rgb(0 0 0 / .04) calc(var(--lab-passage) * .12),
      rgb(0 0 0 / .18) calc(var(--lab-passage) * .28),
      rgb(0 0 0 / .47) calc(var(--lab-passage) * .5),
      rgb(0 0 0 / .79) calc(var(--lab-passage) * .71),
      rgb(0 0 0 / .96) calc(var(--lab-passage) * .88),
      #000 var(--lab-passage)),
    radial-gradient(ellipse 90% calc(var(--lab-passage) * 2.6) at 82% calc(var(--lab-passage) * 2.55),
      #000 66%,transparent 98%);
}
#aplicativo .archive-optical-field {
  display:block;
  position:absolute;
  left:var(--subject-x);
  top:var(--subject-y);
  width:max(100cqw,calc(100cqh * 1672 / 941));
  aspect-ratio:1672 / 941;
  background:none;
  transform:translate(calc(-1 * var(--subject-x)),calc(-1 * var(--subject-y)));
}
#aplicativo .archive-shelves,
#aplicativo .lab-print,
#aplicativo .archive-optical-field::after {
  position:absolute;
  inset:0;
  background-position:center;
  background-repeat:no-repeat;
  background-size:100% 100%;
}
#aplicativo .archive-shelves {
  mask-image:none;
  background-image:url(laboratorio-ambiente.webp);
  transform-origin:var(--subject-x) var(--subject-y);
  transform:scale(var(--archive-room-scale,1));
}
/* Register the near wall to the instrument where the film meets the still.
   Feather it into the independent far enclosure across the whole work area. */
#aplicativo .archive-optical-field::before {
  content:"";
  position:absolute;
  inset:0;
  background:url(laboratorio-ambiente.webp) center/100% 100% no-repeat;
  mask-image:radial-gradient(ellipse 45% 63% at 45% 60%,#000 55%,transparent 98%);
  z-index:1;
}
#aplicativo .archive-optical-field::after {
  content:"";
  background-image:url(laboratorio-bancada.webp);
  z-index:1;
}
#aplicativo .lab-film {
  position:absolute;
  inset:0;
  z-index:2;
  width:100%;
  height:100%;
  pointer-events:none;
  object-fit:fill;
  opacity:0;
  mask:url(laboratorio-mascara.webp) center/100% 100% no-repeat;
  transition:opacity .4s ease-out;
}
#aplicativo .lab-film.is-playing { opacity:1; }
#aplicativo .lab-print { z-index:3; background-image:var(--lab-ink); }
#aplicativo .book-world::after {
  background:linear-gradient(137deg,rgb(5 9 22 / 51%),transparent 54%),
             linear-gradient(0deg,rgb(9 18 34 / 14%),transparent 34%);
}
#aplicativo .gallery-wash { display:none; }
.film-still #aplicativo .archive-shelves { transform:none; }

@media (max-width:950px) and (min-width:701px) {
  #aplicativo .showroom { column-gap:20px; }
  #aplicativo .topic h3 { font-size:25px; }
  #aplicativo .gallery-tabs { gap:0 13px; }
}
/* On wide monitors let the optical table run out to both edges while
   preserving a lens and book sized for the editorial composition. */
@media (min-width:1100px) and (min-aspect-ratio:2/1) {
  #aplicativo .archive-optical-field {
    width:calc(100cqh * 1672 / 941);
    left:50%;
    top:auto;
    bottom:0;
    transform:translateX(-50%);
  }
  #aplicativo .archive-shelves {
    left:calc(50% - 50cqw);
    width:100cqw;
    background-image:url(laboratorio-panoramica.webp);
    transform-origin:42% var(--subject-y);
  }
  #aplicativo .archive-optical-field::after {
    mask-image:linear-gradient(90deg,transparent,#000 4.7%,#000 70%,transparent);
  }
}
@media (min-width:701px) and (orientation:portrait) {
  #aplicativo .gallery-presentation:has(.gallery-mac:not([hidden])) .capture-caption {
    justify-self:end;
    max-inline-size:64%;
    text-align:end;
    text-wrap:balance;
  }
  #aplicativo .archive-optical-field {
    width:107cqw;
    left:-2cqw;
    top:auto;
    bottom:0;
    transform:none;
  }
  #aplicativo .archive-shelves {
    inset:auto auto 0 2cqw;
    width:100cqw;
    height:100cqh;
    background-size:cover;
    background-position:center;
    transform-origin:25cqw calc(100% - 107cqw * 941 / 1672 * .19);
  }
}
@media (max-width:700px) {
  #conteudo #aplicativo {
    --device-height:min(132vw,calc(100svh - var(--nav-h) - 90px),590px);
    --blend-depth:clamp(32px,5.5svh,53px);
  }
  #conteudo #aplicativo .gallery-inner { padding-block:calc(var(--blend-depth) + 12px) clamp(222px,calc(62vw + 32px),359px); }
  #aplicativo .showroom {
    grid-template-columns:minmax(0,1fr);
    grid-template-areas:"editorial" "presentation";
    gap:clamp(19px,5.2vw,29px);
  }
  #aplicativo .gallery-editorial { padding:0; }
  #aplicativo .mask-title { font-size:clamp(40px,9.8vw,58px); }
  #aplicativo .mask-title > span { display:inline-block; }
  #aplicativo .topic-index { margin-top:12px; }
  #aplicativo .gallery-tabs { column-gap:clamp(10px,3.2vw,20px); }
  #aplicativo .gallery-tabs a { min-height:40px; font-size:clamp(12px,3.3vw,15px); }
  #aplicativo .scene-info { margin-top:13px; }
  #aplicativo .topic h3 { max-width:100%; font-size:clamp(24px,5.8vw,31px); }
  #aplicativo .topic p { margin-top:6px; font-size:15px; }
  #aplicativo .gallery-presentation { justify-items:end; }
  #aplicativo .showroom-product { width:100%; justify-items:end; }
  #aplicativo .showroom .gallery-phone { justify-self:end; margin-right:3%; }
  #aplicativo .capture-caption { margin:6px 3% 0 0; }
  #aplicativo .gallery-presentation:has(.gallery-mac:not([hidden])) { min-height:0; }
  #aplicativo .showroom .gallery-mac { width:100%; }
  #aplicativo .archive-optical-field {
    --phone-plate-width:164cqw;
    width:var(--phone-plate-width);
    left:-4cqw;
    top:auto;
    bottom:0;
    transform:none;
  }
  /* Portrait needs a taller view of the room. Frame the cabinets independently
     while keeping the book, the table and their common optical center in place. */
  #aplicativo .archive-shelves {
    inset:auto auto 0 4cqw;
    width:100cqw;
    height:100cqh;
    background-position:61% center;
    background-size:cover;
    transform-origin:37cqw calc(100% - var(--phone-plate-width) * 941 / 1672 * .19);
  }
  #aplicativo .book-world::after {
    background:linear-gradient(180deg,rgb(5 10 20 / 67%) 0%,rgb(5 10 20 / 52%) 32%,transparent 68%);
  }
}
@media (forced-colors:active) {
  #aplicativo .gallery-tabs a[aria-selected=true] { border-bottom:2px solid Highlight; }
}
