/* ============================================================
   METRINA — Components
   Filosofía: SIN bordes salvo excepción, fondos sólidos pastel
   para diferenciar, radios grandes, tipografía pesada.
   Pesos de titular: 700.
   ============================================================ */

/* ---------- TIPOGRAFÍA ---------- */
.m-display, .m-h1, .m-h2, .m-h3, .m-h4, .m-h5 {
  margin: 0;
  font-family: var(--m-font-display);
  color: var(--m-text-default);
  letter-spacing: var(--m-tracking-tight);
  line-height: var(--m-leading-tight);
  text-wrap: balance;
}
.m-display    { font-size: clamp(56px, 8vw, 112px); font-weight: 700; }
.m-display-2  { font-size: clamp(44px, 6vw, 88px);  font-weight: 700;
                margin: 0; line-height: var(--m-leading-tight);
                letter-spacing: var(--m-tracking-tight); color: var(--m-text-default); }
.m-h1 { font-size: clamp(36px, 4.5vw, 68px); font-weight: 700; }
.m-h2 { font-size: clamp(30px, 3.5vw, 52px); font-weight: 700; }
.m-h3 { font-size: var(--m-text-3xl); font-weight: 700; }
.m-h4 { font-size: var(--m-text-2xl); font-weight: 700; letter-spacing: var(--m-tracking-snug); }
.m-h5 { font-size: var(--m-text-xl); font-weight: 600; letter-spacing: var(--m-tracking-snug); }

.m-lead { font-size: var(--m-text-lg); line-height: var(--m-leading-snug); color: var(--m-text-subtle); text-wrap: pretty; max-width: 60ch; }
.m-body { font-size: var(--m-text-base); line-height: var(--m-leading-relaxed); }
.m-small { font-size: var(--m-text-sm); color: var(--m-text-subtle); }
.m-eyebrow {
  display: inline-block;
  font-size: var(--m-text-sm);
  font-weight: 600;
  font-family: var(--m-font-aux);
  color: var(--m-text-brand);
  letter-spacing: var(--m-tracking-wide);
  text-transform: uppercase;
  margin-bottom: var(--m-space-4);
}
.m-quote {
  font-size: var(--m-text-xl);
  line-height: var(--m-leading-snug);
  font-weight: 600;
  letter-spacing: var(--m-tracking-snug);
  color: var(--m-text-default);
}
.m-quote::before { content: "\201C"; }
.m-quote::after  { content: "\201D"; }
.m-mono { font-family: var(--m-font-aux); font-size: 0.9em; }
.m-link { color: var(--m-link-text); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.m-link:hover { color: var(--m-link-hover); }

/* ---------- LAYOUT ---------- */
.m-container { max-width: var(--m-container); margin-inline: auto; padding-inline: var(--m-gutter); }
.m-section { padding-block: var(--m-section-y); }
.m-section-sm { padding-block: 64px; }
.m-grid { display: grid; gap: var(--m-space-6); }
.m-grid-2 { grid-template-columns: repeat(2, 1fr); }
.m-grid-3 { grid-template-columns: repeat(3, 1fr); }
.m-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 880px) {
  .m-grid-2, .m-grid-3, .m-grid-4 { grid-template-columns: 1fr; }
}
.m-stack > * + * { margin-top: var(--m-space-4); }
.m-stack-lg > * + * { margin-top: var(--m-space-8); }
.m-cluster { display: flex; flex-wrap: wrap; gap: var(--m-space-3); align-items: center; }

/* ---------- BUTTONS ----------
   Pill completo. SIN borde. Colores planos, sin sombra.
   El primario es brand para CTAs de conversión (máx 1 por vista).
   El neutral (negro) para acciones secundarias.
   Hover = cambio de tono + micro lift. */
