/* ================================================================
   04 · UTILITIES GLOBAL (SISTEMA UNIFICADO)
   Capa 4 del Bricks Design System V4.3 
================================================================ */

/* ────────────────────────────────────────────────────────────────
   1. FLEXBOX
──────────────────────────────────────────────────────────────── */
.u-flex-row { display: flex; flex-direction: row; }
.u-flex-col { display: flex; flex-direction: column; }
.u-flex-center { display: flex; justify-content: center; align-items: center; }
.u-flex-between { display: flex; justify-content: space-between; align-items: center; }
.u-flex-wrap { flex-wrap: wrap; }
.u-flex-start { display: flex; justify-content: flex-start; align-items: flex-start; }
.u-flex-end { display: flex; justify-content: flex-end; align-items: center; }

/* Justify (Eje principal) */
.u-justify-start { justify-content: flex-start; }
.u-justify-end { justify-content: flex-end; }
.u-justify-center { justify-content: center; }
.u-justify-between { justify-content: space-between; }
.u-justify-around { justify-content: space-around; }

/* Align (Eje cruzado) */
.u-align-start { align-items: flex-start; }
.u-align-center { align-items: center; }
.u-align-end { align-items: flex-end; }
.u-align-stretch { align-items: stretch; }
.u-align-baseline { align-items: baseline; }

/* Flex Responsive */
@media (max-width: 767px) {
  .u-flex-col-tablet-land { flex-direction: column; }
  .u-flex-row-tablet-land { flex-direction: row; }
}
@media (max-width: 479px) {
  .u-flex-col-mobile { flex-direction: column; }
  .u-flex-row-mobile { flex-direction: row; }
}

