/* ============================================================
   soplis.css — SHARED DESIGN SYSTEM
   ------------------------------------------------------------
   NEW FILE. Every page now links this (plus styles.css, which
   previously existed but was linked by ZERO pages — which is why
   .grid-4cols on the homepage silently did nothing).

   Purpose: one source of truth for colour, type, spacing and the
   shared components, so Grocery stops looking like a different
   product from Marketplace.

   Rule going forward: purple is the PLATFORM. Each vertical gets
   an accent colour, but typography, cards, spacing, buttons and
   loading states stay identical everywhere.
   ============================================================ */

:root {
  /* ---- Brand ---- */
  --sop-purple-50:  #f5f0ff;
  --sop-purple-100: #e9d5ff;
  --sop-purple-500: #8b5cf6;
  --sop-purple-600: #7c3aed;
  --sop-purple-700: #6d28d9;

  /* ---- Vertical accents (accent ONLY, never whole-page) ---- */
  --sop-accent-market:  #7c3aed;  /* Marketplace — platform purple */
  --sop-accent-used:    #0891b2;  /* Used Items  — teal            */
  --sop-accent-jobs:    #ea580c;  /* Jobs        — orange          */
  --sop-accent-service: #2563eb;  /* Services    — blue            */
  --sop-accent-grocery: #16a34a;  /* Grocery     — green           */

  /* ---- Neutrals ---- */
  --sop-ink:      #111827;
  --sop-body:     #374151;
  --sop-muted:    #6b7280;
  --sop-faint:    #9ca3af;
  --sop-line:     #e5e7eb;
  --sop-surface:  #ffffff;
  --sop-canvas:   #f9fafb;

  /* ---- Status ---- */
  --sop-success: #16a34a;
  --sop-warning: #f59e0b;
  --sop-danger:  #ef4444;

  /* ---- Type scale ---- */
  --sop-font-display: 'Syne', system-ui, sans-serif;
  --sop-font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --sop-text-xs:   11px;
  --sop-text-sm:   13px;
  --sop-text-base: 15px;
  --sop-text-lg:   18px;
  --sop-text-xl:   22px;
  --sop-text-2xl:  28px;

  /* ---- Spacing ---- */
  --sop-space-1: 4px;
  --sop-space-2: 8px;
  --sop-space-3: 12px;
  --sop-space-4: 16px;
  --sop-space-5: 24px;
  --sop-space-6: 32px;

  /* ---- Radii ---- */
  --sop-radius-sm:   8px;
  --sop-radius-md:  12px;
  --sop-radius-lg:  16px;
  --sop-radius-pill: 999px;

  /* ---- Elevation ---- */
  --sop-shadow-sm: 0 1px 3px rgba(17, 24, 39, .07);
  --sop-shadow-md: 0 4px 14px rgba(17, 24, 39, .09);
  --sop-shadow-lg: 0 18px 44px rgba(31, 41, 55, .18);

  /* ---- Layout ---- */
  --sop-max-width: 1200px;
  --sop-header-h: 60px;
  --sop-bottomnav-h: 62px;
}

/* ============================================================
   UNIFIED HERO
   Previously: mercado.html used a full green gradient, the other
   four verticals each used a different lavender gradient, and
   Services used a fifth. Now all five share one component and
   differ only by --hero-accent.
   ============================================================ */

.sop-hero {
  --hero-accent: var(--sop-accent-market);
  position: relative;
  overflow: hidden;
  padding: var(--sop-space-5) var(--sop-space-4) var(--sop-space-4);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--hero-accent) 8%, #ffffff) 0%,
      #ffffff 55%,
      color-mix(in srgb, var(--hero-accent) 14%, #ffffff) 100%);
  border-bottom: 1px solid var(--sop-line);
}

.sop-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(
    circle at 1px 1px,
    color-mix(in srgb, var(--hero-accent) 22%, transparent) 1px,
    transparent 0);
  background-size: 22px 22px;
  opacity: .35;
}

.sop-hero--market  { --hero-accent: var(--sop-accent-market); }
.sop-hero--used    { --hero-accent: var(--sop-accent-used); }
.sop-hero--jobs    { --hero-accent: var(--sop-accent-jobs); }
.sop-hero--service { --hero-accent: var(--sop-accent-service); }
.sop-hero--grocery { --hero-accent: var(--sop-accent-grocery); }

.sop-hero-inner {
  position: relative;
  max-width: var(--sop-max-width);
  margin: 0 auto;
}

