/* ==========================================================================
   CognivaSoft — Layout primitives
   Containers, the 12-column grid, section rhythm, surfaces, reveal motion.
   ========================================================================== */

.container {
  width: min(100% - (var(--gutter) * 2), var(--container));
  margin-inline: auto;
}

.container--wide { width: min(100% - (var(--gutter) * 2), var(--container-wide)); }

/* --- 12 column grid ------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-m) var(--gutter);
}

.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-12 { grid-column: span 12; }

@media (max-width: 960px) {
  .grid { gap: var(--space-l) var(--gutter); }
  .col-3, .col-4, .col-5 { grid-column: span 6; }
  .col-6, .col-7, .col-8 { grid-column: span 12; }
}

@media (max-width: 620px) {
  .col-3, .col-4, .col-5 { grid-column: span 12; }
}

/* --- Stacks & clusters ---------------------------------------------------- */

.stack > * + * { margin-top: var(--space-s); }
.stack-m > * + * { margin-top: var(--space-m); }
.stack-l > * + * { margin-top: var(--space-l); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-s);
}

/* --- Sections ------------------------------------------------------------- */

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section--tight { padding-block: clamp(3rem, 1.5rem + 4vw, 5rem); }
.section--flush-top { padding-top: 0; }

.section--alt  { background: var(--bg-alt); }
.section--dark {
  background: var(--grad-pine);
  background-color: var(--pine);
  color: var(--on-dark);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 { color: var(--on-dark); }

.section--dark .eyebrow { color: var(--ochre); }
.section--dark .lead    { color: var(--on-dark-soft); }
.section--dark .muted   { color: var(--on-dark-muted); }
.section--dark .num     { color: var(--on-dark-muted); }
.section--dark p        { color: var(--on-dark-soft); }

.section--rule { border-top: 1px solid var(--border); }

/* Section header — one focused message, stacked. The old
   "big headline left / small explainer right" split header is deliberately
   gone: it produced the same templated rhythm on every section. */
.section-head {
  max-width: 52ch;
  margin-bottom: var(--space-xl);
}

.section-head > * + * { margin-top: var(--space-s); }
.section-head h2 { max-width: 26ch; }

.section-head--wide { max-width: 58ch; }
.section-head--wide h2 { max-width: 24ch; }

/* Variant that genuinely earns two columns: the right side carries a
   control or a link, not filler prose. */
.section-head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-m) var(--space-xl);
  max-width: none;
  margin-bottom: var(--space-xl);
}

.section-head--split > * + * { margin-top: 0; }
.section-head--split .section-head__main { max-width: 52ch; }
.section-head--split .section-head__main > * + * { margin-top: var(--space-s); }

@media (max-width: 860px) {
  .section-head { margin-bottom: var(--space-l); }
  .section-head--split { margin-bottom: var(--space-l); }
}

/* --- Hairlines ------------------------------------------------------------ */

.rule { height: 1px; background: var(--border); border: 0; }
.section--dark .rule { background: var(--on-dark-line); }

/* --- Brand watermark -------------------------------------------------------
   An oversized, cropped version of the CognivaSoft monogram — the identity itself
   used as texture. (This replaced a tiled hairline grid: a grid field belongs
   on a canvas, map or blueprint surface, not as generic page decoration.) */

.bg-mark { position: relative; isolation: isolate; }

.bg-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--watermark, rgba(18, 18, 16, 0.045));
  -webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M23.07 8.93A10 10 0 1 0 23.07 23.07' fill='none' stroke='%23000' stroke-width='3.4'/%3E%3Crect x='22.4' y='4.2' width='6.2' height='6.2' fill='%23000'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M23.07 8.93A10 10 0 1 0 23.07 23.07' fill='none' stroke='%23000' stroke-width='3.4'/%3E%3Crect x='22.4' y='4.2' width='6.2' height='6.2' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: 112% 155%;
          mask-position: 112% 155%;
  -webkit-mask-size: min(56%, 30rem);
          mask-size: min(56%, 30rem);
}

:root[data-theme="dark"] { --watermark: rgba(245, 241, 232, 0.05); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --watermark: rgba(245, 241, 232, 0.05); }
}

.section--dark.bg-mark::before { background-color: rgba(245, 241, 232, 0.06); }

/* --- Reveal ----------------------------------------------------------------
   Deliberately rare. The hero owns the page's authored entrance; this is
   reserved for the two or three places where content genuinely benefits from
   arriving (metrics counting up, work cards landing). It is NOT applied
   section-by-section — an identical entrance on every block is wallpaper,
   not motion design. */

[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal].is-visible { opacity: 1; transform: none; }

/* Without JS the content must still be there. */
.no-js [data-reveal] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}
