/* ==========================================================================
   TWL Servicios Hub V3 — Premium redesign matching diamond-cut style
   - Uniform card heights, robust grid (3/2/1), WCAG AA contrast
   - No GSAP-dependent visibility (opacity:1 by default; animations enhance)
   - Section padding 80px desktop / 48px mobile
   ========================================================================== */

.twl-servicios-hub {
  --twl-orange: #ff6a00;
  --twl-orange-strong: #c54a00;
  --twl-dark: #0a0a0a;
  --twl-dark-2: #141414;
  --twl-light: #fafaf8;
  --twl-light-2: #f3f1ec;
  --twl-border-dark: rgba(255,255,255,0.10);
  --twl-border-light: rgba(0,0,0,0.10);
  --twl-text-on-dark: #ffffff;
  --twl-text-on-dark-mute: rgba(255,255,255,0.72);
  --twl-text-on-light: #1a1a1a;
  --twl-text-on-light-mute: #555;
  --twl-radius: 10px;
  --twl-radius-lg: 14px;
  --twl-ease: cubic-bezier(0.2, 0.9, 0.2, 1);
  --twl-shadow-card: 0 8px 28px rgba(0,0,0,0.18);
  --twl-shadow-card-hover: 0 14px 40px rgba(255,106,0,0.20);
}

/* ── Sections ──────────────────────────────────────────────────────────── */
.twl-hub-section {
  position: relative;
  padding: 80px 0;
  margin: 0;
}
@media (max-width: 767.98px) {
  .twl-hub-section { padding: 48px 0; }
}

.twl-hub-section--dark { background: var(--twl-dark); color: var(--twl-text-on-dark); }
.twl-hub-section--light { background: var(--twl-light); color: var(--twl-text-on-light); }

.twl-hub-section--dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  opacity: 0.7;
}
.twl-hub-section--dark > * { position: relative; z-index: 1; }

/* ── Container ─────────────────────────────────────────────────────────── */
.twl-servicios-hub .twl-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 767.98px) {
  .twl-servicios-hub .twl-container { padding: 0 20px; }
}

/* ── Section titles (green-box pattern from theme) ─────────────────────── */
.twl-servicios-hub .section-title-vc {
  text-align: center;
  white-space: normal;
  margin: 0 0 0.6rem;
}
.twl-servicios-hub .green-box { background: var(--twl-orange) !important; }
.twl-hub-section--dark .section-title-vc,
.twl-hub-section--dark .section-title-vc .first-letter-box { color: #fff !important; }
.twl-hub-section--light .section-title-vc,
.twl-hub-section--light .section-title-vc .first-letter-box { color: #0a0a0a !important; }

.twl-servicios-hub .twl-process-subtitle {
  text-align: center;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 0.9rem;
}
.twl-hub-section--dark .twl-process-subtitle { color: var(--twl-orange); }
.twl-hub-section--light .twl-process-subtitle { color: var(--twl-orange-strong); }

/* ── Intro ─────────────────────────────────────────────────────────────── */
.twl-hub-intro__statement {
  max-width: 820px;
  margin: 0 auto 2.5rem;
  text-align: center;
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  line-height: 1.5;
  color: var(--twl-text-on-light);
  font-weight: 400;
}
.twl-hub-intro__statement em {
  color: var(--twl-orange-strong);
  font-style: normal;
  font-weight: 600;
}
.twl-hub-intro__details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 920px;
  margin: 0 auto;
}
.twl-hub-intro__details p {
  color: var(--twl-text-on-light-mute);
  font-size: 0.95rem;
  line-height: 1.75;
  margin: 0;
}
.twl-hub-intro__details strong { color: var(--twl-text-on-light); font-weight: 700; }
@media (max-width: 767.98px) {
  .twl-hub-intro__details { grid-template-columns: 1fr; gap: 1.25rem; }
}

/* ── Category header ───────────────────────────────────────────────────── */
.twl-hub-category__header {
  margin-bottom: 2.5rem;
  text-align: center;
}
.twl-hub-category__title {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  margin: 0 0 0.75rem;
  line-height: 1.15;
}
.twl-hub-category__desc {
  max-width: 640px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.55;
}
.twl-hub-section--dark .twl-hub-category__desc { color: var(--twl-text-on-dark-mute); }
.twl-hub-section--light .twl-hub-category__desc { color: var(--twl-text-on-light-mute); }

/* ── Grid (3 desktop / 2 tablet / 1 mobile) ────────────────────────────── */
.twl-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
}
@media (max-width: 1023px) {
  .twl-hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
}
@media (max-width: 639.98px) {
  .twl-hub-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* ── Cards (uniform, premium) ──────────────────────────────────────────── */
.twl-hub-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 340px;
  padding: 24px;
  border-radius: var(--twl-radius);
  background: #1a1a1a;
  border: 1px solid var(--twl-border-dark);
  text-decoration: none;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.35s var(--twl-ease), box-shadow 0.35s var(--twl-ease), border-color 0.35s var(--twl-ease);
  /* Ensure cards ALWAYS visible — animations are progressive enhancement */
  opacity: 1;
}
@media (max-width: 639.98px) {
  .twl-hub-card { height: 300px; padding: 20px; }
}