.sop-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sop-space-1);
  font-family: var(--sop-font-body);
  font-size: var(--sop-text-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--hero-accent);
  background: color-mix(in srgb, var(--hero-accent) 12%, #ffffff);
  padding: 4px 10px;
  border-radius: var(--sop-radius-pill);
  margin-bottom: var(--sop-space-2);
}

.sop-hero-title {
  font-family: var(--sop-font-display);
  font-size: var(--sop-text-xl);
  font-weight: 800;
  line-height: 1.15;
  color: var(--sop-ink);
  margin: 0;
}

.sop-hero-sub {
  font-family: var(--sop-font-body);
  font-size: var(--sop-text-sm);
  color: var(--sop-muted);
  margin-top: var(--sop-space-1);
}

.sop-hero-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sop-space-2);
  margin-top: var(--sop-space-4);
}

@media (min-width: 768px) {
  .sop-hero { padding: var(--sop-space-6) var(--sop-space-5); }
  .sop-hero-title { font-size: var(--sop-text-2xl); }
  .sop-hero-sub { font-size: var(--sop-text-base); }
}

/* ============================================================
   BUTTONS
   ============================================================ */

.sop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sop-space-2);
  font-family: var(--sop-font-body);
  font-size: var(--sop-text-sm);
  font-weight: 700;
  padding: 9px 18px;
  border: none;
  border-radius: var(--sop-radius-pill);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.sop-btn:active { transform: scale(.97); }

.sop-btn-primary {
  background: var(--hero-accent, var(--sop-purple-600));
  color: #fff;
  box-shadow: var(--sop-shadow-sm);
}
.sop-btn-primary:hover { box-shadow: var(--sop-shadow-md); }

.sop-btn-ghost {
  background: #fff;
  color: var(--hero-accent, var(--sop-purple-600));
  border: 1px solid var(--sop-line);
}

.sop-btn:focus-visible {
  outline: 2px solid var(--sop-purple-600);
  outline-offset: 2px;
}

/* ============================================================
   CARDS
   ============================================================ */

.sop-card {
  background: var(--sop-surface);
  border: 1px solid var(--sop-line);
  border-radius: var(--sop-radius-lg);
  overflow: hidden;
  box-shadow: var(--sop-shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}

.sop-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sop-shadow-md);
}

/* ============================================================
   BRANDED LOADING STATE
   Replaces the 14 different loading strings ("Loading...",
   "Loading…", "Loading nearby shops…", "Loading products...")
   scattered across the site.

   Usage:
     <div class="sop-loader">
       <div class="sop-loader-mark">Soplis</div>
       <div class="sop-loader-text">Finding shops near you</div>
     </div>
   ============================================================ */

.sop-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sop-space-3);
  padding: var(--sop-space-6) var(--sop-space-4);
  min-height: 180px;
}

.sop-loader-mark {
  font-family: var(--sop-font-display);
  font-size: var(--sop-text-2xl);
  font-weight: 800;
  letter-spacing: -.02em;
  background: linear-gradient(
    100deg,
    var(--sop-purple-600) 0%,
    var(--sop-purple-600) 35%,
    var(--sop-purple-100) 50%,
    var(--sop-purple-600) 65%,
    var(--sop-purple-600) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: sop-shimmer 1.6s linear infinite;
}

@keyframes sop-shimmer {
  0%   { background-position: 150% 0; }
  100% { background-position: -50% 0; }
}

.sop-loader-text {
  font-family: var(--sop-font-body);
  font-size: var(--sop-text-sm);
  color: var(--sop-faint);
}

/* Skeleton cards — sized to match real cards so nothing jumps */
.sop-skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e9ebef 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: sop-skeleton 1.3s ease-in-out infinite;
  border-radius: var(--sop-radius-md);
}

@keyframes sop-skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.sop-skeleton-card { height: 230px; }
.sop-skeleton-line { height: 12px; margin-bottom: 8px; }
.sop-skeleton-line.short { width: 55%; }

/* ============================================================
   EMPTY STATES — one style, all verticals
   ============================================================ */

.sop-empty {
  text-align: center;
  padding: var(--sop-space-6) var(--sop-space-4);
  color: var(--sop-faint);
  font-family: var(--sop-font-body);
}

.sop-empty i {
  font-size: 30px;
  display: block;
  margin-bottom: var(--sop-space-3);
  opacity: .5;
}

.sop-empty-title {
  font-size: var(--sop-text-base);
  font-weight: 700;
  color: var(--sop-body);
  margin-bottom: var(--sop-space-1);
}

.sop-empty-sub { font-size: var(--sop-text-sm); }

/* ============================================================
   ACCESSIBILITY
   ============================================================ */

