/* ═══════════════════════════════════════════════════════════════
   Another Cam — styled for the redesign.
   The camera is the site's "augmented layer" made literal, so it wears the
   HUD language: mono uppercase labels, hairlines, square markers, and the
   accent only where something is live or selected. Layout and behaviour
   hooks (ids, .is-open, .is-free, .is-fullscreen, .is-active…) match
   assets/js/camera-kit.js.
   ═══════════════════════════════════════════════════════════════ */

.camkit-overlay {
  --ck-bg: #0b0b0d;
  --ck-ink: var(--ink, #f2fdff);
  --ck-dim: var(--dim, rgba(242, 253, 255, .58));
  --ck-faint: var(--faint, rgba(242, 253, 255, .34));
  --ck-line: var(--line, rgba(242, 253, 255, .13));
  --ck-acc: var(--acc, #7bbbff);
  --ck-acc-ink: var(--acc-ink, #04122b);
  --ck-glass: rgba(6, 6, 7, .55);
  --ck-mono: var(--mono, 'IBM Plex Mono', ui-monospace, Menlo, monospace);
  --ck-body: var(--body, 'General Sans', system-ui, sans-serif);
  --ck-ease: var(--ease, cubic-bezier(.16, 1, .3, 1));

  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  /* No backdrop blur: blurring the viewport behind a live camera costs a
     full-screen GPU pass every frame. A plain scrim reads nearly the same. */
  background: rgba(3, 3, 4, .78);
  font-family: var(--ck-body);
  color: var(--ck-ink);
}

.camkit-overlay.is-open { display: block; }

.camkit-window {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(816px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  background: var(--ck-bg);
  border: 1px solid var(--ck-line);
  border-radius: 22px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7);
  overflow: hidden;
  user-select: none;
}

/* Once the user drags it, JS switches to absolute left/top positioning */
.camkit-window.is-free { transform: none; }

/* ── Header (drag handle) ── */
.camkit-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 48px;
  padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--ck-line);
  cursor: grab;
  flex-shrink: 0;
}

.camkit-header:active { cursor: grabbing; }

.camkit-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ck-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ck-ink);
  pointer-events: none;
}

.camkit-title-icon {
  width: 22px;
  height: 22px;
  flex: none;
}

/* The site's square marker, lit in the accent: the layer is live. */
.camkit-live {
  width: 6px;
  height: 6px;
  border: 1px solid var(--ck-acc);
  background: var(--ck-acc);
  box-shadow: 0 0 10px var(--ck-acc);
}

.camkit-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.camkit-hbtn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid transparent;
  background: none;
  color: var(--ck-dim);
  cursor: pointer;
  transition: color .25s var(--ck-ease), border-color .25s var(--ck-ease), background .25s var(--ck-ease);
}

@media (hover: hover) {
  .camkit-hbtn:hover { color: var(--ck-ink); border-color: var(--ck-line); }
  #close-camera-kit:hover { color: var(--ck-acc-ink); background: var(--ck-acc); border-color: var(--ck-acc); }
}

.camkit-hbtn:focus-visible { outline: 1px solid var(--ck-acc); outline-offset: 2px; }

.camkit-window.is-fullscreen {
  position: fixed !important;
  inset: 12px !important;
  width: calc(100vw - 24px) !important;
  height: calc(100vh - 24px) !important;
  height: calc(100dvh - 24px) !important;
  max-width: none !important;
  max-height: none !important;
  top: 0 !important;
  left: 0 !important;
  transform: none !important;
  border-radius: 18px !important;
  z-index: 10001 !important;
}

.camkit-window.is-fullscreen .camkit-stage {
  flex: 1;
  height: 100%;
}

.camkit-rec-indicator[hidden] { display: none; }

.camkit-rec-indicator {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ck-mono);
  font-size: 11px;
  letter-spacing: .12em;
  font-variant-numeric: tabular-nums;
  color: #ff6b5e;
  pointer-events: none;
}