.m-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--m-space-2);
  padding: 14px 24px; border-radius: var(--m-radius-pill);
  font-size: var(--m-text-base); font-weight: 600;
  letter-spacing: var(--m-tracking-snug);
  border: 0;
  transition: background var(--m-dur-2) var(--m-ease-out),
              color var(--m-dur-2) var(--m-ease-out),
              transform var(--m-dur-1) var(--m-ease-out);
  white-space: nowrap;
  text-decoration: none;
}
/* No vertical lift — background change is enough feedback */
.m-btn:active { transform: scale(0.98); }

.m-btn-brand { background: var(--m-action-brand-bg); color: var(--m-action-brand-text); }
.m-btn-brand:hover { background: var(--m-action-brand-hover); }

.m-btn-primary { background: var(--m-action-neutral-bg); color: var(--m-action-neutral-text); }
.m-btn-primary:hover { background: var(--m-action-neutral-hover); }

.m-btn-ghost { background: transparent; color: var(--m-text-default); padding-inline: 16px; }
.m-btn-ghost:hover { background: var(--m-overlay-hover); }

.m-btn-light { background: var(--m-action-subtle-bg); color: var(--m-action-subtle-text); }
.m-btn-light:hover { background: var(--m-action-subtle-hover); }

.m-btn-on-dark { background: var(--m-cream); color: var(--m-text-default); }
.m-btn-on-dark:hover { background: var(--m-paper); }

.m-btn[disabled] { background: var(--m-action-disabled-bg) !important; color: var(--m-action-disabled-text) !important; opacity: 0.5; cursor: not-allowed; transform: none !important; pointer-events: none; }

.m-btn:focus-visible { outline: none; box-shadow: var(--m-focus-ring); }

.m-btn-sm { padding: 10px 18px; font-size: var(--m-text-sm); }
.m-btn-lg { padding: 18px 32px; font-size: var(--m-text-md); }
.m-btn-xl { padding: 22px 40px; font-size: var(--m-text-lg); }

/* Split button: una accion principal con trigger de variantes */
.m-btn-split {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
}
.m-btn-split .m-btn:active {
  transform: none;
}
.m-btn-split .m-btn:focus-visible {
  position: relative;
  z-index: 1;
}
.m-btn-split-main.m-btn {
  border-top-left-radius: var(--m-radius-pill);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: var(--m-radius-pill);
  padding-right: var(--m-space-4);
}
.m-btn-split-trigger.m-btn {
  border-left: 1px solid var(--m-border-inverse);
  border-top-left-radius: 0;
  border-top-right-radius: var(--m-radius-pill);
  border-bottom-right-radius: var(--m-radius-pill);
  border-bottom-left-radius: 0;
  min-inline-size: calc(var(--m-space-12) + var(--m-space-2));
  padding-inline: var(--m-space-4);
}

/* CTA principal con flecha que entra al hover */
.m-btn-arrow .m-btn-arrow-icon {
  width: 0; overflow: hidden;
  transition: width var(--m-dur-2) var(--m-ease-out);
  display: inline-flex; align-items: center;
}
.m-btn-arrow:hover .m-btn-arrow-icon { width: 18px; }

/* ---------- TAG / BADGE ----------
   Sin borde. Pill. Color de fondo + texto a juego. */
.m-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--m-radius-pill);
  font-size: var(--m-text-sm); font-weight: 600;
  background: var(--m-cream-soft); color: var(--m-text-default);
}
.m-tag-block-1 { background: var(--m-block-1); color: var(--m-brand-deep); }
.m-tag-block-2 { background: var(--m-block-2); color: var(--m-brand-deep); }
.m-tag-block-3 { background: var(--m-block-3); color: var(--m-brand-deep); }
.m-tag-block-4 { background: var(--m-block-4); color: var(--m-brand-deep); }
.m-tag-warm    { background: var(--m-accent-warm); color: var(--m-accent-warm-ink); }
.m-tag-brand   { background: var(--m-brand-soft); color: var(--m-brand-ink); }
.m-tag-dark    { background: var(--m-ink); color: var(--m-cream); }