.sop-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--sop-purple-600);
  outline-offset: 2px;
  border-radius: var(--sop-radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Safe-area padding for notched devices */
.sop-safe-bottom {
  padding-bottom: calc(var(--sop-bottomnav-h) + env(safe-area-inset-bottom, 0px));
}

/* ============================================================
   SHARED SHELL — footer, bottom nav, page hero band
   Injected by soplis-shell.js. These styles live here so every
   page gets identical chrome without duplicated markup.
   ============================================================ */

/* ---- Bottom navigation ---- */
.soplis-bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  background: #fff;
  border-top: 1px solid #eceef2;
  box-shadow: 0 -4px 16px rgba(31, 41, 55, .06);
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.soplis-bottom-nav .inner { display: flex; width: 100%; max-width: 680px; }
.soplis-bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 2px; color: #9aa1ad; text-decoration: none;
  font-size: 10px; font-weight: 600;
  font-family: var(--sop-font-body);
  transition: color .15s ease;
}
.soplis-bottom-nav a i { font-size: 18px; }
.soplis-bottom-nav a.active { color: var(--sop-purple-600); }
.soplis-bottom-nav a:hover { color: var(--sop-purple-500); }
@media (min-width: 861px) { .soplis-bottom-nav a { font-size: 11px; } }

/* Stop the fixed nav covering page content */
body.has-bottom-nav { padding-bottom: calc(var(--sop-bottomnav-h) + env(safe-area-inset-bottom, 0px)); }

/* ---- Footer ---- */
.soplis-footer {
  background: #111827;
  color: #9ca3af;
  font-family: var(--sop-font-body);
  font-size: var(--sop-text-sm);
  margin-top: var(--sop-space-6);
}
.soplis-footer-inner {
  max-width: var(--sop-max-width);
  margin: 0 auto;
  padding: var(--sop-space-6) var(--sop-space-4) var(--sop-space-5);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sop-space-5);
}
@media (min-width: 768px) {
  .soplis-footer-inner { grid-template-columns: 1.4fr 3fr; gap: var(--sop-space-6); }
}
.soplis-footer-logo {
  font-family: var(--sop-font-display);
  font-size: var(--sop-text-xl);
  font-weight: 800;
  color: #fff;
  margin-bottom: var(--sop-space-2);
}
.soplis-footer-brand p { max-width: 34ch; line-height: 1.55; margin: 0; }
.soplis-footer-cols {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sop-space-5) var(--sop-space-4);
}
@media (min-width: 640px) { .soplis-footer-cols { grid-template-columns: repeat(4, 1fr); } }
.soplis-footer-col h3 {
  font-size: var(--sop-text-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  margin: 0 0 var(--sop-space-3);
}
.soplis-footer-col ul { list-style: none; padding: 0; margin: 0; }
.soplis-footer-col li { margin-bottom: var(--sop-space-2); }
.soplis-footer-col a { color: #9ca3af; text-decoration: none; transition: color .15s ease; }
.soplis-footer-col a:hover { color: #fff; text-decoration: underline; }
.soplis-footer-base {
  border-top: 1px solid #1f2937;
  padding: var(--sop-space-4);
  text-align: center;
  font-size: var(--sop-text-xs);
}
body.has-bottom-nav .soplis-footer-base { padding-bottom: calc(var(--sop-space-4) + 8px); }

/* ---- Page hero band for text pages ---- */
/* Same shape and type scale as the marketplace/jobs/grocery heroes */
.soplis-page-hero {
  background: linear-gradient(to right, #6d28d9 0%, #3730a3 100%);
  color: #fff;
  padding: 32px 16px;
  margin-bottom: 24px;
  text-align: center;
}
.soplis-page-hero-inner { max-width: var(--sop-max-width); margin: 0 auto; }
.soplis-page-hero h1 {
  font-size: 24px; font-weight: 700; line-height: 1.2;
  margin: 0 0 8px; color: #fff;
}
.soplis-page-hero p { font-size: 14px; color: rgba(255,255,255,.9); margin: 0; }
@media (min-width: 768px) {
  .soplis-page-hero h1 { font-size: 36px; }
  .soplis-page-hero p  { font-size: 16px; }
}

/* ---- Dashboard shell ---- */
.soplis-dash-hero {
  background: linear-gradient(to right, #6d28d9 0%, #3730a3 100%);
  color: #fff; padding: 24px 16px; margin-bottom: 24px;
}
.soplis-dash-hero-inner { max-width: var(--sop-max-width); margin: 0 auto; }
.soplis-dash-hero h1 { font-size: 22px; font-weight: 700; margin: 0; color: #fff; }
.soplis-dash-hero p  { font-size: 13px; color: rgba(255,255,255,.85); margin: 4px 0 0; }
