/* ============================================================
   BIMNovate · Layout
   12-column CSS Grid, container, section rhythm, ruled dividers.
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-inline: var(--grid-gutter);
  position: relative;
}
.container--narrow { max-width: var(--max-width-narrow); }
.container--wide   { max-width: var(--max-width-wide); }

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

/* Mobile-first span (single column).
   At md+ explicit spans take over via .md\:span-* classes. */
.grid > * { grid-column: 1 / -1; }

@media (min-width: 768px) {
  .md\:span-2  { grid-column: span 2;  }
  .md\:span-3  { grid-column: span 3;  }
  .md\:span-4  { grid-column: span 4;  }
  .md\:span-5  { grid-column: span 5;  }
  .md\:span-6  { grid-column: span 6;  }
  .md\:span-7  { grid-column: span 7;  }
  .md\:span-8  { grid-column: span 8;  }
  .md\:span-9  { grid-column: span 9;  }
  .md\:span-10 { grid-column: span 10; }
  .md\:span-12 { grid-column: 1 / -1;  }

  .md\:start-2 { grid-column-start: 2; }
  .md\:start-3 { grid-column-start: 3; }
  .md\:start-5 { grid-column-start: 5; }
  .md\:start-7 { grid-column-start: 7; }
}

/* === Architectural grid lines (desktop only · very subtle) ==
   Like graph paper bleed-through. Communicates precision —
   not decorative. Opt-in via .grid--lined. */
@media (min-width: 1024px) {
  .grid--lined { position: relative; }
  .grid--lined::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
      90deg,
      transparent,
      transparent calc((100% - 11 * var(--grid-gutter)) / 12),
      var(--color-border-light) calc((100% - 11 * var(--grid-gutter)) / 12),
      var(--color-border-light) calc((100% - 11 * var(--grid-gutter)) / 12 + var(--grid-gutter))
    );
    pointer-events: none;
    opacity: 0.4;
    z-index: 0;
  }
  .grid--lined > * { position: relative; z-index: 1; }
}

/* === Section rhythm ===================================== */
.section {
  padding-block: var(--space-3xl);
  position: relative;
}
.section--tight    { padding-block: var(--space-2xl); }
.section--snug     { padding-block: var(--space-xl); }
.section--surface  { background: var(--color-surface); }
.section--white    { background: var(--color-white); }
.section--dark     { background: var(--color-ink); color: var(--color-white); }
.section--bordered { border-top: var(--rule-weight) solid var(--rule-color); }

/* === Ruled dividers ===================================== */
.rule {
  display: block;
  height: var(--rule-weight);
  width: 100%;
  background: var(--rule-color);
  transform-origin: left center;
  border: 0;
}
.rule--strong { background: var(--color-ink); }
.rule--accent { background: var(--color-accent); height: 2px; }
.rule--blueprint { background: var(--color-blueprint); }

/* === Skip link ========================================== */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-ink);
  color: var(--color-white);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  z-index: var(--z-overlay);
  transition: top var(--duration-fast) var(--ease-out);
}
.skip-link:focus-visible { top: var(--space-sm); }

/* === Utility ============================================ */
.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;
}

.stack { display: flex; flex-direction: column; gap: var(--space-md); }
.stack--lg { gap: var(--space-lg); }
.stack--xl { gap: var(--space-xl); }
.stack--sm { gap: var(--space-sm); }

/* Monument header — eyebrow rides a full-width centred rule, title centred
   below. Theme-aware: hairlines use --color-border on light sections and a
   translucent white on .section--dark. Pairs with a following ruled element
   (e.g. .stats border-top) as the lower frame. */
.monument-header {
  gap: var(--space-lg);
  max-width: none;
  margin-bottom: var(--space-xl);
  text-align: center;
}
.monument-header .eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  max-width: none;
}
.monument-header .eyebrow::before,
.monument-header .eyebrow::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.section--dark .monument-header .eyebrow::before,
.section--dark .monument-header .eyebrow::after {
  background: color-mix(in srgb, var(--color-white) 18%, transparent);
}
/* The two hairlines draw outward from the eyebrow as the header
   reveals — a rule struck across the sheet from its label. */
.monument-header .eyebrow::before { transform-origin: right center; }
.monument-header .eyebrow::after  { transform-origin: left center; }
.monument-header[data-reveal] .eyebrow::before,
.monument-header[data-reveal] .eyebrow::after {
  transform: scaleX(0);
  transition: transform 700ms var(--ease-out) 150ms;
}
.monument-header[data-reveal].is-visible .eyebrow::before,
.monument-header[data-reveal].is-visible .eyebrow::after {
  transform: scaleX(1);
}
/* Body copy under a centred title needs its own measure back */
.monument-header .caption,
.monument-header .lead {
  max-width: 56ch;
  margin-inline: auto;
}

@media (prefers-reduced-motion: reduce) {
  /* Mirrors the animated selector exactly, [data-reveal] included, or
     it loses the specificity match and the rules still draw. */
  .monument-header[data-reveal] .eyebrow::before,
  .monument-header[data-reveal] .eyebrow::after {
    transform: none;
    transition: none;
  }
}

.cluster { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: center; }
.cluster--sm { gap: var(--space-sm); }
.cluster--end { justify-content: flex-end; }
.cluster--between { justify-content: space-between; }
