/*
  Layout primitives: containers, section rhythm, grid/flex helpers,
  and the marketing type scale (DESIGN.md sections 5, 6, 7).

  Breakpoints used throughout the design system:
    mobile:  < 640px  (default, mobile-first)
    tablet:  >= 640px
    desktop: >= 1024px
*/

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

/* Long-form readable content (docs prose, article-style copy) */
.content {
  max-width: var(--content-max);
  margin-inline: auto;
}

/* Vertical rhythm between major marketing sections */
.section {
  padding-block: var(--space-12); /* 48px mobile */
}

@media (min-width: 640px) {
  .section {
    padding-block: var(--space-16); /* 64px tablet */
  }
}

@media (min-width: 1024px) {
  .section {
    padding-block: var(--space-24); /* 96px desktop */
  }
}

.section-tight {
  padding-block: var(--space-8);
}

/* Flex helpers */
.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-center {
  display: flex;
  align-items: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Vertical stack with consistent spacing between children */
.stack > * + * {
  margin-top: var(--space-4);
}

.stack-lg > * + * {
  margin-top: var(--space-8);
}

/* Grid helpers for feature/card layouts */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.grid-4 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.grid-auto {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Centered heading + short subcopy above a section's content */
.section-header {
  max-width: 640px;
  margin: 0 auto var(--space-10);
  text-align: center;
}

.section-header p {
  margin-top: var(--space-3);
}

/* Marketing type scale -- independent of semantic heading level so the
   visual hierarchy can differ from document structure when needed. */
.text-hero {
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.text-display {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  font-weight: 600;
}

.text-section-heading {
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.15;
  font-weight: 600;
}

.text-body-lg {
  font-size: 18px;
  line-height: 1.6;
}

.text-body {
  font-size: 16px;
  line-height: 1.6;
}

.text-small {
  font-size: 14px;
  line-height: 1.5;
}

.text-meta {
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text-muted);
}

.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-mono { font-family: var(--font-mono); }

/* Authenticated app shell: fixed sidebar + fluid main column */
.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) 1fr;
  }
}

.app-main {
  max-width: 1400px;
  width: 100%;
  padding: var(--space-6);
}

/* Screen-reader-only content (still focusable when it contains a link) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
