/* Before and after (capabilities page): the same terry before and after a process, divided by a slider. */
@property --pos { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
.compares { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 3vw, 36px); }
.compare { margin: 0; }
.compare-frame { --pos: 50%; position: relative; overflow: hidden; aspect-ratio: 3 / 2; background: #f1ede5; }
.compare-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.compare-after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }

/* Divide line and a diamond handle, after the diamond at the top of the NTTML crown */
.compare-frame::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 6px rgba(0, 0, 0, 0.3); pointer-events: none; }
.compare-frame::before {
  content: ""; position: absolute; z-index: 2; top: 50%; left: var(--pos); width: 46px; height: 46px; margin: -23px 0 0 -23px; pointer-events: none;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: var(--gold-ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M7 5 2 10l5 5M13 5l5 5-5 5' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") center / 20px no-repeat;
}
.compare-label { position: absolute; top: 12px; left: 12px; padding: 5px 10px; background: rgba(14, 18, 37, 0.78); color: #fff; font: 700 0.66rem/1.4 var(--body); letter-spacing: 0.16em; text-transform: uppercase; pointer-events: none; }
.compare-label.after { left: auto; right: 12px; }

/* The range input covers the whole photo, so it can be dragged anywhere; vertical swipes still scroll the page */
.compare-range { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; touch-action: pan-y; -webkit-appearance: none; appearance: none; }
.compare-range::-webkit-slider-thumb { -webkit-appearance: none; width: 2px; height: 100%; }
.compare-range::-moz-range-thumb { width: 2px; height: 100%; border: 0; }
.compare-frame:has(.compare-range:focus-visible) { outline: 2px solid var(--title-navy); outline-offset: 3px; }
.compare figcaption { margin-top: 12px; font-size: 0.88rem; }
.compare figcaption strong { color: var(--ink); }

/* A short nudge the first time a slider comes into view shows that it moves */
.compare-frame.nudge { animation: compare-nudge 1.3s var(--ease); }
@keyframes compare-nudge { 30% { --pos: 64%; } 65% { --pos: 38%; } }

/* Without JavaScript the two photos sit side by side */
html:not(.js) .compare-frame { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; aspect-ratio: auto; background: none; }
html:not(.js) .compare-after { position: static; clip-path: none; }
html:not(.js) .compare-frame img { height: auto; aspect-ratio: 3 / 2; }
html:not(.js) .compare-frame::before, html:not(.js) .compare-frame::after { display: none; }

@media (max-width: 760px) { .compares { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .compare-frame.nudge { animation: none; } }