.camkit-rec-dot {
  width: 7px;
  height: 7px;
  background: #ff453a;
  animation: camkit-blink 1.2s ease-in-out infinite;
}

@keyframes camkit-blink { 50% { opacity: .25; } }

/* ── Stage (camera feed) ── */
.camkit-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  transition: aspect-ratio .35s var(--ck-ease);
}

.camkit-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Viewfinder corner marks, drawn with gradients so they cost nothing. */
.camkit-frame {
  position: absolute;
  inset: 10px;
  z-index: 2;
  pointer-events: none;
  --c: rgba(242, 253, 255, .7);
  --l: 16px;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) 1px,
    linear-gradient(var(--c), var(--c)) top left / 1px var(--l),
    linear-gradient(var(--c), var(--c)) top right / var(--l) 1px,
    linear-gradient(var(--c), var(--c)) top right / 1px var(--l),
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) 1px,
    linear-gradient(var(--c), var(--c)) bottom left / 1px var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) 1px,
    linear-gradient(var(--c), var(--c)) bottom right / 1px var(--l);
  background-repeat: no-repeat;
}

.camkit-flash {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.camkit-flash.fire { animation: camkit-flash-anim .45s ease-out; }

@keyframes camkit-flash-anim {
  0% { opacity: .95; }
  100% { opacity: 0; }
}

/* Floating tools inside the feed */
.camkit-stage-tools {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 3;
}

.camkit-aspect-group {
  display: flex;
  padding: 3px;
  gap: 2px;
  background: rgba(10, 10, 12, .62);
  border: 1px solid var(--ck-line);
  border-radius: 100px;
}

.camkit-aspect-btn {
  border: none;
  background: none;
  color: var(--ck-dim);
  font-family: var(--ck-mono);
  font-size: 10px;
  letter-spacing: .1em;
  padding: 6px 11px;
  border-radius: 100px;
  cursor: pointer;
  transition: background .25s var(--ck-ease), color .25s var(--ck-ease);
}

@media (hover: hover) { .camkit-aspect-btn:hover { color: var(--ck-ink); } }

.camkit-aspect-btn.is-active {
  background: var(--ck-ink);
  color: #060607;
}

.camkit-aspect-btn:focus-visible { outline: 1px solid var(--ck-acc); outline-offset: 1px; }

.camkit-tool-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 12, .62);
  border: 1px solid var(--ck-line);
  color: var(--ck-ink);
  cursor: pointer;
  transition: background .25s var(--ck-ease), color .25s var(--ck-ease), border-color .25s var(--ck-ease), transform .35s var(--ck-ease);
}

@media (hover: hover) {
  .camkit-tool-btn:hover { background: var(--ck-acc); border-color: var(--ck-acc); color: var(--ck-acc-ink); transform: rotate(-30deg); }
}

/* ── Shutter + record ── */
.camkit-actions {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  z-index: 3;
}

.camkit-shutter {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px solid rgba(242, 253, 255, .9);
  background: rgba(6, 6, 7, .2);
  padding: 5px;
  cursor: pointer;
  transition: transform .2s var(--ck-ease), border-color .25s var(--ck-ease);
}

.camkit-shutter:active { transform: scale(.92); }

.camkit-shutter-inner {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--ck-ink);
  transition: transform .25s var(--ck-ease), background .25s var(--ck-ease);
}

@media (hover: hover) {
  .camkit-shutter:hover { border-color: var(--ck-acc); }
  .camkit-shutter:hover .camkit-shutter-inner { transform: scale(.92); background: var(--ck-acc); }
}

.camkit-record {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid rgba(242, 253, 255, .5);
  background: rgba(6, 6, 7, .2);
  padding: 6px;
  cursor: pointer;
  transition: border-color .2s ease, transform .15s ease;
}

.camkit-record:active { transform: scale(.92); }

.camkit-record-inner {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #ff453a;
  transition: border-radius .25s var(--ck-ease), transform .25s var(--ck-ease);
}