.twl-hub-card:hover,
.twl-hub-card:focus-visible {
  transform: translateY(-6px);
  border-color: var(--twl-orange);
  box-shadow: var(--twl-shadow-card-hover);
}

/* Image background card */
.twl-hub-card--has-img {
  background-size: cover;
  background-position: center;
}
.twl-hub-card--has-img::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg,
    rgba(0,0,0,0.15) 0%,
    rgba(0,0,0,0.55) 55%,
    rgba(0,0,0,0.92) 100%);
}

/* Video card */
.twl-hub-card--has-video { background: #0a0a0a; }
.twl-hub-card__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}
.twl-hub-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg,
    rgba(0,0,0,0.20) 0%,
    rgba(0,0,0,0.55) 50%,
    rgba(0,0,0,0.92) 100%);
}

/* Card content sits above overlay */
.twl-hub-card > *:not(.twl-hub-card__video):not(.twl-hub-card__overlay) {
  position: relative;
  z-index: 2;
}

/* Light-section solid card (when no img/video) */
.twl-hub-section--light .twl-hub-card:not(.twl-hub-card--has-img):not(.twl-hub-card--has-video) {
  background: #ffffff;
  border-color: var(--twl-border-light);
  color: var(--twl-text-on-light);
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
.twl-hub-section--light .twl-hub-card:not(.twl-hub-card--has-img):not(.twl-hub-card--has-video) .twl-hub-card__desc { color: var(--twl-text-on-light-mute); }
.twl-hub-section--light .twl-hub-card:not(.twl-hub-card--has-img):not(.twl-hub-card--has-video) .twl-hub-card__cta { color: var(--twl-orange-strong); }

/* Badge */
.twl-hub-card__badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  background: var(--twl-orange);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border-radius: 100px;
  box-shadow: 0 4px 12px rgba(255,106,0,0.35);
}

/* Card text — high specificity to beat parent theme h3 styles */
.twl-servicios-hub .twl-hub-card .twl-hub-card__title,
.twl-servicios-hub h3.twl-hub-card__title {
  font-size: 1.3rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  margin: 0 0 0.5rem !important;
  color: #fff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.twl-servicios-hub .twl-hub-card .twl-hub-card__desc {
  font-size: 0.92rem !important;
  line-height: 1.55 !important;
  color: rgba(255,255,255,0.92) !important;
  margin: 0 0 1rem !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
/* Light-section solid cards need dark text */
.twl-hub-section--light .twl-hub-card:not(.twl-hub-card--has-img):not(.twl-hub-card--has-video) .twl-hub-card__title {
  color: var(--twl-text-on-light) !important;
  text-shadow: none;
}
.twl-hub-section--light .twl-hub-card:not(.twl-hub-card--has-img):not(.twl-hub-card--has-video) .twl-hub-card__desc {
  color: var(--twl-text-on-light-mute) !important;
  text-shadow: none;
}
.twl-hub-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--twl-orange);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: gap 0.25s var(--twl-ease);
}
.twl-hub-card__cta > span { transition: transform 0.25s var(--twl-ease); }
.twl-hub-card:hover .twl-hub-card__cta { gap: 12px; }
.twl-hub-card:hover .twl-hub-card__cta > span { transform: translateX(3px); }

