/* ============================================================================
   MEREBA — Tema "Wimbledon" modernizado
   Paleta señorial: verde profundo + morado + crema.
   Se carga DESPUÉS de css/bulma/micss.css y sobreescribe las clases de Bulma
   realmente usadas en las plantillas (navbar, botones, enlaces, footer, iconos).

   Mantenimiento: las variables de marca también están en css/bulma/micss.scss.
   Si algún día se recompila Bulma (`npm run build`), este archivo sigue siendo
   la fuente de verdad del color en producción (el sitio no usa build-tooling).
   ========================================================================== */

:root {
  /* Colores de marca */
  --mereba-green: #00703C;
  --mereba-green-dark: #0B3D2E;
  --mereba-green-hover: #00582F;
  --mereba-purple: #52297B;
  --mereba-purple-dark: #3C1E5C;
  --mereba-cream: #F5F3EC;
  --mereba-cream-soft: #FBFAF6;
  --mereba-ink: #2B2B2B;
  --mereba-line: #E3DFD3;

  /* Tipografía */
  --mereba-font-body: "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mereba-font-mono: "Inconsolata", "Menlo", "Consolas", monospace;

  /* Espaciado */
  --mereba-space-1: 0.25rem;
  --mereba-space-2: 0.5rem;
  --mereba-space-3: 0.75rem;
  --mereba-space-4: 1rem;
  --mereba-space-5: 1.5rem;
  --mereba-space-6: 2rem;
  --mereba-space-7: 3rem;
  --mereba-space-8: 4rem;

  /* Radios */
  --mereba-radius-sm: 6px;
  --mereba-radius: 10px;
  --mereba-radius-lg: 14px;

  /* Sombras */
  --mereba-shadow-sm: 0 1px 2px rgba(11, 61, 46, 0.06);
  --mereba-shadow: 0 4px 12px rgba(11, 61, 46, 0.10);
  --mereba-shadow-lg: 0 8px 24px rgba(11, 61, 46, 0.12);

  /* Transiciones */
  --mereba-transition-fast: 150ms ease;
  --mereba-transition: 250ms ease;

  /* Layout */
  --mereba-content-max: 1200px;
  --mereba-section-py: clamp(2.5rem, 6vw, 5rem);
}

/* ---------- Reset accesible y base ---------- */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body,
p, li, label, .subtitle,
.input, .textarea, .select select,
.navbar, .button, .tag, .mereba-eyebrow, .footer, .notification {
  font-family: var(--mereba-font-body);
}

