/* ==========================================================================
   BBBFPO — Bishnah Border Basmati Farmers Producer Organisation
   Global stylesheet. Mobile-first, lightweight, no framework.
   Brand: white background · rice-gold accents · agricultural green.
   ========================================================================== */

/* ---- Design tokens ---- */
:root {
  --green:        #0D5C46;
  --green-dark:   #084231;
  --green-light:  #E7F1ED;
  --gold:         #D4A017;
  --gold-dark:    #B8860B;
  --gold-light:   #FBF3DD;
  --cream:        #F8F6F2;
  --ink:          #1F2A24;
  --muted:        #5C6B63;
  --line:         #E6E3DC;
  --white:        #FFFFFF;
  --error:        #C0392B;
  --error-light:  #FFF0EE;

  --radius:       14px;
  --radius-sm:    9px;
  --shadow:       0 6px 24px rgba(13, 92, 70, 0.08);
  --shadow-lg:    0 14px 40px rgba(13, 92, 70, 0.14);
  --maxw:         1180px;

  --font-head: "Playfair Display", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  scroll-behavior: smooth;
  /* FIX #16: scroll-padding-top accounts for 70px sticky header on anchor links */
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--white);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; }
button { font-family: inherit; cursor: pointer; }

/* FIX #20: visible focus for keyboard navigation — WCAG 2.1 AA */
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; color: var(--green-dark); font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3 { font-size: 1.25rem; }
p  { color: var(--muted); }

/* ---- Layout helpers ---- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0; }
.section--tight { padding: 44px 0; }
.bg-cream { background: var(--cream); }
.bg-green { background: var(--green); color: #fff; }
.text-center { text-align: center; }
.eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gold-dark); margin-bottom: 10px;
}
.section-head { max-width: 660px; margin: 0 auto 40px; text-align: center; }
.section-head p { margin-top: 10px; }
.lead { font-size: 1.08rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  border: 2px solid transparent; transition: all .18s ease; white-space: nowrap;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); transform: translateY(-2px); }
.btn-gold { background: var(--gold); color: #2a2000; }
.btn-gold:hover { background: var(--gold-dark); color:#fff; transform: translateY(-2px); }
.btn-outline { border-color: var(--green); color: var(--green); background: transparent; }
.btn-outline:hover { background: var(--green); color: #fff; }
.btn-wa { background: #25D366; color: #08361c; }
.btn-wa:hover { background: #1ebe57; transform: translateY(-2px); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: .85rem; }

/* ==========================================================================
   Header / Navigation
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  width: 40px; height: 40px; border-radius: 11px; background: var(--green);
  display: grid; place-items: center; color: var(--gold); font-family: var(--font-head);
  font-weight: 700; font-size: 1.1rem; flex: none;
}
.brand__name { font-family: var(--font-head); font-weight: 700; color: var(--green-dark); font-size: 1.15rem; line-height: 1; }
.brand__sub  { font-size: .68rem; color: var(--muted); letter-spacing: .04em; }

.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links a {
  padding: 9px 14px; border-radius: 8px; font-weight: 500; font-size: .94rem; color: var(--ink);
  transition: background .15s, color .15s;
}
.nav__links a:hover { background: var(--green-light); color: var(--green-dark); }
.nav__links a.active { color: var(--green); font-weight: 600; }
.nav__cta { margin-left: 8px; }
.nav__shop {
  margin-left: 8px; background: var(--green); color: #fff !important;
  padding: 8px 18px; border-radius: 20px; font-weight: 600;
}
.nav__shop:hover { background: var(--green-dark) !important; color: #fff !important; }
.nav__shop.active { background: var(--green-dark); color: #fff !important; font-weight: 700; }

.nav__toggle {
  display: none; background: none; border: none; padding: 8px; color: var(--green-dark);
}
.nav__toggle svg { width: 26px; height: 26px; }

@media (max-width: 860px) {
  .nav__toggle { display: block; }
  .nav__links {
    position: fixed; inset: 70px 0 auto 0; flex-direction: column; align-items: stretch;
    background: #fff; border-bottom: 1px solid var(--line); padding: 14px 20px 22px; gap: 2px;
    transform: translateY(-120%); transition: transform .25s ease; box-shadow: var(--shadow);
    z-index: 49;
  }
  .nav__links.open { transform: translateY(0); }
  .nav__links a { padding: 13px 12px; font-size: 1rem; }
  .nav__cta { margin: 8px 0 0; }
  .nav__shop { margin: 10px 0 0; border-radius: 10px; text-align: center; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative; color: #fff; overflow: hidden;
  background: linear-gradient(120deg, rgba(8,66,49,.92), rgba(13,92,70,.78)),
              url("https://images.unsplash.com/photo-1536304929831-ee1ca9d44906?w=1600&q=80") center/cover no-repeat;
}
.hero__inner { padding: 92px 0 100px; max-width: 720px; }
.hero h1 { color: #fff; }
.hero h1 .accent { color: var(--gold); }
.hero p { color: rgba(255,255,255,.9); font-size: 1.12rem; margin-top: 18px; max-width: 560px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.hero__badges { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 40px; }
.hero__badge { display: flex; align-items: center; gap: 9px; font-size: .92rem; color: rgba(255,255,255,.92); }
.hero__badge svg { width: 20px; height: 20px; color: var(--gold); flex: none; }

/* ==========================================================================
   Feature grid (Why choose)
   ========================================================================== */