/* ────────────────────────────────────────────────────────────────
   2. GRID
──────────────────────────────────────────────────────────────── */
.u-grid-2 { grid-template-columns: repeat(2, 1fr); }
.u-grid-3 { grid-template-columns: repeat(3, 1fr); }
.u-grid-4 { grid-template-columns: repeat(4, 1fr); }
.u-grid-auto { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Grid Responsive */
@media (max-width: 1023px) {
  .u-grid-laptop-2 { grid-template-columns: repeat(2, 1fr); }
  .u-grid-laptop-1 { grid-template-columns: 1fr; }
}
@media (max-width: 899px) {
  .u-grid-tablet-2 { grid-template-columns: repeat(2, 1fr); }
  .u-grid-tablet-1 { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .u-grid-tablet-land-2 { grid-template-columns: repeat(2, 1fr); }
  .u-grid-tablet-land-1 { grid-template-columns: 1fr; }
}
@media (max-width: 479px) {
  .u-grid-mobile-2 { grid-template-columns: repeat(2, 1fr); }
  .u-grid-mobile-1 { grid-template-columns: 1fr; }
}
@media (max-width: 374px) {
  .u-grid-mobile-s-1 { grid-template-columns: 1fr; }
}

/* ────────────────────────────────────────────────────────────────
   3. SPACING, SIZING & HEIGHTS
──────────────────────────────────────────────────────────────── */
/* Gaps */
.u-gap-xs { gap: var(--space-xs); }
.u-gap-s  { gap: var(--space-s); }
.u-gap-m  { gap: var(--space-m); }
.u-gap-l  { gap: var(--space-l); }
.u-gap-xl { gap: var(--space-xl); }

/* Alturas */
.u-h-screen { height: var(--h-screen); }
.u-h-full   { height: var(--h-full-pct); }
.u-h-half   { height: var(--h-half); }
.u-h-third  { height: var(--h-third); }
.u-h-auto   { height: var(--h-auto); }

.u-min-h-screen { min-height: var(--min-h-screen); }
.u-min-h-half   { min-height: var(--min-h-half); }
.u-min-h-third  { min-height: var(--h-third); }
.u-min-h-auto   { min-height: var(--min-h-auto); }

/* Anchos */
.u-w-full  { width: 100%; }
.u-w-auto  { width: auto; }
.u-mw-full { max-width: 100%; }
.u-mw-prose  { max-width: var(--mw-prose); }
.u-mw-narrow { max-width: var(--mw-narrow); }
.u-mw-base   { max-width: var(--mw-base); }
.u-mw-wide   { max-width: var(--mw-wide); }

/* ────────────────────────────────────────────────────────────────
   4. POSITIONING & Z-INDEX
──────────────────────────────────────────────────────────────── */
.u-relative { position: relative; }
.u-absolute { position: absolute; }
.u-overflow-hidden { overflow: hidden; }

/* Inset & Coordenadas */
.u-inset-0  { inset: 0; }
.u-top-0    { top: 0; }
.u-bottom-0 { bottom: 0; }
.u-left-0   { left: 0; }
.u-right-0  { right: 0; }

.u-top-50 { top: 50%; transform: translateY(-50%); }
.u-left-50 { left: 50%; transform: translateX(-50%); }
.u-center-absolute { top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* Z-index */
.u-z-hide     { z-index: var(--z-hide); }
.u-z-base     { z-index: var(--z-base); }
.u-z-dropdown { z-index: var(--z-dropdown); }
.u-z-sticky   { z-index: var(--z-sticky); }
.u-z-overlay  { z-index: var(--z-overlay); }
.u-z-modal    { z-index: var(--z-modal); }

/* ────────────────────────────────────────────────────────────────
   5. TYPOGRAPHY
──────────────────────────────────────────────────────────────── */
/* Alineación */
.u-text-center { text-align: center; }
.u-text-left   { text-align: left; }
.u-text-right  { text-align: right; }

@media (max-width: 899px) {
  .u-text-center-tablet { text-align: center; }
  .u-text-left-tablet   { text-align: left; }
}
@media (max-width: 479px) {
  .u-text-center-mobile { text-align: center; }
  .u-text-left-mobile   { text-align: left; }
}

/* Colores de texto */
.u-text-primary   { color: var(--color-primary); }
.u-text-secondary { color: var(--color-secondary); }
.u-text-body      { color: var(--text-body); }
.u-text-heading   { color: var(--text-heading); }
.u-text-muted     { color: var(--text-muted); }
.u-text-inverse   { color: var(--text-inverse); }
.u-text-disabled  { color: var(--text-disabled); }
.u-text-success   { color: var(--color-success-text); }
.u-text-danger    { color: var(--color-danger-text); }
.u-text-warning   { color: var(--color-warning-text); }
.u-text-info      { color: var(--color-info-text); }

/* ────────────────────────────────────────────────────────────────
   6. BACKGROUNDS, OVERLAYS & MEDIA
──────────────────────────────────────────────────────────────── */
/* Fondos Color */
.u-bg-primary         { background-color: var(--color-primary); }
.u-bg-primary-subtle  { background-color: var(--color-primary-subtle); }
.u-bg-secondary       { background-color: var(--color-secondary); }
.u-bg-surface         { background-color: var(--surface-base); }
.u-bg-sunken          { background-color: var(--surface-sunken); }
.u-bg-inverse         { background-color: var(--surface-inverse); }
.u-bg-raised          { background-color: var(--surface-raised); box-shadow: var(--shadow-md); }

/* Fondos Estado */
.u-bg-success         { background-color: var(--color-success); }
.u-bg-success-subtle  { background-color: var(--color-success-subtle); }
.u-bg-danger          { background-color: var(--color-danger); }
.u-bg-danger-subtle   { background-color: var(--color-danger-subtle); }
.u-bg-warning         { background-color: var(--color-warning); }
.u-bg-warning-subtle  { background-color: var(--color-warning-subtle); }
.u-bg-info            { background-color: var(--color-info); }
.u-bg-info-subtle     { background-color: var(--color-info-subtle); }

/* Fondos Imagen */
.u-bg-image         { background-size: cover; background-position: center; background-repeat: no-repeat; }
.u-bg-image--top    { background-position: center top; }
.u-bg-image--bottom { background-position: center bottom; }
.u-bg-image--left   { background-position: left center; }
.u-bg-image--right  { background-position: right center; }

/* Overlay */
.u-overlay { isolation: isolate; }
.u-overlay::before {
  content: ''; position: absolute; inset: 0; background: var(--overlay-base);
  z-index: 0; pointer-events: none;
}
.u-overlay--light::before { background: rgba(17, 24, 39, 0.40); }
.u-overlay--dark::before { background: rgba(17, 24, 39, 0.85); }
.u-overlay > * { position: relative; z-index: 1; }

/* Media & Iconos */
.u-img-cover { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.u-ratio-16-9 { aspect-ratio: 16/9; }
.u-ratio-1-1  { aspect-ratio: 1/1; }

.u-icon-s { width: 1.5rem; height: 1.5rem; }
.u-icon-m { width: 2.5rem; height: 2.5rem; }
.u-icon-l { width: 4rem; height: 4rem; }

/* ────────────────────────────────────────────────────────────────
   7. BORDERS, RADII & SHADOWS
──────────────────────────────────────────────────────────────── */
/* Bordes */
.u-border        { border: var(--border-width) solid var(--border-base); }
.u-border-subtle { border: var(--border-width) solid var(--border-subtle); }
.u-border-strong { border: var(--border-width) solid var(--border-strong); }
.u-border-top    { border-top: var(--border-width) solid var(--border-base); }
.u-border-bottom { border-bottom: var(--border-width) solid var(--border-base); }
.u-border-left   { border-left: var(--border-width) solid var(--border-base); }
.u-border-right  { border-right: var(--border-width) solid var(--border-base); }

/* Radios */
.u-radius-none { border-radius: var(--radius-none); }
.u-radius-sm   { border-radius: var(--radius-sm); }
.u-radius-md   { border-radius: var(--radius-md); }
.u-radius-lg   { border-radius: var(--radius-lg); }
.u-radius-xl   { border-radius: var(--radius-xl); }
.u-radius-full { border-radius: var(--radius-full); }
.u-radius-top    { border-top-left-radius: var(--radius-md); border-top-right-radius: var(--radius-md); }
.u-radius-bottom { border-bottom-left-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }

/* Sombras */
.u-shadow-none { box-shadow: var(--shadow-none); }
.u-shadow-sm   { box-shadow: var(--shadow-sm); }
.u-shadow-md   { box-shadow: var(--shadow-md); }
.u-shadow-lg   { box-shadow: var(--shadow-lg); }
.u-shadow-xl   { box-shadow: var(--shadow-xl); }

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

.u-shadow-transition { transition: box-shadow var(--tr-base); }

/* ────────────────────────────────────────────────────────────────
   8. VISIBILITY
──────────────────────────────────────────────────────────────── */
/* Hide */
.u-hide-desktop { display: none; }
@media (max-width: 899px) { .u-hide-desktop { display: flex; } }

@media (max-width: 899px) { .u-hide-tablet { display: none; } }
@media (max-width: 479px) { .u-hide-tablet { display: flex; } }

@media (max-width: 479px) { .u-hide-mobile { display: none; } }

/* Show */
.u-show-mobile { display: none; }
@media (max-width: 479px) { .u-show-mobile { display: revert; } }

.u-show-tablet { display: none; }
@media (max-width: 899px) and (min-width: 480px) { .u-show-tablet { display: revert; } }

/* ────────────────────────────────────────────────────────────────
   9. TRANSITIONS
──────────────────────────────────────────────────────────────── */
.u-transition-fast   { transition: all var(--tr-fast); }
.u-transition-base   { transition: all var(--tr-base); }
.u-transition-slow   { transition: all var(--tr-slow); }
.u-transition-bounce { transition: all var(--tr-bounce); }
.u-transition-none   { transition: none; }


/* ================================================================
   05 · PATTERNS GLOBAL (SISTEMA UNIFICADO)
   Capa 5 del Bricks Design System V4.3
================================================================ */

/* ────────────────────────────────────────────────────────────────
   1. TIPOGRAFÍA (t-)
──────────────────────────────────────────────────────────────── */
.t-lead {
  font-size: var(--lead-font-size, var(--subsection-title-size));
  line-height: var(--lead-line-height, var(--subsection-title-lh));
  letter-spacing: var(--lead-letter-spacing, var(--subsection-title-ls));
  font-weight: var(--lead-font-weight, var(--fw-medium));
  font-family: var(--lead-font-family, var(--ff-body));
}

.t-display {
  font-size: var(--display-font-size, var(--page-size));
  line-height: var(--display-line-height, var(--page-lh));
  letter-spacing: var(--display-letter-spacing, var(--page-ls));
  font-weight: var(--display-font-weight, var(--fw-bold));
  font-family: var(--display-font-family, var(--ff-display));
}

.t-hero {
  font-size: var(--hero-font-size, var(--page-size));
  line-height: var(--hero-line-height, var(--page-lh));
  letter-spacing: var(--hero-letter-spacing, var(--page-ls));
  font-weight: var(--hero-font-weight, var(--fw-bold));
  font-family: var(--hero-font-family, var(--ff-display));
}

.t-lead-exp {
  font-size: var(--lead-exp-size, var(--section-subtitle-size));
  line-height: var(--lead-exp-lh, var(--section-subtitle-lh));
  letter-spacing: var(--lead-exp-ls, var(--section-subtitle-ls));
  font-weight: var(--lead-exp-fw, var(--fw-medium));
}

.t-ui-label {
  font-size: var(--ui-label-font-size, var(--minor-title-size));
  line-height: var(--ui-label-line-height, var(--minor-title-lh));
  letter-spacing: var(--ui-label-letter-spacing, var(--minor-title-ls));
  font-weight: var(--ui-label-font-weight, var(--fw-semibold));
  font-family: var(--ui-label-font-family, var(--ff-body));
}

.t-ui-body {
  font-size: var(--ui-body-font-size, var(--body-editorial-size));
  line-height: var(--ui-body-line-height, var(--body-editorial-lh));
  letter-spacing: var(--ui-body-letter-spacing, var(--body-editorial-ls));
  font-weight: var(--ui-body-font-weight, var(--fw-regular));
  font-family: var(--ui-body-font-family, var(--ff-body));
}

.t-ui-eyebrow {
  font-size: var(--ui-eyebrow-font-size, var(--micro-title-size));
  line-height: var(--ui-eyebrow-line-height, var(--micro-title-lh));
  letter-spacing: var(--ui-eyebrow-letter-spacing, var(--micro-title-ls));
  font-weight: var(--ui-eyebrow-font-weight, var(--fw-bold));
  font-family: var(--ui-eyebrow-font-family, var(--ff-body));
  text-transform: uppercase;
}

.t-ui-caption {
  font-size: var(--ui-caption-font-size, var(--micro-title-size));
  line-height: var(--ui-caption-line-height, var(--micro-title-lh));
  letter-spacing: var(--ui-caption-letter-spacing, var(--micro-title-ls));
  font-weight: var(--ui-caption-font-weight, var(--fw-regular));
  font-family: var(--ui-caption-font-family, var(--ff-body));
}

.t-ui-price {
  font-size: var(--ui-price-font-size, var(--section-subtitle-size));
  line-height: var(--ui-price-line-height, var(--section-subtitle-lh));
  letter-spacing: var(--ui-price-letter-spacing, var(--section-subtitle-ls));
  font-weight: var(--ui-price-font-weight, var(--fw-bold));
  font-family: var(--ui-price-font-family, var(--ff-display));
}

/* ────────────────────────────────────────────────────────────────
   2. LAYOUT / ESTRUCTURA (l-)
──────────────────────────────────────────────────────────────── */
/* Secciones base */
.l-section {
  min-height: var(--section-min-height, auto);
  padding: var(--section-padding-y, var(--space-3xl)) var(--section-padding-x, var(--space-2xl));
}
.l-section-sm {
  min-height: var(--section-min-height, auto);
  padding: var(--section-padding-y-sm, var(--space-xl)) var(--section-padding-x, var(--space-2xl));
}
.l-section-flush {
  padding: 0 var(--section-padding-x, var(--space-2xl));
}
.l-section-flush-top {
  padding: 0 var(--section-padding-x, var(--space-2xl)) var(--section-padding-y, var(--space-3xl)) var(--section-padding-x, var(--space-2xl));
}
.l-section-flush-bottom {
  padding: var(--section-padding-y, var(--space-3xl)) var(--section-padding-x, var(--space-2xl)) 0 var(--section-padding-x, var(--space-2xl));
}

/* Secciones Responsive */
@media (max-width: 899px) {
  .l-section { padding: var(--space-2xl) var(--space-xl); }
  .l-section-sm { padding: var(--space-l) var(--space-xl); }
  .l-section-flush { padding: 0 var(--space-xl); }
  .l-section-flush-top { padding: 0 var(--space-xl) var(--space-2xl) var(--space-xl); }
  .l-section-flush-bottom { padding: var(--space-2xl) var(--space-xl) 0 var(--space-xl); }
}
@media (max-width: 479px) {
  .l-section { padding: var(--space-xl) var(--space-l); }
  .l-section-sm { padding: var(--space-m) var(--space-l); }
  .l-section-flush { padding: 0 var(--space-l); }
  .l-section-flush-top { padding: 0 var(--space-l) var(--space-xl) var(--space-l); }
  .l-section-flush-bottom { padding: var(--space-xl) var(--space-l) 0 var(--space-l); }
}

/* Contenedores */
.l-container {
  width: 100%;
  max-width: var(--content-max-width, var(--mw-base));
  margin-left: auto;
  margin-right: auto;
}
.l-container-narrow {
  width: 100%;
  max-width: var(--content-narrow-width, var(--mw-narrow));
  margin-left: auto;
  margin-right: auto;
}
.l-container-wide {
  width: 100%;
  max-width: var(--content-wide-width, var(--mw-wide));
  margin-left: auto;
  margin-right: auto;
}
.l-prose {
  width: 100%;
  max-width: var(--prose-max-width, var(--mw-prose));
  margin-left: auto;
  margin-right: auto;
}

/* Pilas (Stacks) verticales */
.l-stack-section {
  display: flex;
  flex-direction: column;
  row-gap: var(--section-gap, var(--space-3xl));
}
.l-stack-block {
  display: flex;
  flex-direction: column;
  row-gap: var(--block-gap, var(--space-2xl));
}
.l-stack-content {
  display: flex;
  flex-direction: column;
  row-gap: var(--content-gap, var(--space-xl));
}

/* ────────────────────────────────────────────────────────────────
   3. COMPONENTES Y PATRONES (p-)
──────────────────────────────────────────────────────────────── */
/* Grid Patrón Base */
.p-grid {
  width: 100%;
  max-width: var(--grid-max-width, 100%);
  display: grid;
  gap: var(--grid-col-gap, var(--space-l));
  padding: var(--grid-padding-y, 0) var(--grid-padding-x, 0);
}

/* Grid Patrón Dividido */
.p-grid--divided {
  --divider-color: var(--grid-divider-color, var(--border-base));
}
.p-grid--divided > * {
  border-right: 1px solid var(--divider-color);
  padding-right: calc(var(--grid-col-gap, var(--space-l)) / 2);
  padding-left: calc(var(--grid-col-gap, var(--space-l)) / 2);
}
.p-grid--divided > *:first-child {
  padding-left: 0;
}
.p-grid--divided > *:last-child {
  border-right: none;
  padding-right: 0;
}
@media (max-width: 899px) {
  .p-grid--divided > * {
    border-right: none;
    border-bottom: 1px solid var(--divider-color);
    padding-right: 0;
    padding-left: 0;
    padding-bottom: var(--space-l);
  }
  .p-grid--divided > *:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
}

/* Card */
.p-card {
  min-height: var(--card-min-height, 100%);
  max-width: var(--card-max-width, 100%);
  padding: var(--card-padding-y, var(--surface-padding, 1rem)) var(--card-padding-x, var(--surface-padding, 1rem));
  border-radius: var(--card-radius, var(--surface-radius, 8px));
  display: flex;
  flex-direction: column;
  row-gap: var(--card-gap, var(--surface-gap, 1rem));
}

/* CTA */
.p-cta {
  min-height: var(--cta-min-height, auto);
  padding: var(--cta-padding-y, var(--surface-padding, 1rem)) var(--cta-padding-x, var(--surface-padding, 1rem));
  border-radius: var(--cta-radius, var(--surface-radius, 8px));
  display: flex;
  flex-direction: column;
  row-gap: var(--cta-gap, var(--surface-gap, 1rem));
}
.p-cta--featured {
  border-radius: var(--cta-featured-radius, var(--surface-radius, 8px));
}

/* Hero */
.p-hero {
  min-height: var(--hero-min-height, 80vh);
  padding: var(--hero-padding-y, var(--section-padding-y, 3rem)) var(--hero-padding-x, var(--section-padding-x, 2rem));
  border-radius: var(--hero-radius, var(--surface-radius, 8px));
  display: flex;
  flex-direction: column;
  align-self: center;
  row-gap: var(--hero-gap, var(--block-gap, 2rem));
}

.p-hero__content {
  width: 100%;
  max-width: var(--hero-content-max-width, var(--mw-base));
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  row-gap: var(--content-gap, var(--space-xl));
  position: relative;
  z-index: 1;
}

/* Botones Base y Modificadores */
.p-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--btn-gap, var(--space-xs));
  padding-block: var(--btn-padding-y, var(--interactive-padding-y));
  padding-inline: var(--btn-padding-x, var(--interactive-padding-x));
  font-family: var(--ff-body);
  font-size: var(--btn-font-size, var(--text-m));
  font-weight: var(--btn-font-weight, var(--fw-semibold));
  letter-spacing: var(--btn-letter-spacing, var(--ls-base));
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  border-radius: var(--btn-radius, var(--interactive-radius));
  border: var(--btn-border-width, 2px) solid transparent;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--tr-fast), color var(--tr-fast), border-color var(--tr-fast), box-shadow var(--tr-fast), opacity var(--tr-fast);
}

.p-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 3px; }
.p-btn:disabled, .p-btn[aria-disabled="true"] {
  color: var(--text-disabled);
  background-color: var(--surface-sunken);
  border-color: var(--border-subtle);
  cursor: not-allowed;
  pointer-events: none;
}
.p-btn:active:not(:disabled) { transform: scale(0.98); }

