/* The olive oil card that lights up against the light: the product card of a small olive mill on a warm paper page.
   On the left a real photograph of corked bottles of oil (.shot, placed by the script so the first bottle stays in the
   middle of the column), with a brighter copy of it (.shot__lit) uncovered from the bottom up by a moving mask, a sun
   behind (.photo__sun) and a glint clipped to the outline of the first bottle. Behind the words a caustic, the light
   that went through the oil, spreads on the card. On the right the mill, the name, four notes, the price and the
   button that fills with oil. */
:root {
  --page: #efe9de;          /* the page */
  --card: #fbf8f2;          /* the card */
  --ink: #23251b;           /* the words */
  --muted: #8b8676;         /* the small words */
  --rule: rgba(35, 37, 27, 0.1); /* the thin lines */
  --oil: #c9a227;           /* the colour of the lit oil, the caustic and the lines */
  --olive: #2f3a1d;         /* the button */
  --olive-ink: #f6f1e4;     /* the words on the button */
  --sun: #ffd98a;           /* the warm light behind the bottle */
}

* {
  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(10px, 3vmin, 32px);
  overflow: hidden;
  background:
    radial-gradient(70% 60% at 50% 42%, rgba(255, 255, 255, 0.55), transparent 70%),
    var(--page);
}

/* ------------------------------------------------------------------ the card */
.card {
  position: relative;
  width: min(640px, 92vw);
  height: min(400px, 86vh);
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
  gap: clamp(14px, 3.2vmin, 26px);
  padding: clamp(8px, 1.6vmin, 11px);
  border-radius: clamp(18px, 3.4vmin, 24px);
  background: linear-gradient(180deg, #fffdf9, var(--card) 40%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 1px rgba(35, 37, 27, 0.06),
    0 1px 1px rgba(60, 50, 20, 0.05),
    0 4px 10px -2px rgba(60, 50, 20, 0.07),
    0 22px 44px -16px rgba(60, 50, 20, 0.2),
    0 50px 90px -40px rgba(60, 50, 20, 0.22);
  opacity: 0;
  isolation: isolate;
}

/* the light that went through the oil, on the card: a warm pool and a net of brighter lines */
.card__caustic {
  position: absolute;
  left: 30%;
  top: 22%;
  width: 70%;
  height: 86%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  mix-blend-mode: multiply;
  background: radial-gradient(closest-side, rgba(233, 196, 98, 0.32), rgba(233, 196, 98, 0.12) 55%, transparent);
  transform-origin: 0% 40%;
}

.card__ripples {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-size: 240px 240px;
  opacity: 0.7;
  filter: blur(0.6px);
  -webkit-mask-image: radial-gradient(closest-side, #000 20%, rgba(0, 0, 0, 0.5) 60%, transparent);
  mask-image: radial-gradient(closest-side, #000 20%, rgba(0, 0, 0, 0.5) 60%, transparent);
}

/* ------------------------------------------------------------------ the photo */
.photo {
  position: relative;
  margin: 0;
  border-radius: clamp(12px, 2.4vmin, 16px);
  overflow: hidden;
  background: #f2f0ec;
  z-index: 1;
  isolation: isolate;
}

.photo__sun {
  position: absolute;
  left: 50%;
  bottom: -30%;
  width: 150%;
  height: 120%;
  margin-left: -75%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--sun), rgba(255, 217, 138, 0.45) 45%, transparent);
  mix-blend-mode: multiply;
  opacity: 0;
  z-index: 2;
  pointer-events: none;
}

.shot {
  position: absolute;
  left: 0;
  top: 0;
}

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

/* the oil in the shade of the room */
.shot__img {
  filter: saturate(0.62) brightness(0.93) contrast(0.97);
}

/* the oil held up to the light, uncovered from the bottom up */
.shot__lit {
  --rise: -0.4;
  filter: saturate(1.55) brightness(1.1) contrast(1.06) sepia(0.12);
  -webkit-mask-image: linear-gradient(to top, #000 calc(var(--rise) * 100%), transparent calc(var(--rise) * 100% + 34%));
  mask-image: linear-gradient(to top, #000 calc(var(--rise) * 100%), transparent calc(var(--rise) * 100% + 34%));
}

/* the glass of the first bottle: the script gives it its outline */
.shot__glass {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.shot__glint {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--gw, 30px);
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85) 45%, #fff 50%, rgba(255, 255, 255, 0.85) 55%, transparent);
  filter: blur(2px);
  mix-blend-mode: screen;
  opacity: 0;
}

/* the edge of the glass catching the sun: a thin warm line on the far side */
.shot__rim {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 84.5%, rgba(255, 236, 170, 0.7) 87.4%, transparent 88.8%);
  mix-blend-mode: screen;
  opacity: 0;
}

.photo__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(35, 37, 27, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  pointer-events: none;
  z-index: 4;
}

/* a small glass chip on the photo */
.photo__tag {
  position: absolute;
  left: clamp(8px, 1.8vmin, 12px);
  top: clamp(8px, 1.8vmin, 12px);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px 5px 7px;
  border-radius: 999px;
  font-size: clamp(9.5px, 1.8vmin, 11px);
  font-weight: 560;
  font-stretch: 105%;
  letter-spacing: 0.01em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8), 0 4px 12px -6px rgba(40, 35, 10, 0.3);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  backdrop-filter: blur(8px) saturate(1.2);
}

.photo__tag svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: #6b7a2f;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------------------------------------------ the words */
.info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(6px, 1.6vmin, 12px) clamp(6px, 1.8vmin, 14px) clamp(4px, 1vmin, 8px) 0;
}

