/* Layout: containers, sections, section themes, grids.
   A section's background comes ONLY from one theme class (theme-dark / theme-tint),
   so two background classes can never cancel each other out (old defect D1). */

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: calc(860px + var(--gutter) * 2); }

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(2.5rem, 2rem + 3vw, 4.5rem); }
.section + .section:not([class*="theme-"]) { border-top: 1px solid var(--grey-200); }

.theme-tint { background: var(--grey-50); }

.theme-dark {
  background-color: var(--ink-950);
  color: var(--on-dark);
  position: relative;
  isolation: isolate;
}
.theme-dark h1, .theme-dark h2, .theme-dark h3, .theme-dark h4 { color: #fff; }
.theme-dark a:not(.btn) { color: var(--cyan-300); }
.theme-dark a:not(.btn):hover { color: #fff; }

/* Blueprint grid used behind dark heroes */
.grid-lines::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--line-dark) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-dark) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 20%, transparent 75%);
  opacity: 0.55;
  pointer-events: none;
}
.grid-lines::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: radial-gradient(60% 60% at 85% 0%, rgba(0, 174, 239, 0.18), transparent 70%),
              radial-gradient(50% 50% at 0% 100%, rgba(10, 74, 138, 0.35), transparent 70%);
  pointer-events: none;
}

/* Section heading block (left aligned by default) */
.section-head { max-width: 760px; margin-bottom: var(--space-7); }
.section-head p { margin-top: var(--space-4); font-size: var(--step-1); color: var(--grey-500); }
.theme-dark .section-head p { color: var(--on-dark-muted); }
.section-head--split {
  max-width: none;
  display: grid;
  gap: var(--space-4) var(--space-7);
  align-items: end;
}
.section-head--split p { margin-top: 0; }
@media (min-width: 960px) {
  .section-head--split { grid-template-columns: 1.1fr 1fr; }
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--cyan-700);
  margin-bottom: var(--space-4);
}
.kicker::before {
  content: "";
  width: 18px;
  height: 2px;
  background: currentColor;
}
.theme-dark .kicker { color: var(--cyan-300); }

.lead { font-size: var(--step-1); color: var(--grey-500); max-width: 62ch; }
.theme-dark .lead { color: var(--on-dark-muted); }

/* Grids */
.grid { display: grid; gap: var(--space-5); }
@media (min-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

.split {
  display: grid;
  gap: var(--space-7);
  align-items: center;
}
@media (min-width: 960px) {
  .split { grid-template-columns: 1fr 1fr; gap: var(--space-8); }
  .split--wide-left { grid-template-columns: 1.2fr 1fr; }
  .split--wide-right { grid-template-columns: 1fr 1.2fr; }
  .split--top { align-items: start; }
}

.stack > * + * { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-7 { margin-top: var(--space-7); }
