/* Lu Beauty Brows · before/after loupe (loupe.css)
   Without JavaScript, and for a pair shown as a two-up: the two photos side by side, each labelled. With it: one
   photo and a fine brass ring (none with data-loupe="toggle"), the toggle "Before · After" and an italic hint.
   Tokens: --lu-loupe-size (ring diameter), --lu-loupe-ratio (frame, desktop), --lu-loupe-ratio-narrow (phones). */

.lu-loupe {
  --lu-loupe-size: 180px;
  --lu-paper: #F3ECE3;
  --lu-ink: #2A211B;
  --lu-brown: #5C483A;
  --lu-muted: #6E6055;              /* 5.2:1 on her paper */
  --lu-thread: #A4472F;
  --lu-serif: "Playfair", "Playfair Display", Georgia, serif;
  --lu-label: "Playfair Text", "Playfair Text Fallback", Georgia, serif;   /* the hero's small-capital legend */
  position: relative;
  margin: 0;
  color: var(--lu-ink);
  container-type: inline-size;
}
@media (max-width: 760px) { .lu-loupe { --lu-loupe-size: 140px; } }

/* ---------- two-up: no JavaScript, or a pair that only compares side by side ---------- */
.lu-loupe__stage { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lu-loupe__before, .lu-loupe__after { position: relative; display: block; }
.lu-loupe__stage img { display: block; width: 100%; height: auto; }
.lu-loupe__before::after, .lu-loupe__after::after,
.lu-loupe__corner, .lu-loupe__tag {
  position: absolute; padding: 3px 8px 4px;
  background: rgba(243, 236, 227, .94); color: var(--lu-ink);
  font: 400 13px/1.1 var(--lu-label); font-variant-caps: all-small-caps; letter-spacing: .09em; white-space: nowrap;
  pointer-events: none;
}
.lu-loupe__before::after, .lu-loupe__after::after { content: attr(data-label); left: 10px; top: 10px; }
@media (max-width: 560px) { .lu-loupe:not(.is-loupe) .lu-loupe__stage { grid-template-columns: 1fr; } }

/* ---------- the loupe ---------- */
.lu-loupe.is-loupe .lu-loupe__stage {
  display: block;
  aspect-ratio: var(--lu-loupe-ratio, 16 / 7);
  overflow: hidden;
  background: #D8C7B6;
  touch-action: pan-y;                 /* a finger on the photo scrolls the page, always */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
@media (max-width: 760px) {
  .lu-loupe.is-loupe .lu-loupe__stage { aspect-ratio: var(--lu-loupe-ratio-narrow, 4 / 3); }   /* wide pairs are cropped around data-focus */
}
.lu-loupe.is-loupe .lu-loupe__before,
.lu-loupe.is-loupe .lu-loupe__after { position: absolute; inset: 0; }
.lu-loupe.is-loupe .lu-loupe__before::after,
.lu-loupe.is-loupe .lu-loupe__after::after { display: none; }
.lu-loupe.is-loupe .lu-loupe__stage img { width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
/* the after shows through a mask the engine draws: the ring's disc at rest, a feathered iris when it opens */
.lu-loupe.is-loupe .lu-loupe__after {
  -webkit-mask-image: linear-gradient(transparent, transparent); mask-image: linear-gradient(transparent, transparent);
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}

/* the ring: an outer hairline, a 2.5 px brass band, an inner light hairline, a soft lift; it rises when picked up */
.lu-loupe__ring {
  position: absolute; left: 0; top: 0;
  width: var(--lu-loupe-size); height: var(--lu-loupe-size);
  border-radius: 50%;
  touch-action: none;                  /* dragging the ring never scrolls */
  cursor: grab;
  will-change: transform;
  opacity: var(--lu-ring-o, 1);
  box-shadow:
    0 0 0 .75px rgba(42, 33, 27, .28),
    0 calc(6px + 6px * var(--lu-lift, 0)) calc(16px + 10px * var(--lu-lift, 0)) calc(-8px - 4px * var(--lu-lift, 0)) rgba(42, 33, 27, calc(.35 + .05 * var(--lu-lift, 0))),
    0 1px 2px rgba(42, 33, 27, .12);
}
.lu-loupe__ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; padding: 2.5px;
  background: conic-gradient(from 215deg, #7A5A33, #C8A365 18%, #F2E2B8 26%, #B8915A 40%, #7A5A33 55%, #D9BC84 75%, #F2E2B8 82%, #8F6C3F);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.lu-loupe__ring::after { content: ""; position: absolute; inset: 2.5px; border-radius: 50%; box-shadow: inset 0 0 0 .75px rgba(243, 236, 227, .6); }
.lu-loupe.is-dragging .lu-loupe__ring, .lu-loupe.is-dragging .lu-loupe__stage { cursor: grabbing; }
.lu-loupe.is-focus .lu-loupe__ring { outline: 2px solid var(--lu-thread); outline-offset: 5px; }
.lu-loupe.is-after .lu-loupe__ring { pointer-events: none; }
/* the rim that travels with the iris's edge (SVG, drawn only while the iris moves) */
.lu-loupe__rim { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; display: none; }
.lu-loupe__rim circle { fill: none; }
.lu-loupe__rim-b { stroke-width: 2.5; }
.lu-loupe__rim-o { stroke: rgba(42, 33, 27, .28); stroke-width: .75; }
.lu-loupe__rim-i { stroke: rgba(243, 236, 227, .6); stroke-width: .75; }

/* the tag rides the ring's upper right at 45 degrees (upper left near the right edge): never over the eye.
   The engine places it with a transform and crossfades it when it changes side. */
.lu-loupe__tag { left: 0; top: 0; will-change: transform; }
.lu-loupe.is-latent:not(:hover):not(:focus-within):not(.is-woken) .lu-loupe__tag { visibility: hidden; }
.lu-loupe__corner { left: 12px; top: 12px; }

/* a secondary loupe (data-ring="hover"): one live ring per screen; its ring shows on hover, focus or a first tap */
.lu-loupe.is-latent .lu-loupe__ring, .lu-loupe.is-latent .lu-loupe__after { transition: opacity 240ms cubic-bezier(.2, .8, .2, 1); }
.lu-loupe.is-latent:not(:hover):not(:focus-within):not(.is-woken) :is(.lu-loupe__ring, .lu-loupe__after) { opacity: 0; }

/* ---------- controls: the toggle in the hero's legend voice, an italic hint; the range only for the keyboard ---------- */
.lu-loupe__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0 28px; margin-top: 6px; }
.lu-loupe__toggle {
  display: flex; align-items: center; gap: 10px;
  font: 400 14px/1 var(--lu-label); font-variant-caps: all-small-caps; letter-spacing: .09em; color: var(--lu-muted);
}
.lu-loupe__toggle button {
  min-height: 44px; padding: 0 2px; border: 0; background: none; cursor: pointer;
  font: inherit; font-variant-caps: inherit; letter-spacing: inherit; color: var(--lu-muted);
  text-decoration: underline 1px transparent; text-underline-offset: 6px;
  transition: color .25s ease, text-decoration-color .25s ease;
}
.lu-loupe__toggle button:hover { color: var(--lu-ink); }
.lu-loupe__toggle button[aria-pressed="true"] { color: var(--lu-ink); text-decoration-color: var(--lu-thread); }
.lu-loupe__toggle button:focus-visible { outline: 1px solid var(--lu-thread); outline-offset: 4px; }
.lu-loupe__hint { margin: 0; font: italic 400 15px/1.4 var(--lu-serif); color: var(--lu-muted); }
@media (hover: none) { .lu-loupe__hint { font-size: 14px; } }

/* the range moves the ring along the brow for the keyboard and screen readers. It stays out of sight until it has
   the keyboard focus, then shows as a plain rule with a small brass bead */
.lu-loupe__scale, .lu-loupe__scale label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.lu-loupe__scale:focus-within { position: static; flex: 1 0 100%; width: auto; height: auto; overflow: visible; clip-path: none; }
.lu-loupe__range { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; }
.lu-loupe__range::-webkit-slider-runnable-track { height: 1px; background: var(--lu-brown); }
.lu-loupe__range::-moz-range-track { height: 1px; background: var(--lu-brown); }
.lu-loupe__range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 11px; height: 11px; margin-top: -5px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #F2E2B8, #C8A365 45%, #8F6C3F);
  box-shadow: 0 0 0 .75px rgba(42, 33, 27, .35), 0 0 0 5px rgba(164, 71, 47, .22);
}
.lu-loupe__range::-moz-range-thumb {
  width: 11px; height: 11px; border: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #F2E2B8, #C8A365 45%, #8F6C3F);
  box-shadow: 0 0 0 .75px rgba(42, 33, 27, .35), 0 0 0 5px rgba(164, 71, 47, .22);
}
.lu-loupe__range:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  .lu-loupe__toggle button, .lu-loupe.is-latent .lu-loupe__ring, .lu-loupe.is-latent .lu-loupe__after { transition: none; }
}