/* ── Cross-links grid (premium cards, not list) ────────────────────────── */
.twl-hub-crosslinks__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 2.5rem;
}
@media (max-width: 1023px) {
  .twl-hub-crosslinks__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639.98px) {
  .twl-hub-crosslinks__grid { grid-template-columns: 1fr; }
}

.twl-hub-crosslink {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 24px 22px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--twl-border-dark);
  border-radius: var(--twl-radius);
  text-decoration: none;
  color: #fff;
  min-height: 130px;
  transition: transform 0.3s var(--twl-ease), border-color 0.3s var(--twl-ease), box-shadow 0.3s var(--twl-ease), background 0.3s var(--twl-ease);
  position: relative;
  overflow: hidden;
}
.twl-hub-crosslink::after {
  content: '→';
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 1.1rem;
  color: var(--twl-orange);
  opacity: 0.7;
  transition: transform 0.3s var(--twl-ease), opacity 0.3s var(--twl-ease);
}
.twl-hub-crosslink:hover,
.twl-hub-crosslink:focus-visible {
  transform: translateY(-4px);
  border-color: var(--twl-orange);
  background: rgba(255,106,0,0.06);
  box-shadow: var(--twl-shadow-card);
}
.twl-hub-crosslink:hover::after { transform: translateX(4px); opacity: 1; }
.twl-hub-crosslink strong {
  font-size: 1rem;
  color: #fff;
  font-weight: 700;
  line-height: 1.3;
  padding-right: 28px;
}
.twl-hub-crosslink span {
  color: var(--twl-text-on-dark-mute);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ── Why grid (4 desktop / 2 tablet / 1 mobile) ────────────────────────── */
.twl-hub-why__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 2.5rem;
}
@media (max-width: 1023px) {
  .twl-hub-why__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639.98px) {
  .twl-hub-why__grid { grid-template-columns: 1fr; }
}

.twl-hub-why__item {
  background: #fff;
  border: 1px solid var(--twl-border-light);
  border-radius: var(--twl-radius);
  padding: 26px 22px;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.3s var(--twl-ease), box-shadow 0.3s var(--twl-ease), border-color 0.3s var(--twl-ease);
  position: relative;
}
.twl-hub-why__item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 22px;
  right: 22px;
  height: 3px;
  background: var(--twl-orange);
  border-radius: 0 0 3px 3px;
  opacity: 0;
  transition: opacity 0.3s var(--twl-ease);
}
.twl-hub-why__item:hover {
  transform: translateY(-4px);
  border-color: rgba(255,106,0,0.3);
  box-shadow: var(--twl-shadow-card);
}
.twl-hub-why__item:hover::before { opacity: 1; }
.twl-hub-why__item strong {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--twl-text-on-light);
  display: block;
  margin-bottom: 0.25rem;
}
.twl-hub-why__item p {
  color: var(--twl-text-on-light-mute);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0;
}

/* ── FAQ accordion (clean DC style) ────────────────────────────────────── */
.twl-hub-faq__list {
  max-width: 820px;
  margin: 2.5rem auto 0;
}
.twl-hub-faq__item {
  border-bottom: 1px solid rgba(0,0,0,0.10);
  background: none;
  padding: 0;
  margin: 0;
  border-radius: 0;
}
button.twl-hub-faq__header,
.twl-hub-faq__header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 1.25rem 0 !important;
  width: 100% !important;
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
  text-align: left;
  gap: 1rem !important;
  margin: 0 !important;
  line-height: 1.5 !important;
  font-weight: 600;
  font-size: 1rem;
  color: var(--twl-text-on-light) !important;
  transition: color 0.2s;
}
button.twl-hub-faq__header:hover,
button.twl-hub-faq__header:focus {
  background: none !important;
  background-color: transparent !important;
  box-shadow: none !important;
  color: var(--twl-orange-strong) !important;
}
.twl-hub-faq__num {
  font-family: 'JetBrains Mono', 'SF Mono', monospace !important;
  font-size: 0.65rem !important;
  color: rgba(0,0,0,0.4) !important;
  margin-right: 1rem;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}
