/* ==========================================================================
   Cross Kashmir — Layout primitives
   Containers, vertical sections, stack/cluster/grid helpers.
   Requires tokens.css + base.css.
   ========================================================================== */

/* ---- Page shell -------------------------------------------------------------
   Every page is: skip link, header, <main id="main">, footer, scripts.
   The body is a column that is at least one screen tall; <main> absorbs the
   spare height, so the footer rests at the bottom of short pages and simply
   follows the content on long ones. <main> gets no padding of its own: pages
   build their rhythm with .section so full-width bands stay possible. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;     /* avoids the mobile browser-toolbar gap; vh above is the fallback */
}

body > main {
  flex: 1 0 auto;
}

/* ---- Containers ----------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Reading width for article-like text. Combine with .container:
   <div class="container container--narrow"> */
.container--narrow {
  max-width: calc(var(--container-narrow) + 2 * var(--gutter));
}

/* ---- Vertical rhythm between page sections ------------------------------- */
.section {
  padding-block: var(--space-8);
}

@media (min-width: 768px) {
  .section {
    padding-block: var(--space-12);
  }
}

@media (min-width: 1024px) {
  .section {
    padding-block: var(--space-16);
  }
}

/* ---- Stack: vertical flow with consistent gaps --------------------------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stack--sm { gap: var(--space-2); }
.stack--lg { gap: var(--space-8); }

/* ---- Cluster: wrapping horizontal group (buttons, tags, nav items) ------- */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* ---- Grid: fluid card grid, no breakpoints needed -------------------------
   Columns are created as soon as 16rem fits, so the layout adapts smoothly
   at every width rather than jumping at fixed breakpoints. */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid--cards {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
}

@media (min-width: 768px) {
  .grid {
    gap: var(--space-6);
  }
}
