/* ============================================================
   layout.css — Container, section wrappers, grid system
   Depends on: variables.css, base.css
   ============================================================ */

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

/* Narrow container for text-heavy blocks (FAQ, forms) */
.container--narrow {
  max-width: 800px;
}

/* Wide container (full-bleed sections with inner padding) */
.container--wide {
  max-width: 1440px;
}

/* ── Section wrappers ───────────────────────────────────── */
.section {
  padding: var(--section-padding);
}

/* Alternate background — even sections */
.section--alt {
  background-color: var(--color-surface);
}

/* Dark (primary blue) accent sections */
.section--dark {
  background-color: var(--color-primary);
  color: var(--color-text-on-dark);
}

.section--dark .section-title {
  color: var(--color-text-on-dark);
}

.section--dark .section-subtitle {
  color: rgba(255, 255, 255, 0.75);
}

.section-subtitle__link {
  display: inline-block;
  margin-left: var(--space-2);
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  white-space: nowrap;
}

.section-subtitle__link:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* Accent (yellow) section */
.section--accent {
  background-color: var(--color-accent);
  color: var(--color-text-on-accent);
}

/* ── CSS Grid helpers ───────────────────────────────────── */

/* Auto-responsive grid: fills as many columns as fit */
.grid {
  display: grid;
  gap: var(--grid-gap);
}

/* 2-column grid */
.grid--2 {
  grid-template-columns: 1fr;
}

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

/* 3-column grid */
.grid--3 {
  grid-template-columns: 1fr;
}

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

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

/* 4-column grid */
.grid--4 {
  grid-template-columns: repeat(2, 1fr);
}

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

/* 2-column layout: text + visual (60/40 on desktop) */
.grid--split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  align-items: center;
}

@media (min-width: 1024px) {
  .grid--split {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
  }
}

/* ── Flex utilities ─────────────────────────────────────── */
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap     { flex-wrap: wrap; }
.flex-col      { flex-direction: column; }
.gap-2         { gap: var(--space-2); }
.gap-4         { gap: var(--space-4); }
.gap-6         { gap: var(--space-6); }
.gap-8         { gap: var(--space-8); }

/* ── Section header block ───────────────────────────────── */
/* Usage: <div class="section-header"> <h2>…</h2> <p>…</p> </div> */
.section-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.section-header__eyebrow {
  display: inline-block;
  font-size: var(--text-label);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

.section-header__eyebrow--light {
  color: rgba(255, 255, 255, 0.7);
}

/* ── CTA row (centered button group) ───────────────────── */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
  margin-top: var(--space-8);
}

/* ── Horizontal scroll container (mobile cards) ────────── */
.scroll-x {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-2);          /* room for scrollbar */
  scrollbar-width: none;                   /* Firefox */
}

.scroll-x::-webkit-scrollbar {
  display: none;                           /* Chrome/Safari */
}

.scroll-x > * {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* ── Aspect ratio helpers ───────────────────────────────── */
.ratio-square    { aspect-ratio: 1 / 1; }
.ratio-video     { aspect-ratio: 16 / 9; }
.ratio-portrait  { aspect-ratio: 3 / 4; }
.ratio-landscape { aspect-ratio: 4 / 3; }

/* ── Image fill ─────────────────────────────────────────── */
.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ── Spacer ─────────────────────────────────────────────── */
.spacer-4  { height: var(--space-4); }
.spacer-8  { height: var(--space-8); }
.spacer-12 { height: var(--space-12); }

/* ── Display helpers ────────────────────────────────────── */
.hide-mobile {
  display: none;
}

@media (min-width: 768px) {
  .hide-mobile {
    display: revert;
  }
  .hide-tablet-up {
    display: none;
  }
}

/* ── Utility: nowrap только на десктопе (на мобильном текст переносится естественно) ── */
@media (min-width: 768px) {
  .nowrap-desktop {
    white-space: nowrap;
  }
}

/* ── License strip (тонкая полоса-бейдж между секциями) ─── */
.license-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background-color: var(--color-primary-light);
  color: var(--color-primary-dark);
  padding: var(--space-3) var(--container-padding);
  font-size: var(--text-body-m);
  font-weight: var(--font-weight-semibold);
  text-align: center;
}

.license-strip svg {
  flex-shrink: 0;
}

.license-strip a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.license-strip a:hover {
  color: var(--color-primary);
}