.grid { display: grid; gap: 22px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid--4 { grid-template-columns: repeat(2,1fr);} .grid--3{grid-template-columns:repeat(2,1fr);} }
@media (max-width: 560px) { .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; } }

.feature {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 22px;
  text-align: center; transition: transform .18s, box-shadow .18s;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature__icon {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 16px; display: grid; place-items: center;
  background: var(--gold-light); color: var(--gold-dark);
}
.feature__icon svg { width: 28px; height: 28px; }
.feature h3 { margin-bottom: 6px; }
.feature p { font-size: .92rem; }

/* ==========================================================================
   Product cards
   ========================================================================== */
.products-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
@media (max-width: 1000px){ .products-grid{ grid-template-columns: repeat(3,1fr);} }
@media (max-width: 760px) { .products-grid{ grid-template-columns: repeat(2,1fr);} }
@media (max-width: 480px) { .products-grid{ grid-template-columns: 1fr;} }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.card__media { position: relative; aspect-ratio: 4/3; background: var(--cream); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card__media img { transform: scale(1.05); }

/* FIX #15: image placeholder shown when image fails to load */
.card__media img[data-error] { object-fit: contain; padding: 20px; opacity: .5; }

.card__badge {
  position: absolute; top: 10px; left: 10px; background: var(--gold); color: #2a2000;
  font-size: .68rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; letter-spacing: .02em;
}
.card__body { padding: 16px 16px 18px; display: flex; flex-direction: column; flex: 1; }
.card__cat { font-size: .72rem; font-weight: 600; color: var(--gold-dark); text-transform: uppercase; letter-spacing: .06em; }
.card__title { font-family: var(--font-head); font-weight: 700; color: var(--green-dark); font-size: 1.08rem; margin: 4px 0 6px; }
.card__desc { font-size: .85rem; color: var(--muted); flex: 1; }
.card__sizes { display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0 10px; }
.chip { font-size: .72rem; background: var(--green-light); color: var(--green-dark); padding: 3px 9px; border-radius: 999px; font-weight: 500; }
.card__price { display: flex; align-items: baseline; gap: 7px; margin-bottom: 13px; }
.card__price .now { font-size: 1.2rem; font-weight: 800; color: var(--green-dark); }
.card__price .was { font-size: .85rem; color: #aaa; text-decoration: line-through; }
.card__price .unit { font-size: .78rem; color: var(--muted); }
.card__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ==========================================================================
   Story / split section
   ========================================================================== */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
@media (max-width: 820px){ .split{ grid-template-columns: 1fr; gap: 30px;} }
.split__media img { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.split h2 { margin-bottom: 14px; }
.split p + p { margin-top: 14px; }
.checklist { margin-top: 18px; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; color: var(--ink); }
.checklist svg { width: 20px; height: 20px; color: var(--green); flex: none; margin-top: 2px; }

/* ---- Stats strip ---- */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; text-align: center; }
@media (max-width: 560px){ .stats{ grid-template-columns: repeat(2,1fr);} }
.stat__num { font-family: var(--font-head); font-weight: 800; font-size: 2.1rem; color: var(--gold-dark); }
.stat__label { font-size: .85rem; color: var(--muted); margin-top: 2px; }
/* FIX #17: on dark .bg-green backgrounds override colors */
.bg-green .stat__num { color: var(--gold); }
.bg-green .stat__label { color: rgba(255,255,255,.85); }

/* ==========================================================================
   CTA band
   ========================================================================== */
.cta-band { background: linear-gradient(120deg, var(--green-dark), var(--green)); color:#fff; border-radius: var(--radius); padding: 46px 36px; text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,.88); max-width: 540px; margin: 12px auto 24px; }
.cta-band .hero__cta { justify-content: center; }

/* ==========================================================================
   Product detail
   ========================================================================== */
.pd { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
@media (max-width: 860px){ .pd{ grid-template-columns: 1fr; gap: 28px;} }
.gallery__main { border-radius: var(--radius); overflow: hidden; aspect-ratio: 1/1; background: var(--cream); box-shadow: var(--shadow); }
.gallery__main img { width:100%; height:100%; object-fit: cover; }
.gallery__thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery__thumbs button { width: 70px; height: 70px; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); background:none; padding:0; flex: none; }
.gallery__thumbs button.active { border-color: var(--gold); }
.gallery__thumbs button:hover { border-color: var(--green); }
.gallery__thumbs img { width:100%; height:100%; object-fit: cover; }

.pd__badges { display:flex; flex-wrap:wrap; gap:8px; margin-bottom: 12px; }
.pd__tagline { color: var(--gold-dark); font-weight: 600; margin: 6px 0 14px; }
.pd__price { display:flex; align-items:baseline; gap:10px; margin: 16px 0; flex-wrap: wrap; }
.pd__price .now { font-size: 2rem; font-weight: 800; color: var(--green-dark); font-family: var(--font-head); }
.pd__price .was { color:#aaa; text-decoration: line-through; }
.pd__price .save { background: var(--gold-light); color: var(--gold-dark); font-size:.78rem; font-weight:700; padding:3px 10px; border-radius:999px; }
.size-options { display:flex; flex-wrap:wrap; gap:10px; margin: 10px 0 20px; }
.size-options button {
  border:2px solid var(--line); background:#fff; border-radius:10px; padding:9px 16px; font-weight:600; font-size:.9rem; color: var(--ink); transition: all .15s;
}
.size-options button.active { border-color: var(--green); background: var(--green-light); color: var(--green-dark); }
.size-options button:hover:not(.active) { border-color: var(--muted); }
.size-options .price { display:block; font-size:.78rem; color: var(--muted); font-weight:500; }

.pd__section { margin-top: 30px; }
.pd__section h3 { color: var(--green-dark); margin-bottom: 12px; }
.spec-table { width:100%; border-collapse: collapse; font-size:.92rem; }
.spec-table tr { border-bottom: 1px solid var(--line); }
.spec-table th { text-align:left; padding:11px 0; color: var(--muted); font-weight:500; width: 42%; }
.spec-table td { padding:11px 0; color: var(--ink); font-weight:600; }

.breadcrumb { font-size:.85rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a:hover { color: var(--green); }
.breadcrumb [aria-current] { color: var(--ink); font-weight: 500; }

/* ==========================================================================
   Contact
   ========================================================================== */
.contact-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 40px; }
@media (max-width: 820px){ .contact-grid{ grid-template-columns:1fr;} }
.info-item { display:flex; gap:14px; margin-bottom: 22px; align-items:flex-start; }
.info-item__icon { width:44px; height:44px; border-radius:11px; background: var(--green-light); color: var(--green); display:grid; place-items:center; flex:none; }
.info-item__icon svg { width:22px; height:22px; }
.info-item h4 { color: var(--green-dark); margin-bottom: 2px; font-size: 1rem; }
.info-item p, .info-item a { font-size:.92rem; color: var(--muted); }
.info-item a:hover { color: var(--green); }

.form-card { background:#fff; border:1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.field { margin-bottom: 16px; }
.field label { display:block; font-size:.85rem; font-weight:600; color: var(--green-dark); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width:100%; padding: 11px 13px; border:1px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size:.95rem; color: var(--ink); background:#fff; transition: border .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { outline:none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-light); }
.field textarea { resize: vertical; min-height: 120px; }
/* FIX #1: field error styles */
.field input.error, .field textarea.error { border-color: var(--error); box-shadow: 0 0 0 3px var(--error-light); }
.field-error { font-size: .8rem; color: var(--error); margin-top: 5px; display: none; }
.field-error.show { display: block; }

.map-embed { border-radius: var(--radius); overflow:hidden; box-shadow: var(--shadow); border:1px solid var(--line); margin-top: 36px; }
.map-embed iframe { width:100%; height: 320px; border:0; display:block; }
.map-embed__fallback { display:none; }

/* ==========================================================================
   Legal pages
   ========================================================================== */
.legal { max-width: 800px; margin: 0 auto; }
.legal h2 { font-size: 1.4rem; margin: 30px 0 10px; }
.legal h3 { font-size: 1.1rem; margin: 22px 0 8px; color: var(--green); }
.legal p, .legal li { color: var(--muted); margin-bottom: 10px; }
.legal ul { list-style: disc; padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.page-hero { background: var(--green-light); padding: 50px 0; text-align:center; }
.page-hero p { max-width: 600px; margin: 10px auto 0; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { background: var(--green-dark); color: rgba(255,255,255,.82); padding: 54px 0 24px; }
.footer-grid { display:grid; grid-template-columns: 1.6fr 1fr 1fr 1.4fr; gap: 34px; }
@media (max-width: 820px){ .footer-grid{ grid-template-columns: 1fr 1fr;} }
@media (max-width: 480px){ .footer-grid{ grid-template-columns: 1fr;} }
.site-footer h4 { color:#fff; font-family: var(--font-body); font-weight:700; font-size:.95rem; letter-spacing:.04em; text-transform: uppercase; margin-bottom: 14px; }
.site-footer a { color: rgba(255,255,255,.78); font-size:.92rem; }
.site-footer a:hover { color: var(--gold); }
.site-footer li { margin-bottom: 9px; }
.footer-about p { font-size:.92rem; margin-top: 12px; }
.footer-brand { display:flex; align-items:center; gap:10px; }
.footer-brand .brand__name, .footer-brand .brand__sub { color:#fff; }
.footer-bottom { border-top:1px solid rgba(255,255,255,.14); margin-top: 40px; padding-top: 20px; display:flex; flex-wrap:wrap; gap:10px; justify-content: space-between; font-size:.85rem; }

/* ---- Floating WhatsApp ---- */
.wa-float {
  position: fixed; right: 18px; bottom: 18px; z-index: 60; width: 56px; height: 56px; border-radius: 50%;
  background: #25D366; color:#fff; display:grid; place-items:center; box-shadow: 0 8px 24px rgba(0,0,0,.22);
  transition: transform .18s;
}
.wa-float:hover { transform: scale(1.08); }
.wa-float svg { width: 30px; height: 30px; }

/* ---- Misc ---- */
.loader { text-align:center; padding: 60px 0; color: var(--muted); }
.empty { text-align:center; padding: 60px 0; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--green-dark); color:#fff; padding: 12px 22px; border-radius: 999px; font-size:.9rem;
  box-shadow: var(--shadow-lg); opacity: 0; transition: all .25s; z-index: 80; pointer-events:none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* FIX #4: fade-up ONLY hides content when JS has loaded (class added by site.js).
   Without JS, elements stay fully visible at all times. */
.js .fade-up { opacity: 0; transform: translateY(18px); transition: opacity .5s ease, transform .5s ease; }
.js .fade-up.in { opacity: 1; transform: none; }

/* Visually hidden but accessible to screen readers (used by sr-only caption in spec tables) */
.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;
}