.camkit-record.is-recording { border-color: #ff453a; }

.camkit-record.is-recording .camkit-record-inner {
  border-radius: 3px;
  transform: scale(.58);
}

.camkit-shutter:focus-visible,
.camkit-record:focus-visible,
.camkit-tool-btn:focus-visible { outline: 1px solid var(--ck-acc); outline-offset: 3px; }

.camkit-status {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-family: var(--ck-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ck-ink);
  background: rgba(10, 10, 12, .62);
  border: 1px solid var(--ck-line);
  padding: 8px 16px;
  border-radius: 100px;
  white-space: nowrap;
}

.camkit-status[hidden] { display: none; }

/* ── Lens carousel ── */
.camkit-carousel-wrap {
  position: relative;
  padding: 4px 10px 12px;
  border-top: 1px solid var(--ck-line);
  flex-shrink: 0;
}

.camkit-carousel {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  overflow-x: auto;
  cursor: grab;
  /* Half the strip either side, so the first and last lens can sit under
     the centre ring. Headroom on top for the enlarged centre lens. */
  padding: 14px calc(50% - 30px) 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}

.camkit-carousel::-webkit-scrollbar { display: none; }

.camkit-carousel-msg {
  width: 100%;
  text-align: center;
  font-family: var(--ck-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1.8;
  color: var(--ck-dim);
  padding: 14px 16px;
}

.camkit-carousel-msg a { color: var(--ck-acc); }

.camkit-lens {
  flex: 0 0 auto;
  width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.camkit-carousel.dragging { cursor: grabbing; }
.camkit-carousel.dragging .camkit-lens { pointer-events: none; }

.camkit-lens-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: rgba(242, 253, 255, .05);
  box-shadow: 0 0 0 1px var(--ck-line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ck-dim);
  /* --k is set by camera-kit.js: 1 under the centre ring, 0 a few lenses
     away. Lenses swell as they reach the ring and fade toward the edges. */
  transform: scale(calc(.72 + .42 * var(--k, 0)));
  opacity: calc(.35 + .65 * var(--k, 0));
  will-change: transform;
}

@media (hover: hover) { .camkit-lens:hover .camkit-lens-icon { opacity: 1; } }

.camkit-lens:focus-visible .camkit-lens-icon { box-shadow: 0 0 0 1px var(--ck-acc); }

/* The fixed ring in the middle of the strip: the lens under it is live. */
.camkit-carousel-wrap:has(.is-ringed)::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 9px;
  width: 64px;
  height: 64px;
  margin-left: -32px;
  border-radius: 50%;
  border: 2px solid var(--ck-acc);
  box-shadow: 0 0 22px -4px var(--ck-acc), inset 0 0 14px -6px var(--ck-acc);
  pointer-events: none;
}

/* Names only show for the lens you're on (or hovering). */
.camkit-lens-name {
  max-width: 64px;
  font-family: var(--ck-mono);
  font-size: 8.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ck-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .2s ease, transform .2s ease, color .2s ease;
}

.camkit-lens.is-active .camkit-lens-name { opacity: 1; transform: translateY(0); color: var(--ck-ink); }

@media (hover: hover) {
  .camkit-lens:hover .camkit-lens-name { opacity: 1; transform: translateY(0); }
}

/* ── Resize handle ── */
.camkit-resize {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ck-faint);
  cursor: nwse-resize;
  z-index: 4;
}

@media (hover: hover) { .camkit-resize:hover { color: var(--ck-acc); } }

/* ── Mobile: full-screen sheet, no drag/resize ── */
@media (max-width: 640px) {
  .camkit-window {
    top: 0 !important;
    left: 0 !important;
    transform: none;
    width: 100vw !important;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .camkit-window.is-free { transform: none; }
  .camkit-header { cursor: default; padding-top: env(safe-area-inset-top); height: calc(48px + env(safe-area-inset-top)); }
  .camkit-stage { flex: 1; aspect-ratio: auto !important; transition: none; }
  .camkit-resize { display: none; }
  .camkit-carousel-wrap { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .camkit-stage { transition: none; }
  .camkit-rec-dot { animation: none; }
}
