/* PAGE: assets/css/main.css
   ExigentCleaning — base styles for layout, components, and cards
   Responsive tiers:
   - XS phones:   ≤360px
   - S phones:    361–480px
   - L phones:    481–640px
   - Tablets P:   641–834px (portrait)
   - Tablets L:   835–1024px (landscape / small laptops)
   - Desktop:     1025–1279px
   - XL Desktop:  1280–1535px
   - 2XL/Wide:    ≥1536px
*/

/* =============== CSS Variables =============== */
:root{
  /* Colors */
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e7eb;

  --accent: #2563eb;     /* primary */
  --accent-2: #16a34a;   /* success */
  --danger: #ef4444;     /* error */
  --warn: #f59e0b;       /* warning */

  /* Layout & tokens */
  --radius: 14px;
  --shadow: 0 10px 24px rgba(15,23,42,.08);
  --container: 1120px;   /* will scale up at larger widths */
  --space: 16px;         /* base spacing unit */

  /* Type scale */
  --fs-0: clamp(.875rem, .82rem + .2vw, .95rem);
  --fs-1: clamp(1rem, .96rem + .4vw, 1.125rem);
  --fs-2: clamp(1.15rem, 1.05rem + .7vw, 1.35rem);
  --fs-3: clamp(1.35rem, 1.2rem + 1vw, 1.75rem);
  --fs-4: clamp(1.6rem, 1.3rem + 1.4vw, 2.2rem);

  /* Safe area (iOS notches) */
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Wider containers on large screens */
@media (min-width: 1280px){ :root{ --container: 1200px; } }
@media (min-width: 1536px){ :root{ --container: 1320px; } }
@media (min-width: 1720px){ :root{ --container: 1440px; } }



/* =============== Reduced Motion =============== */
@media (prefers-reduced-motion: reduce){
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* =============== Resets & Basics =============== */
*,
*::before,
*::after { 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;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

picture, img[data-zoom]{
  content-visibility: auto; /* perf */
  contain-intrinsic-size: 320px 240px; /* prevent layout shift guess */
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover, a:focus {
  text-decoration: underline;
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: calc(var(--space) + var(--safe-left));
  padding-right: calc(var(--space) + var(--safe-right));
}

/* Helpers */
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.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;
}
.spacer { flex: 1 1 auto; }
.only-mobile { display: none; }
.only-desktop { display: initial; }
.hide { display: none !important; }

/* =============== Typography =============== */
h1, h2, h3 {
  color: var(--text);
  line-height: 1.2;
  margin: 0 0 10px;
}
h1 { font-size: var(--fs-4); }
h2 { font-size: var(--fs-3); }
h3 { font-size: var(--fs-2); }
p  { margin: 0 0 12px; font-size: var(--fs-1); }

/* =============== Header =============== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: var(--safe-top);
}

.header-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  min-height: 64px;
}

.logo {
  font-weight: 800;
  letter-spacing: .2px;
  white-space: nowrap;
  font-size: var(--fs-2);
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  padding: 8px;
  border-radius: 10px;
}
.nav-toggle .bar {
  display: block;
  width: 20px; height: 2px; margin: 4px 0;
  background: var(--text);
  border-radius: 2px;
}

.nav ul {
  list-style: none;
  display: flex;
  gap: 14px;
  margin: 0; padding: 0;
}
.nav a {
  display: inline-block;
  padding: 10px 8px;
  border-radius: 8px;
  font-size: var(--fs-1);
}
.nav a.active,
.nav a[aria-current="page"] {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  text-decoration: none;
}

.site-search {
  display: flex; gap: 8px; align-items: center;
}
.site-search input[type="search"]{
  padding: 10px 12px;
  min-width: min(44vw, 360px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: var(--fs-1);
}
.site-search button{
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: var(--fs-1);
}
.site-search button:hover{ filter: brightness(.95); }

.auth-links { display: flex; gap: 8px; }

/* Subnav */
.subnav {
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.subnav .container {
  display: flex; gap: 8px; padding-top: 8px; padding-bottom: 8px;
}

/* Mobile nav open helper (toggle .nav--open on <body> with JS) */
@media (max-width: 768px){
  .nav { display: none; }
  body.nav--open .nav{
    display: block;
    position: absolute;
    left: 0; right: 0; top: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 8px calc(var(--space) + var(--safe-left)) 12px calc(var(--space) + var(--safe-right));
  }
  body.nav--open .nav ul{ flex-direction: column; gap: 2px; }
}

/* =============== Chips & Badges =============== */
.chip {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .9rem;
  background: #fff;
  gap: 8px;
  touch-action: manipulation;
}
.badge {
  display: inline-block;
  font-size: .75rem;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #eef2ff;
  color: #4338ca;
}
.badge-in { background: #ecfdf5; color:#065f46; border-color:#a7f3d0; }
.badge-out{ background: #fef2f2; color:#991b1b; border-color:#fecaca; }
.badge-sponsor{ background: #fff7ed; color:#9a3412; border-color:#fed7aa; }

/* =============== Buttons =============== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff; cursor: pointer;
  text-decoration: none;
  transition: transform .02s ease, filter .15s ease;
  font-size: var(--fs-1);
}
@media (pointer: fine){
  .btn:hover { filter: brightness(.96); }
}
.btn:active { transform: translateY(1px); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}
.btn-disabled, .btn[disabled] {
  opacity: .6; cursor: not-allowed; background: #e5e7eb; color: #6b7280; border-color: #e5e7eb;
}

/* Sticky CTA for mobile (use on product pages) */
.sticky-cta {
  position: sticky;
  bottom: 0;
  z-index: 40;
  padding: 10px calc(var(--space) + var(--safe-left)) calc(10px + var(--safe-bottom)) calc(var(--space) + var(--safe-right));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}
@media (min-width: 835px){ .sticky-cta{ display: none; } }

/* =============== Cards & Layout Blocks =============== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  content-visibility: auto;
}

.grid.two {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0,1fr));
}
.grid.three {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0,1fr));
}
.grid.auto-fill {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.grid.auto-fill.stores { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Utilities for columns */
.grid.cols-1{ display:grid; grid-template-columns: 1fr; gap:12px; }
.grid.cols-2{ display:grid; grid-template-columns: repeat(2,1fr); gap:12px; }
.grid.cols-4{ display:grid; grid-template-columns: repeat(4,1fr); gap:12px; }

/* =============== Forms =============== */
.form .field { margin-bottom: 12px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="search"],
.field input[type="url"],
.field input[type="number"],
.field input[type="file"],
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: var(--fs-1);
}
.field textarea { resize: vertical; }
.req { color: var(--danger); margin-left: 2px; }

.checkbox, .radio { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.checkbox.small { font-size: .9rem; }

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: var(--fs-1);
}
.alert-error { border-color: #fecaca; background: #fef2f2; color: #7f1d1d; }

/* =============== Product Card =============== */
.product-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  align-items: start;
  border-radius: 12px;
}
.product-card .media {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  transition: transform .2s ease;
}
.product-card img { width: 100%; height: 100%; object-fit: cover; }

.product-card .brand {
  font-size: .85rem; color: var(--muted); margin-bottom: 4px;
}
.product-card .title a { text-decoration: none; }
.product-card .price-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 6px;
}
.product-card .price { font-weight: 700; }
.product-card .from { color: var(--muted); margin-right: 4px; }
.product-card .offers { color: var(--muted); font-size: .9rem; }
.product-card .price.unavailable { color: var(--muted); }
.product-card .actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

@media (pointer: fine){
  .product-card:hover .media { transform: translateY(-2px); }
}

/* =============== Offer Row =============== */
.offer-row {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.offer-left .store {
  display: inline-flex; gap: 10px; align-items: center;
}
.offer-left .store-logo {
  width: 32px; height: 32px; object-fit: contain;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 2px;
}
.offer-left .store-name { font-weight: 600; }
.offer-left .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.offer-left .host { margin-top: 6px; font-size: .85rem; }

.rating { display: inline-flex; gap: 2px; align-items: center; margin-top: 6px; }
.rating .star { font-size: 1rem; color: #d1d5db; }
.rating .star.full { color: #f59e0b; }
.rating .count { margin-left: 6px; color: var(--muted); font-size: .85rem; }

.offer-right {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.offer-right .price-block { display: grid; gap: 4px; justify-items: start; }
.offer-right .price { font-weight: 800; font-size: 1.1rem; }
.offer-right .shipping, .offer-right .updated { font-size: .85rem; color: var(--muted); }
.offer-right .actions { display: flex; gap: 8px; justify-content: end; }

/* =============== Store Card =============== */
.store-card {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px;
  align-items: start;
  border-radius: 12px;
}
.store-card .media .logo {
  width: 100%; height: 90px; object-fit: contain;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 8px;
  transition: transform .2s ease;
}
.store-card .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.store-card .desc { color: var(--muted); }
.store-card .counts, .store-card .from-price { margin-top: 6px; color: var(--muted); }
.store-card .from { color: var(--muted); margin-right: 4px; }
.store-card .price { font-weight: 700; }
.store-card .actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

@media (pointer: fine){
  .store-card:hover .media .logo { transform: scale(1.02); }
}

/* =============== Auth Blocks =============== */
.auth-header h2 { margin-bottom: 4px; }
.auth .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* =============== Footer =============== */
.site-footer {
  margin-top: 32px;
  padding: 24px 0 calc(24px + var(--safe-bottom));
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.footer-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.2fr .8fr .6fr;
}
.footer-brand .logo { font-weight: 800; display: inline-block; margin-bottom: 6px; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.btn-link, .back-to-top {
  background: transparent; border: 0; color: var(--accent);
  cursor: pointer; padding: 0;
}

/* ===================================================================== */
/* =====================  NEW LIGHT DESIGN ADDITIONS  =================== */
/* ===================================================================== */

/* =============== Home Hero & Sections =============== */
.page-home .hero {
  display: grid;
  gap: 16px;
  align-items: center;
  background:
    radial-gradient(1200px 200px at 20% -40%, #e8efff 0%, transparent 60%),
    radial-gradient(800px 150px at 90% 0%, #e7fff1 0%, transparent 60%),
    var(--surface);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hero-title { margin: 0 0 4px; font-size: var(--fs-4); }
.lead { font-size: 1.05rem; color: var(--muted); }

.hero-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.hero-search input[type="search"]{
  width: 100%;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: var(--fs-1);
}
.hero-search button { padding: 12px 16px; border-radius: 12px; font-size: var(--fs-1); }

.section { margin-top: 28px; }
.section .head { margin-bottom: 12px; }
.section-title { margin: 0; }

/* =============== Chips container tidy =============== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* =============== Info grid =============== */
.info-grid .info-card h3 { margin: 0 0 6px; }
.info-grid .info-card p { margin: 0; }

/* =============== Pagination (optional) =============== */
.pager {
  display: flex; gap: 8px; justify-content: center; align-items: center;
  margin-top: 18px;
}
.pager a, .pager span {
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: #fff;
}
.pager .active { border-color: var(--accent); color: var(--accent); }

/* =============== Animations & Skeletons =============== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-up { animation: fadeUp .25s ease both; }

.skeleton {
  position: relative; overflow: hidden; background: #eef2f7; border-radius: 10px; min-height: 12px;
}
.skeleton::after{
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  transform: translateX(-100%); animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ===================================================================== */
/* ======================== RESPONSIVE QUERIES ========================== */
/* ===================================================================== */

/* --- Tablet landscape and below (≤1024px) --- */
@media (max-width: 1024px){
  .header-row { grid-template-columns: auto 1fr auto; }
  .auth-links { display: none; }

  .offer-row { grid-template-columns: 1fr; }
  .offer-right { grid-template-columns: 1fr; justify-items: start; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: 1fr 1fr; }
}

/* --- Tablet portrait and below (≤834px) --- */
@media (max-width: 834px){
  .page-home .hero { padding: 16px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .store-card { grid-template-columns: 1fr; }
  .product-card { grid-template-columns: 120px 1fr; }
  .site-search input[type="search"]{ min-width: 0; width: 100%; }
}

/* --- Large phones / small tablets (641–834px) --- */
@media (min-width: 641px) and (max-width: 834px){
  .only-mobile { display: initial; }
  .only-desktop { display: none; }
  .hero-title{ font-size: clamp(1.4rem, 1.1rem + 2vw, 2rem); }
}

/* --- Large phones (481–640px) --- */
@media (min-width: 481px) and (max-width: 640px){
  .header-row { grid-template-columns: auto auto 1fr; gap: 10px; }
  .nav-toggle { display: inline-block; }
  .product-card { grid-template-columns: 110px 1fr; }
  .offer-left .host { display: none; } /* hide secondary meta */
  .footer-grid { grid-template-columns: 1fr; }
  .only-mobile { display: initial; }
  .only-desktop { display: none; }
}

/* --- Small phones (361–480px) --- */
@media (min-width: 361px) and (max-width: 480px){
  .header-row { grid-template-columns: auto 1fr auto; gap: 8px; }
  .nav-toggle { display: inline-block; }
  .nav { display: none; } /* use .nav--open on body to show */
  .product-card { grid-template-columns: 1fr; }
  .product-card .media { aspect-ratio: 16/9; }
  .offer-right { gap: 8px; }
  .hero-search { grid-template-columns: 1fr; }
  .hero-search button { width: 100%; }
  .only-mobile { display: initial; }
  .only-desktop { display: none; }
}

/* --- Extra small phones (≤360px) --- */
@media (max-width: 360px){
  :root{ --space: 12px; }
  .header-row { grid-template-columns: auto 1fr auto; gap: 6px; min-height: 56px; }
  .logo { font-size: 1rem; }
  .site-search input[type="search"]{ padding: 9px 10px; }
  .site-search button{ padding: 9px 10px; }
  .card { padding: 12px; }
  .product-card { grid-template-columns: 1fr; gap: 10px; }
  .offer-row { padding: 10px; }
  .only-mobile { display: initial; }
  .only-desktop { display: none; }
}

/* --- Desktop & XL adjustments --- */
@media (min-width: 1280px){
  .grid.auto-fill { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .grid.auto-fill.stores { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}

/* --- 2XL / wide screens --- */
@media (min-width: 1536px){
  .hero-title{ font-size: clamp(2rem, 1.4rem + 1.8vw, 2.6rem); }
  .grid.cols-4{ grid-template-columns: repeat(4,1fr); }
}

/* ===================================================================== */
/* ============================ PRINT ================================== */
/* ===================================================================== */
@media print{
  :root{
    --bg:#fff; --surface:#fff; --text:#000; --muted:#333; --border:#ddd;
  }
  body{ background:#fff; color:#000; }
  .site-header, .subnav, .site-footer, .sticky-cta { display: none !important; }
  a{ text-decoration: none; color:#000; }
  .card{ box-shadow:none; border:1px solid #ddd; }
}
