/**
 * BRACHOT.NET - CENTRALIZED LAYOUT SYSTEM
 * ========================================
 * Modern CSS Grid-based responsive layout system
 * Single source of truth for all layout, breakpoints, and widths
 *
 * Created: 2025-01-02
 * Replaces: Gumby Framework (gumby.css, gumby_style.css)
 *
 * BREAKPOINTS:
 * - Mobile:  0-767px    (fluid width, 15px padding)
 * - Tablet:  768-1279px (fluid width, 20px padding)
 * - Desktop: 1280px+    (max 1280px, 20px padding)
 */

/* ============================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   Change these values to control entire site
   ============================================ */
:root {
  /* Breakpoint values */
  --breakpoint-mobile: 767px;
  --breakpoint-tablet: 768px;
  --breakpoint-desktop: 1280px;

  /* Container max-widths */
  --container-mobile: 100%;
  --container-tablet: 100%;
  --container-desktop: 1280px;

  /* Container padding */
  --padding-mobile: 15px;
  --padding-tablet: 20px;
  --padding-desktop: 20px;

  /* Column gap (gutter) */
  --gutter-mobile: 10px;
  --gutter-tablet: 15px;
  --gutter-desktop: 20px;

  /* Grid columns */
  --grid-columns: 12;

  /* Z-index layers - Centralized management */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 500;
  --z-fixed: 1000;
  --z-modal-backdrop: 5000;
  --z-modal: 6000;
  --z-popover: 7000;
  --z-tooltip: 8000;
  --z-notification: 9000;

  /* Typography - Font sizes */
  --font-size-base: 14px;
  --font-size-small: 13px;
  --font-size-xs: 12px;
  --font-size-large: 16px;
  --font-size-xl: 18px;
  --font-size-input: 16px;  /* Prevents iOS zoom */
}

/* ============================================
   BASE CONTAINER STYLES (Mobile-first)
   ============================================ */

.container {
  width: 100%;
  max-width: var(--container-mobile);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--padding-mobile);
  padding-right: var(--padding-mobile);
  box-sizing: border-box;
}

