/* =============================================================================
   layout.css — VBS Grid, Spacing & Section Structure
   12-column CSS Grid. Max content width 1400px. Section padding system.
   Import after tokens.css and reset.css.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Container — max-width wrapper, centred
----------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

.container--narrow {
  max-width: 900px;
}

.container--wide {
  max-width: 1600px;
}

/* -----------------------------------------------------------------------------
   12-Column CSS Grid
----------------------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gutter);
}

/* Wide grid — increased gutter on larger viewports */
@media (min-width: 1200px) {
  .grid {
    gap: var(--gutter-wide);
  }
}

/* Span helpers */
.col-1  { grid-column-end: span 1; }
.col-2  { grid-column-end: span 2; }
.col-3  { grid-column-end: span 3; }
.col-4  { grid-column-end: span 4; }
.col-5  { grid-column-end: span 5; }
.col-6  { grid-column-end: span 6; }
.col-7  { grid-column-end: span 7; }
.col-8  { grid-column-end: span 8; }
.col-9  { grid-column-end: span 9; }
.col-10 { grid-column-end: span 10; }
.col-11 { grid-column-end: span 11; }
.col-12 { grid-column-end: span 12; }

/* Column start helpers */
.col-start-1  { grid-column-start: 1; }
.col-start-2  { grid-column-start: 2; }
.col-start-3  { grid-column-start: 3; }
.col-start-4  { grid-column-start: 4; }
.col-start-5  { grid-column-start: 5; }
.col-start-7  { grid-column-start: 7; }

/* Tablet — collapse to 6 columns */
@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(6, 1fr);
    gap: var(--gutter);
  }

  .col-3, .col-4 { grid-column: span 3; }
  .col-5, .col-6 { grid-column: span 6; }
  .col-7, .col-8 { grid-column: span 6; }
  .col-9         { grid-column: span 6; }
}

/* Mobile — collapse to 4 columns */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
  }

  .col-1, .col-2, .col-3, .col-4,
  .col-5, .col-6, .col-7, .col-8,
  .col-9, .col-10, .col-11, .col-12 {
    grid-column: span 4;
  }

  .container {
    padding-inline: var(--space-sm);
  }
}

/* -----------------------------------------------------------------------------
   Section Structure
----------------------------------------------------------------------------- */

.section {
  position: relative;
  padding-block: var(--section-pad);
  overflow: hidden;
}

/* Reduced section padding on mobile */
@media (max-width: 768px) {
  .section {
    padding-block: 5rem;
  }
}

/* Section variants */
.section--navy {
  /* Intentional dark island — use only for hero and final CTA banner */
  background-color: var(--color-navy);
}

.section--alt {
  background: var(--color-surface-2);
}

.section--flush {
  padding-block: 0;
}

.section--sm {
  padding-block: calc(var(--section-pad) / 2);
}

@media (max-width: 768px) {
  .section--sm {
    padding-block: 3rem;
  }
}

/* -----------------------------------------------------------------------------
   Section Header — consistent heading + label pattern
----------------------------------------------------------------------------- */

.section-header {
  margin-bottom: var(--space-lg);
}

.section-header--centred {
  text-align: center;
}

.section-header--centred p {
  margin-inline: auto;
}

.section-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: var(--space-sm);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-h1);
  font-weight: 600;
  line-height: 1.05;
  color: var(--color-cream);
  margin-bottom: var(--space-sm);
}

.section-subtitle {
  font-size: var(--text-body);
  color: var(--color-cream);
  opacity: 0.7;
  max-width: 60ch;
}

/* -----------------------------------------------------------------------------
   Flex Utilities
----------------------------------------------------------------------------- */

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col     { display: flex; flex-direction: column; }
.flex-gap-sm  { gap: var(--space-sm); }
.flex-gap-md  { gap: var(--space-md); }
.flex-gap-lg  { gap: var(--space-lg); }

/* -----------------------------------------------------------------------------
   Scan Line Overlay — CRT texture pseudo-element
   Use .scanlines--dark-only on .section--navy / hero sections only.
   .scanlines kept as alias but should be swapped to --dark-only in HTML.
----------------------------------------------------------------------------- */

.scanlines::before,
.scanlines--dark-only::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.03) 3px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* Ensure content sits above scan line overlay */
.scanlines > *,
.scanlines--dark-only > * {
  position: relative;
  z-index: 2;
}

/* -----------------------------------------------------------------------------
   Divider
----------------------------------------------------------------------------- */

.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--color-gold-20) 20%,
    var(--color-gold-20) 80%,
    transparent
  );
  margin-block: var(--space-lg);
}

/* -----------------------------------------------------------------------------
   Visibility Utilities
----------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* -----------------------------------------------------------------------------
   Full-Bleed Sections (canvas hero etc.)
----------------------------------------------------------------------------- */

.full-bleed {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.full-bleed .container {
  position: relative;
  z-index: var(--z-content);
}
