:root { --bar-header: 5rem; }
html { scroll-padding-top: calc(var(--bar-header) + 1rem); }
.top { position: sticky; top: 0; }
.cover {
  --shot: calc(100vh - var(--bar-header));
  --shot: calc(100svh - var(--bar-header));
  --travel: clamp(50rem, 152svh, 100rem);
  --room-shadow: linear-gradient(180deg, #1012141c, #1c17143f 60%, #100e0a48);
  position: relative; background: #100d0c;
}
.bar-stage { position: relative; isolation: isolate; overflow: hidden; }
.bar-shelf-anchor { position: absolute; top: var(--shot); left: 0; width: 1px; height: 1px; pointer-events: none; }
.bar-shelf-anchor { scroll-margin-top: -1rem; }
.bar-hall, .bar-hall picture, .bar-hall img { display: block; width: 100%; height: 100%; }
.bar-upper, .bar-lower { position: relative; height: var(--shot); container-type: size; }
.bar-upper, .bar-lower { overflow: hidden; }
.bar-upper { background: #15100e; }
/* The room is framed behind the full-size bottles before the scroll script loads. */
.bar-hall-frame {
  position: absolute; left: 50%; top: 50%;
  width: max(100cqw, 177.68cqh); aspect-ratio: 1672 / 941;
  transform: translate(-50%, -50%);
}
.bar-hall { transform-origin: 0 0; }
.bar-hall-frame::after { content: ""; position: absolute; inset: 0; background: var(--room-shadow); opacity: .69; }
.bar-inscription {
  position: absolute; z-index: 1; top: 10%; left: 50%; transform: translate(-50%, -50%);
  width: min(40cqw, 44cqh); height: auto; pointer-events: none;
  filter: drop-shadow(0 2px 4px #29180e99);
}
.bar-foreground { position: absolute; inset: 0; z-index: 1; container-type: size; pointer-events: none; }
.bar-floor, .bar-row { position: absolute; inset: 0; container-type: size; }
.bar-fit-upper, .bar-countertop {
  position: absolute; aspect-ratio: 1586 / 992; left: 50%; top: 65%;
  transform: translate(-50%, -65%);
}
.bar-fit-upper { width: min(100%, 159.88cqh); }
.bar-countertop {
  width: 100%; height: min(100cqh, 62.55cqw);
  mask-image: linear-gradient(180deg, transparent 80.9%, #000 81.8%);
}
.bar-empty, .bar-room, .bar-backwall { position: absolute; inset: 0; width: 100%; height: 100%; }
.bar-empty { background: url("img/barra/barra-vacia.webp") center / 100% 100%; }
.bar-backwall { container-type: size; transform-origin: 0 0; }
/* The cabinet is registered to the wide and portrait photographs of the room. */
.bar-fit-lower {
  --hall-left: -.12388; --hall-top: -.09416; --hall-width: 1.24776; --hall-height: 1.24801;
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -43%);
  width: max(112cqw, 229cqh); aspect-ratio: 1672 / 941;
}
.bar-lower { background: #15100e; isolation: isolate; }
.bar-cabinet-face { position: absolute; inset: 0; }
@property --lamp-radius {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 36%;
}
@property --lamp-bounce {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
.bar-shelves {
  position: absolute; inset: 0; pointer-events: none;
}
.bar-bay { position: absolute; inset-block: 0; --crown: 15.83422%; }
/* Each bay has two mask columns, direct light and spill, registered to the same photograph. */
.bar-bay:nth-child(1) {
  left: 7.11722%; width: 26.85407%;
  --direct-x: 0%; --spill-x: 20%; --fixture-x: 52.6%; --crown-x: 54.8%;
}
.bar-bay:nth-child(2) {
  left: 36.48325%; width: 27.03349%; --crown: 12.00850%;
  --direct-x: 40%; --spill-x: 60%; --fixture-x: 50%; --crown-x: 49.8%; --crown-y: 9.7%;
}
.bar-bay:nth-child(3) {
  left: 66.02871%; width: 26.79426%;
  --direct-x: 80%; --spill-x: 100%; --fixture-x: 44.6%; --crown-x: 45.1%;
}
.bar-bay a {
  position: absolute; inset-inline: 0; top: var(--from); height: calc(var(--to) - var(--from));
  pointer-events: auto; --origin-x: var(--fixture-x); --lamp-on: 0; --lamp-visible: hidden;
}
.bar-bay a:nth-child(1) {
  --from: var(--crown); --to: 41.55154%; --mask-y: 0%; --origin-x: var(--crown-x); --origin-y: var(--crown-y, 12.8%);
}
.bar-bay a:nth-child(2) { --from: 41.55154%; --to: 59.29862%; --mask-y: 50%; --origin-y: 4.8%; }
.bar-bay a:nth-child(3) { --from: 59.29862%; --to: 77.89586%; --mask-y: 100%; --origin-y: 6.3%; }
.bar-fill, .bar-bay a::before, .bar-bay a::after {
  position: absolute; inset: 0; pointer-events: none;
  background: var(--lit-photo, none) center / 100% 100% no-repeat;
}
/* The room photograph includes ambient light. Load an individual lamp when it is first used. */
.bar-bay a:is(.lamp-ready, :focus-visible, :active) {
  --lit-photo: var(--lamp-photo);
  --lamp-masks: url("img/barra/salon/luces/huellas.webp");
}
.bar-fill {
  --lamp-bounce: var(--lamp-on);
  opacity: var(--lamp-bounce);
}
.bar-bay a::before, .bar-bay a::after {
  content: ""; z-index: 1;
  opacity: var(--lamp-on); visibility: var(--lamp-visible);
}
.bar-bay a::before {
  mask: var(--lamp-masks, none) var(--direct-x) var(--mask-y) / 600% 300% no-repeat;
}
.bar-bay a::after {
  --lamp-radius: calc(36% + var(--lamp-on) * 112%);
  mask-image: var(--lamp-masks, none),
    radial-gradient(ellipse var(--lamp-radius) calc(var(--lamp-radius) * 1.6) at var(--origin-x) var(--origin-y),
      #000 55%, #000d 68%, #0005 86%, transparent 100%);
  mask-position: var(--spill-x) var(--mask-y), center;
  mask-size: 600% 300%, 100% 100%;
  mask-repeat: no-repeat;
  mask-composite: intersect;
}
.bar-bay a:is(:focus-visible,:active) {
  --lamp-on: 1; --lamp-visible: visible;
}
.bar-bay a:focus-visible { outline-offset: -2px; }
.bar-bay-controls { display: none; }
.brand-categories > :target h3 { color: #e8c994; }
@media (prefers-reduced-motion: no-preference) {
  .bar-fill {
    transition: --lamp-bounce calc(.32s + var(--lamp-on) * .28s) cubic-bezier(.35,.06,.28,1) calc(var(--lamp-on) * .11s);
  }
  .bar-bay a {
    --spill-duration: calc(.32s + var(--lamp-on) * .25s);
    --warm-up: calc(var(--lamp-on) * .045s);
    --hide-after: calc((1 - var(--lamp-on)) * .40s);
  }
  .bar-bay a::before {
    transition: opacity .28s ease-out calc((1 - var(--lamp-on)) * .045s), visibility 0s linear var(--hide-after);
  }
  .bar-bay a::after {
    transition: --lamp-radius var(--spill-duration) cubic-bezier(.32,.08,.24,1) var(--warm-up),
      opacity var(--spill-duration) ease-in-out var(--warm-up), visibility 0s linear var(--hide-after);
  }
}
.bar-title {
  position: absolute; z-index: 1; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  padding: 0 max(var(--gutter), 5.8cqw) clamp(2rem, 10cqh, 7rem);
  color: #fff3de; font-family: var(--titulares);
  font-size: clamp(2.5rem, min(7.8cqw, 15cqh), 9rem); font-synthesis: none;
  line-height: .99; letter-spacing: .012em; text-transform: uppercase; text-shadow: 0 2px 8px #21120c80;
  background: radial-gradient(ellipse 80% 86% at 9% 82%, #150d09e0, #1b100bb8 34%, #21150e5c 67%, transparent 96%);
}
.bar-sales, .bar-sales > span { display: block; }
.bar-title em {
  margin-top: .48em; font-size: clamp(1.5rem, min(3.3cqw, 6.5cqh), 3.8rem);
  font-style: normal; line-height: 1.1; letter-spacing: .035em; color: #f3d4a3;
}

/* The inside edges of the fourth and fifth bottles are equally far from the lens axis. */
.bar-row-back { --y: 83.55%; --mobile-y: 54.5%; }
.bar-row-front { --y: 85.7%; --mobile-y: 90.5%; }
.bar-row { --half-aisle: 2.9%; }
.bar-dom {
  --product: url("img/barra/entrada/dom-perignon.webp");
  --silhouette: polygon(29% 1%, 68% 1%, 72% 12%, 67% 17%, 70% 31%, 94% 52%,
    100% 62%, 99% 97%, 84% 100%, 16% 100%, 0 97%, 0 62%, 7% 51%, 27% 34%, 31% 19%, 26% 13%);
  --x: 5.8%; --w: 10.95%; --mobile-x: 11.2%; --mobile-w: 19%; --max-w: 11.4cqh;
  --exposure: .93; --cast: -21deg; --glow: #8b7e3d40;
}
.bar-walker {
  --product: url("img/barra/entrada/johnnie-walker.webp");
  --silhouette: polygon(26% 0, 75% 0, 73% 18%, 100% 31%, 100% 96%, 92% 100%,
    6% 100%, 0 95%, 1% 32%, 26% 19%);
  --x: 17.5%; --w: 9.55%; --mobile-x: 12.1%; --mobile-w: 16%; --max-w: 9.5cqh;
  --cast: -13deg; --glow: #d1933d6b;
  --transmission: radial-gradient(ellipse 17% 9% at 50% 19%, #000c, #000);
}
.bar-patron {
  --product: url("img/barra/entrada/patron.webp");
  --silhouette: polygon(40% 0, 58% 0, 71% 8%, 70% 16%, 74% 18%, 68% 23%, 70% 38%,
    88% 46%, 98% 57%, 100% 94%, 95% 99%, 13% 100%, 2% 95%, 0 61%, 8% 49%,
    31% 37%, 32% 23%, 26% 18%, 30% 16%, 29% 9%);
  --x: 29%; --w: 12.45%; --mobile-x: 34.5%; --mobile-w: 22.6%; --max-w: 14cqh;
  --cast: -7deg; --glow: #bb9a6463;
  --transmission: radial-gradient(ellipse 47% 18% at 50% 42%, #0009, #000 94%);
}
.bar-jack {
  --product: url("img/barra/entrada/jack-daniels.webp");
  --silhouette: polygon(30% 0, 70% 0, 68% 15%, 75% 25%, 74% 34%, 100% 42%,
    100% 96%, 92% 100%, 8% 100%, 0 96%, 0 43%, 26% 34%, 24% 26%, 31% 15%);
  --w: 11.45%; --mobile-w: 20.5%; --max-w: 12.7cqh;
  --cast: -12deg; --glow: #cc83326b;
}
.bar-home.bar-azul {
  --product: url("img/barra/entrada/clase-azul.webp");
  --silhouette: polygon(43% 0, 56% 0, 76% 4%, 84% 11%, 66% 27%, 86% 49%, 87% 58%,
    78% 66%, 88% 72%, 100% 97%, 76% 100%, 23% 100%, 0 97%, 11% 73%, 22% 66%,
    13% 59%, 13% 49%, 33% 27%, 14% 11%, 22% 4%);
  --w: 12.25%; --mobile-w: 20.5%; --max-w: 12.7cqh;
  --exposure: .89; --cast: 9deg; --glow: transparent;
}
.bar-bombay {
  --product: url("img/barra/entrada/bombay-sapphire.webp");
  --silhouette: polygon(26% 0, 75% 0, 74% 14%, 76% 21%, 100% 31%, 100% 97%,
    86% 100%, 14% 100%, 0 97%, 0 31%, 21% 23%, 26% 20%);
  --x: 71.6%; --w: 10.3%; --mobile-x: 65.5%; --mobile-w: 18.5%; --max-w: 11.7cqh;
  --cast: 8deg; --glow: #71949158;
  --transmission: radial-gradient(ellipse 41% 11% at 50% 28%, #000d, #000);
}
.bar-home.bar-julio {
  --product: url("img/barra/entrada/don-julio.webp");
  --silhouette: polygon(36% 0, 62% 0, 75% 5%, 73% 10%, 69% 14%, 74% 29%,
    94% 68%, 100% 90%, 100% 98%, 92% 100%, 6% 100%, 0 98%, 2% 83%, 30% 14%, 23% 6%);
  --x: 83.3%; --w: 11.45%; --mobile-x: 87.9%; --mobile-w: 16.8%; --max-w: 10.1cqh;
  --exposure: .95; --cast: 12deg; --glow: #db873353;
}
.bar-jameson {
  --product: url("img/barra/entrada/jameson.webp");
  --silhouette: polygon(30% 0, 70% 0, 70% 16%, 75% 30%, 99% 40%, 100% 96%,
    94% 100%, 6% 100%, 0 96%, 1% 40%, 9% 35%, 26% 30%);
  --x: 94.6%; --w: 9.7%; --mobile-x: 89%; --mobile-w: 16%; --max-w: 10.2cqh;
  --exposure: .89; --cast: 21deg; --glow: #9993504d;
}
.bar-home { position: absolute; height: 0; left: var(--x); top: var(--y); width: var(--w); transform: translateX(-50%); }
.bar-home[data-aisle="left"] { left: auto; right: calc(50% + var(--half-aisle)); transform: none; }
.bar-home[data-aisle="right"] { left: calc(50% + var(--half-aisle)); transform: none; }
.bar-bottle {
  position: absolute; width: 100%; left: 0; bottom: 0; pointer-events: none;
}
.bar-bottle img {
  width: 100%; height: auto;
  filter: brightness(var(--exposure, .92));
  mask-image: var(--transmission, none);
}
/* The hit area stays on the counter while the glass lifts. */
.bar-bottle a {
  position: absolute; inset: var(--lift) 0 0;
  clip-path: var(--silhouette); pointer-events: auto; cursor: pointer;
}
.bar-bottle a:focus-visible { outline: none; }
.bar-bottle:has(a:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; }
.bar-bottle:has(a:is(:focus-visible, :active)) { --bottle-y: var(--lift); }
.bar-foot {
  position: absolute; top: -1px; left: -23%; width: 146%; aspect-ratio: 1 / .28;
  transform: skewX(var(--cast)); transform-origin: center top;
}
.bar-foot::before {
  content: ""; position: absolute; inset: -15% -4% 0;
  background: radial-gradient(ellipse 31% 7% at 50% 14%, #100a07f2 36%, #170f0ac9 66%, transparent),
    radial-gradient(ellipse 14% 16% at 56% 32%, var(--glow), transparent),
    radial-gradient(ellipse 40% 39% at 50% 25%, #1b120bc9 7%, #21160d69 52%, transparent 95%);
}
.bar-foot::after {
  content: ""; position: absolute; inset: 0 15.75% 33%;
  background: var(--product) center bottom / 100% auto no-repeat;
  transform: scaleY(-1); filter: blur(1px); opacity: .20;
  mask-image: linear-gradient(0deg, #000 2%, #0008 32%, transparent 96%);
}
/* A stable stage keeps the camera in place when Safari retracts its address bar. */
@media (prefers-reduced-motion: no-preference) {
  .cover { --shot: 100vh; --shot: 100lvh; margin-top: calc(-1 * var(--bar-header)); }
  .bar-inscription { top: calc(var(--bar-header) + 8%); }
}
@media (prefers-reduced-motion: no-preference) and (scripting: enabled) {
  .cover { min-height: calc(var(--shot) + var(--travel)); }
}
.cover.is-travelling { height: calc(var(--shot) + var(--travel)); }
.is-travelling .bar-shelf-anchor { top: var(--travel); }
.is-travelling .bar-stage { position: sticky; top: 0; height: var(--shot); }
.is-travelling .bar-upper, .is-travelling .bar-lower { position: absolute; inset: 0; }
.is-travelling .bar-upper { z-index: 1; background: none; pointer-events: none; }
.is-travelling .bar-row, .is-travelling .bar-floor { transform-origin: 50% 48%; }

@media (max-width: 58rem) { :root { --bar-header: 4.3rem; } }
@media (max-width: 44rem) { :root { --bar-header: 4rem; } }
@media (max-height: 32rem) and (min-aspect-ratio: 1/1) {
  :root { --bar-header: 3.45rem; }
  .top .top-inner { min-height: var(--bar-header); }
}
@media (max-aspect-ratio: 1/1) {
  .cover { --travel: 130svh; }
  .bar-inscription { top: 8%; width: min(56cqw, 36cqh); }
  .bar-fit-upper, .bar-countertop { inset: 0; width: 100%; height: 100%; transform: none; aspect-ratio: auto; }
  .bar-hall-frame {
    width: max(100cqw, 56.28cqh); aspect-ratio: 941 / 1672;
  }
  .bar-countertop { mask-image: linear-gradient(180deg, transparent 47.2%, #000 47.6%); }
  .bar-empty { background: url("img/barra/basalto-vertical.webp") center / 100% 100% no-repeat; }
  .bar-home { left: var(--mobile-x); top: var(--mobile-y); width: min(var(--mobile-w), var(--max-w)); }
  .bar-row { --half-aisle: 3.3%; }
  .bar-fit-lower {
    --hall-left: -.03284; --hall-top: -.60362; --hall-width: 1.06569; --hall-height: 3.36419;
    width: max(112cqw, 218cqh);
    translate: var(--shelf-pan, 0%) 0;
  }
  .bar-bay-controls:not([hidden]) {
    display: flex; justify-content: space-between; position: absolute; z-index: 2;
    inset: auto .75rem .6rem; pointer-events: none;
  }
  .is-travelling .bar-bay-controls { bottom: max(.6rem, calc(100lvh - 100dvh + .6rem + env(safe-area-inset-bottom))); }
  .bar-bay-controls button {
    display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0 0 .15em;
    border: 1px solid #c7a57d66; border-radius: var(--button-radius); background: #261b12db; color: #f1dcba;
    font: 1.75rem/1 Georgia, serif; cursor: pointer; pointer-events: auto;
  }
  .bar-bay-controls button:disabled { visibility: hidden; }
  .is-travelling .bar-row, .is-travelling .bar-floor { transform-origin: 50% 30%; }
  .bar-title {
    padding: 0 max(var(--gutter), 6cqw) max(4.5rem, 12cqh);
    font-size: clamp(2.2rem, 11.4cqw, 6.6rem);
    background: linear-gradient(0deg, #140d09e8, #1b110bd1 22%, #22170e66 48%, transparent 72%);
  }
  .bar-title em { font-size: clamp(1.5rem, 5.9cqw, 3.25rem); }
}
@media (max-aspect-ratio: 1/1) and (prefers-reduced-motion: no-preference) {
  .bar-inscription { top: calc(var(--bar-header) + 8%); }
  .bar-fit-lower { transition: translate .38s ease-out; }
}