.m-tag-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- PILLS NAV ---------- */
.m-nav-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--m-radius-pill);
  font-size: var(--m-text-sm); font-weight: 500;
  color: var(--m-text-subtle); background: transparent;
  cursor: pointer;
  transition: all var(--m-dur-2) var(--m-ease-out);
}
.m-nav-pill:hover { background: var(--m-overlay-hover-soft); color: var(--m-text-default); }
.m-nav-pill.is-active { background: var(--m-ink); color: var(--m-cream); }

.m-pillbar {
  display: inline-flex; gap: 4px; padding: 6px;
  background: var(--m-cream-soft); border-radius: var(--m-radius-pill);
}

/* ---------- INPUTS ---------- */
.m-field { display: flex; flex-direction: column; gap: 8px; }
.m-label { font-size: var(--m-text-sm); font-weight: 600; color: var(--m-text-default); }
.m-help  { font-size: var(--m-text-xs); color: var(--m-text-subtle); }

.m-input, .m-select, .m-textarea {
  width: 100%;
  padding: 16px 20px;
  border: 0;
  border-radius: var(--m-radius-md);
  background: var(--m-bg-surface);
  color: var(--m-text-default);
  font: inherit;
  font-size: var(--m-text-base);
  line-height: 1.4;
  transition: box-shadow var(--m-dur-2) var(--m-ease-out);
  box-shadow: inset 0 0 0 1px transparent;
}
.m-input:hover, .m-select:hover, .m-textarea:hover { box-shadow: inset 0 0 0 1px var(--m-border-strong); }
.m-input:focus, .m-select:focus, .m-textarea:focus {
  outline: none; box-shadow: inset 0 0 0 2px var(--m-border-focus);
}
.m-input::placeholder { color: var(--m-text-disabled); }
.m-textarea { min-height: 120px; resize: vertical; }
.m-input-on-cream { background: var(--m-cream-soft); }

.m-checkbox, .m-radio {
  display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: var(--m-text-base);
}
.m-checkbox input, .m-radio input {
  appearance: none; width: 22px; height: 22px; margin: 0;
  background: var(--m-bg-surface);
  display: grid; place-content: center;
  transition: all var(--m-dur-2) var(--m-ease-out);
  box-shadow: inset 0 0 0 2px var(--m-border-strong);
}
.m-checkbox input { border-radius: 6px; }
.m-radio input { border-radius: 50%; }
.m-checkbox input:checked, .m-radio input:checked {
  background: var(--m-ink); box-shadow: inset 0 0 0 2px var(--m-ink);
}
.m-checkbox input:checked::after {
  content: ""; width: 12px; height: 12px; background: var(--m-cream);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
}
.m-radio input:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--m-cream); }

.m-switch { position: relative; display: inline-block; width: 52px; height: 30px; }
.m-switch input { opacity: 0; width: 0; height: 0; }
.m-switch-track {
  position: absolute; inset: 0; background: var(--m-line-strong);
  border-radius: var(--m-radius-pill);
  transition: background var(--m-dur-2) var(--m-ease-out);
}
.m-switch-track::before {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; background: var(--m-paper); border-radius: 50%;
  transition: transform var(--m-dur-2) var(--m-ease-out);
}
.m-switch input:checked + .m-switch-track { background: var(--m-ink); }
.m-switch input:checked + .m-switch-track::before { transform: translateX(18px); }

/* ---------- OPEN LAYOUTS ----------
   Patrones abiertos: el DEFAULT para listas, testimonios, features.
   Diferenciación por espacio, tipografía y separadores sutiles.
   Cards (.m-card) se reservan para contenido que necesita
   contención visual explícita (pricing, dashboards, widgets). */

/* Lista abierta — items separados por línea sutil, sin fondo */
.m-list-flow {
  display: flex; flex-direction: column; gap: 0;
}
.m-list-flow > * + * {
  border-top: 1px solid var(--m-line);
}

