:root {
  color-scheme: dark;
  --bg: #09090b;
  --text: #f4f1ea;
  --muted: rgba(244, 241, 234, 0.62);
  --line: rgba(244, 241, 234, 0.18);
  --pos: 0.5;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Outfit", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100svh;
  background:
    radial-gradient(ellipse 70% 45% at 50% 42%, rgba(70, 78, 96, 0.16), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

button,
a {
  font: inherit;
  color: inherit;
}

.back {
  position: fixed;
  z-index: 5;
  top: 18px;
  left: 22px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
}

.back:hover,
.back:focus-visible {
  color: var(--text);
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100svh;
  padding: 72px 0 32px;
}

.intro {
  text-align: center;
}

.kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 560;
  letter-spacing: -0.03em;
}

.frame {
  position: relative;
  width: min(1080px, calc(100% - 48px));
  margin-top: 28px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  background: #141416;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  touch-action: none;
  cursor: ew-resize;
  user-select: none;
}

.frame.is-vertical {
  cursor: ns-resize;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.clip {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc((1 - var(--pos)) * 100%) 0 0);
}

.frame.is-vertical .clip {
  clip-path: inset(0 0 calc((1 - var(--pos)) * 100%) 0);
}

.tag {
  position: absolute;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(9, 9, 11, 0.55);
  color: var(--text);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 0.15s linear;
}

.tag-before {
  top: 14px;
  left: 14px;
}

.tag-after {
  top: 14px;
  right: 14px;
}

.frame.is-vertical .tag-after {
  top: auto;
  right: auto;
  bottom: 14px;
  left: 14px;
}

.line {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: calc(var(--pos) * 100%);
  width: 1.5px;
  background: rgba(244, 241, 234, 0.92);
  transform: translateX(-50%);
  pointer-events: none;
}

.frame.is-vertical .line {
  top: calc(var(--pos) * 100%);
  bottom: auto;
  left: 0;
  width: 100%;
  height: 1.5px;
  transform: translateY(-50%);
}

.handle {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: #16140f;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: inherit;
}

.handle svg {
  width: 22px;
  height: 22px;
}

.frame.is-vertical .handle svg {
  transform: rotate(90deg);
}

.handle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.caption {
  min-height: 1.6rem;
  margin: 16px 0 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 560;
}

.pairs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.pairs button,
.orient {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.pairs button {
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.pairs button[aria-pressed="true"] {
  background: var(--text);
  color: #16140f;
  border-color: var(--text);
}

.controls {
  margin-top: 12px;
}

.orient {
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.pairs button:focus-visible,
.orient:focus-visible,
.back:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .back {
    top: 14px;
    left: 14px;
  }

  .app {
    padding-top: 64px;
  }

  .frame {
    width: calc(100% - 28px);
    border-radius: 14px;
  }

  .hint {
    padding: 0 18px;
    text-align: center;
  }
}
