/* The photo that changes look from the preset strip: the Looks panel of Tintra, an invented photo editor, on a near
   black page. The photo is a canvas; the five thumbnails are small canvases of the same photo with each grade. GSAP
   moves the outer elements (the ring, the thumbnails' buttons, the slider's thumb), the CSS the inner ones. */
:root {
  --page: #0b0a09;            /* the page */
  --panel: #151312;           /* the body of the panel */
  --panel-2: #1c1a18;         /* the raised bits (pill, track) */
  --edge: rgba(255, 255, 255, 0.075); /* the 1px edges at rest */
  --ink: #f1ece6;             /* the words */
  --muted: #8d857c;           /* the small words */
  --accent: #ff9d5c;          /* the accent: the ring, the slider, the check */
  --accent-2: #ffd4ae;        /* the light end of the accent */
  --halo: 255, 157, 92;       /* the light behind the panel (r, g, b), changes with the look */
  --w: min(88vw, 400px, calc(150vh - 250px)); /* the width of the panel */
}

* {
  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: 16px;
  overflow: hidden;
  isolation: isolate;
}

/* a fine grain over the whole page */
.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the light behind the panel, in the colour of the current look */
.halo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--w) * 1.7);
  height: calc(var(--w) * 1.4);
  margin: calc(var(--w) * -0.7) 0 0 calc(var(--w) * -0.85);
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(var(--halo), 0.38), rgba(var(--halo), 0.12) 55%, rgba(var(--halo), 0) 100%);
  filter: blur(18px);
  opacity: 0;
}

.editor {
  position: relative;
  width: var(--w);
  padding: calc(var(--w) * 0.034);
  border-radius: calc(var(--w) * 0.062);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 40%),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 0 1px var(--edge),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 12px 28px -8px rgba(0, 0, 0, 0.6),
    0 40px 80px -24px rgba(0, 0, 0, 0.7);
  opacity: 0;
}

/* ---------------------------------------------------------------- the head */
.editor__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: calc(var(--w) * 0.082);
  margin-bottom: calc(var(--w) * 0.03);
  padding: 0 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.brand__mark {
  width: calc(var(--w) * 0.055);
  height: calc(var(--w) * 0.055);
  flex: none;
  filter: drop-shadow(0 2px 6px rgba(224, 112, 58, 0.35));
}

.brand__name {
  font-size: clamp(11px, calc(var(--w) * 0.037), 14px);
  font-weight: 620;
  letter-spacing: -0.01em;
}

.brand__file {
  font-size: clamp(9.5px, calc(var(--w) * 0.03), 11.5px);
  color: var(--muted);
  font-variation-settings: 'wdth' 90;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: calc(var(--w) * 0.068);
  padding: 0 calc(var(--w) * 0.026) 0 calc(var(--w) * 0.02);
  border-radius: 999px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--edge), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: clamp(9.5px, calc(var(--w) * 0.03), 11.5px);
  font-weight: 560;
  transition: color 0.4s ease, background-color 0.4s ease, box-shadow 0.4s ease;
  flex: none;
}