/* Quote grande — testimonial o cita, sin caja */
.m-quote-lg {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 600;
  line-height: var(--m-leading-snug);
  letter-spacing: var(--m-tracking-snug);
  color: var(--m-text-default);
}
.m-quote-lg::before { content: "\201C"; }
.m-quote-lg::after  { content: "\201D"; }

/* Spotlight — layout editorial de dos columnas alternadas */
.m-spotlight {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}
.m-spotlight.is-reversed > :first-child { order: 2; }
.m-spotlight.is-reversed > :last-child  { order: 1; }
@media (max-width: 880px) {
  .m-spotlight { grid-template-columns: 1fr; gap: 40px; }
  .m-spotlight.is-reversed > :first-child,
  .m-spotlight.is-reversed > :last-child { order: unset; }
}

/* Timeline — lista vertical con marcadores conectados */
.m-timeline {
  display: flex; flex-direction: column; gap: 0;
  position: relative;
}
.m-timeline::before {
  content: "";
  position: absolute;
  left: 28px; top: 40px; bottom: 40px;
  width: 2px;
  background: linear-gradient(to bottom, var(--m-brand), var(--m-block-2), var(--m-accent-warm));
}
.m-timeline-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 32px;
  padding: 40px 0;
  position: relative;
}
.m-timeline-marker {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--m-font-display);
  font-size: var(--m-text-xl);
  font-weight: 700;
  color: var(--m-paper);
  background: var(--m-brand);
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 8px var(--m-cream);
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .m-timeline::before { left: 22px; }
  .m-timeline-item { grid-template-columns: 44px 1fr; gap: 20px; }
  .m-timeline-marker { width: 44px; height: 44px; font-size: var(--m-text-md); }
}

/* ---------- CARDS ----------
   Contención visual explícita. Usar para pricing, dashboards,
   widgets y elementos que necesitan separación del fondo.
   Para listas, testimonios y features, preferir open layouts. */
.m-card {
  background: var(--m-bg-surface);
  border-radius: var(--m-radius-2xl);
  padding: var(--m-space-8);
  border: 0;
  transition: transform var(--m-dur-3) var(--m-ease-out);
}
.m-card-hover:hover { transform: translateY(-4px); }

.m-card-block-1 { background: var(--m-block-1); }
.m-card-block-2 { background: var(--m-block-2); }
.m-card-block-3 { background: var(--m-block-3); }
.m-card-block-4 { background: var(--m-block-4); }
.m-card-warm    { background: var(--m-accent-warm); }
.m-card-brand-soft { background: var(--m-brand-soft); }
.m-card-cream   { background: var(--m-cream-soft); }
.m-card-ink     { background: var(--m-ink); color: var(--m-cream); }
.m-card-deep    { background: var(--m-brand-deep); color: var(--m-cream); }

.m-card-ink .m-h2, .m-card-ink .m-h3, .m-card-ink .m-h4, .m-card-ink .m-h5,
.m-card-deep .m-h2, .m-card-deep .m-h3, .m-card-deep .m-h4, .m-card-deep .m-h5 {
  color: var(--m-cream);
}

/* Aliases legacy */
.m-card-coral  { background: var(--m-block-1); }
.m-card-forest { background: var(--m-brand-deep); color: var(--m-cream); }
.m-card-forest .m-h2, .m-card-forest .m-h3, .m-card-forest .m-h4, .m-card-forest .m-h5 { color: var(--m-cream); }

/* Card de feature: imagen integrada + título abajo */
.m-feature {
  background: var(--m-bg-surface);
  border-radius: var(--m-radius-2xl);
  padding: 40px;
  display: flex; flex-direction: column; gap: 24px;
  min-height: 420px;
  position: relative; overflow: hidden;
}
.m-feature-media {
  margin-top: auto;
  border-radius: var(--m-radius-xl);
  aspect-ratio: 4/3; min-height: 200px;
  background: linear-gradient(135deg, var(--m-bg-block-primary), var(--m-bg-block-tertiary));
  display: grid; place-items: center;
  font-family: var(--m-font-aux); font-size: var(--m-text-xs);
  color: var(--m-text-brand-strong); opacity: 0.7;
}

