/* ============================================================
   Sokendi Layout System
   ============================================================
   Owns: containers, grids, flex/stack primitives, sections, footer.
   (base.css owns typography, surfaces, buttons, badges.)

   Tokens: uses ONLY the scale defined in BaseLayout.astro
   (--space-1 … --space-24, --ease-out-quart, …). This file used to
   reference --space-xs/sm/md/lg and --ease-standard, which don't exist:
   every gap, margin and transition using them silently computed to 0 /
   none (footer links had no spacing, .flex/.cluster had no gap).
   ============================================================ */

/* ------------------------------
   1. Containers
   ------------------------------
   Single gutter via padding. Before, base.css AND this file both styled
   .container (width calc + padding), so the gutter was doubled. */
.container,
.container-sm,
.container-xs {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--space-6);
}
.container    { max-width: 1280px; }
.container-sm { max-width: 960px; }
.container-xs { max-width: 720px; }

/* ------------------------------
   2. Grid system
   ------------------------------
   min(Npx, 100%): a plain minmax(320px, 1fr) column is wider than a
   320px phone's content area (320 − 2×16px gutter = 288px), which caused
   horizontal page scrolling on small phones. */
.grid,
.grid-2,
.grid-3,
.grid-4,
.grid-auto {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
}
.grid-2    { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid-3    { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid-4    { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }

/* ------------------------------
   3. Flex primitives
   ------------------------------ */
.flex {
  display: flex;
  gap: var(--space-4);
}
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}
.flex-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.flex-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* One definition each (base.css also had .stack and .row; the two .stack
   rules — flex gap AND owl margins — would have doubled the spacing). */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}
.frame {
  display: grid;
  place-items: center;
  padding: var(--space-6);
}

/* Two-column content/visual split. (Name kept for compatibility; consider
   .split — "sidebar" usually means navigation.) */
.sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 3.5rem);
}

/* dvh: 100vh is taller than the visible area on mobile (it ignores the
   browser toolbar), so content "centered" in .cover sat too low. */
.cover {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ------------------------------
   4. Section spacing
   ------------------------------ */
.section    { padding-block: clamp(4rem, 10vw, 8rem); }
.section-sm { padding-block: clamp(2.5rem, 7vw, 4rem); }
.section-lg { padding-block: clamp(6rem, 12vw, 12rem); }

/* ------------------------------
   5. Alignment
   ------------------------------ */
.center-text { text-align: center; }
.center-content { margin-inline: auto; }

/* base.css caps every <p> at 65ch. Inside centered blocks that capped box
   stayed LEFT-aligned, so centered paragraphs looked off-center on wide
   screens. Center the box too. */
.center-text p,
.center-content > p { margin-inline: auto; }

/* ------------------------------
   6. Footer
   ------------------------------
   Single source of truth. Delete the separate footer.css (it duplicated
   these selectors with tokens that don't exist: --surface-2,
   --pure-white, --accent-strong — wherever it won the cascade, the footer
   lost its background and heading colors). */
.footer {
  padding-block: clamp(3rem, 8vw, 5rem);
  background: var(--sh-elevated);
  border-top: 1px solid var(--border-default);
}

.footer-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: clamp(2rem, 4vw, 3rem);
}

.footer-logo {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
}

.footer-tagline {
  max-width: 260px;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-secondary);
}

.footer-heading {
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

/* Links: padding makes each one a ~30px tap target (was ~20px tall with
   0 spacing, because --space-xs was undefined). */
.footer-links a {
  display: block;
  width: fit-content;
  padding-block: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: color var(--duration-fast) var(--ease-out-quart);
}
.footer-links a:hover { color: var(--accent-amber); }
.footer-links a:focus-visible { outline-offset: 2px; }

/* Current page link (set aria-current="page" in the component). */
.footer-links a[aria-current='page'] { color: var(--text-primary); }

.footer-bottom {
  margin-top: clamp(2rem, 6vw, 3rem);
  padding-top: var(--space-6);
  text-align: center;
  border-top: 1px solid var(--border-default);
}

.footer-bottom p {
  max-width: none;        /* was capped at 65ch and left-aligned → off-center */
  margin-inline: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ------------------------------
   7. Responsive
   ------------------------------ */
@media (max-width: 1024px) {
  .sidebar { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px) {
  .container,
  .container-sm,
  .container-xs { padding-inline: var(--space-4); }
  .section { padding-block: clamp(3rem, 9vw, 4.5rem); }
}

@media (max-width: 480px) {
  .section { padding-block: clamp(2rem, 8vw, 3rem); }
  .footer-container { grid-template-columns: minmax(0, 1fr); }
}