/*
 * Recorder · Take a photo (js/recorder/snapshot/). Brand tokens only (brand/tokens.css via css/tokens.css).
 */

/* ---------- the camera button, under Stop (76 px round, accent border) ---------- */
.snap-shutter {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.snap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.snap-btn:hover:not(:disabled) { transform: scale(1.06); }
.snap-btn:active:not(:disabled) { transform: scale(0.95); }
.snap-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.snap-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.snap-btn.is-busy { animation: snap-pulse 0.3s ease; }

/* the small chevron that opens the options */
.snap-chevron {
  position: absolute;
  inset-block-end: -4px;
  inset-inline-end: -4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.snap-chevron:hover { background: var(--surface-sunken); }
.snap-chevron:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.snap-chevron[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

@keyframes snap-pulse { 50% { transform: scale(0.9); } }

/* ---------- feedback on the stage ---------- */
.snap-flash {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #fff;
  pointer-events: none;
  animation: snap-flash 0.3s ease-out forwards;
}

@keyframes snap-flash { from { opacity: 0.9; } to { opacity: 0; } }

/* what will be captured, while the options are open */
.snap-frame {
  position: absolute;
  z-index: 4;
  border: 2px dashed var(--accent);
  border-radius: 4px;
  pointer-events: none;
}

.snap-frame-label {
  position: absolute;
  inset-block-start: 6px;
  inset-inline-start: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 11px/1.6 var(--font-ui);
}

/* the timer's countdown */
.snap-countdown {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  pointer-events: none;
}

.snap-countdown-n {
  font: 700 96px/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.snap-countdown .btn { pointer-events: auto; }

/* ---------- options popover ---------- */
.snap-pop {
  position: absolute;
  z-index: 8;
  width: 300px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-popover);
}

.snap-pop h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.snap-pop-label {
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.snap-src {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.snap-src-opt {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.snap-src-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft-bg); }
.snap-src-opt:has(input:disabled) { cursor: not-allowed; opacity: 0.55; }
.snap-src-opt input { grid-row: span 2; margin: 0; accent-color: var(--accent); }
.snap-src-name { font-size: 13px; font-weight: 600; }
.snap-src-note { color: var(--muted); font-size: 12px; }

.snap-seg {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.snap-seg button {
  flex: 1;
  height: 28px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font: 600 12px/1 var(--font-ui);
  cursor: pointer;
}

.snap-seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }

.snap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
}

.snap-quality { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; }
.snap-quality input { flex: 1; accent-color: var(--accent); }
.snap-quality output { min-width: 3ch; font-variant-numeric: tabular-nums; text-align: end; }

/* ---------- Photos tray ---------- */
.snap-tray { margin-bottom: 16px; }
.snap-tray[hidden] { display: none; }

.snap-tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.snap-tray-head h2 { margin: 0; font-size: 15px; }

.snap-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.snap-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

.snap-thumb {
  width: 96px;
  height: 54px;
  border-radius: 6px;
  background: #000;
  object-fit: contain;
}

.snap-meta { min-width: 0; font-size: 12px; }
.snap-name { font-weight: 600; font-size: 13px; }
.snap-sub { color: var(--muted); }

.snap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  grid-column: 1 / -1;
}

.snap-actions .btn { height: 28px; padding: 0 10px; font-size: 12px; }

.snap-empty { color: var(--muted); font-size: 13px; }

/* ---------- undo toast ---------- */
.snap-toast {
  position: fixed;
  inset-block-end: 24px;
  inset-inline-start: 50%;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-radius: var(--radius-md);
  background: var(--text);
  color: var(--surface);
  font-size: 13px;
  box-shadow: var(--shadow-popover);
  transform: translateX(-50%);
}

:root[dir="rtl"] .snap-toast { transform: translateX(50%); }

.snap-toast button {
  border: 0;
  background: transparent;
  color: var(--accent-soft-bg);
  font: 600 13px/1 var(--font-ui);
  cursor: pointer;
}
