/* THE MIRROR ROOM — six reflections. one of them is lying. */

:root {
  --mr-wall: #14161c;
  --mr-panel: #1e212a;
  --mr-shape: #cfd6e6;
}

body.mirror {
  background: var(--mr-wall);
  color: #dfe3ec;
  min-height: 100vh;
  padding: 4rem 1.5rem 10rem;
}

.mr-header {
  text-align: center;
  margin-bottom: 3rem;
}
.mr-header h1 {
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.8rem;
}
.mr-header p {
  max-width: 42ch;
  margin: 0.75rem auto 0;
  font-size: 0.8rem;
  opacity: 0.75;
}

/* the reflection wall */
.wall {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  max-width: 560px;
  margin: 0 auto;
  background: #000;
  border: 1px solid #000;
}

.tile {
  aspect-ratio: 1;
  background: var(--mr-panel);
  position: relative;
  overflow: hidden;
  display: block;
  cursor: pointer;
}
.tile-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* the reflected shape — a simple asymmetric mark, so a true mirror is
   obvious and a false one (unmirrored) is obvious too, once you notice */
.mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mark::before {
  content: '';
  width: 46%;
  height: 66%;
  background: linear-gradient(120deg, var(--mr-shape) 0 35%, transparent 35%),
              radial-gradient(circle at 30% 25%, var(--mr-shape) 0 14%, transparent 15%);
  opacity: 0.85;
}

/* every tile mirrors the source horizontally except one — expressed as
   a "parity" (which way the panel faces by default) combined with a
   "flip" (whether you've clicked it), so a click can invert either kind
   of panel correctly without fighting the base rule for the transform */
.mark { transform: scaleX(calc(var(--parity, 1) * var(--flip, 1))); }

.tile:nth-child(odd) .mark { --parity: 1; }
.tile:nth-child(even) .mark { --parity: -1; }
.tile.odd-one-out .mark { --parity: 1; }

.tile:has(.tile-toggle:checked) .mark { --flip: -1; }

.tile .plate {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 0.55rem;
  opacity: 0.3;
  letter-spacing: 0.1em;
}

.mr-hint {
  max-width: 40ch;
  margin: 2rem auto 4rem;
  text-align: center;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* the difference panel — two identical strings of text, stacked exactly,
   blended so that matching glyphs cancel to black and only the glyph
   that doesn't match stays lit */
.diff-wrap {
  max-width: 480px;
  margin: 0 auto;
  background: #000;
  padding: 3rem 1.5rem;
  isolation: isolate;
  text-align: center;
}

.diff-stack {
  position: relative;
  display: inline-block;
  font-family: "Courier New", monospace; /* fixed width — glyphs must align exactly */
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.diff-stack span {
  display: block;
}

/* both layers are the SAME color. where the two strings agree, the
   glyphs land on identical pixels and mix-blend-mode: difference cancels
   them to black. where the strings disagree, there's no matching glyph
   underneath to cancel against, so that letter alone stays lit. */
.diff-stack .layer-a,
.diff-stack .layer-b {
  color: #f2f2f2;
}
.diff-stack .layer-b {
  position: absolute;
  inset: 0;
  mix-blend-mode: difference;
}

.diff-caption {
  margin-top: 1.5rem;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.62;
}