/* Quote inline */
.m-inline-quote {
  display: flex; gap: 12px; align-items: center;
  padding-top: 20px;
  margin-top: auto;
}
.m-inline-quote-text { font-size: var(--m-text-sm); }
.m-inline-quote-text em { font-style: normal; font-weight: 500; }
.m-inline-quote-meta { font-size: var(--m-text-xs); color: var(--m-text-subtle); margin-top: 2px; }

/* ---------- ICON TILE ----------
   Tile cuadrada con SVG dentro, para feature lists, security cards. */
.m-icon-tile {
  width: 48px; height: 48px;
  border-radius: var(--m-radius-xl);
  display: grid; place-items: center;
  flex-shrink: 0;
  color: var(--m-brand-deep);
}
.m-icon-tile-block-1 { background: var(--m-block-1); }
.m-icon-tile-block-2 { background: var(--m-block-2); }
.m-icon-tile-block-3 { background: var(--m-block-3); }
.m-icon-tile-block-4 { background: var(--m-block-4); }
.m-icon-tile-warm    { background: var(--m-accent-warm); color: var(--m-accent-warm-ink); }
.m-icon-tile-brand   { background: var(--m-brand-soft); color: var(--m-brand-ink); }

/* ---------- AVATARES ---------- */
.m-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--m-block-1); color: var(--m-brand-deep);
  display: inline-grid; place-items: center; font-weight: 600; font-size: var(--m-text-sm);
  flex-shrink: 0;
}
.m-avatar-sm { width: 28px; height: 28px; font-size: var(--m-text-xs); }
.m-avatar-lg { width: 56px; height: 56px; font-size: var(--m-text-lg); }
.m-avatar-xl { width: 88px; height: 88px; font-size: var(--m-text-2xl); }
.m-avatar-stack { display: inline-flex; }
.m-avatar-stack .m-avatar { box-shadow: 0 0 0 3px var(--m-cream); }
.m-avatar-stack .m-avatar + .m-avatar { margin-left: -10px; }

/* ---------- ALERTS ---------- */
.m-alert {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 20px 24px;
  border-radius: var(--m-radius-lg);
  background: var(--m-cream-soft);
}
.m-alert-icon {
  flex-shrink: 0; display: grid; place-items: center; margin-top: 2px;
}
.m-alert-success { background: var(--m-bg-success); }
.m-alert-success .m-alert-icon { color: var(--m-success); }
.m-alert-warning { background: var(--m-bg-warning); }
.m-alert-warning .m-alert-icon { color: var(--m-warning); }
.m-alert-danger  { background: var(--m-bg-danger); }
.m-alert-danger .m-alert-icon  { color: var(--m-danger); }
.m-alert-info    { background: var(--m-bg-info); }
.m-alert-info .m-alert-icon    { color: var(--m-info); }
.m-alert-brand   { background: var(--m-brand-soft); color: var(--m-brand-ink); }
.m-alert-brand .m-alert-icon { color: var(--m-brand); }

/* ---------- TABS ---------- */
.m-tabs { display: inline-flex; gap: 4px; padding: 6px; background: var(--m-cream-soft); border-radius: var(--m-radius-pill); }
.m-tab {
  padding: 10px 20px; border-radius: var(--m-radius-pill);
  font-size: var(--m-text-sm); font-weight: 500; color: var(--m-text-subtle);
  cursor: pointer; transition: all var(--m-dur-2) var(--m-ease-out);
}
.m-tab:hover { color: var(--m-text-default); }
.m-tab.is-active { background: var(--m-ink); color: var(--m-cream); }

