/* ==========================================================================
   AGRINICHE UNITED CO. — FIELD LEDGER DESIGN SYSTEM
   Layout Styles (Grid, Flexbox, Spacing, Structure)
   File: assets/css/layout.css
   Depends on: assets/css/variables.css
   NOTE: This file governs LAYOUT ONLY — no color, typography, or button rules.
   ========================================================================== */


/* --------------------------------------------------------------------
   1. CONTAINER
   -------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container-fluid {
  width: 100%;
  padding-inline: var(--space-6);
}


/* --------------------------------------------------------------------
   2. SECTION SPACING
   -------------------------------------------------------------------- */

section {
  padding-block: var(--space-11);
}

.section-sm {
  padding-block: var(--space-7);
}

.section-lg {
  padding-block: var(--space-12);
}


/* --------------------------------------------------------------------
   3. DISPLAY HELPERS
   -------------------------------------------------------------------- */

.flex {
  display: flex;
}

.grid {
  display: grid;
}

.flex-row {
  display: flex;
  flex-direction: row;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

.align-start { align-items: flex-start; }
.align-center { align-items: center; }
.align-end { align-items: flex-end; }
.align-stretch { align-items: stretch; }


/* --------------------------------------------------------------------
   4. GRID SYSTEM
   -------------------------------------------------------------------- */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

/* Auto-fit grid — responsive card/component grid without media queries */
.grid-auto-fit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-6);
}

.grid-auto-fit-sm {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

.grid-auto-fit-lg {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-7);
}


/* --------------------------------------------------------------------
   5. WIDTH UTILITIES
   -------------------------------------------------------------------- */

.w-full { width: 100%; }
.w-half { width: 50%; }
.w-auto { width: auto; }
.max-w-sm { max-width: var(--container-sm); }
.max-w-md { max-width: var(--container-md); }
.max-w-lg { max-width: var(--container-lg); }
.max-w-xl { max-width: var(--container-xl); }
.max-w-2xl { max-width: var(--container-2xl); }


/* --------------------------------------------------------------------
   6. HEIGHT UTILITIES
   -------------------------------------------------------------------- */

.h-full { height: 100%; }
.h-auto { height: auto; }
.h-screen { height: 100vh; }
.min-h-screen { min-height: 100vh; }


/* --------------------------------------------------------------------
   7. RESPONSIVE BREAKPOINTS (reference queries used across layout rules)
   -------------------------------------------------------------------- */

/* Breakpoints referenced:
   --breakpoint-sm:  480px
   --breakpoint-md:  768px
   --breakpoint-lg:  1024px
   --breakpoint-xl:  1280px
   --breakpoint-2xl: 1536px
   CSS custom properties cannot be used inside @media queries directly,
   so literal values mirror the tokens defined in variables.css. */


/* --------------------------------------------------------------------
   8. OVERFLOW UTILITIES
   -------------------------------------------------------------------- */

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-hidden { overflow-x: hidden; }


/* --------------------------------------------------------------------
   9. POSITION UTILITIES
   -------------------------------------------------------------------- */

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; top: 0; }

.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }


/* --------------------------------------------------------------------
   10. GAP UTILITIES
   -------------------------------------------------------------------- */

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-7 { gap: var(--space-7); }
.gap-8 { gap: var(--space-8); }


/* --------------------------------------------------------------------
   11. MARGIN UTILITIES
   -------------------------------------------------------------------- */

.m-0 { margin: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mx-auto { margin-inline: auto; }
.my-auto { margin-block: auto; }


/* --------------------------------------------------------------------
   12. PADDING UTILITIES
   -------------------------------------------------------------------- */

.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.px-4 { padding-inline: var(--space-4); }
.px-6 { padding-inline: var(--space-6); }
.py-4 { padding-block: var(--space-4); }
.py-6 { padding-block: var(--space-6); }


/* --------------------------------------------------------------------
   13. HERO LAYOUT
   -------------------------------------------------------------------- */

.hero {
  display: flex;
  align-items: center;
  min-height: 80vh;
  padding-block: var(--space-12);
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: var(--container-md);
}

.hero-media {
  position: relative;
  width: 100%;
  height: 100%;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}


/* --------------------------------------------------------------------
   14. FOOTER LAYOUT
   -------------------------------------------------------------------- */

.footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-9);
  padding-block: var(--space-11) var(--space-7);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: var(--space-8);
}

.footer-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-bottom {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-top: var(--space-6);
}


/* --------------------------------------------------------------------
   15. RESPONSIVE LAYOUT ADJUSTMENTS
   -------------------------------------------------------------------- */

/* Extra-large desktops */
@media (max-width: 1536px) {
  .container {
    max-width: var(--container-xl);
  }
}

/* Standard desktops */
@media (max-width: 1280px) {
  .grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablets / small laptops */
@media (max-width: 1024px) {
  .hero {
    min-height: auto;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large mobile / small tablets */
@media (max-width: 768px) {
  .container,
  .container-fluid {
    padding-inline: var(--space-4);
  }

  section {
    padding-block: var(--space-8);
  }

  .section-lg {
    padding-block: var(--space-9);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .container,
  .container-fluid {
    padding-inline: var(--space-3);
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
}