/* The perfume page with the light that crosses the glass. A dark product page in two columns: the photograph on the
   left, the words on the right. The photo is stacked in layers inside .shot, a box with the photo's own proportions
   that the script sizes to cover its column (so the outline of the bottle, written in the photo's pixels, lands on
   the glass at every size): the photo in the dark, the same photo lit inside a pool of light, the warm halo behind
   the bottle, the caustic on the table, and the glass layer clipped to the bottle with the glowing amber and the
   glints. The script moves the light with --lx and --ly (pixels inside .shot) and --i (how much light there is). */
:root {
  --page: #0b0907;          /* the page */
  --card: #120e0b;          /* the product page */
  --edge: rgba(255, 232, 200, 0.08); /* its hairline edge */
  --ink: #f2e9dc;           /* the words */
  --muted: #8b7f70;         /* the small words, and the notes in the dark */
  --accent: #e3a457;        /* amber: the one colour of light */
  --button: #f2e9dc;        /* the button */
  --button-ink: #15100b;    /* the words on the button */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 3vmin, 32px);
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 30% 45%, rgba(227, 164, 87, 0.06), transparent 70%),
    var(--page);
}

/* ------------------------------------------------------------------ the page */
.product {
  position: relative;
  width: min(900px, 94vw);
  height: min(560px, 90vh);
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
  border-radius: clamp(14px, 2.6vmin, 26px);
  background: linear-gradient(180deg, #16110d, var(--card) 60%);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 236, 210, 0.07),
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 24px 48px -16px rgba(0, 0, 0, 0.75),
    0 60px 120px -40px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  opacity: 0;
}

/* ------------------------------------------------------------------ the photo */
.photo {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #0d0a08;
  --lx: -999px;
  --ly: -999px;
  --r: 260px;
  --i: 0;
  --dark: 0.38;
}

.shot {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* the room in the dark */
.shot__img {
  filter: brightness(var(--dark)) saturate(0.78) contrast(1.08);
}

/* the same room inside the pool of light */
.shot__lit {
  filter: brightness(0.86) saturate(1.04) sepia(0.18) contrast(1.06);
  opacity: var(--i);
  -webkit-mask-image: radial-gradient(circle var(--r) at var(--lx) var(--ly), #000 0%, rgba(0, 0, 0, 0.62) 34%, rgba(0, 0, 0, 0.18) 68%, transparent 100%);
  mask-image: radial-gradient(circle var(--r) at var(--lx) var(--ly), #000 0%, rgba(0, 0, 0, 0.62) 34%, rgba(0, 0, 0, 0.18) 68%, transparent 100%);
}

/* the warm air behind the bottle: the light that came through the amber, everywhere but on the glass */
.shot__halo {
  position: absolute;
  inset: 0;
  background: radial-gradient(var(--hw, 220px) var(--hh, 360px) at var(--hx, 50%) var(--hy, 55%), rgba(227, 164, 87, 0.5), rgba(227, 120, 50, 0.16) 45%, transparent 75%);
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
}

/* the caustic on the table: the amber light focused by the glass, thrown on the other side of the light */
.shot__caustic {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw, 160px);
  height: var(--ch, 40px);
  margin: calc(var(--ch, 40px) / -2) 0 0 calc(var(--cw, 160px) / -2);
  opacity: 0;
  mix-blend-mode: screen;
  pointer-events: none;
}

.shot__caustic-light {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, rgba(255, 214, 150, 0.95), rgba(240, 160, 70, 0.55) 38%, rgba(200, 110, 40, 0.18) 70%, transparent),
    repeating-radial-gradient(ellipse at 42% 50%, rgba(255, 230, 180, 0.5) 0 2px, transparent 3px 9px);
  background-size: 100% 100%, 140% 140%;
  background-position: 50% 50%, 30% 50%;
  -webkit-mask-image: radial-gradient(closest-side, #000 40%, transparent);
  mask-image: radial-gradient(closest-side, #000 40%, transparent);
  filter: blur(2.5px);
}

/* the glass: clipped to the outline of the bottle by the script */
.shot__glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.shot__amber {
  filter: brightness(1.12) saturate(1.38) contrast(1.12);
  opacity: calc(var(--i) * var(--amber, 0.9));
  -webkit-mask-image: radial-gradient(circle calc(var(--r) * 0.8) at var(--lx) var(--ly), #000 0%, rgba(0, 0, 0, 0.4) 45%, transparent 100%);
  mask-image: radial-gradient(circle calc(var(--r) * 0.8) at var(--lx) var(--ly), #000 0%, rgba(0, 0, 0, 0.4) 45%, transparent 100%);
}

.shot__streak {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--sw, 22px);
  height: 100%;
  margin-left: calc(var(--sw, 22px) / -2);
  opacity: 0;
  mix-blend-mode: screen;
}

.shot__streak-light {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 246, 228, 0.32) 30%, rgba(255, 252, 244, 0.95) 50%, rgba(255, 246, 228, 0.32) 70%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent calc(var(--ly) - var(--r) * 0.9), #000 var(--ly), transparent calc(var(--ly) + var(--r) * 0.9));
  mask-image: linear-gradient(180deg, transparent calc(var(--ly) - var(--r) * 0.9), #000 var(--ly), transparent calc(var(--ly) + var(--r) * 0.9));
  filter: blur(1.5px);
}

.shot__streak--back .shot__streak-light {
  background: linear-gradient(90deg, transparent, rgba(255, 196, 120, 0.55) 50%, transparent);
  filter: blur(3px);
}

/* the dark around the edges, and the photo melting into the page on the right */
.photo__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 55% 50%, transparent 55%, rgba(8, 6, 5, 0.6) 100%),
    linear-gradient(90deg, transparent 78%, rgba(18, 14, 11, 0.55));
}

/* the hairline between the photo and the words, lit at the height of the light */
.photo__seam {
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent calc(var(--ly) - 140px), rgba(227, 164, 87, 0.85) var(--ly), transparent calc(var(--ly) + 140px));
  opacity: var(--i);
  pointer-events: none;
}

.photo__tag {
  position: absolute;
  left: clamp(10px, 2.4vmin, 22px);
  bottom: clamp(10px, 2.4vmin, 20px);
  font-size: clamp(9px, 1.3vmin, 11px);
  font-variation-settings: 'wdth' 112;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(242, 233, 220, 0.62);
}

/* ------------------------------------------------------------------ the words */
.info {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(12px, 5.2vmin, 54px) clamp(12px, 5vmin, 52px);
}

.info__house {
  margin: 0;
  font-size: clamp(9px, 1.4vmin, 11px);
  font-weight: 560;
  font-variation-settings: 'wdth' 118;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.info__name {
  margin: clamp(6px, 1.4vmin, 12px) 0 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: clamp(21px, min(5vw, 7.4vh), 50px);
  font-weight: 340;
  font-variation-settings: 'opsz' 96, 'SOFT' 60;
  line-height: 1;
  letter-spacing: -0.015em;
}

.info__name em {
  font-style: italic;
  font-weight: 300;
  font-variation-settings: 'opsz' 96, 'SOFT' 100, 'WONK' 1;
}

.info__kind {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: clamp(6px, 1.3vmin, 12px) 0 0;
  font-size: clamp(10px, 1.6vmin, 13px);
  color: var(--muted);
}

.info__sep {
  width: 16px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.info__line {
  margin: clamp(8px, 2vmin, 18px) 0 0;
  max-width: 30ch;
  font-size: clamp(11px, 1.8vmin, 14px);
  line-height: 1.5;
  color: rgba(242, 233, 220, 0.66);
}

/* the notes: each one lights up as the light passes its height on the bottle (--h from 0 to 1, set by the script) */
.notes {
  list-style: none;
  margin: clamp(10px, 3.4vmin, 32px) 0 0;
  padding: 0;
  display: grid;
  gap: clamp(6px, 1.6vmin, 14px);
}

.note {
  --h: 0;
  position: relative;
  display: grid;
  grid-template-columns: clamp(34px, 7.4vmin, 62px) minmax(0, 1fr);
  align-items: baseline;
  column-gap: 10px;
  padding-bottom: clamp(5px, 1.3vmin, 11px);
}

.note__tier {
  font-size: clamp(8px, 1.3vmin, 10.5px);
  font-weight: 560;
  font-variation-settings: 'wdth' 116;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) calc(var(--h) * 100%), var(--muted));
}

.note__names {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: clamp(11px, 2.1vmin, 17px);
  font-variation-settings: 'opsz' 24, 'SOFT' 50;
  font-weight: calc(300 + var(--h) * 140);
  line-height: 1.2;
  color: color-mix(in srgb, var(--ink) calc(18% + var(--h) * 82%), #3c342b);
  text-shadow: 0 0 calc(var(--h) * 14px) rgba(227, 164, 87, calc(var(--h) * 0.45));
}

.note__rule {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(242, 233, 220, 0.09);
  overflow: hidden;
}

/* the amber line that runs along the rule: an element of its own, because GSAP moves it */
.note__fill {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, rgba(227, 164, 87, 0.15), var(--accent) 88%, #ffe2b4);
}

/* ------------------------------------------------------------------ price and bag */
.buy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 2vmin, 16px);
  margin-top: clamp(12px, 3.6vmin, 34px);
}

.buy__price {
  display: grid;
  gap: 2px;
  margin: 0;
}

.buy__amount {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: clamp(17px, 3.4vmin, 28px);
  font-weight: 380;
  font-variation-settings: 'opsz' 48;
  line-height: 1;
}

.buy__note {
  font-size: clamp(8.5px, 1.3vmin, 11px);
  color: var(--muted);
}

.bag {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--button-ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bag__face {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: clamp(32px, 6vmin, 46px);
  padding: 0 clamp(14px, 2.6vmin, 22px);
  border-radius: 999px;
  background: linear-gradient(180deg, #fbf4ea, var(--button));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(120, 90, 50, 0.18),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 10px 24px -10px rgba(227, 164, 87, 0.45);
  overflow: hidden;
  transition: box-shadow 0.4s;
}

/* the sheen that crosses the button on hover */
.bag__face::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 210, 150, 0.7), transparent);
  transform: translateX(0) skewX(-14deg);
  opacity: 0;
}

