/* Rangefinder homepage */
.rf-body { --dark: var(--night); --paper: var(--night-ink); --accent: var(--night-ink); --gutter: var(--m); --font-mono: var(--text); background: var(--dark); color: var(--paper); overflow: hidden; }
.rf-name { font-size: 1.15rem; letter-spacing: 0.01em; }

.rf {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  padding: 0;
  overflow: hidden;
  animation: none;
}

.rf-photo,
.rf-layer {
  background-size: cover;
  background-position: 50% 58%;
  background-repeat: no-repeat;
}

.rf-photo {
  position: absolute;
  inset: -24px;               /* hides blurred edges */
  will-change: filter;
  transition: filter .15s linear;
}

.rf-shade { position: absolute; inset: 0; background: rgba(8, 8, 7, 0.28); }

/* Bright-line frame */
.rf-frame {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(78vw, 920px);
  aspect-ratio: 3 / 2;
  pointer-events: none;
}

.rf-corner { position: absolute; width: 40px; height: 28px; border: 0 solid rgba(245, 242, 234, 0.85); }
.rf-corner.tl { left: 0; top: 0; border-left-width: 2px; border-top-width: 2px; }
.rf-corner.tr { right: 0; top: 0; border-right-width: 2px; border-top-width: 2px; }
.rf-corner.bl { left: 0; bottom: 0; border-left-width: 2px; border-bottom-width: 2px; }
.rf-corner.br { right: 0; bottom: 0; border-right-width: 2px; border-bottom-width: 2px; }

/* Focus patch: layers are viewport-sized and offset by JS so they line up with the photo behind */
.rf-patch {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: clamp(120px, 18vw, 210px);
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 3px;
  border: 1.5px solid rgba(245, 242, 234, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition: border-color .2s, box-shadow .2s;
}

.rf-layer {
  position: absolute;
  left: var(--px, 0);
  top: var(--py, 0);
  width: var(--vw, 100vw);
  height: var(--vh, 100vh);
}

.rf-ghost { opacity: .6; }
.rf-ghost::after { content: ""; position: absolute; inset: 0; background: #E3C98F; mix-blend-mode: multiply; }

.rf.is-aligned .rf-patch { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 0 24px var(--accent); }

/* Top bar */
.rf-top {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 24px var(--gutter);
  font-size: var(--s-small);
}

.rf-skip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(236, 233, 227, 0.55);
  border-radius: 999px;
  background: rgba(21, 20, 18, 0.35);
  color: var(--paper);
  text-decoration: none;
  transition: background-color .2s, border-color .2s;
}
.rf-skip:hover { background: rgba(236, 233, 227, 0.15); border-color: var(--paper); }
.rf-skip:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }

/* Controls */
.rf-controls {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 0 var(--gutter) clamp(20px, 4vh, 40px);
}

.rf-status {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
}

.rf.is-aligned .rf-status { color: var(--accent); }

.rf-row { width: 100%; max-width: 680px; display: flex; align-items: center; gap: 20px; }

.rf-barrel {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  background: #171715;
  border: 1px solid #3a3a36;
  box-shadow: inset 0 10px 18px rgba(0,0,0,.6), inset 0 -10px 18px rgba(0,0,0,.6);
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
}

.rf-barrel:focus-within { outline: 2px solid var(--accent); outline-offset: 4px; }

.rf-barrel input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; pointer-events: none;
}

.rf-strip { position: absolute; left: 50%; top: 0; height: 100%; }

.rf-tick { position: absolute; width: 1px; background: #8a877e; top: 20px; height: 9px; }
.rf-tick.major { background: var(--paper); top: 14px; height: 16px; }

.rf-mark {
  position: absolute;
  top: 36px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  color: #d8d4ca;
}

.rf-index {
  position: absolute; left: 50%; top: 0; transform: translateX(-6px);
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 9px solid var(--accent);
}

.rf-shutter {
  flex: 0 0 auto;
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  padding: 0;
  border: 2px solid #4a4a45;
  background: #22221f;
  cursor: not-allowed;
  transition: transform .12s ease, background-color .2s ease, border-color .2s ease;
}

.rf-shutter span { width: 26px; height: 26px; border-radius: 50%; background: var(--dark); border: 2px solid rgba(13,13,12,.35); }

.rf.is-aligned .rf-shutter { background: var(--green); border-color: var(--night-ink); cursor: pointer; }
.rf.is-aligned .rf-shutter span { background: var(--night-ink); border-color: transparent; }
.rf-shutter:not(:disabled):hover { transform: scale(1.04); }
.rf-shutter:not(:disabled):active { transform: scale(.94); }
.rf-shutter:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.rf-hint { margin: 0; font-size: 12px; color: rgba(245, 242, 234, 0.75); text-align: center; }

/* Shutter flash */
.rf-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.rf.is-shot .rf-flash { animation: rf-flash .55s ease-out forwards; }
@keyframes rf-flash { 0% { opacity: 1; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: no-preference) {
  .rf.is-aligned .rf-shutter { animation: rf-pulse 1.6s ease-in-out infinite; }
}
@keyframes rf-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(236, 233, 227, .5); }
  50% { box-shadow: 0 0 0 10px rgba(236, 233, 227, 0); }
}

@media (max-width: 560px) {
  .rf-frame { top: 42%; width: 90vw; }
  .rf-row { gap: 14px; }
  .rf-barrel { height: 56px; }
  .rf-shutter { width: 56px; height: 56px; }
}
