/**
 * Portfolio layout fixes (legado skin).
 *
 * Root cause: .organism-filters had floated children and no clearfix, so the
 * gallery (flex/grid BFC) sat in the leftover strip between the floats and
 * looked misaligned. Rebuild the filter bar and gallery with flex/grid.
 */

/* --- Filter bar: real height, no escaped floats --- */
.organism-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px 24px;
  width: 100%;
  box-sizing: border-box;
}

.organism-filters::after {
  content: none;
}

.molecule-filters-participation {
  float: none;
  width: auto;
  flex: 0 1 auto;
  max-width: calc(100% - 220px);
}

.molecule-filters-clients {
  float: none;
  width: 180px;
  height: auto;
  min-height: 105px;
  flex: 0 0 180px;
  margin-left: auto;
}

.molecule-filters-resume {
  /* stays position:fixed from the base skin */
  flex: 0 0 100%;
}

/* --- Participation red buttons: single row --- */
.molecule-filters-redbutton {
  display: flex;
  flex-wrap: nowrap;
  width: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0;
}

.molecule-filters-redbutton > .atom-filters-redbutton {
  box-sizing: border-box;
  position: relative;
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  margin: 0 1px 0 0;
  padding: 0 12px;
  text-align: center;
  font-size: 13px;
  line-height: 50px;
  height: 50px;
  white-space: nowrap;
  border-radius: 0;
}

.molecule-filters-redbutton > .atom-filters-redbutton:last-child {
  margin-right: 0;
}

.molecule-filters-participation li:first-child,
.molecule-filters-participation li:last-child {
  border-radius: 0;
}

.molecule-filters-redbutton > .atom-filters-redbutton:first-child {
  border-radius: 15px 0 0 15px;
}

.molecule-filters-redbutton > .atom-filters-redbutton:last-child {
  border-radius: 0 15px 15px 0;
}

/* Submenu: left-aligned rows, full-width clickable labels */
.molecule-filters-submenu {
  text-align: left !important;
  font-size: 13px;
  box-sizing: border-box;
  padding: 6px 0 28px !important;
}

.molecule-filters-submenu > .atom-filters-resource {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: auto !important;
  min-height: 0;
  padding: 0 !important;
  margin: 0;
  text-align: left;
}

.molecule-filters-submenu > .atom-filters-resource label {
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-height: 32px;
  padding: 6px 14px;
  margin: 0;
  cursor: pointer;
  text-align: left;
  color: #4c5250;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.molecule-filters-submenu > .atom-filters-resource label:hover {
  background-color: rgba(0, 0, 0, 0.12);
}

.molecule-filters-submenu > .atom-filters-resource input {
  display: block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  vertical-align: middle;
}

/* --- Clients reach --- */
.molecule-filters-reach {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.molecule-filters-reach > .atom-filters-reach {
  position: relative;
  float: none;
  clear: none;
  width: 50%;
  margin: 0;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.molecule-filters-reach > .atom-filters-reach.off {
  opacity: 0.45;
}

.molecule-filters-reach > .atom-filters-reach label {
  display: block;
  width: 100%;
  height: 50px;
  overflow: hidden !important;
  text-indent: -9999px !important;
  white-space: nowrap;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  cursor: pointer;
}

/* Checkbox must never paint — label + background image are the control */
.molecule-filters-reach > .atom-filters-reach input[type='checkbox'] {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none;
}

/* --- Gallery: CSS Grid, full width, stable with filters --- */
.molecule-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 3%;
  row-gap: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  clear: both;
  /* header now has real height; keep a modest top gap instead of the old 125px float clearance */
  padding: 28px 0 0;
  margin: 0;
  list-style: none;
  align-items: start;
}

.molecule-gallery > .atom-gallery-item {
  float: none !important;
  clear: none !important;
  position: relative;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  box-sizing: border-box;
  min-width: 0;
}

.molecule-gallery > .atom-gallery-item.is-filtered-out,
.molecule-gallery > .atom-gallery-item[hidden] {
  display: none !important;
}

.molecule-gallery .atom-gallery-link {
  display: block;
  width: 100%;
}

.molecule-gallery .atom-gallery-figure {
  width: 100%;
  margin: 0;
  overflow: hidden;
}

.molecule-gallery .atom-gallery-img {
  display: block;
  width: 100%;
  height: auto;
}

.molecule-gallery .atom-gallery-caption {
  width: 100%;
  box-sizing: border-box;
  padding-top: 20px;
}

@media only screen and (max-width: 850px) {
  .molecule-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 20px;
  }
}

@media only screen and (max-width: 500px) {
  .organism-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .molecule-filters-participation,
  .molecule-filters-clients {
    flex: 1 1 auto;
    width: 100%;
    margin-left: 0;
  }

  .molecule-filters-redbutton {
    width: 100%;
    flex-wrap: wrap;
  }

  .molecule-filters-redbutton > .atom-filters-redbutton {
    flex: 1 1 auto;
  }

  .molecule-gallery {
    grid-template-columns: 1fr;
    column-gap: 0;
  }
}

/* --- Editorial content (Fase 2 texts on legado skin) --- */
.organism-home-editorial .group-columns {
  margin-bottom: 2rem;
}

.organism-home-editorial .molecule-lastjobs-smalllist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  padding: 0;
  margin: 1.5rem 0;
  list-style: none;
}

.organism-home-editorial .molecule-lastjobs-smallitem {
  float: none;
  width: auto;
  margin: 0;
}

.organism-home-editorial .molecule-lastjobs-smallitem img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-bottom: 0.75rem;
}

.molecule-contact-form select {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0.35rem 0 1rem;
  padding: 0.5rem 0.65rem;
  font: inherit;
  border: 1px solid #ccc;
  background: #fff;
}

/* Contact focus stays legible and does not change the field geometry. */
#contato-app .molecule-contact-form input:focus,
#contato-app .molecule-contact-form textarea:focus {
  background-color: rgba(76, 82, 80, .1);
  color: #4c5250;
  outline: 2px solid #b51922;
  outline-offset: 2px;
}
#contato-app .molecule-contact-form select:focus {
  background-color: #fff;
  color: #4c5250;
  outline: 2px solid #b51922;
  outline-offset: 2px;
}

/* Hidden contact panels and form stay hidden at every viewport width. */
#contato-app [hidden] {
  display: none !important;
}

/* Keep both contact introduction cards static on hover. */
#contato-app [data-contact-intro] .atom-contact-box,
#contato-app [data-contact-intro] .atom-contact-box:hover {
  -webkit-transform: none;
  -moz-transform: none;
  -ms-transform: none;
  -o-transform: none;
  transform: none;
  -webkit-transition: none;
  -moz-transition: none;
  -ms-transition: none;
  -o-transition: none;
  transition: none;
}

/* Contact message field. */
#contato-app .contact-message-field { padding-top: 10px; }
#contato-app .contact-message-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 6px;
}
#contato-app .contact-message-heading label {
  margin: 0;
  padding: 0;
  color: #b51922;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5625rem;
}