.bag.is-hover .bag__face::after {
  animation: sheen 0.9s cubic-bezier(0.3, 0.6, 0.2, 1) forwards;
}

@media (hover: hover) {
  .bag:hover .bag__face::after {
    animation: sheen 0.9s cubic-bezier(0.3, 0.6, 0.2, 1) forwards;
  }
  .bag:hover .bag__face {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      inset 0 -1px 0 rgba(120, 90, 50, 0.18),
      0 1px 2px rgba(0, 0, 0, 0.4),
      0 14px 30px -10px rgba(227, 164, 87, 0.7);
  }
}

@keyframes sheen {
  0% { transform: translateX(0) skewX(-14deg); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateX(380%) skewX(-14deg); opacity: 0; }
}

.bag__words {
  position: relative;
  font-size: clamp(11px, 1.9vmin, 14px);
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.bag__icon {
  position: relative;
  width: clamp(14px, 2.3vmin, 18px);
  height: clamp(14px, 2.3vmin, 18px);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.bag__check {
  stroke: #b06a1c;
  stroke-width: 1.9;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.bag:focus-visible {
  outline: none;
}

.bag:focus-visible .bag__face {
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent);
}

/* ------------------------------------------------------------------ the drawn pointer and the grain */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 24px;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  fill: #fbf6ee;
  stroke: #16110c;
  stroke-width: 1.2;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
}

.grain {
  position: absolute;
  inset: -40px;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-size: 180px 180px;
  z-index: 4;
}

/* ------------------------------------------------------------------ small boxes */
@media (max-width: 560px) {
  .product {
    grid-template-columns: minmax(0, 0.86fr) minmax(0, 1fr);
  }
  .info__line {
    display: none;
  }
  .note {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 2px;
  }
  .buy {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-height: 520px) {
  .info__line {
    display: none;
  }
}
