/* =============================================================================
   EL REGENTE — Utility Classes
   Depends on: tokens.css
   ============================================================================= */

/* ── Display ─────────────────────────────────────────────────────────────── */
.u-hidden {
  display: none !important;
}

.u-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;
}

.u-not-sr-only {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.u-flex         { display: flex; }
.u-flex-col     { display: flex; flex-direction: column; }
.u-flex-center  { display: flex; align-items: center; justify-content: center; }
.u-inline-flex  { display: inline-flex; }
.u-grid         { display: grid; }
.u-block        { display: block; }
.u-inline       { display: inline; }
.u-inline-block { display: inline-block; }

/* ── Flex helpers ────────────────────────────────────────────────────────── */
.u-items-center   { align-items: center; }
.u-items-start    { align-items: flex-start; }
.u-items-end      { align-items: flex-end; }
.u-justify-center { justify-content: center; }
.u-justify-between{ justify-content: space-between; }
.u-justify-end    { justify-content: flex-end; }
.u-flex-wrap      { flex-wrap: wrap; }
.u-flex-1         { flex: 1; }
.u-flex-shrink-0  { flex-shrink: 0; }
.u-gap-2          { gap: var(--er-space-2); }
.u-gap-3          { gap: var(--er-space-3); }
.u-gap-4          { gap: var(--er-space-4); }
.u-gap-6          { gap: var(--er-space-6); }
.u-gap-8          { gap: var(--er-space-8); }

/* ── Position ────────────────────────────────────────────────────────────── */
.u-relative { position: relative; }
.u-absolute { position: absolute; }
.u-sticky   { position: sticky; }
.u-fixed    { position: fixed; }
.u-inset-0  { inset: 0; }

/* ── Overflow ────────────────────────────────────────────────────────────── */
.u-overflow-hidden { overflow: hidden; }
.u-overflow-x-auto { overflow-x: auto; }

/* ── Text Color ──────────────────────────────────────────────────────────── */
.u-text-brand     { color: var(--er-text-brand) !important; }
.u-text-muted     { color: var(--er-text-muted) !important; }
.u-text-secondary { color: var(--er-text-secondary) !important; }
.u-text-primary   { color: var(--er-text-primary) !important; }
.u-text-white     { color: #ffffff !important; }
.u-text-inherit   { color: inherit !important; }

/* ── Text Transform & Decoration ─────────────────────────────────────────── */
.u-uppercase    { text-transform: uppercase; }
.u-lowercase    { text-transform: lowercase; }
.u-capitalize   { text-transform: capitalize; }
.u-no-underline { text-decoration: none !important; }
.u-underline    { text-decoration: underline; }
.u-italic       { font-style: italic; }

/* ── Font ────────────────────────────────────────────────────────────────── */
.u-font-headline { font-family: var(--er-font-headline); }
.u-font-body     { font-family: var(--er-font-body); }
.u-font-mono     { font-family: var(--er-font-mono); }

.u-font-normal    { font-weight: var(--er-font-normal); }
.u-font-medium    { font-weight: var(--er-font-medium); }
.u-font-semibold  { font-weight: var(--er-font-semibold); }
.u-font-bold      { font-weight: var(--er-font-bold); }
.u-font-extrabold { font-weight: var(--er-font-extrabold); }

/* ── Text Size ───────────────────────────────────────────────────────────── */
.u-text-xs   { font-size: var(--er-text-xs); }
.u-text-sm   { font-size: var(--er-text-sm); }
.u-text-base { font-size: var(--er-text-base); }
.u-text-lg   { font-size: var(--er-text-lg); }
.u-text-xl   { font-size: var(--er-text-xl); }
.u-text-2xl  { font-size: var(--er-text-2xl); }
.u-text-3xl  { font-size: var(--er-text-3xl); }
.u-text-4xl  { font-size: var(--er-text-4xl); }

/* ── Text Overflow ───────────────────────────────────────────────────────── */
.u-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.u-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.u-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.u-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Text Align ──────────────────────────────────────────────────────────── */
.u-text-left   { text-align: left; }
.u-text-center { text-align: center; }
.u-text-right  { text-align: right; }

/* ── Letter Spacing ──────────────────────────────────────────────────────── */
.u-tracking-wide    { letter-spacing: var(--er-tracking-wide); }
.u-tracking-wider   { letter-spacing: var(--er-tracking-wider); }
.u-tracking-widest  { letter-spacing: var(--er-tracking-widest); }

/* ── Background ──────────────────────────────────────────────────────────── */
.u-bg-primary   { background-color: var(--er-bg-primary); }
.u-bg-secondary { background-color: var(--er-bg-secondary); }
.u-bg-elevated  { background-color: var(--er-bg-elevated); }
.u-bg-brand     { background-color: var(--er-color-brand); }
.u-bg-dark      { background-color: #1A1A1A; }

/* ── Spacing — Margin ────────────────────────────────────────────────────── */
.u-mt-2  { margin-top: var(--er-space-2); }
.u-mt-4  { margin-top: var(--er-space-4); }
.u-mt-6  { margin-top: var(--er-space-6); }
.u-mt-8  { margin-top: var(--er-space-8); }
.u-mt-12 { margin-top: var(--er-space-12); }
.u-mt-16 { margin-top: var(--er-space-16); }

.u-mb-2  { margin-bottom: var(--er-space-2); }
.u-mb-4  { margin-bottom: var(--er-space-4); }
.u-mb-6  { margin-bottom: var(--er-space-6); }
.u-mb-8  { margin-bottom: var(--er-space-8); }
.u-mb-12 { margin-bottom: var(--er-space-12); }
.u-mb-16 { margin-bottom: var(--er-space-16); }

.u-mx-auto { margin-inline: auto; }

/* ── Spacing — Padding ───────────────────────────────────────────────────── */
.u-p-4   { padding: var(--er-space-4); }
.u-p-6   { padding: var(--er-space-6); }
.u-p-8   { padding: var(--er-space-8); }
.u-px-4  { padding-inline: var(--er-space-4); }
.u-px-6  { padding-inline: var(--er-space-6); }
.u-py-4  { padding-block: var(--er-space-4); }
.u-py-8  { padding-block: var(--er-space-8); }
.u-py-12 { padding-block: var(--er-space-12); }
.u-py-16 { padding-block: var(--er-space-16); }

/* ── Border ──────────────────────────────────────────────────────────────── */
.u-border-top-brand {
  border-top: 3px solid var(--er-color-brand);
}

.u-border-bottom {
  border-bottom: 1px solid var(--er-border-color);
}

.u-border-top {
  border-top: 1px solid var(--er-border-color);
}

.u-rounded-sm  { border-radius: var(--er-radius-sm); }
.u-rounded-md  { border-radius: var(--er-radius-md); }
.u-rounded-lg  { border-radius: var(--er-radius-lg); }
.u-rounded-xl  { border-radius: var(--er-radius-xl); }
.u-rounded-pill{ border-radius: var(--er-radius-pill); }
.u-rounded-full{ border-radius: 50%; }

/* ── Width / Height ──────────────────────────────────────────────────────── */
.u-w-full  { width: 100%; }
.u-h-full  { height: 100%; }
.u-min-w-0 { min-width: 0; }

/* ── Section Divider ─────────────────────────────────────────────────────── */
.u-section-divider {
  width: 100%;
  border: none;
  border-top: 1px solid var(--er-border-subtle);
  margin-block: var(--er-space-8);
}

/* ── Premium Badge ───────────────────────────────────────────────────────── */
.u-premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--er-color-brand);
  color: #ffffff;
  font-family: var(--er-font-headline);
  font-weight: var(--er-font-bold);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: var(--er-radius-pill);
  line-height: 1.4;
  vertical-align: middle;
}

.u-premium-badge::before {
  content: '♠';
  font-size: 8px;
}

/* ── Breaking News Dot ───────────────────────────────────────────────────── */
.u-breaking-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--er-color-brand);
  animation: er-breaking-pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes er-breaking-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 var(--er-color-brand-glow);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 0 6px transparent;
  }
}