body {
  background-color: var(--mereba-cream);
  color: var(--mereba-ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.title, .fontmereba, .fontmerebatit {
  font-family: "merebaFont", var(--mereba-font-body);
  line-height: 1.2;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

/* Titulares fluidos */
.is-size-1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.is-size-2 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
}

.is-size-3 {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
}

.subtitle {
  line-height: 1.6;
}

/* ---------- Enlaces y focus ---------- */
a {
  color: var(--mereba-purple);
  transition: color var(--mereba-transition-fast);
}

a:hover {
  color: var(--mereba-purple-dark);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--mereba-purple);
  outline-offset: 2px;
  border-radius: var(--mereba-radius-sm);
}

.navbar a:focus-visible {
  outline-offset: -3px;
}

/* ---------- Contenedores y secciones ---------- */
.container.is-fluid > hr {
  background-color: var(--mereba-line);
}

.mereba-section {
  padding-top: var(--mereba-section-py);
  padding-bottom: var(--mereba-section-py);
}

.mereba-section.is-hero {
  padding-top: clamp(2rem, 5vw, 4rem);
  padding-bottom: clamp(2rem, 5vw, 4rem);
}

.mereba-section.is-alt {
  background-color: var(--mereba-cream-soft);
}

/* ---------- Navbar ---------- */
.navbar.is-dark {
  background-color: var(--mereba-green-dark);
}

.navbar.is-dark .navbar-item,
.navbar.is-dark .navbar-link {
  color: #F2EFE6;
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
}

.navbar.is-dark .navbar-item:hover,
.navbar.is-dark .navbar-link:hover,
.navbar.is-dark .navbar-item.is-active {
  background-color: var(--mereba-green);
  color: #ffffff;
}

.navbar.is-dark .navbar-brand .navbar-item:hover {
  background-color: transparent;
}

.navbar.is-dark .navbar-brand .fontmereba {
  color: #ffffff !important;
  font-size: 1.35rem;
}

.navbar.is-dark .navbar-dropdown {
  background-color: var(--mereba-cream-soft);
  border-top-color: var(--mereba-green);
}

.navbar.is-dark .navbar-dropdown .navbar-item {
  color: var(--mereba-ink);
}

.navbar.is-dark .navbar-dropdown .navbar-item:hover {
  background-color: var(--mereba-green);
  color: #ffffff;
}

.navbar-burger {
  color: #F2EFE6;
  width: 3rem;
  height: 3rem;
}

/* ---------- Botones ---------- */
.button {
  transition: background-color var(--mereba-transition-fast),
              border-color var(--mereba-transition-fast),
              transform var(--mereba-transition-fast),
              box-shadow var(--mereba-transition-fast);
}

.button:active {
  transform: translateY(1px);
}

.button.is-primary {
  background-color: var(--mereba-green);
  border-color: transparent;
  color: #ffffff;
}

.button.is-primary:hover,
.button.is-primary:focus,
.button.is-primary.is-hovered {
  background-color: var(--mereba-green-hover);
  color: #ffffff;
}

.button.is-primary:active,
.button.is-primary.is-active {
  background-color: var(--mereba-green-dark);
  color: #ffffff;
}

.button.is-primary.is-light {
  background-color: #E2EFE7;
  color: var(--mereba-green-dark);
}

.button.is-primary[disabled] {
  background-color: var(--mereba-green);
}

.button.is-accent {
  background-color: var(--mereba-purple);
  border-color: transparent;
  color: #ffffff;
}

.button.is-accent:hover,
.button.is-accent:focus {
  background-color: var(--mereba-purple-dark);
  color: #ffffff;
}

.button.is-outlined.is-primary {
  border-color: var(--mereba-green);
  color: var(--mereba-green);
}

.button.is-outlined.is-primary:hover {
  background-color: var(--mereba-green);
  color: #ffffff;
}

@media (max-width: 768px) {
  .buttons .button.is-medium,
  .buttons .button {
    width: 100%;
  }
}

/* ---------- Texto/iconos primarios ---------- */
.has-text-primary {
  color: var(--mereba-green) !important;
}

.has-background-primary {
  background-color: var(--mereba-green) !important;
}

/* ---------- Tarjetas ---------- */
.mereba-card {
  background-color: var(--mereba-cream-soft);
  border: 1px solid var(--mereba-line);
  border-radius: var(--mereba-radius);
  padding: 1.75rem;
  height: 100%;
  box-shadow: var(--mereba-shadow-sm);
  transition: box-shadow var(--mereba-transition), transform var(--mereba-transition);
}

.mereba-card:hover {
  box-shadow: var(--mereba-shadow-lg);
  transform: translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
  .mereba-card:hover {
    transform: none;
  }
}

.mereba-card.is-interactive {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.mereba-card.is-interactive:hover {
  color: inherit;
}

.mereba-card.is-interactive .card-link {
  margin-top: auto;
  color: var(--mereba-purple);
  font-weight: 700;
}

.mereba-accent-top {
  border-top: 4px solid var(--mereba-green);
}

.mereba-eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--mereba-purple);
  margin-bottom: 0.5rem;
}

/* ---------- Credibilidad ---------- */
.mereba-credibility {
  background-color: var(--mereba-green-dark);
  color: #F2EFE6;
  border-radius: var(--mereba-radius-lg);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.mereba-credibility h2,
.mereba-credibility h3,
.mereba-credibility .title {
  color: #ffffff;
}

.mereba-credibility p {
  color: #EDEAE0;
}

.mereba-credibility strong {
  color: #ffffff;
}

.mereba-credibility .tag {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 600;
}

/* ---------- Notificaciones / cookies ---------- */
.notification.is-primary.is-light {
  background-color: #E2EFE7;
  color: var(--mereba-green-dark);
}

#cookie-notification {
  margin-bottom: 0;
}

