/*
 * CUBRA Design System — layout.css
 * Container, grid, flex helpers, header, footer, page sections
 * Requiere: tokens.css
 */

/* ════════════════════════════════
   CONTAINER
   ════════════════════════════════ */

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

@media (min-width: 768px) {
  .container { padding-inline: var(--space-8); }
}

@media (min-width: 1280px) {
  .container { padding-inline: var(--space-6); }
}

.container-sm  { max-width: 680px;  margin-inline: auto; padding-inline: var(--space-5); }
.container-md  { max-width: 900px;  margin-inline: auto; padding-inline: var(--space-5); }
.container-xl  { max-width: 1400px; margin-inline: auto; padding-inline: var(--space-5); }


/* ════════════════════════════════
   GRID
   ════════════════════════════════ */

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Auto-fit responsive (sin media query) */
.grid-auto-sm { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-auto-md { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

/* Gap utilities */
.gap-2  { gap: var(--space-2);  }
.gap-4  { gap: var(--space-4);  }
.gap-6  { gap: var(--space-6);  }
.gap-8  { gap: var(--space-8);  }
.gap-10 { gap: var(--space-10); }
.gap-12 { gap: var(--space-12); }

/* Responsive: md breakpoint */
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Responsive: lg breakpoint */
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
}

/* Two-column con sidebar */
.layout-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

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

.layout-sidebar-right {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 1024px) {
  .layout-sidebar-right {
    grid-template-columns: 1fr 300px;
  }
}


/* ════════════════════════════════
   FLEX HELPERS
   ════════════════════════════════ */

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.items-end    { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-1       { flex: 1 1 0%; }
.shrink-0     { flex-shrink: 0; }


/* ════════════════════════════════
   SPACING HELPERS
   ════════════════════════════════ */

.mt-4  { margin-top: var(--space-4);  }
.mt-6  { margin-top: var(--space-6);  }
.mt-8  { margin-top: var(--space-8);  }
.mt-12 { margin-top: var(--space-12); }
.mb-4  { margin-bottom: var(--space-4);  }
.mb-6  { margin-bottom: var(--space-6);  }
.mb-8  { margin-bottom: var(--space-8);  }
.mb-12 { margin-bottom: var(--space-12); }

.p-4  { padding: var(--space-4);  }
.p-6  { padding: var(--space-6);  }
.p-8  { padding: var(--space-8);  }
.px-4 { padding-inline: var(--space-4); }
.px-6 { padding-inline: var(--space-6); }
.py-4 { padding-block: var(--space-4);  }
.py-6 { padding-block: var(--space-6);  }
.py-8 { padding-block: var(--space-8);  }

/* ════════════════════════════════
   DISPLAY / VISIBILITY
   ════════════════════════════════ */

.hidden { display: none; }

@media (min-width: 768px) {
  .md\:block  { display: block; }
  .md\:flex   { display: flex;  }
  .md\:hidden { display: none;  }
}

@media (min-width: 1024px) {
  .lg\:block  { display: block; }
  .lg\:flex   { display: flex;  }
  .lg\:hidden { display: none;  }
}


/* ════════════════════════════════
   SITE HEADER (estructura)
   ════════════════════════════════ */

/* Ver también: components.css .site-header, .nav-* */

/* Barra de utilidades superior (opcional) */
.topbar {
  background: var(--brand-primary-dark);
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--text-xs);
  padding: var(--space-1) 0;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
}

.topbar a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.topbar a:hover {
  color: var(--text-inverted);
}


/* ════════════════════════════════
   PAGE SECTIONS
   ════════════════════════════════ */

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

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

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

.section-alt {
  background: var(--surface-alt);
}

.section-dark {
  background: var(--surface-dark);
  color: var(--text-inverted);
}

.section-dark h2,
.section-dark h3,
.section-dark p {
  color: var(--text-inverted);
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin-inline: auto;
  margin-bottom: var(--space-10);
}

.section-eyebrow {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-accent);
  margin-bottom: var(--space-3);
}

.section-header h2 {
  margin-bottom: var(--space-4);
}

.section-header p {
  color: var(--text-muted);
  font-size: var(--text-lg);
}


/* ════════════════════════════════
   SITE FOOTER
   ════════════════════════════════ */

.site-footer {
  background: var(--surface-dark);
  color: rgba(255, 255, 255, 0.75);
  padding-block: var(--space-12) var(--space-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  margin-bottom: var(--space-10);
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-10);
  }
}

.footer-brand p {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.6);
  margin-top: var(--space-3);
  max-width: 300px;
}

.footer-col h4 {
  font-family: var(--font-head);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-inverted);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.footer-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-links a {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--brand-accent);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.58); /* increased for 4.5:1 contrast on surface-dark */
}

.footer-bottom a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: var(--brand-accent);
}


/* ════════════════════════════════
   BREADCRUMB
   ════════════════════════════════ */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-6);
}

.breadcrumb li + li::before {
  content: '/';
  color: var(--border-strong);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--brand-primary);
}

.breadcrumb li:last-child {
  color: var(--text);
  font-weight: var(--weight-medium);
}


/* ════════════════════════════════
   MISC UTILITIES
   ════════════════════════════════ */

.text-center  { text-align: center; }
.text-right   { text-align: right;  }
.text-left    { text-align: left;   }

.w-full  { width: 100%; }
.h-full  { height: 100%; }
.min-h-screen { min-height: 100vh; }

.rounded-sm   { border-radius: var(--radius-sm);   }
.rounded-md   { border-radius: var(--radius-md);   }
.rounded-lg   { border-radius: var(--radius-lg);   }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm  { box-shadow: var(--shadow-sm);  }
.shadow-md  { box-shadow: var(--shadow-md);  }
.shadow-lg  { box-shadow: var(--shadow-lg);  }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Print */
@media print {
  .site-header,
  .site-footer,
  .nav-toggle,
  .btn { display: none !important; }
  body { font-size: 12pt; }
  a::after { content: " (" attr(href) ")"; font-size: 10pt; color: #666; }
}
