/* ==========================================================================
   Pikvita — layout.css
   Container, section rhythm, stacks, clusters and the grids pages are built from.
   Mobile-first; min-width queries at 48em (768), 64em (1024), 90em (1440).
   ========================================================================== */

.container {
  width: 100%;
  margin-inline: auto;
  max-width: calc(var(--container) + var(--margin) * 2);
  padding-inline: var(--margin);   /* content spans the page grid: full width less the margins, capped at 1240 (round 207) */
}
/* Page grid lines (round 155): drawn on the page and on each section's own background, so photos and cards cover them */
body,
.site-main > section,
.download,
.site-footer {
  background-image: var(--grid-lines);
  background-size: var(--grid-w) 100%;
  background-position: 50% 0;
  background-repeat: repeat-y;
}

.container--narrow { max-width: calc(var(--container-narrow) + var(--margin) * 2); }

/* Sections: vertical rhythm comes from one token */
.section {
  padding-block: var(--section-pad);
  position: relative;
}
.section--flush-top { padding-top: 0; }

/* Section heading block */
.section-head {
  display: grid;
  gap: var(--space-4);
  max-width: 44rem;
  margin-bottom: var(--head-gap);
}

/* Flow stacks */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--lg { gap: var(--stack-gap); }
.stack > * { margin: 0; }

/* Horizontal clusters (button rows, chips, promise rows) */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.cluster--lg { gap: var(--space-4) var(--space-5); }

/* Two-column split used by heroes and feature sections */
.split {
  display: grid;
  gap: var(--space-9);
  align-items: center;
}
@media (min-width: 64em) {
  .split { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
}

/* Auto grid for cards */
.grid {
  display: grid;
  gap: var(--space-5);
}
@media (min-width: 48em) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 64em) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Ruled grid: bordered cells that share one hairline (proof strip, beliefs, posts) */
.ruled {
  display: grid;
  border-top: var(--stroke);
  border-left: var(--stroke);
}
.ruled > * {
  border-right: var(--stroke);
  border-bottom: var(--stroke);
  padding: var(--space-6);
}
@media (min-width: 48em) {
  .ruled--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ruled--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 64em) {
  .ruled--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ruled--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Page hero for inner pages */
.page-hero {
  padding-top: var(--space-10);
  padding-bottom: var(--space-8);
}

/* Long-form reading column */
.prose {
  max-width: var(--measure);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--text);
}
.prose > * + * { margin-top: var(--space-5); }
.prose > h2 { margin-top: var(--space-9); font-size: var(--text-heading); }
.prose > h3 { margin-top: var(--space-7); }
.prose > h2 + * , .prose > h3 + * { margin-top: var(--space-3); }
.prose ul, .prose ol { padding-left: 1.2em; display: grid; gap: var(--space-2); }
.prose li::marker { color: var(--accent); }
.prose a:not([class]) {
  color: var(--accent);
  font-weight: 600;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}
.prose a:not([class]):hover { text-decoration-thickness: 2px; }

/* Main landmark sits under the sticky header */
.site-main { display: block; }

/* Copy stacks (owner, round 31): eyebrow → heading 20px, heading → lede 12px, lede → buttons 20px, on every section */
.copy-stack { gap: calc(var(--space-4) + var(--space-1)); }
.copy-stack > :is(h1, h2, h3) + p { margin-top: calc(var(--space-3) - var(--space-4) - var(--space-1)); }

/* Story and blog pages are white (round 50); only the download band and the footer keep the home page look */
body[data-page="story"], body[data-page="blog"] { background-color: var(--color-surface); }
.story-hero, .page-hero { padding-top: var(--space-10); }
.story-hero { padding-bottom: var(--space-10); }
.page-hero { padding-bottom: var(--space-8); }
.story-hero .cluster, .blog-hero .lede { margin-top: var(--space-2); }
