/* Layout base y grid */
.container {
  width: min(100%, 1200px);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

.row {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Single source of truth for inter-section spacing (was previously declared
   three times across this file with three different, contradictory values —
   var(--space-2xl), var(--space-xl), and var(--space-lg) inside a max-width
   query — so the effective padding depended on source order, not intent). */
/* Each .section contributes half the visible gap to the section before and
   after it (padding, not margin, so nothing collapses). 12px here + 12px
   from the next section's own top padding = ~24px between them on mobile;
   16px + 16px = ~32px on desktop. Previously var(--space-lg)/var(--space-2xl)
   (24px/48px each) made the visible gaps 48px/96px — twice the target. */
.section {
  padding-block: var(--space-sm);
}
@media (min-width: 900px) {
  .section {
    padding-block: 1rem;
  }
}

.flex {
  display: flex;
}

.space-between { justify-content: space-between; align-items: center; }

.flex-center {
  align-items: center;
  justify-content: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.page-wrapper {
  width: min(100%, 1280px);
  margin-inline: auto;
  padding: 1rem 1.5rem;
}

.page-header {
  display: grid;
  gap: var(--space-sm);
}

.page-header h1 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.page-header nav a {
  color: var(--color-primary);
  text-decoration: none;
}

.page-header nav a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.35rem;
}

.photo-example {
  width: 100%;
  max-width: 780px;
  margin-inline: auto;
}

.component-block {
  padding: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.grid-responsive {
  display: grid;
  gap: var(--space-sm);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Categories-grid is unused by index.html (which uses .categories-preview,
   defined responsively in home.css) — kept here only for any other page that
   may still reference it. .products-grid used to be defined here too, which
   silently fought with the real, more specific carousel rules for that same
   class in home.css; removed to leave a single source of truth there. */
.categories-grid {
  display: grid;
  gap: var(--space-sm);
  grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 375px) and (max-width: 767px) {
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .categories-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .categories-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
  .photo-example {
    max-width: 100%;
  }
}
