/* ═══════════════════════════════════════════════════════════
   Production polish layer — implements the Gemini UX audit.
   Loaded after all other stylesheets so its fixes win.
   Covers: focus rings, input standardization, loading and
   empty states, error states, hover consistency, z-order.
   ═══════════════════════════════════════════════════════════ */

/* ── 1 · Accessible focus rings everywhere ─────────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── 2 · Button hover parity (audit #2) ────────────────────── */
.btn-o:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }

/* ── 3 · Card hover glow (audit #3, #11) ───────────────────── */
.card:hover,
.proj-card:hover,
.fund-card:hover,
.opp-card:hover {
  box-shadow: 0 10px 30px oklch(0 0 0 / 0.35), 0 0 24px var(--violet-dim);
}
.nl:hover { transform: translateY(-1px); }

/* ── 4 · Standardized form controls (audit #5, #8) ─────────── */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not(.leaflet-control *):not(.auth-input),
textarea,
select:not(.auth-select) {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:not([type="checkbox"]):not([type="radio"]):not(.auth-input):focus,
textarea:focus,
select:not(.auth-select):focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-dim);
  outline: none;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

input.error, textarea.error, select.error {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px var(--rose-dim);
}
.form-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-family: var(--font-labels);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--rose);
}
.form-error::before { content: '⚠'; font-size: 12px; }

/* ── 5 · Loading: spinner + skeleton (audit #6) ────────────── */
@keyframes cb-spin { to { transform: rotate(360deg); } }
.spinner {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 3px solid var(--border-hi);
  border-top-color: var(--violet);
  animation: cb-spin 0.8s linear infinite;
}
.pg-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 56px 24px;
  color: var(--text-dim);
  font-family: var(--font-labels);
  letter-spacing: 0.12em;
}
.pg-loading::before {
  content: '';
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 3px solid var(--border-hi);
  border-top-color: var(--violet);
  animation: cb-spin 0.8s linear infinite;
}

@keyframes cb-skeleton {
  0% { background-position: 130% 0; }
  100% { background-position: -30% 0; }
}
.skeleton {
  border-radius: 10px;
  background: var(--bg-mid);
  background-image: linear-gradient(100deg,
    transparent 35%, oklch(1 0 0 / 0.05) 50%, transparent 65%);
  background-size: 300% 100%;
  animation: cb-skeleton 1.4s ease-in-out infinite;
}

/* ── 6 · Empty states with art (audit #7) ──────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 44px 24px 52px;
}
.empty-state img {
  width: min(190px, 46vw);
  height: auto;
  border-radius: 18px;
  margin-bottom: 12px;
  opacity: 0.92;
}
.empty-state .es-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.05em;
  color: var(--text);
}
.empty-state .es-sub {
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--text-dim);
  max-width: 300px;
  line-height: 1.5;
}
.empty-state .btn { margin-top: 14px; }

/* ── 6b · AI imagery layers ────────────────────────────────── */
.hero-skyline {
  position: absolute;
  inset: 0;
  background: url('/assets/gamification/app/hero-skyline.webp') center 30% / cover no-repeat;
  opacity: 0.42;
  -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 96%);
  mask-image: linear-gradient(180deg, #000 30%, transparent 96%);
  pointer-events: none;
}
.page-banner {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 22px;
}
.page-banner img {
  display: block;
  width: 100%;
  height: clamp(110px, 22vw, 190px);
  object-fit: cover;
  opacity: 0.85;
}
.page-banner::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, oklch(0.07 0.025 270 / 0.9) 0%, transparent 55%);
}


/* ── 7 · Z-order sanity (audit #10) ────────────────────────── */
#nav { z-index: var(--z-nav); }
#toast-root { z-index: var(--z-toast); }

/* ── 8 · Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .spinner, .pg-loading::before { animation-duration: 1.6s; }
  .skeleton { animation: none; }
}