#cookie-notification.is-hidden {
  display: none;
}

/* ---------- Footer ---------- */
.footer.nota,
.footer {
  background-color: var(--mereba-green-dark) !important;
  padding: 2.5rem 1.5rem 2rem;
}

.footer .has-text-white,
.footer a.has-text-white {
  color: #F2EFE6 !important;
}

.footer a.has-text-white:hover {
  color: #ffffff !important;
  text-decoration: underline;
}

.footer .level {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer .level-item {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.5rem;
}

@media (max-width: 768px) {
  .footer .columns {
    text-align: center;
  }
  .footer .has-text-right {
    text-align: center !important;
  }
}

/* ---------- Iconos ---------- */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon svg {
  width: 100%;
  height: 100%;
}

.icon.is-small { width: 1em; height: 1em; }
.icon.is-medium { width: 1.5em; height: 1.5em; }
.icon.is-large { width: 2em; height: 2em; }

.button .icon {
  margin-right: 0.35em;
}

/* ---------- Tarjetas de aplicación ---------- */
.mereba-app-card {
  background-color: var(--mereba-cream-soft);
  border: 1px solid var(--mereba-line);
  border-radius: var(--mereba-radius);
  overflow: hidden;
  box-shadow: var(--mereba-shadow-sm);
  transition: box-shadow var(--mereba-transition), transform var(--mereba-transition);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.mereba-app-card:hover {
  box-shadow: var(--mereba-shadow-lg);
  transform: translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
  .mereba-app-card:hover {
    transform: none;
  }
}

.mereba-app-card .app-image {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  width: 100%;
  background-color: var(--mereba-line);
}

.mereba-app-card .app-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.mereba-app-card .app-title {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  margin-bottom: 0.5rem;
}

.mereba-app-card .app-desc {
  color: #5b5b55;
  flex-grow: 1;
  margin-bottom: 1rem;
}

.mereba-app-card .app-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mereba-app-card .app-tags .tag {
  background-color: #E2EFE7;
  color: var(--mereba-green-dark);
}

.mereba-app-card .app-link {
  margin-top: auto;
  font-weight: 700;
  color: var(--mereba-purple);
}

/* ---------- Tags de marca ---------- */
.tag.is-mereba {
  background-color: #E2EFE7;
  color: var(--mereba-green-dark);
  font-weight: 600;
}

/* ---------- Formularios ---------- */
.input, .textarea, .select select {
  border-color: var(--mereba-line);
  border-radius: var(--mereba-radius-sm);
  transition: border-color var(--mereba-transition-fast), box-shadow var(--mereba-transition-fast);
}

.input:focus, .textarea:focus, .select select:focus {
  border-color: var(--mereba-green);
  box-shadow: 0 0 0 3px rgba(0, 112, 60, 0.15);
}

.label {
  color: var(--mereba-ink);
  font-weight: 600;
}

.help.is-danger {
  margin-top: 0.35rem;
}

/* ---------- Tablas backoffice ---------- */
.table-container {
  -webkit-overflow-scrolling: touch;
}

.table th {
  color: var(--mereba-ink);
}

/* Scroll horizontal en móvil para tarjetas de dashboard */
.is-scrollable-touch {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.is-scrollable-touch::-webkit-scrollbar {
  height: 6px;
}

.is-scrollable-touch::-webkit-scrollbar-thumb {
  background-color: var(--mereba-line);
  border-radius: 3px;
}

@media (min-width: 769px) {
  .is-scrollable-touch {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

/* Helpers responsive que Bulma no expone por breakpoint */
@media (min-width: 1024px) {
  .is-justify-content-end-desktop {
    justify-content: flex-end !important;
  }
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--mereba-green-dark);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
  transition: top var(--mereba-transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* ---------- Impresión ---------- */
@media print {
  .navbar,
  .footer,
  #cookie-notification,
  .buttons,
  .mereba-app-card .app-link {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  a {
    color: #000;
    text-decoration: underline;
  }
}

/* ---------- Utilidades de accesibilidad ---------- */
.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;
}

/* ---------- Código ---------- */
code, pre, kbd, samp {
  font-family: var(--mereba-font-mono);
}