.twl-hub-faq__q {
  flex: 1;
  color: var(--twl-text-on-light) !important;
}
.twl-hub-faq__toggle {
  font-family: 'JetBrains Mono', 'SF Mono', monospace !important;
  font-size: 1.4rem !important;
  color: var(--twl-orange) !important;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: none !important;
  border: none !important;
  transition: transform 0.35s var(--twl-ease);
  line-height: 1;
}
.twl-hub-faq__item.is-open .twl-hub-faq__toggle { transform: rotate(45deg); }
.twl-hub-faq__body {
  height: 0;
  overflow: hidden;
  background: none;
  transition: height 0.35s var(--twl-ease);
}
.twl-hub-faq__body p {
  padding: 0 0 1.25rem !important;
  font-size: 0.95rem !important;
  color: var(--twl-text-on-light-mute) !important;
  line-height: 1.7 !important;
  margin: 0;
}
.twl-hub-faq__body p a {
  color: var(--twl-orange-strong) !important;
  text-decoration: underline;
}

/* ── Reveal helpers: ALWAYS visible by default; GSAP enhances ──────────── */
.twl-hub-reveal { text-align: center; }
.twl-hub-reveal,
.twl-hub-reveal-stagger > * { opacity: 1 !important; transform: none !important; }

/* Failsafe: if GSAP fails to run, force visibility after 1s via animation */
@keyframes twl-hub-failsafe { to { opacity: 1; transform: none; } }
.twl-hub-card,
.twl-hub-crosslink,
.twl-hub-why__item { animation: twl-hub-failsafe 0.01s linear 1.2s forwards; }

/* ── HARD overrides for data-twl-animate stuck state (translateY(32px)) ── */
.twl-servicios-hub [data-twl-animate],
.twl-servicios-hub .twl-hub-reveal,
.twl-servicios-hub .twl-hub-reveal-stagger,
.twl-servicios-hub .twl-hub-reveal-stagger > *,
.twl-servicios-hub .twl-hub-crosslink,
.twl-servicios-hub .twl-hub-why__item,
.twl-servicios-hub .twl-hub-card { opacity: 1 !important; transform: none !important; }

