/* ourPhotosAgain – Shared Styles (MVP) */

:root {
  --bg: #f5efe6;
  --primary: #a9b388;
  --secondary: #d6a184;
  --text: #2c2c2c;
  --button: #5e755e;
  --button-text: #ffffff;
  --error: #b00020;
  --success: #1b5e20;

  --radius: 16px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  min-height: 100%;
}

h1,
h2,
h3 {
  font-family:
    Poppins,
    Inter,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  margin: 0 0 12px;
}

.page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

.header {
  padding: 16px 24px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: none;
  background: var(--button);
  color: var(--button-text);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.05s ease,
    opacity 0.2s ease;
  user-select: none;
}

.cta:active {
  transform: translateY(1px);
}

.cta.secondary {
  background: var(--primary);
  color: #1b1b1b;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.footer {
  padding: 16px 24px 24px;
  color: #555;
  font-size: 14px;
  opacity: 0.9;
}

/* Login layout */
.login-hero {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px 24px;
}

.login-cta {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(245, 239, 230, 0) 0%, rgba(245, 239, 230, 1) 30%);
  padding: 24px;
}

/* Capture */
.capture-grid {
  display: grid;
  gap: 16px;
}

.capture-option {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 2px dashed rgba(0, 0, 0, 0.1);
  border-radius: var(--radius);
  text-align: center;
}

/* Remaster */
.remaster-stage {
  display: grid;
  gap: 12px;
}

.remaster-canvas,
.remaster-image {
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  display: block;
}

.remaster-toolbar {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(245, 239, 230, 0) 0%, rgba(245, 239, 230, 1) 40%);
  padding: 12px 0 20px;
}

.helper {
  color: #666;
  font-size: 14px;
}

/* Toasts */
#toast-root {
  position: fixed;
  top: 16px;
  right: 16px;
  display: grid;
  gap: 8px;
  z-index: 9999;
}

.toast {
  background: #333;
  color: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.toast.success {
  background: #2e7d32;
}
.toast.error {
  background: #c62828;
}

/* Inputs hidden but accessible when needed */
input[type='file'] {
  display: none;
}

/* Buttons grid for mobile friendliness */
.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .button-row {
    grid-template-columns: repeat(3, 1fr);
  }
}
/* Top bar with avatar */
.topbar {
  position: relative; /* make it the positioning context */
  top: 0;
  z-index: 100;
  background: var(--bg);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 56px; /* lock a consistent bar height */
}

.avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px;
  border-radius: 999px;
}

.avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.user-menu {
  position: absolute;
  right: 24px;
  top: 100%; /* sits just below the topbar */
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 180px;
  padding: 8px;
  display: none;
}

.user-menu.open {
  display: block;
}

.user-menu .menu-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
  font-weight: 600;
  color: var(--text);
}

.user-menu .menu-item:hover,
.user-menu .menu-item:focus {
  background: rgba(0, 0, 0, 0.05);
  outline: none;
}

/* ===========================
   Before/After Compare Slider
   =========================== */
.compare {
  --pos: 50%; /* slider position (0–100) */
  /* aspect ratio is set dynamically via --ratio: W/H (e.g., 4032/3024) */
  aspect-ratio: var(--ratio, 4/3);
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  background: #f0f0f0; /* subtle backdrop while images load */
}

/* Both images occupy the exact same box */
.compare-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* no stretch; preserve aspect */
  display: block;
  pointer-events: none;
}

/* Overlay reveals remastered using clipping (no resize) */
.compare-overlay {
  position: absolute;
  inset: 0;
  /* Reveal left -> right using clip-path (top, right, bottom, left) */
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

/* Draggable handle */
.compare-handle {
  position: absolute;
  top: 0;
  left: var(--pos);
  transform: translateX(-50%);
  height: 100%;
  width: 32px; /* generous touch target */
  background: transparent;
  border: none;
  cursor: ew-resize;
  outline: none;
  z-index: 2;
}

.compare-handle:focus-visible .handle-grip {
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.5);
}

/* vertical bar + circular grip */
.handle-grip {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.35);
}
.handle-grip::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: var(--shadow);
}

/* helper: reduce accidental text selection while dragging */
.compare,
.compare * {
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* ===========================
   Alerts
   =========================== */
.alert {
  box-sizing: border-box;
  width: 100%;
  max-width: 720px;
  margin: 12px auto 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
}
.alert-error {
  background: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}