.pill.is-on {
  color: var(--accent-2);
  background: rgba(255, 157, 92, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 157, 92, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.pill__check {
  width: 10px;
  height: 10px;
  flex: none;
}

.pill__check path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.pill__win {
  display: block;
  position: relative;
  overflow: hidden;
  height: 1.3em;
  line-height: 1.3em;
}

.pill__word {
  display: block;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- the photo */
.photo {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: calc(var(--w) * 0.04);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.4),
    0 10px 24px -10px rgba(0, 0, 0, 0.8);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.photo__inner {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background: #222;
}

.photo__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.photo__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.photo__tag {
  position: absolute;
  top: calc(var(--w) * 0.026);
  left: calc(var(--w) * 0.026);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: clamp(9px, calc(var(--w) * 0.028), 11px);
  font-weight: 600;
  color: #fff;
  background: rgba(16, 14, 12, 0.42);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  opacity: 0;
  pointer-events: none;
}

.compare {
  position: absolute;
  left: calc(var(--w) * 0.026);
  bottom: calc(var(--w) * 0.026);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: calc(var(--w) * 0.07);
  padding: 0 9px 0 7px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: clamp(9px, calc(var(--w) * 0.028), 11px);
  font-weight: 560;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(16, 14, 12, 0.34);
  -webkit-backdrop-filter: blur(12px) saturate(1.5);
  backdrop-filter: blur(12px) saturate(1.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 12px -4px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.compare svg {
  width: 12px;
  height: 12px;
}

.compare.is-down {
  background: rgba(255, 255, 255, 0.9);
  color: #17130f;
}

/* ---------------------------------------------------------------- the strip */
.strip {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: calc(var(--w) * 0.022);
  margin-top: calc(var(--w) * 0.034);
  padding: 3px 1px 0;
}

.strip__ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  border-radius: calc(var(--w) * 0.036);
  box-shadow:
    0 0 0 1.5px var(--accent),
    0 0 14px -2px rgba(255, 157, 92, 0.55);
  pointer-events: none;
  z-index: 2;
  opacity: 0;
}

.look {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--w) * 0.016);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.look:focus-visible .look__lift {
  box-shadow: 0 0 0 2px var(--ink);
}

.look__lift {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: calc(var(--w) * 0.03);
  overflow: hidden;
  background: #222;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5), 0 6px 12px -6px rgba(0, 0, 0, 0.8);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
  filter: brightness(0.82) saturate(0.9);
}

.look__lift::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 38%);
  pointer-events: none;
}

.look__thumb {
  display: block;
  width: 100%;
  height: 100%;
}

.look__name {
  font-size: clamp(9px, calc(var(--w) * 0.029), 11.5px);
  font-weight: 540;
  letter-spacing: 0.005em;
  transition: color 0.3s ease, font-variation-settings 0.4s ease;
  font-variation-settings: 'wdth' 92;
}

.look[aria-checked='true'] .look__lift {
  transform: translateY(-2px);
  filter: none;
}

.look[aria-checked='true'] .look__name {
  color: var(--ink);
  font-variation-settings: 'wdth' 104;
}

@media (hover: hover) {
  .look:hover .look__lift {
    transform: translateY(-3px);
    filter: brightness(1) saturate(1);
  }
  .look:hover .look__name {
    color: var(--ink);
  }
  .compare:hover {
    background: rgba(16, 14, 12, 0.5);
  }
  .slider:hover .slider__knob {
    transform: scale(1.08);
  }
}

/* ---------------------------------------------------------------- the strength */
.amount {
  display: grid;
  grid-template-columns: auto 1fr calc(var(--w) * 0.08);
  align-items: center;
  gap: calc(var(--w) * 0.03);
  margin-top: calc(var(--w) * 0.03);
  padding: 0 2px;
  height: calc(var(--w) * 0.07);
  transition: opacity 0.4s ease;
}

.amount.is-off {
  opacity: 0.4;
}

.amount__label,
.amount__value {
  font-size: clamp(9.5px, calc(var(--w) * 0.03), 11.5px);
  color: var(--muted);
  font-weight: 540;
}

.amount__value {
  text-align: right;
  color: var(--ink);
}

.slider {
  position: relative;
  height: 100%;
  margin: 0 7px;
  cursor: pointer;
  touch-action: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.slider__track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 4px;
  background: var(--panel-2);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.slider__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 157, 92, 0.35), var(--accent) 70%, var(--accent-2));
  transform-origin: 0 50%;
}

.slider__thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0;
  height: 0;
}

.slider__knob {
  position: absolute;
  width: 14px;
  height: 14px;
  left: -7px;
  top: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #ffffff, #e9e2da);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.4), 0 2px 5px rgba(0, 0, 0, 0.5), 0 0 0 0 rgba(255, 157, 92, 0);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.slider.is-down .slider__knob,
.slider:focus-visible .slider__knob {
  transform: scale(1.22);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.4), 0 3px 8px rgba(0, 0, 0, 0.5), 0 0 0 5px rgba(255, 157, 92, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .look__lift,
  .slider__knob {
    transition: filter 0.3s ease, box-shadow 0.3s ease;
  }
  .look[aria-checked='true'] .look__lift {
    transform: none;
  }
  .slider.is-down .slider__knob {
    transform: none;
  }
}