.info__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.info__mill {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: clamp(10px, 1.9vmin, 11.5px);
  font-weight: 640;
  font-stretch: 112%;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.info__mill span {
  font-weight: 460;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
}

.cart {
  position: relative;
  width: clamp(28px, 5.4vmin, 32px);
  height: clamp(28px, 5.4vmin, 32px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(35, 37, 27, 0.08), 0 2px 6px -3px rgba(40, 35, 10, 0.25);
}

.cart svg {
  width: 56%;
  height: 56%;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.cart__count {
  position: absolute;
  right: -4px;
  top: -4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--olive);
  color: var(--olive-ink);
  font-size: 9px;
  font-weight: 650;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--card);
  transform: scale(0);
}

.cart__reel {
  display: block;
}

.cart__reel span {
  display: block;
  height: 15px;
}

.info__name {
  margin: clamp(8px, 2.4vmin, 18px) 0 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 380;
  font-size: clamp(25px, 6.4vmin, 40px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 96, 'SOFT' 50;
}

.info__name em {
  font-style: italic;
  font-weight: 340;
  color: #5d6a26;
}

.info__kind {
  margin: clamp(4px, 1vmin, 7px) 0 0;
  font-size: clamp(10.5px, 2vmin, 12.5px);
  line-height: 1.35;
  color: var(--muted);
}

/* the four notes: a label, a value that rises, a line that fills with oil */
.notes {
  margin: auto 0 0;
  padding: clamp(8px, 2vmin, 14px) 0 0;
  display: grid;
  gap: 0;
}

.note {
  position: relative;
  display: grid;
  grid-template-columns: minmax(52px, 0.36fr) 1fr;
  align-items: baseline;
  gap: 8px;
  padding: clamp(4px, 1.05vmin, 7px) 0;
  overflow: hidden;
}

.note dt {
  font-size: clamp(9.5px, 1.75vmin, 10.5px);
  font-weight: 560;
  font-stretch: 108%;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.note dd {
  margin: 0;
  font-size: clamp(11px, 2.1vmin, 13px);
  font-weight: 470;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note__rule {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--rule);
}

.note__rule i {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--oil), rgba(201, 162, 39, 0.25));
  transform: scaleX(0);
  transform-origin: 0% 50%;
}

/* ------------------------------------------------------------------ price and button */
.buy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: clamp(8px, 2.2vmin, 16px);
}

.price {
  margin: 0;
  display: flex;
  align-items: baseline;
  font-size: clamp(22px, 5vmin, 30px);
  font-weight: 560;
  font-stretch: 92%;
  letter-spacing: -0.02em;
  line-height: 1;
}

.price__cur {
  font-size: 0.62em;
  margin-right: 1px;
  align-self: flex-start;
  margin-top: 0.12em;
}

.price__digits {
  display: inline-flex;
  align-items: flex-start;
  height: 1.05em;
  overflow: hidden;
}

.price__col {
  display: block;
}

.price__col span {
  display: block;
  height: 1.05em;
  line-height: 1.05em;
}

.price__cents {
  font-size: 0.5em;
  color: var(--muted);
  margin-left: 1px;
}

.add {
  position: relative;
  flex: 0 0 auto;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--olive-ink);
  background: none;
  cursor: pointer;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}

.add__face {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: clamp(36px, 7.4vmin, 42px);
  padding: 0 clamp(13px, 2.8vmin, 17px) 0 clamp(14px, 3vmin, 18px);
  border-radius: inherit;
  font-size: clamp(11.5px, 2.2vmin, 13px);
  font-weight: 560;
  font-stretch: 104%;
  white-space: nowrap;
  z-index: 1;
}

.add::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #3d4a26, var(--olive));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 1px 2px rgba(30, 30, 10, 0.25),
    0 8px 18px -8px rgba(47, 58, 29, 0.6);
}

/* the oil that fills the button */
.add__oil {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

.add__oil::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--level, 0%);
  background: linear-gradient(180deg, #d9b443, #b38a1c);
}

.add__wave {
  position: absolute;
  left: 0;
  width: 200%;
  height: 7px;
  bottom: calc(var(--level, 0%) - 1px);
  fill: #d9b443;
}

.add__icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.add:focus-visible {
  outline: 2px solid var(--oil);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ pointer and grain */
.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 24px;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  fill: #fff;
  stroke: #1d1f16;
  stroke-width: 1.2;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 5px rgba(40, 30, 10, 0.3));
}

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

/* ------------------------------------------------------------------ small boxes: the photo goes on top */
@media (max-width: 540px) {
  .card {
    height: auto;
    max-height: 96vh;
    grid-template-columns: 1fr;
    grid-template-rows: clamp(92px, 27vh, 220px) auto;
    gap: clamp(8px, 2vh, 14px);
  }

  .card__caustic {
    left: -10%;
    top: 18%;
    width: 120%;
    height: 70%;
    transform-origin: 50% 0%;
  }

  .info {
    padding: 0 clamp(6px, 2.4vw, 12px) clamp(4px, 1vh, 8px);
  }

  .info__name {
    margin-top: clamp(4px, 1.4vh, 12px);
    font-size: clamp(22px, 7vw, 32px);
  }

  .notes {
    padding-top: clamp(4px, 1.4vh, 10px);
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
  }

  .note {
    grid-template-columns: 1fr;
    gap: 1px;
    padding: clamp(3px, 0.9vh, 6px) 0;
  }

  .note dd {
    font-size: clamp(10.5px, 3.1vw, 12.5px);
  }

  .buy {
    margin-top: clamp(6px, 1.6vh, 12px);
  }
}

@media (max-height: 460px) and (min-width: 541px) {
  .info__kind {
    display: none;
  }
}