/* ── HARD overrides for cross-link titles (parent theme injects rgb(30,30,30)) ── */
.twl-servicios-hub .twl-hub-crosslinks .twl-hub-crosslink strong,
.twl-servicios-hub .twl-hub-section--dark .twl-hub-crosslink strong,
.twl-servicios-hub .twl-hub-crosslinks .twl-hub-crosslink b,
.twl-servicios-hub .twl-hub-crosslinks .twl-hub-crosslink h3 {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
.twl-servicios-hub .twl-hub-crosslinks .twl-hub-crosslink span {
  color: rgba(255,255,255,0.72) !important;
  -webkit-text-fill-color: rgba(255,255,255,0.72) !important;
}

/* ── Why items: ensure dark text on light bg ─────────────────────────────── */
.twl-servicios-hub .twl-hub-why .twl-hub-why__item strong {
  color: #1a1a1a !important;
  -webkit-text-fill-color: #1a1a1a !important;
}
.twl-servicios-hub .twl-hub-why .twl-hub-why__item p {
  color: #555 !important;
  -webkit-text-fill-color: #555 !important;
}

/* ── Reduced motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .twl-hub-card,
  .twl-hub-crosslink,
  .twl-hub-why__item,
  .twl-hub-faq__toggle,
  .twl-hub-faq__body { transition: none !important; }
  .twl-hub-card:hover,
  .twl-hub-crosslink:hover,
  .twl-hub-why__item:hover { transform: none !important; }
}

/* ── Layout fixes: hide top bar + sidebar on this template ─────────────── */
.page-template-page-templatestwl-servicios-hub-php .top_panel_title { display: none !important; }

.page-template-page-templatestwl-servicios-hub-php .sidebar,
.page-template-page-templatestwl-servicios-hub-php aside,
.page-template-page-templatestwl-servicios-hub-php [role="complementary"]:not([aria-label]),
.page-template-page-templatestwl-servicios-hub-php .widget_area,
.page-template-page-templatestwl-servicios-hub-php .sidebar_inner,
body.twl-no-sidebar .sidebar,
body.twl-no-sidebar aside.sidebar,
body.twl-no-sidebar .widget_area { display: none !important; }

.page-template-page-templatestwl-servicios-hub-php .content_wrap,
.page-template-page-templatestwl-servicios-hub-php .page_content_wrap .content_wrap,
.page-template-page-templatestwl-servicios-hub-php .content,
.page-template-page-templatestwl-servicios-hub-php .content_wrap > .content,
body.twl-no-sidebar .content_wrap,
body.twl-no-sidebar .content {
  width: 100% !important;
  max-width: 100% !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.twl-no-sidebar .page_content_wrap { padding: 0 !important; }

/* ── Prevent mediaelement player wrapping card videos ──────────────────── */
.twl-hub-card .mejs-container,
.twl-hub-card .wp-video,
.twl-hub-card .mejs-overlay,
.twl-hub-card .mejs-layers,
.twl-hub-card .mejs-controls { display: none !important; }

.twl-hub-card video.twl-hub-card__video,
.twl-hub-card .wp-video video,
.twl-hub-card .mejs-container video {
  display: block !important;
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  z-index: 0 !important;
}

/* ── Remove header divider above footer ────────────────────────────────── */
.twl-servicios-hub .twl-cta { border-bottom: none; }
.page-template-page-templatestwl-servicios-hub-php .footer_wrap.footer_custom::before,
.page-template-page-templatestwl-servicios-hub-php footer.footer_wrap.footer_custom::before { display: none !important; }

/* ── Header: kill bottom margin on scheme_dark ─────────────────────────── */
.top_panel.top_panel_default.default_header.default_header_bg_img.without_bg_image.scheme_dark,
.top_panel_default.default_header.scheme_dark,
.top_panel.scheme_dark { margin-bottom: 0 !important; }

/* ── CTA section: force contrast on services-hub (and any dark bg) ─────── */
.twl-servicios-hub .twl-section.twl-cta {
  background: var(--twl-dark);
  color: var(--twl-text-on-dark);
  padding: 80px 0;
}
.twl-servicios-hub .twl-section.twl-cta .twl-cta__title,
.twl-servicios-hub .twl-section.twl-cta h2 {
  color: var(--twl-text-on-dark) !important;
  font-size: clamp(1.75rem, 3.5vw, 2.6rem);
  font-weight: 800;
  margin: 0 0 16px;
  text-align: center;
}
.twl-servicios-hub .twl-section.twl-cta .twl-cta__subtitle,
.twl-servicios-hub .twl-section.twl-cta p {
  color: var(--twl-text-on-dark-mute) !important;
  font-size: 1.1rem;
  text-align: center;
  margin: 0 0 28px;
}
.twl-servicios-hub .twl-section.twl-cta .twl-cta__buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.twl-servicios-hub .twl-section.twl-cta .twl-btn--whatsapp {
  background: #25D366;
  color: #fff;
  border: none;
}
.twl-servicios-hub .twl-section.twl-cta .twl-btn--whatsapp:hover { background: #1ebe5a; }
.twl-servicios-hub .twl-section.twl-cta .twl-btn--primary {
  background: var(--twl-orange);
  color: #fff;
  border: none;
}
.twl-servicios-hub .twl-section.twl-cta .twl-btn--primary:hover { background: #ff8533; }
.twl-servicios-hub .twl-section.twl-cta .twl-btn--outline {
  background: transparent;
  color: #fff;
  border: 2px solid #fff;
}
.twl-servicios-hub .twl-section.twl-cta .twl-btn--outline:hover { background: #fff; color: #0a0a0a; }
.twl-servicios-hub .twl-section.twl-cta .twl-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  transition: all .2s ease;
}
