/* FarmFresh — reset, layout primitives, typography */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--heading);
  line-height: var(--lh-tight);
  margin: 0 0 var(--s-3);
  font-weight: 700;
  letter-spacing: -.02em;   /* snug, to echo the rounded Quicksand wordmark */
}
h1 { font-size: var(--t-2xl); }
@media (min-width: 900px) { h1 { font-size: var(--t-3xl); } }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }   /* a clear step down from h2, up from body */
h4 { font-size: var(--t-base); letter-spacing: -.01em; }
p  { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }

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

img, svg, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.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;
}

.skip-link {
  position: absolute; left: var(--s-3); top: -60px; z-index: 200;
  background: var(--forest); color: #fff; padding: 10px 16px;
  border-radius: var(--r-md); transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: calc(var(--safe-top) + var(--s-3)); }

/* ---- App shell ---------------------------------------------------------- */
#app { min-height: 100dvh; display: flex; flex-direction: column; }

.app-main {
  flex: 1;
  padding-top: calc(var(--announce-h) + var(--header-h) + var(--safe-top));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--s-4));
}
@media (min-width: 900px) {
  .app-main { padding-bottom: var(--s-8); }
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: max(var(--s-4), var(--safe-left));
}
.wrap--narrow { max-width: var(--wrap-narrow); }
.wrap--flush { padding-inline: 0; }

/* ---- Sections ----------------------------------------------------------- */
.section { padding-block: var(--s-7); }
.section--mint { background: var(--surface-sunken); }
.section--paper { background: var(--surface); }
.section--tight { padding-block: var(--s-5); }
@media (min-width: 900px) { .section { padding-block: var(--s-9); } }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-4); margin-bottom: var(--s-5);
}
.section-head h2 { margin: 0; }
/* "View more ›" — keep the chevron inline beside the label, not stacked under it. */
.link-more { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: var(--t-sm); white-space: nowrap; }
.link-more svg { flex: none; }

/* ---- Grid helpers ------------------------------------------------------- */
.grid { display: grid; gap: var(--s-4); }
.grid--products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid--products { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 980px) { .grid--products { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-5); } }

.grid--cards { grid-template-columns: 1fr; }
@media (min-width: 680px) { .grid--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .grid--cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.grid--two { grid-template-columns: 1fr; gap: var(--s-6); }
@media (min-width: 860px) { .grid--two { grid-template-columns: 1fr 1fr; } }

.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.stack--lg { gap: var(--s-5); }
.row { display: flex; align-items: center; gap: var(--s-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* Horizontal scroll rail (recipes, videos, farms on mobile) */
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: 78%;
  gap: var(--s-4); overflow-x: auto; scroll-snap-type: x mandatory;
  padding-inline: max(var(--s-4), var(--safe-left));
  margin-inline: calc(-1 * max(var(--s-4), var(--safe-left)));
  padding-bottom: var(--s-2);
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
@media (min-width: 680px) { .rail { grid-auto-columns: 46%; } }
@media (min-width: 1000px) {
  .rail { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); overflow: visible;
          padding-inline: 0; margin-inline: 0; }
}

/* ---- Text utilities ----------------------------------------------------- */
.muted { color: var(--ink-3); }
.small { font-size: var(--t-sm); }
.tiny  { font-size: var(--t-xs); }
.strong { font-weight: 700; }
.center { text-align: center; }
.eyebrow {
  font-size: var(--t-xs); font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--brand-700);
}
.eyebrow--light { color: rgba(255,255,255,.82); }
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.price { font-weight: 800; color: var(--ink); }
.price-unit { font-weight: 600; color: var(--ink-3); font-size: .85em; }
.price-was { text-decoration: line-through; color: var(--ink-3); font-weight: 600; margin-left: var(--s-2); }

/* ---- Breadcrumb --------------------------------------------------------- */
.crumbs {
  display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap;
  font-size: var(--t-sm); color: var(--forest); padding-block: var(--s-3);
}
.crumbs span { color: var(--ink-3); }

/* ---- Motion ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ---- Grid/flex minimum-size guard --------------------------------------
   Grid and flex children default to `min-width: auto`, which means their
   minimum size is their *content* width. A horizontal scroller inside one —
   a .chips row, a .rail, a .table-wrap — therefore pushes its parent wider
   than the screen, and on a phone Chrome then expands the whole layout
   viewport to match. Opting these containers' children out of that is what
   keeps the page exactly as wide as the device.                            */
.grid > *,
.split > *,
.shop-layout > *,
.cart-layout > *,
.account-layout > *,
.seller-layout > *,
.editor-grid > *,
.recipe-layout > *,
.contact-grid > *,
.pdp > *,
.panel--split > * { min-width: 0; }

/* ---- Breakpoint utilities ----------------------------------------------
   The counterpart to .shop-aside / .seller-nav, which appear at 1000px.    */
.only-narrow { display: block; }
.only-wide   { display: none; }
@media (min-width: 1000px) {
  .only-narrow { display: none; }
  .only-wide   { display: block; }
}