/* ── Animations ──────────────────────────────────────────────────────────── */
.u-fade-in {
  animation: er-fade-in 400ms ease forwards;
}

@keyframes er-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.u-fade-in-delay-1 { animation-delay: 100ms; opacity: 0; animation-fill-mode: forwards; }
.u-fade-in-delay-2 { animation-delay: 200ms; opacity: 0; animation-fill-mode: forwards; }
.u-fade-in-delay-3 { animation-delay: 300ms; opacity: 0; animation-fill-mode: forwards; }

/* ── Spade Watermark ─────────────────────────────────────────────────────── */
.u-spade-watermark {
  position: relative;
  overflow: hidden;
}

.u-spade-watermark::after {
  content: '♠';
  position: absolute;
  right: -0.2em;
  bottom: -0.3em;
  font-size: clamp(8rem, 20vw, 16rem);
  color: rgba(229, 57, 32, 0.06);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  font-family: var(--er-font-headline);
}

/* ── Responsive Visibility ───────────────────────────────────────────────── */
@media (max-width: 639px) {
  .u-hide-mobile { display: none !important; }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .u-hide-tablet { display: none !important; }
}

@media (min-width: 1024px) {
  .u-hide-desktop { display: none !important; }
  .u-show-mobile-only { display: none !important; }
}

/* ── Aspect Ratios ───────────────────────────────────────────────────────── */
.u-aspect-16-9 { aspect-ratio: 16 / 9; }
.u-aspect-4-3  { aspect-ratio: 4 / 3; }
.u-aspect-1-1  { aspect-ratio: 1 / 1; }
.u-aspect-3-2  { aspect-ratio: 3 / 2; }

