/* =========================================================
   DogFamily Frontend CSS – DF2030 SaaS BASE (LOCKED)
   Mobile-first • CRO-first • Layout.php driven
   - Global foundation ONLY (no page-specific styling here)
   - Page-specific tweaks go to: /assets/css/home.css, product.css, cart.css, etc.
   ========================================================= */

/* -------------------------
   Design tokens
   ------------------------- */
:root{
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #111111;
  --muted: #6b7280;
  --border: #e5e7eb;

  --brand: #111111;          /* keep neutral, theme later */
  --brand-contrast: #ffffff;

  --radius: 12px;
  --shadow: 0 10px 30px rgba(0,0,0,.08);

  --container: 1200px;
  --gutter: 16px;

  --link: inherit;
  --focus: 2px solid rgba(17,17,17,.35);
}

/* -------------------------
   Base / reset-ish
   ------------------------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

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

/* -------------------------
   Layout primitives
   ------------------------- */
.container{
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Global page wrapper (views often output <main class="page ...">) */
.page{
  display: block;
  padding: 24px 0;
}

/* Utility spacing (small set, safe) */
.mt-0{ margin-top:0!important; }
.mb-0{ margin-bottom:0!important; }
.mt-1{ margin-top:8px!important; }
.mb-1{ margin-bottom:8px!important; }
.mt-2{ margin-top:16px!important; }
.mb-2{ margin-bottom:16px!important; }
.mt-3{ margin-top:24px!important; }
.mb-3{ margin-bottom:24px!important; }

/* -------------------------
   Typography (SaaS baseline)
   ------------------------- */
h1, h2, h3, h4, h5, h6{
  margin: 0 0 12px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

p{
  margin: 0 0 12px;
  color: var(--text);
}

.small, .muted{
  color: var(--muted);
}

/* -------------------------
   Buttons (generic, used by home/product/etc)
   ------------------------- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none !important;
  cursor: pointer;
  user-select: none;
  transition: transform .06s ease, opacity .12s ease, background-color .12s ease, border-color .12s ease;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-primary{
  background: var(--brand);
  color: var(--brand-contrast);
  border-color: var(--brand);
}

.btn-secondary{
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-large{
  padding: 14px 18px;
  border-radius: 12px;
}

/* Mobile-first: full-width CTA if inside .stack or when explicitly wanted */
.stack .btn,
.btn-block{
  width: 100%;
}

/* -------------------------
   Global header (layout.php uses .site-header/.site-nav)
   ------------------------- */
.site-header{
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .site-brand{
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px var(--gutter);
}

.site-header .site-logo{
  font-weight: 800;
  letter-spacing: -0.02em;
}

.site-header .site-sub{
  font-size: 12px;
  color: var(--muted);
}

.site-nav{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 var(--gutter) 12px;
}

.site-nav a{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14px;
  color: #333;
}

.site-nav a:hover{
  background: rgba(0,0,0,.04);
  text-decoration: none;
}

.site-cart{
  margin-left: auto; /* pushes cart right on wider screens; harmless on wrap */
}

/* Desktop: align brand + nav into one row without changing markup */
@media (min-width: 992px){
  .site-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
  }
  .site-header .site-brand{
    padding: 14px 0;
    margin-left: calc((100vw - min(var(--container), 100vw)) / 2);
    padding-left: var(--gutter);
  }
  .site-nav{
    padding: 14px 0;
    margin-right: calc((100vw - min(var(--container), 100vw)) / 2);
    padding-right: var(--gutter);
    gap: 12px;
  }
}

/* -------------------------
   Footer (layout.php uses .site-footer)
   ------------------------- */
.site-footer{
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 18px var(--gutter);
  color: var(--muted);
  font-size: 14px;
}

/* -------------------------
   Cards + grids (foundation for products, lists, etc.)
   ------------------------- */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.card--shadow{
  box-shadow: var(--shadow);
}

/* Generic grid helper */
.grid{
  display: grid;
  gap: 16px;
}

/* Product grid baseline (home.php uses .product-grid/.product-card) */
.product-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.product-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .08s ease, box-shadow .12s ease;
}

.product-card:hover{
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.product-card__link{
  display: block;
  padding: 14px;
}

.product-card h3{
  margin: 12px 0 6px;
  font-size: 16px;
}

.product-card p{
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.product-card .price{
  font-weight: 800;
  letter-spacing: -0.01em;
}

@media (min-width: 576px){
  .product-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 992px){
  .product-grid{
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }
}

/* -------------------------
   Sections baseline (home.php uses .hero/.trust-block/etc)
   NOTE: only minimal spacing here; visuals go to page css.
   ------------------------- */
section{
  padding: 18px 0;
}

/* Make common headings not look "raw" even without home.css */
.section-header h2{
  font-size: 22px;
}
.section-header p{
  color: var(--muted);
}

/* -------------------------
   Cart badge (DF8 / DF2030)
   Used by /assets/js/cart-ui.js (id: df-cart-count)
   JS toggles display none/inline-flex
   ------------------------- */
#df-cart-count{
  display: none;              /* default off */
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 18px;
  margin-left: 6px;
  background: #111;
  color: #fff;
  vertical-align: middle;
  pointer-events: none;
}

/* =========================================================
   Generic helpers: responsive 2-col grid + media cards
   (used by category/context + future pages)
   ========================================================= */

.df-grid-2{ grid-template-columns: 1fr; }
@media (min-width: 768px){
  .df-grid-2{ grid-template-columns: 1fr 1fr; }
}

/* Media card: force 16:9 display even if source is square */
.df-media-card{
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 16 / 9;
}

.df-media-img{
  width: 100%;
  height: 100%;
  object-fit: cover;   /* crops square -> 16:9 */
  display: block;
}

/* If JS sets it visible via style or class, it will render properly */
#df-cart-count.is-visible{
  display: inline-flex;
}

/* -------------------------
   Safety: prevent accidental overflow
   ------------------------- */
html { overflow-x: hidden; }
body { overflow-x: hidden; }