.p-btn--sm {
  --btn-padding-y: var(--space-xs);
  --btn-padding-x: var(--space-m);
  --btn-font-size: var(--text-m);
}
.p-btn--lg {
  --btn-padding-y: var(--space-m);
  --btn-padding-x: var(--space-2xl);
  --btn-font-size: var(--text-l);
}
.p-btn--icon {
  --btn-padding-x: var(--btn-padding-y, var(--interactive-padding-y));
  aspect-ratio: 1;
}
.p-btn--pill { --btn-radius: var(--radius-full); }
.p-btn--square { --btn-radius: var(--radius-none); }

/* Bloque Feature */
.p-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--feature-gap, var(--space-l));
  background: transparent;
  padding: var(--feature-padding-y, var(--space-xl)) var(--feature-padding-x, var(--space-m));
}
.p-feature__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--feature-icon-size, var(--space-3xl));
  height: var(--feature-icon-size, var(--space-3xl));
  flex-shrink: 0;
  color: var(--color-primary);
}
.p-feature__body {
  display: flex;
  flex-direction: column;
  gap: var(--feature-body-gap, var(--space-s));
  align-items: center;
}
.p-feature__title { font-weight: var(--fw-bold); color: var(--text-heading); }
.p-feature__desc { color: var(--text-body); max-width: var(--mw-feature); }

/* ────────────────────────────────────────────────────────────────
   4. ELEMENTOS GLOBALES
──────────────────────────────────────────────────────────────── */
a { color: var(--link-color, var(--color-primary)); transition: color var(--tr-fast); }
a:hover { color: var(--link-hover, var(--color-primary-hover)); }
a:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: var(--radius-sm); }
nav a { text-decoration: none; }