/* ── Object Fit ──────────────────────────────────────────────────────────── */
.u-object-cover   { object-fit: cover; }
.u-object-contain { object-fit: contain; }

/* ── Cursor ──────────────────────────────────────────────────────────────── */
.u-cursor-pointer { cursor: pointer; }

/* ── Opacity ─────────────────────────────────────────────────────────────── */
.u-opacity-0   { opacity: 0; }
.u-opacity-50  { opacity: 0.5; }
.u-opacity-75  { opacity: 0.75; }
.u-opacity-100 { opacity: 1; }

/* ── Pointer Events ──────────────────────────────────────────────────────── */
.u-pointer-none   { pointer-events: none; }
.u-pointer-auto   { pointer-events: auto; }

/* ── User Select ─────────────────────────────────────────────────────────── */
.u-select-none { user-select: none; }

/* ── White Space ─────────────────────────────────────────────────────────── */
.u-whitespace-nowrap { white-space: nowrap; }

/* ── Editorial Grid System ───────────────────────────────────────────────── */
/* !important needed because Blocksy's main.min.css loads AFTER our CSS */
.er-grid {
  display: grid !important;
  gap: var(--er-space-6, 1.5rem) !important;
  width: 100% !important;
}

.er-grid--3col {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.er-grid--2col {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.er-grid--4col {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.er-grid--hero {
  grid-template-columns: 2fr 1fr !important;
  grid-template-rows: auto auto;
}

@media (max-width: 1024px) {
  .er-grid--3col  { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .er-grid--4col  { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .er-grid--hero  { grid-template-columns: 1fr !important; }
}

@media (max-width: 640px) {
  .er-grid--3col,
  .er-grid--2col,
  .er-grid--4col  { grid-template-columns: 1fr !important; }
}

/* ── Archive Layout ──────────────────────────────────────────────────────── */
.er-archive {
  padding: var(--er-space-10, 2.5rem) 0 var(--er-space-16, 4rem);
}

.er-archive__header {
  margin-bottom: var(--er-space-8, 2rem);
  padding-bottom: var(--er-space-4, 1rem);
  border-bottom: 2px solid var(--er-color-brand, #E53920);
}

.er-archive__title {
  font-family: var(--er-font-headline, 'Space Grotesk', sans-serif);
  font-size: var(--er-text-3xl, 1.875rem);
  font-weight: 800;
  color: var(--er-text-primary, #fff);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin: 0;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.er-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: var(--er-space-2, 0.5rem);
  justify-content: center;
  align-items: center;
  margin-top: var(--er-space-12, 3rem);
}

.er-pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--er-space-2, 0.5rem);
  align-items: center;
}

.er-pagination .page-numbers {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--er-space-3, 0.75rem);
  border: 1px solid var(--er-border-color, #2A2A2A);
  border-radius: var(--er-radius-sm, 4px);
  color: var(--er-text-secondary, #ccc);
  font-family: var(--er-font-headline, sans-serif);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: all 0.2s;
}

.er-pagination .page-numbers.current,
.er-pagination .page-numbers:hover {
  background: var(--er-color-brand, #E53920);
  border-color: var(--er-color-brand, #E53920);
  color: #fff;
}

.er-pagination .page-numbers.dots {
  border-color: transparent;
  pointer-events: none;
}

/* ── Footer link color fix ───────────────────────────────────────────────── */
.ct-footer a,
.ct-footer .widget a {
  color: var(--er-text-secondary, #cccccc);
}

.ct-footer a:hover,
.ct-footer .widget a:hover {
  color: var(--er-color-brand, #E53920);
}

.ct-footer .widget-title {
  color: var(--er-text-primary, #ffffff);
  font-family: var(--er-font-headline, 'Space Grotesk', sans-serif);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

/* ── Header nav links ────────────────────────────────────────────────────── */
.ct-header a,
.ct-header .ct-menu-link {
  color: var(--er-text-primary, #ffffff) !important;
}

.ct-header a:hover,
.ct-header .ct-menu-link:hover {
  color: var(--er-color-brand, #E53920) !important;
}

/* Red de seguridad global (a añadir a utilities.css): cubre legado hard-coded
   (.u-fade-in, hero track 0.55s, player 0.3s, er-scroll, er-pulse, card flip) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  .er-eq i { transform: scaleY(.7) !important; }
}

@media (prefers-contrast: more) {
  :root { --er-stage-text-dim: rgba(255,255,255,.80); --er-stage-line-strong: rgba(255,255,255,.7); }
  .er-portal::after, .er-regencia__sheet::after { display: none; }   /* sin grano */
}

@media (forced-colors: active) {
  .er-regencia__field:focus-within { outline: 2px solid Highlight; }
  .er-regencia__btn { border: 1px solid ButtonText; }
  .er-portal__spade, .er-podcast-feature__num { display: none; }
  .er-regencia__sheet, .er-print-cover { border: 1px solid CanvasText; }
  .er-manifesto__em::after { background: Highlight; }
}