.row {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

/* ============================================
   TABLET BREAKPOINT (768px+)
   ============================================ */
@media (min-width: 768px) {
  .container {
    max-width: var(--container-tablet);
    padding-left: var(--padding-tablet);
    padding-right: var(--padding-tablet);
  }
}

/* ============================================
   DESKTOP BREAKPOINT (1280px+)
   ============================================ */
@media (min-width: 1280px) {
  .container {
    max-width: var(--container-desktop);
    padding-left: var(--padding-desktop);
    padding-right: var(--padding-desktop);
  }
}

/* ============================================
   MODERN 12-COLUMN GRID SYSTEM
   Using CSS Grid internally (simpler than Gumby)
   ============================================ */

/* Base column styles */
.column,
.columns {
  width: 100%;
  padding-left: var(--gutter-mobile);
  padding-right: var(--gutter-mobile);
  box-sizing: border-box;
  min-height: 1px; /* Prevent collapse */
}

/* Mobile: All columns stack to 100% */
@media (max-width: 767px) {
  .column,
  .columns {
    float: none;
    width: 100% !important;
    margin-left: 0;
    padding: 0;
  }
}

/* Tablet & Desktop: 12-column percentage-based grid */
@media (min-width: 768px) {
  .column,
  .columns {
    float: left;
    padding-left: 0;
    padding-right: 0;
  }

  /* Column widths (percentage-based for fluid layout) */
  .one.column,
  .one.columns { width: 8.33333%; }

  .two.columns { width: 16.66667%; }

  .three.columns { width: 25%; }

  .four.columns { width: 33.33333%; }

  .five.columns { width: 41.66667%; }

  .six.columns { width: 50%; }

  .seven.columns { width: 58.33333%; }

  .eight.columns { width: 66.66667%; }

  .nine.columns { width: 75%; }

  .ten.columns { width: 83.33333%; }

  .eleven.columns { width: 91.66667%; }

  .twelve.columns { width: 100%; }

  /* One-third and two-thirds */
  .one-third.column { width: 33.33333%; }
  .two-thirds.column { width: 66.66667%; }

  /* One-half */
  .one-half.column { width: 50%; }
}

@media (min-width: 1280px) {
  .column,
  .columns {
    padding-left: var(--gutter-desktop);
    padding-right: var(--gutter-desktop);
  }
}

/* Column offsets (push from left) */
@media (min-width: 768px) {
  .offset-by-one { margin-left: 8.33333%; }
  .offset-by-two { margin-left: 16.66667%; }
  .offset-by-three { margin-left: 25%; }
  .offset-by-four { margin-left: 33.33333%; }
  .offset-by-five { margin-left: 41.66667%; }
  .offset-by-six { margin-left: 50%; }
  .offset-by-seven { margin-left: 58.33333%; }
  .offset-by-eight { margin-left: 66.66667%; }
  .offset-by-nine { margin-left: 75%; }
  .offset-by-ten { margin-left: 83.33333%; }
  .offset-by-eleven { margin-left: 91.66667%; }
}

/* ============================================
   RESPONSIVE UTILITY CLASSES
   Show/Hide elements at different breakpoints
   ============================================ */

/* Hide on Mobile (0-767px) */
.hide-on-mobile,
.hideOnMobile,
.hidden-xs {
  display: none !important;
}

@media (min-width: 768px) {
  .hide-on-mobile,
  .hideOnMobile,
  .hidden-xs {
    display: block !important;
  }
}

/* Hide on Tablet (768-1279px) */
@media (min-width: 768px) and (max-width: 1279px) {
  .hide-on-tablet,
  .hideOnMedium,
  .hidden-md {
    display: none !important;
  }
}

/* Hide on Desktop (1280px+) */
@media (min-width: 1280px) {
  .hide-on-desktop,
  .hidden-lg {
    display: none !important;
  }
}

/* Show only on specific breakpoints */
.show-on-mobile-only {
  display: block !important;
}

@media (min-width: 768px) {
  .show-on-mobile-only {
    display: none !important;
  }
}

.show-on-tablet-only {
  display: none !important;
}

@media (min-width: 768px) and (max-width: 1279px) {
  .show-on-tablet-only {
    display: block !important;
  }
}

.show-on-desktop-only {
  display: none !important;
}

@media (min-width: 1280px) {
  .show-on-desktop-only {
    display: block !important;
  }
}

/* ============================================
   CLEARFIX
   For proper float clearing
   ============================================ */
.row:after,
.clearfix:after {
  content: "";
  display: table;
  clear: both;
}

/* ============================================
   RTL (RIGHT-TO-LEFT) SUPPORT
   For Hebrew content
   ============================================ */
[dir="rtl"] .column,
[dir="rtl"] .columns {
  float: right;
}

[dir="rtl"] .row {
  direction: rtl;
}

@media (min-width: 768px) {
  [dir="rtl"] .offset-by-one { margin-right: 8.33333%; margin-left: 0; }
  [dir="rtl"] .offset-by-two { margin-right: 16.66667%; margin-left: 0; }
  [dir="rtl"] .offset-by-three { margin-right: 25%; margin-left: 0; }
  [dir="rtl"] .offset-by-four { margin-right: 33.33333%; margin-left: 0; }
  [dir="rtl"] .offset-by-five { margin-right: 41.66667%; margin-left: 0; }
  [dir="rtl"] .offset-by-six { margin-right: 50%; margin-left: 0; }
  [dir="rtl"] .offset-by-seven { margin-right: 58.33333%; margin-left: 0; }
  [dir="rtl"] .offset-by-eight { margin-right: 66.66667%; margin-left: 0; }
  [dir="rtl"] .offset-by-nine { margin-right: 75%; margin-left: 0; }
  [dir="rtl"] .offset-by-ten { margin-right: 83.33333%; margin-left: 0; }
  [dir="rtl"] .offset-by-eleven { margin-right: 91.66667%; margin-left: 0; }
}

/* ============================================
   CENTERED CONTENT COLUMN
   Common pattern for centered content
   ============================================ */
.centered-column {
  max-width: 800px;
  margin: 0 auto;
  padding-left: var(--padding-mobile);
  padding-right: var(--padding-mobile);
}

@media (min-width: 768px) {
  .centered-column {
    padding-left: var(--padding-tablet);
    padding-right: var(--padding-tablet);
  }
}

/* ============================================
   FLEX UTILITIES
   Modern flexbox helpers
   ============================================ */
.flex-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-start {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.flex-end {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* ============================================
   SPACING UTILITIES
   Consistent spacing system
   ============================================ */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.ml-0 { margin-left: 0 !important; }
.mr-0 { margin-right: 0 !important; }

.p-0 { padding: 0 !important; }
.pt-0 { padding-top: 0 !important; }
.pb-0 { padding-bottom: 0 !important; }
.pl-0 { padding-left: 0 !important; }
.pr-0 { padding-right: 0 !important; }

/* Small spacing */
.mt-1 { margin-top: 8px; }
.mb-1 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.mt-3 { margin-top: 24px; }
.mb-3 { margin-bottom: 24px; }
.mt-4 { margin-top: 32px; }
.mb-4 { margin-bottom: 32px; }

/* ============================================
   DEBUG HELPERS
   Remove in production
   ============================================ */
.debug-container {
  outline: 2px solid red;
}

.debug-row {
  outline: 2px solid blue;
}

.debug-column {
  outline: 1px solid green;
  background: rgba(0, 255, 0, 0.1);
}

/* ============================================
   PRINT STYLES
   Optimize layout for printing
   ============================================ */
@media print {
  .container,
  .row {
    max-width: 100%;
    padding: 0;
  }

  .column,
  .columns {
    float: none;
    width: 100%;
  }

  .hide-on-print {
    display: none !important;
  }
}