/* ---------- TABLE ---------- */
.m-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--m-text-sm); }
.m-table th, .m-table td { text-align: left; padding: 18px 20px; }
.m-table th {
  font-weight: 600; color: var(--m-text-subtle); font-size: var(--m-text-xs);
  letter-spacing: var(--m-tracking-caps); text-transform: uppercase;
}
.m-table tbody tr { background: var(--m-bg-surface); }
.m-table tbody tr + tr td { border-top: 1px solid var(--m-line); }
.m-table-card {
  border-radius: var(--m-radius-sm); overflow: hidden; background: var(--m-bg-surface);
}

/* ---------- PROGRESS ---------- */
.m-progress { height: 10px; background: var(--m-cream-soft); border-radius: var(--m-radius-pill); overflow: hidden; }
.m-progress-bar { height: 100%; background: var(--m-action-neutral-bg); border-radius: inherit; }
.m-progress-bar-brand { background: var(--m-bg-brand); }
.m-progress-bar-warm  { background: var(--m-accent-warm); }

/* ---------- STAT ---------- */
.m-stat { display: flex; flex-direction: column; gap: 8px; }
.m-stat-num {
  font-family: var(--m-font-display); font-weight: 700;
  font-size: clamp(48px, 6vw, 88px); line-height: 1;
  letter-spacing: var(--m-tracking-tight); color: var(--m-text-default);
}
.m-stat-label { font-size: var(--m-text-base); color: var(--m-text-subtle); max-width: 22ch; }

/* ---------- LOGO ---------- */
.m-logo-mark {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--m-ink); color: var(--m-cream);
  display: inline-grid; place-items: center;
  font-family: var(--m-font-display); font-weight: 700; font-size: 24px;
}
.m-logo {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--m-font-display); font-size: 30px;
  font-weight: 700; letter-spacing: var(--m-tracking-tight);
  color: var(--m-text-default);
}

/* ---------- SECCIONES ---------- */
.m-section-cream      { background: var(--m-bg-page); }
.m-section-cream-soft { background: var(--m-bg-subtle); }
.m-section-ink        { background: var(--m-ink); color: var(--m-cream); }
.m-section-deep       { background: var(--m-brand-deep); color: var(--m-cream); }
.m-section-block-1    { background: var(--m-block-1); }
.m-section-block-2    { background: var(--m-block-2); }
.m-section-block-3    { background: var(--m-block-3); }
.m-section-block-4    { background: var(--m-block-4); }
.m-section-warm       { background: var(--m-accent-warm); }

.m-section-ink h1, .m-section-ink h2, .m-section-ink h3,
.m-section-deep h1, .m-section-deep h2, .m-section-deep h3 {
  color: var(--m-cream);
}
.m-section-ink .m-lead, .m-section-deep .m-lead { color: var(--m-text-on-dark-muted); }

/* Aliases legacy */
.m-section-forest { background: var(--m-brand-deep); color: var(--m-cream); }
.m-section-forest h1, .m-section-forest h2, .m-section-forest h3 { color: var(--m-cream); }
.m-section-forest .m-lead { color: var(--m-text-on-dark-muted); }

/* ---------- LOGO STRIP ---------- */
.m-logo-strip {
  display: flex; flex-wrap: wrap; gap: 56px;
  align-items: center; justify-content: center;
  opacity: 0.55;
}
.m-logo-strip span {
  font-family: var(--m-font-display); font-weight: 600;
  font-size: var(--m-text-lg); letter-spacing: var(--m-tracking-snug);
  color: var(--m-text-default);
}

/* ---------- DECORATIVE BLOB ---------- */
.m-blob {
  border-radius: var(--m-radius-3xl);
  aspect-ratio: 4/3;
}

/* ---------- KBD ---------- */
.m-kbd {
  font-family: var(--m-font-aux); font-size: 12px; font-weight: 500;
  background: var(--m-bg-surface); padding: 3px 8px; border-radius: 6px;
  box-shadow: inset 0 -2px 0 var(--m-overlay-hover), inset 0 0 0 1px var(--m-line);
}
